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

net: dsa: bcm_sf2: Prevent GPHY shutdown for kexec'd kernels

For a kernel that is being kexec'd we re-enable the integrated GPHY in
order for the subsequent MDIO bus scan to succeed and properly bind to
the bcm7xxx PHY driver. If we did not do that, the GPHY would be shut
down by the time the MDIO driver is probing the bus, and it would fail
to read the correct PHY OUI and therefore bind to an appropriate PHY
driver. Later on, this would cause DSA not to be able to successfully
attach to the PHY, and the interface would not be created at all.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
2399d614 0d906b1e

+14
+14
drivers/net/dsa/bcm_sf2.c
··· 30 30 #include <linux/etherdevice.h> 31 31 #include <net/switchdev.h> 32 32 #include <linux/platform_data/b53.h> 33 + #include <linux/kexec.h> 33 34 34 35 #include "bcm_sf2.h" 35 36 #include "bcm_sf2_regs.h" ··· 1134 1133 return 0; 1135 1134 } 1136 1135 1136 + static void bcm_sf2_sw_shutdown(struct platform_device *pdev) 1137 + { 1138 + struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); 1139 + 1140 + /* For a kernel about to be kexec'd we want to keep the GPHY on for a 1141 + * successful MDIO bus scan to occur. If we did turn off the GPHY 1142 + * before (e.g: port_disable), this will also power it back on. 1143 + */ 1144 + if (priv->hw_params.num_gphy == 1) 1145 + bcm_sf2_gphy_enable_set(priv->dev->ds, kexec_in_progress); 1146 + } 1147 + 1137 1148 #ifdef CONFIG_PM_SLEEP 1138 1149 static int bcm_sf2_suspend(struct device *dev) 1139 1150 { ··· 1176 1163 static struct platform_driver bcm_sf2_driver = { 1177 1164 .probe = bcm_sf2_sw_probe, 1178 1165 .remove = bcm_sf2_sw_remove, 1166 + .shutdown = bcm_sf2_sw_shutdown, 1179 1167 .driver = { 1180 1168 .name = "brcm-sf2", 1181 1169 .of_match_table = bcm_sf2_of_match,