From f6f9192684a9339059b7a12e443cde8897dd1b2c Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Fri, 9 Oct 2009 00:17:14 +0000 Subject: [PATCH] --- yaml --- r: 170675 b: refs/heads/master c: 748031f9fd2c06b28817d80761a5de97190cfd03 h: refs/heads/master i: 170673: 996f5e8831f762564689f3ed1fb59cb64a7f5777 170671: 94729859d682aec3d89c0866ba65083634d527e2 v: v3 --- [refs] | 2 +- trunk/arch/sh/include/asm/sh_eth.h | 1 + trunk/drivers/net/sh_eth.c | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 3f506f031841..02622afbc41c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a6e4bc5304033e434fabccabb230b8e9ff55d76f +refs/heads/master: 748031f9fd2c06b28817d80761a5de97190cfd03 diff --git a/trunk/arch/sh/include/asm/sh_eth.h b/trunk/arch/sh/include/asm/sh_eth.h index acf99700deed..f739061e2ee4 100644 --- a/trunk/arch/sh/include/asm/sh_eth.h +++ b/trunk/arch/sh/include/asm/sh_eth.h @@ -7,6 +7,7 @@ struct sh_eth_plat_data { int phy; int edmac_endian; + unsigned char mac_addr[6]; unsigned no_ether_link:1; unsigned ether_link_active_low:1; }; diff --git a/trunk/drivers/net/sh_eth.c b/trunk/drivers/net/sh_eth.c index f49d0800c1d1..a4da7e7574eb 100644 --- a/trunk/drivers/net/sh_eth.c +++ b/trunk/drivers/net/sh_eth.c @@ -298,16 +298,20 @@ static void update_mac_address(struct net_device *ndev) * When you want use this device, you must set MAC address in bootloader. * */ -static void read_mac_address(struct net_device *ndev) +static void read_mac_address(struct net_device *ndev, unsigned char *mac) { u32 ioaddr = ndev->base_addr; - ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); - ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; - ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; - ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); - ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; - ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); + if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) { + memcpy(ndev->dev_addr, mac, 6); + } else { + ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); + ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; + ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; + ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); + ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; + ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); + } } struct bb_info { @@ -1427,7 +1431,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) mdp->post_fw = POST_FW >> (devno << 1); /* read and set MAC address */ - read_mac_address(ndev); + read_mac_address(ndev, pd->mac_addr); /* First device only init */ if (!devno) {