diff options
author | Magnus Damm <damm@opensource.se> | 2009-10-08 20:17:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-13 06:44:05 -0400 |
commit | 748031f9fd2c06b28817d80761a5de97190cfd03 (patch) | |
tree | 06a66bfcf510cb22a961c1a617fdfa04562e9f1e /drivers/net | |
parent | a6e4bc5304033e434fabccabb230b8e9ff55d76f (diff) |
net: allow sh_eth to get mac address through platform data
Extend the sh_eth driver to allow passing the mac address
using the platform data structure. This to simplify board
setup code.
Signed-off-by: Magnus Damm <damm@opensource.se>
Tested-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sh_eth.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index f49d0800c1d1..a4da7e7574eb 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -298,16 +298,20 @@ static void update_mac_address(struct net_device *ndev) | |||
298 | * When you want use this device, you must set MAC address in bootloader. | 298 | * When you want use this device, you must set MAC address in bootloader. |
299 | * | 299 | * |
300 | */ | 300 | */ |
301 | static void read_mac_address(struct net_device *ndev) | 301 | static void read_mac_address(struct net_device *ndev, unsigned char *mac) |
302 | { | 302 | { |
303 | u32 ioaddr = ndev->base_addr; | 303 | u32 ioaddr = ndev->base_addr; |
304 | 304 | ||
305 | ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); | 305 | if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) { |
306 | ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; | 306 | memcpy(ndev->dev_addr, mac, 6); |
307 | ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; | 307 | } else { |
308 | ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); | 308 | ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); |
309 | ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; | 309 | ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; |
310 | ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); | 310 | ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; |
311 | ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); | ||
312 | ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; | ||
313 | ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); | ||
314 | } | ||
311 | } | 315 | } |
312 | 316 | ||
313 | struct bb_info { | 317 | struct bb_info { |
@@ -1427,7 +1431,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
1427 | mdp->post_fw = POST_FW >> (devno << 1); | 1431 | mdp->post_fw = POST_FW >> (devno << 1); |
1428 | 1432 | ||
1429 | /* read and set MAC address */ | 1433 | /* read and set MAC address */ |
1430 | read_mac_address(ndev); | 1434 | read_mac_address(ndev, pd->mac_addr); |
1431 | 1435 | ||
1432 | /* First device only init */ | 1436 | /* First device only init */ |
1433 | if (!devno) { | 1437 | if (!devno) { |