Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: enetc: fix the incorrect clearing of IF_MODE bits

The enetc phylink .mac_config handler intends to clear the IFMODE field
(bits 1:0) of the PM0_IF_MODE register, but incorrectly clears all the
other fields instead.

For normal operation, the bug was inconsequential, due to the fact that
we write the PM0_IF_MODE register in two stages, first in
phylink .mac_config (which incorrectly cleared out a bunch of stuff),
then we update the speed and duplex to the correct values in
phylink .mac_link_up.

Judging by the code (not tested), it looks like maybe loopback mode was
broken, since this is one of the settings in PM0_IF_MODE which is
incorrectly cleared.

Fixes: c76a97218dcb ("net: enetc: force the RGMII speed and duplex instead of operating in inband mode")
Reported-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vladimir Oltean and committed by
David S. Miller
325fd36a 42007019

+1 -2
+1 -2
drivers/net/ethernet/freescale/enetc/enetc_pf.c
··· 541 541 542 542 if (phy_interface_mode_is_rgmii(phy_mode)) { 543 543 val = enetc_port_rd(hw, ENETC_PM0_IF_MODE); 544 - val &= ~ENETC_PM0_IFM_EN_AUTO; 545 - val &= ENETC_PM0_IFM_IFMODE_MASK; 544 + val &= ~(ENETC_PM0_IFM_EN_AUTO | ENETC_PM0_IFM_IFMODE_MASK); 546 545 val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG; 547 546 enetc_port_wr(hw, ENETC_PM0_IF_MODE, val); 548 547 }