aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-10-26 06:44:37 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-10-26 06:50:47 -0400
commit376abbb4b31ac9a7fe90fb48b98e2c977cb3d882 (patch)
tree82134bda6b32a52da5a1d72ff0985d6cfaa1a6ba
parent40e4231809a022586caa8f253663317033ba2eb1 (diff)
sh: mac address through private data for sh_eth on ecovec24
Convert the ecovec24 board code to pass the mac address to the sh_eth driver using platform data. Also, remove the static clock to allow Runtime PM. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c33
1 files changed, 4 insertions, 29 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index dfc262bff0ad..da851a3b714a 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -519,12 +519,9 @@ static u8 mac_read(struct i2c_adapter *a, u8 command)
519 return buf; 519 return buf;
520} 520}
521 521
522#define MAC_LEN 6 522static void __init sh_eth_init(struct sh_eth_plat_data *pd)
523static void __init sh_eth_init(void)
524{ 523{
525 struct i2c_adapter *a = i2c_get_adapter(1); 524 struct i2c_adapter *a = i2c_get_adapter(1);
526 struct clk *eth_clk;
527 u8 mac[MAC_LEN];
528 int i; 525 int i;
529 526
530 if (!a) { 527 if (!a) {
@@ -532,33 +529,11 @@ static void __init sh_eth_init(void)
532 return; 529 return;
533 } 530 }
534 531
535 eth_clk = clk_get(NULL, "eth0");
536 if (!eth_clk) {
537 pr_err("can not get eth0 clk\n");
538 return;
539 }
540
541 /* read MAC address frome EEPROM */ 532 /* read MAC address frome EEPROM */
542 for (i = 0; i < MAC_LEN; i++) { 533 for (i = 0; i < sizeof(pd->mac_addr); i++) {
543 mac[i] = mac_read(a, 0x10 + i); 534 pd->mac_addr[i] = mac_read(a, 0x10 + i);
544 msleep(10); 535 msleep(10);
545 } 536 }
546
547 /* clock enable */
548 clk_enable(eth_clk);
549
550 /* reset sh-eth */
551 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
552
553 /* set MAC addr */
554 ctrl_outl((mac[0] << 24) |
555 (mac[1] << 16) |
556 (mac[2] << 8) |
557 (mac[3] << 0), SH_ETH_MAHR);
558 ctrl_outl((mac[4] << 8) |
559 (mac[5] << 0), SH_ETH_MALR);
560
561 clk_put(eth_clk);
562} 537}
563 538
564#define PORT_HIZA 0xA4050158 539#define PORT_HIZA 0xA4050158
@@ -802,7 +777,7 @@ arch_initcall(arch_setup);
802 777
803static int __init devices_setup(void) 778static int __init devices_setup(void)
804{ 779{
805 sh_eth_init(); 780 sh_eth_init(&sh_eth_plat);
806 return 0; 781 return 0;
807} 782}
808device_initcall(devices_setup); 783device_initcall(devices_setup);