[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOJe8K2eH+6Eg0vOnOFwNsy9-TyxBJwYDCTDbLcbB3yu42OW1w@mail.gmail.com>
Date: Tue, 10 Sep 2013 18:19:11 +0400
From: Denis Kirjanov <kda@...ux-powerpc.org>
To: Fugang Duan <B38611@...escale.com>
Cc: b20596@...escale.com, b45643@...escale.com, davem@...emloft.net,
netdev@...r.kernel.org, shawn.guo@...aro.org,
bhutchings@...arflare.com, R49496@...escale.com,
stephen@...workplumber.org
Subject: Re: [PATCH] net: fec: add the initial to set the physical mac address
On 8/22/13, Fugang Duan <B38611@...escale.com> wrote:
> For imx6slx evk platform, the fec driver cannot work since there
> have no valid mac address set in physical mac registers.
>
> For imx serial platform, fec/enet IPs both need the physical MAC
> address initial, otherwise it cannot work.
>
> After acquiring the valid MAC address from devices tree/pfuse/
> kernel command line/random mac address, and then set it to the
> physical MAC address registers.
>
> Signed-off-by: Fugang Duan <B38611@...escale.com>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 4349a9e..9b5e08c 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1867,10 +1867,12 @@ fec_set_mac_address(struct net_device *ndev, void
> *p)
> struct fec_enet_private *fep = netdev_priv(ndev);
> struct sockaddr *addr = p;
>
> - if (!is_valid_ether_addr(addr->sa_data))
> - return -EADDRNOTAVAIL;
> + if (p) {
I don't see how the p pointer can be NULL...
> + if (!is_valid_ether_addr(addr->sa_data))
> + return -EADDRNOTAVAIL;
>
> - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> + memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> + }
>
> writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
> (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
> @@ -1969,6 +1971,7 @@ static int fec_enet_init(struct net_device *ndev)
>
> /* Get the Ethernet address */
> fec_get_mac(ndev);
> + fec_set_mac_address(ndev, NULL);
>
> /* Set receive and transmit descriptor base. */
> fep->rx_bd_base = cbd_base;
> --
> 1.7.1
>
>
> --
> 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
>
--
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