All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes
@ 2018-10-09 23:48 Florian Fainelli
  2018-10-09 23:48 ` [PATCH net 1/2] net: dsa: bcm_sf2: Fix unbind ordering Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-10-09 23:48 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli

Hi David,

Here are two fixes for the bcm_sf2 driver that were found during testing
unbind and analysing another issue during system suspend/resume.

Thanks!

Florian Fainelli (2):
  net: dsa: bcm_sf2: Fix unbind ordering
  net: dsa: bcm_sf2: Call setup during switch resume

 drivers/net/dsa/bcm_sf2.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/2] net: dsa: bcm_sf2: Fix unbind ordering
  2018-10-09 23:48 [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes Florian Fainelli
@ 2018-10-09 23:48 ` Florian Fainelli
  2018-10-09 23:48 ` [PATCH net 2/2] net: dsa: bcm_sf2: Call setup during switch resume Florian Fainelli
  2018-10-11  5:53 ` [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-10-09 23:48 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli

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: d9338023fb8e ("net: dsa: bcm_sf2: Make it a real platform device driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index e0066adcd2f3..b6d8e849a949 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1173,10 +1173,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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/2] net: dsa: bcm_sf2: Call setup during switch resume
  2018-10-09 23:48 [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes Florian Fainelli
  2018-10-09 23:48 ` [PATCH net 1/2] net: dsa: bcm_sf2: Fix unbind ordering Florian Fainelli
@ 2018-10-09 23:48 ` Florian Fainelli
  2018-10-11  5:53 ` [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2018-10-09 23:48 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, vivien.didelot, Florian Fainelli

There is no reason to open code what the switch setup function does, in
fact, because we just issued a switch reset, we would make all the
register get their default values, including for instance, having unused
port be enabled again and wasting power and leading to an inappropriate
switch core clock being selected.

Fixes: 8cfa94984c9c ("net: dsa: bcm_sf2: add suspend/resume callbacks")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index b6d8e849a949..fc8b48adf38b 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -703,7 +703,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
 static int bcm_sf2_sw_resume(struct dsa_switch *ds)
 {
 	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-	unsigned int port;
 	int ret;
 
 	ret = bcm_sf2_sw_rst(priv);
@@ -715,14 +714,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
 	if (priv->hw_params.num_gphy == 1)
 		bcm_sf2_gphy_enable_set(ds, true);
 
-	for (port = 0; port < DSA_MAX_PORTS; port++) {
-		if (dsa_is_user_port(ds, port))
-			bcm_sf2_port_setup(ds, port, NULL);
-		else if (dsa_is_cpu_port(ds, port))
-			bcm_sf2_imp_setup(ds, port);
-	}
-
-	bcm_sf2_enable_acb(ds);
+	ds->ops->setup(ds);
 
 	return 0;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes
  2018-10-09 23:48 [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes Florian Fainelli
  2018-10-09 23:48 ` [PATCH net 1/2] net: dsa: bcm_sf2: Fix unbind ordering Florian Fainelli
  2018-10-09 23:48 ` [PATCH net 2/2] net: dsa: bcm_sf2: Call setup during switch resume Florian Fainelli
@ 2018-10-11  5:53 ` David Miller
  2018-10-11 22:02   ` Florian Fainelli
  2 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2018-10-11  5:53 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue,  9 Oct 2018 16:48:56 -0700

> Here are two fixes for the bcm_sf2 driver that were found during
> testing unbind and analysing another issue during system
> suspend/resume.

Series applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes
  2018-10-11  5:53 ` [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes David Miller
@ 2018-10-11 22:02   ` Florian Fainelli
  2018-10-11 22:20     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2018-10-11 22:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, andrew, vivien.didelot

On 10/10/2018 10:53 PM, David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Tue,  9 Oct 2018 16:48:56 -0700
> 
>> Here are two fixes for the bcm_sf2 driver that were found during
>> testing unbind and analysing another issue during system
>> suspend/resume.
> 
> Series applied and queued up for -stable, thanks.

Did you push that series yet?

git pull
remote: Counting objects: 171, done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 171 (delta 144), reused 118 (delta 100)
Receiving objects: 100% (171/171), 32.80 KiB | 16.40 MiB/s, done.
Resolving deltas: 100% (144/144), completed with 61 local objects.
>From https://git.kernel.org/pub/scm/linux/kernel/git/davem/net
   52b5d6f5dcf0..052858663db3  master     -> davem-net/master

git rebase net/master sf2-fixes
First, rewinding head to replay your work on top of it...
Applying: net: dsa: bcm_sf2: Fix unbind ordering
Applying: net: dsa: bcm_sf2: Call setup during switch resume
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes
  2018-10-11 22:02   ` Florian Fainelli
@ 2018-10-11 22:20     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-10-11 22:20 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 11 Oct 2018 15:02:54 -0700

> On 10/10/2018 10:53 PM, David Miller wrote:
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Date: Tue,  9 Oct 2018 16:48:56 -0700
>> 
>>> Here are two fixes for the bcm_sf2 driver that were found during
>>> testing unbind and analysing another issue during system
>>> suspend/resume.
>> 
>> Series applied and queued up for -stable, thanks.
> 
> Did you push that series yet?
> 
> git pull
> remote: Counting objects: 171, done.
> remote: Compressing objects: 100% (71/71), done.
> remote: Total 171 (delta 144), reused 118 (delta 100)
> Receiving objects: 100% (171/171), 32.80 KiB | 16.40 MiB/s, done.
> Resolving deltas: 100% (144/144), completed with 61 local objects.
> From https://git.kernel.org/pub/scm/linux/kernel/git/davem/net
>    52b5d6f5dcf0..052858663db3  master     -> davem-net/master
> 
> git rebase net/master sf2-fixes
> First, rewinding head to replay your work on top of it...
> Applying: net: dsa: bcm_sf2: Fix unbind ordering
> Applying: net: dsa: bcm_sf2: Call setup during switch resume

I applied them to net-next, sorry about that.

I'll add them to 'net' too.

Done.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-12  5:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 23:48 [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes Florian Fainelli
2018-10-09 23:48 ` [PATCH net 1/2] net: dsa: bcm_sf2: Fix unbind ordering Florian Fainelli
2018-10-09 23:48 ` [PATCH net 2/2] net: dsa: bcm_sf2: Call setup during switch resume Florian Fainelli
2018-10-11  5:53 ` [PATCH net 0/2] net: dsa: bcm_sf2: Couple of fixes David Miller
2018-10-11 22:02   ` Florian Fainelli
2018-10-11 22:20     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.