Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc5d8ced authored by Gavin Schenk's avatar Gavin Schenk Committed by Greg Kroah-Hartman
Browse files

net: fec: set mac address unconditionally



[ Upstream commit b82d44d78480faff7456e9e0999acb9d38666057 ]

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: default avatarGavin Schenk <g.schenk@eckelmann.de>
Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 9638d19e ("net: fec: add netif status check before set mac address")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ee4acb7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -944,11 +944,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(cpu_to_be32(temp_mac[0]), fep->hwp + FEC_ADDR_LOW);
		writel(cpu_to_be32(temp_mac[1]), fep->hwp + FEC_ADDR_HIGH);
	}
	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);