linux-stable/drivers/net/ethernet/freescale
Wei Fang cbc17e7802 net: fec: Set mac_managed_pm during probe
Setting mac_managed_pm during interface up is too late.

In situations where the link is not brought up yet and the system suspends
the regular PHY power management will run. Since the FEC ETHEREN control
bit is cleared (automatically) on suspend the controller is off in resume.
When the regular PHY power management resume path runs in this context it
will write to the MII_DATA register but nothing will be transmitted on the
MDIO bus.

This can be observed by the following log:

    fec 5b040000.ethernet eth0: MDIO read timeout
    Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0xc8 returns -110
    Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: error -110

The data written will however remain in the MII_DATA register.

When the link later is set to administrative up it will trigger a call to
fec_restart() which will restore the MII_SPEED register. This triggers the
quirk explained in f166f890c8 ("net: ethernet: fec: Replace interrupt
driven MDIO with polled IO") causing an extra MII_EVENT.

This extra event desynchronizes all the MDIO register reads, causing them
to complete too early. Leading all reads to read as 0 because
fec_enet_mdio_wait() returns too early.

When a Microchip LAN8700R PHY is connected to the FEC, the 0 reads causes
the PHY to be initialized incorrectly and the PHY will not transmit any
ethernet signal in this state. It cannot be brought out of this state
without a power cycle of the PHY.

Fixes: 557d5dc83f ("net: fec: use mac-managed PHY PM")
Closes: https://lore.kernel.org/netdev/1f45bdbe-eab1-4e59-8f24-add177590d27@actia.se/
Signed-off-by: Wei Fang <wei.fang@nxp.com>
[jernberg: commit message]
Signed-off-by: John Ernberg <john.ernberg@actia.se>
Link: https://lore.kernel.org/r/20240328155909.59613-2-john.ernberg@actia.se
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-04-03 19:20:26 -07:00
..
dpaa eth: dpaa: add missing net/xdp.h include 2023-08-03 16:17:34 -07:00
dpaa2 dpaa2-switch: cleanup the egress flood of an unused FDB 2023-12-23 01:18:59 +00:00
enetc ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side 2024-01-31 12:30:47 +00:00
fman net: dpaa: fman_memac: accept phy-interface-type = "10gbase-r" in the device tree 2024-02-23 11:22:42 +00:00
fs_enet net: ethernet: Use device_get_match_data() 2023-10-13 10:04:53 +01:00
Kconfig net: fec: allow to build without PAGE_POOL_STATS 2023-06-20 12:11:59 -07:00
Makefile
fec.h ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side 2024-01-31 12:30:47 +00:00
fec_main.c net: fec: Set mac_managed_pm during probe 2024-04-03 19:20:26 -07:00
fec_mpc52xx.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00
fec_mpc52xx.h
fec_mpc52xx_phy.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00
fec_ptp.c net: fec: delete fec_ptp_disable_hwts() 2023-08-02 19:11:06 -07:00
fsl_pq_mdio.c net: fill in MODULE_DESCRIPTION()s for fsl_pq_mdio 2024-01-24 15:12:21 -08:00
gianfar.c ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side 2024-01-31 12:30:47 +00:00
gianfar.h eth: gfar: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:42 +01:00
gianfar_ethtool.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00
ucc_geth.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00
ucc_geth.h
ucc_geth_ethtool.c net: ethernet: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:26 -07:00
xgmac_mdio.c net: Explicitly include correct DT includes 2023-07-27 20:33:16 -07:00