aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2016-10-20 12:32:19 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-20 14:43:50 -0400
commit2399d6143f85b155ae84ccd94237befd36b8f6c7 (patch)
tree51fc96f1700fb5fda3537b75648af7bf7be3d8cb
parent0d906b1e8d4002cdd59590fec630f4e75023e288 (diff)
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>
-rw-r--r--drivers/net/dsa/bcm_sf2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 0427009bc924..077a24541584 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -30,6 +30,7 @@
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include <net/switchdev.h> 31#include <net/switchdev.h>
32#include <linux/platform_data/b53.h> 32#include <linux/platform_data/b53.h>
33#include <linux/kexec.h>
33 34
34#include "bcm_sf2.h" 35#include "bcm_sf2.h"
35#include "bcm_sf2_regs.h" 36#include "bcm_sf2_regs.h"
@@ -1133,6 +1134,18 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
1133 return 0; 1134 return 0;
1134} 1135}
1135 1136
1137static void bcm_sf2_sw_shutdown(struct platform_device *pdev)
1138{
1139 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
1140
1141 /* For a kernel about to be kexec'd we want to keep the GPHY on for a
1142 * successful MDIO bus scan to occur. If we did turn off the GPHY
1143 * before (e.g: port_disable), this will also power it back on.
1144 */
1145 if (priv->hw_params.num_gphy == 1)
1146 bcm_sf2_gphy_enable_set(priv->dev->ds, kexec_in_progress);
1147}
1148
1136#ifdef CONFIG_PM_SLEEP 1149#ifdef CONFIG_PM_SLEEP
1137static int bcm_sf2_suspend(struct device *dev) 1150static int bcm_sf2_suspend(struct device *dev)
1138{ 1151{
@@ -1163,6 +1176,7 @@ MODULE_DEVICE_TABLE(of, bcm_sf2_of_match);
1163static struct platform_driver bcm_sf2_driver = { 1176static struct platform_driver bcm_sf2_driver = {
1164 .probe = bcm_sf2_sw_probe, 1177 .probe = bcm_sf2_sw_probe,
1165 .remove = bcm_sf2_sw_remove, 1178 .remove = bcm_sf2_sw_remove,
1179 .shutdown = bcm_sf2_sw_shutdown,
1166 .driver = { 1180 .driver = {
1167 .name = "brcm-sf2", 1181 .name = "brcm-sf2",
1168 .of_match_table = bcm_sf2_of_match, 1182 .of_match_table = bcm_sf2_of_match,