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

Commit 448765e1 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: bcm_sf2: Fix unbind ordering



The order in which we release resources is unfortunately leading to bus
errors while dismantling the port. This is because we set
priv->wol_ports_mask to 0 to tell bcm_sf2_sw_suspend() that it is now
permissible to clock gate the switch. Later on, when dsa_slave_destroy()
comes in from dsa_unregister_switch() and calls
dsa_switch_ops::port_disable, we perform the same dismantling again, and
this time we hit registers that are clock gated.

Make sure that dsa_unregister_switch() is the first thing that happens,
which takes care of releasing all user visible resources, then proceed
with clock gating hardware. We still need to set priv->wol_ports_mask to
0 to make sure that an enabled port properly gets disabled in case it
was previously used as part of Wake-on-LAN.

Fixes: d9338023 ("net: dsa: bcm_sf2: Make it a real platform device driver")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f98ebd47
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1172,10 +1172,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
{
	struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);

	/* Disable all ports and interrupts */
	priv->wol_ports_mask = 0;
	bcm_sf2_sw_suspend(priv->dev->ds);
	dsa_unregister_switch(priv->dev->ds);
	/* Disable all ports and interrupts */
	bcm_sf2_sw_suspend(priv->dev->ds);
	bcm_sf2_mdio_unregister(priv);

	return 0;