Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Magnus Damm and committed by
Paul Mundt
376abbb4 40e42318

+4 -29
+4 -29
arch/sh/boards/mach-ecovec24/setup.c
··· 519 519 return buf; 520 520 } 521 521 522 - #define MAC_LEN 6 523 - static void __init sh_eth_init(void) 522 + static void __init sh_eth_init(struct sh_eth_plat_data *pd) 524 523 { 525 524 struct i2c_adapter *a = i2c_get_adapter(1); 526 - struct clk *eth_clk; 527 - u8 mac[MAC_LEN]; 528 525 int i; 529 526 530 527 if (!a) { ··· 529 532 return; 530 533 } 531 534 532 - eth_clk = clk_get(NULL, "eth0"); 533 - if (!eth_clk) { 534 - pr_err("can not get eth0 clk\n"); 535 - return; 536 - } 537 - 538 535 /* read MAC address frome EEPROM */ 539 - for (i = 0; i < MAC_LEN; i++) { 540 - mac[i] = mac_read(a, 0x10 + i); 536 + for (i = 0; i < sizeof(pd->mac_addr); i++) { 537 + pd->mac_addr[i] = mac_read(a, 0x10 + i); 541 538 msleep(10); 542 539 } 543 - 544 - /* clock enable */ 545 - clk_enable(eth_clk); 546 - 547 - /* reset sh-eth */ 548 - ctrl_outl(0x1, SH_ETH_ADDR + 0x0); 549 - 550 - /* set MAC addr */ 551 - ctrl_outl((mac[0] << 24) | 552 - (mac[1] << 16) | 553 - (mac[2] << 8) | 554 - (mac[3] << 0), SH_ETH_MAHR); 555 - ctrl_outl((mac[4] << 8) | 556 - (mac[5] << 0), SH_ETH_MALR); 557 - 558 - clk_put(eth_clk); 559 540 } 560 541 561 542 #define PORT_HIZA 0xA4050158 ··· 777 802 778 803 static int __init devices_setup(void) 779 804 { 780 - sh_eth_init(); 805 + sh_eth_init(&sh_eth_plat); 781 806 return 0; 782 807 } 783 808 device_initcall(devices_setup);