[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110322123316.GH28098@S2100-06.ap.freescale.net>
Date: Tue, 22 Mar 2011 20:33:17 +0800
From: Shawn Guo <shawn.guo@...escale.com>
To: Lothar Waßmann <LW@...O-electronics.de>
CC: <netdev@...r.kernel.org>, <u.kleine-koenig@...gutronix.de>
Subject: Re: [PATCH 4/4] drivers/net/fec: Don't mess with configured MAC
addresses.
On Tue, Mar 22, 2011 at 11:00:02AM +0100, Lothar Waßmann wrote:
> The FEC driver currently uses the MAC address assigned to the first
> interface incremented by one for the second interface.
>
> Change this to be able to configure distinct MAC addresses via
> platform_data.
>
> Signed-off-by: Lothar Waßmann <LW@...O-electronics.de>
Acked-by: <shawn.guo@...escale.com>
--
Regards,
Shawn
> ---
> drivers/net/fec.c | 9 ++-------
> 1 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 3666524..9d89e99 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -736,7 +736,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> struct fec_platform_data *pdata = fep->pdev->dev.platform_data;
> - unsigned char *iap, tmpaddr[ETH_ALEN];
> + unsigned char iap[ETH_ALEN], tmpaddr[ETH_ALEN];
>
> /*
> * try to get mac address in following order:
> @@ -744,7 +744,10 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
> * 1) module parameter via kernel command line in form
> * fec.macaddr=0x00,0x04,0x9f,0x01,0x30,0xe0
> */
> - iap = macaddr;
> + if (fep->pdev->id == 0)
> + memcpy(iap, macaddr, ETH_ALEN);
> + else
> + memset(iap, 0, ETH_ALEN);
>
> /*
> * 2) from flash or fuse (via platform data)
> @@ -767,14 +770,10 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
> be32_to_cpu(readl(fep->hwp + FEC_ADDR_LOW));
> *((unsigned short *) &tmpaddr[4]) =
> be16_to_cpu(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
> - iap = &tmpaddr[0];
> + memcpy(iap, tmpaddr, ETH_ALEN);
> }
>
> memcpy(ndev->dev_addr, iap, ETH_ALEN);
> -
> - /* Adjust MAC if using macaddr */
> - if (iap == macaddr)
> - ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->pdev->id;
> }
>
> /* ------------------------------------------------------------------------- */
> --
> 1.5.6.5
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists