* [PATCH] fec: Always write MAC address to controller register
@ 2016-11-22 11:24 Daniel Krüger
2016-11-22 15:07 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Krüger @ 2016-11-22 11:24 UTC (permalink / raw)
To: Fugang Duan; +Cc: netdev, Alexander Stein
On non-FEC_QUIRK_ENET_MAC types the MAC address needs to be set in FEC
during initialisation, if not done by bootloader already. Especially random
MACs or MAC addresses provided by kernel parameter must be set.
Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
---
drivers/net/ethernet/freescale/fec_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2a03857..ea32fda 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -902,14 +902,14 @@ fec_restart(struct net_device *ndev)
/*
* enet-mac reset will reset mac address registers too,
* so need to reconfigure it.
+ * On non-FEC_QUIRK_ENET_MAC types it won't be reset,
+ * but it must be configured once at least (especially random MACs).
*/
- if (fep->quirks & FEC_QUIRK_ENET_MAC) {
- memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN);
- writel((__force u32)cpu_to_be32(temp_mac[0]),
- fep->hwp + FEC_ADDR_LOW);
- writel((__force u32)cpu_to_be32(temp_mac[1]),
- fep->hwp + FEC_ADDR_HIGH);
- }
+ memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN);
+ writel((__force u32)cpu_to_be32(temp_mac[0]),
+ fep->hwp + FEC_ADDR_LOW);
+ writel((__force u32)cpu_to_be32(temp_mac[1]),
+ fep->hwp + FEC_ADDR_HIGH);
/* Clear any outstanding interrupt. */
writel(0xffffffff, fep->hwp + FEC_IEVENT);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fec: Always write MAC address to controller register
2016-11-22 11:24 [PATCH] fec: Always write MAC address to controller register Daniel Krüger
@ 2016-11-22 15:07 ` David Miller
2016-11-22 15:51 ` Daniel Krüger
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-11-22 15:07 UTC (permalink / raw)
To: daniel.krueger; +Cc: fugang.duan, netdev, alexander.stein
This change is already in the tree via commit
b82d44d78480faff7456e9e0999acb9d38666057 made nearly
two months ago:
commit b82d44d78480faff7456e9e0999acb9d38666057
Author: Gavin Schenk <g.schenk@eckelmann.de>
Date: Fri Sep 30 11:46:10 2016 +0200
net: fec: set mac address unconditionally
If the mac address origin is not dt, you can only safely assign a mac
address after "link up" of the device. If the link is off the clocks are
disabled and because of issues assigning registers when clocks are off the
new mac address cannot be written in .ndo_set_mac_address() on some soc's.
This fix sets the mac address unconditionally in fec_restart(...) and
ensures consistency between fec registers and the network layer.
Signed-off-by: Gavin Schenk <g.schenk@eckelmann.de>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 9638d19e4816 ("net: fec: add netif status check before set mac address")
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1fa2d87..48a033e 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -913,13 +913,11 @@ fec_restart(struct net_device *ndev)
* enet-mac reset will reset mac address registers too,
* so need to reconfigure it.
*/
- if (fep->quirks & FEC_QUIRK_ENET_MAC) {
- memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN);
- writel((__force u32)cpu_to_be32(temp_mac[0]),
- fep->hwp + FEC_ADDR_LOW);
- writel((__force u32)cpu_to_be32(temp_mac[1]),
- fep->hwp + FEC_ADDR_HIGH);
- }
+ memcpy(&temp_mac, ndev->dev_addr, ETH_ALEN);
+ writel((__force u32)cpu_to_be32(temp_mac[0]),
+ fep->hwp + FEC_ADDR_LOW);
+ writel((__force u32)cpu_to_be32(temp_mac[1]),
+ fep->hwp + FEC_ADDR_HIGH);
/* Clear any outstanding interrupt. */
writel(0xffffffff, fep->hwp + FEC_IEVENT);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fec: Always write MAC address to controller register
2016-11-22 15:07 ` David Miller
@ 2016-11-22 15:51 ` Daniel Krüger
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Krüger @ 2016-11-22 15:51 UTC (permalink / raw)
To: David Miller; +Cc: fugang.duan, netdev, alexander.stein
Sorry, I missed it.
But thanks for the fast answer.
cu,
Daniel
Am 22.11.2016 um 16:07 schrieb David Miller:
>
> This change is already in the tree via commit
> b82d44d78480faff7456e9e0999acb9d38666057 made nearly
> two months ago:
> [...]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-22 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 11:24 [PATCH] fec: Always write MAC address to controller register Daniel Krüger
2016-11-22 15:07 ` David Miller
2016-11-22 15:51 ` Daniel Krüger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox