All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line
@ 2019-11-04 21:51 Florian Fainelli
  2019-11-04 21:51 ` [PATCH net-next v2 1/2] dt-bindings: net: Describe BCM7445 switch reset property Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Florian Fainelli @ 2019-11-04 21:51 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski

Hi David, Andrew, Vivien,

This patch series definest the optional reset controller line for the
BCM7445/BCM7278 integrated Ethernet switches and updates the driver to
drive that reset line in lieu of the internal watchdog based reset since
it does not work on BCM7278.

Thanks!

Changes in v2:
- make the reset_control_assert() conditional to BCM7278 in the remove
  function as well

Florian Fainelli (2):
  dt-bindings: net: Describe BCM7445 switch reset property
  net: dsa: bcm_sf2: Add support for optional reset controller line

 .../bindings/net/brcm,bcm7445-switch-v4.0.txt |  6 ++++++
 drivers/net/dsa/bcm_sf2.c                     | 19 +++++++++++++++++++
 drivers/net/dsa/bcm_sf2.h                     |  3 +++
 3 files changed, 28 insertions(+)

-- 
2.17.1


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

* [PATCH net-next v2 1/2] dt-bindings: net: Describe BCM7445 switch reset property
  2019-11-04 21:51 [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
@ 2019-11-04 21:51 ` Florian Fainelli
  2019-11-04 21:51 ` [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
  2019-11-06  2:06 ` [PATCH net-next v2 0/2] " David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2019-11-04 21:51 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski

The BCM7445/BCM7278 built-in Ethernet switch have an optional reset line
to the SoC's reset controller, describe the 'resets' and 'reset-names'
properties as optional.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt b/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt
index b7336b9d6a3c..48a7f916c5e4 100644
--- a/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt
+++ b/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt
@@ -44,6 +44,12 @@ Optional properties:
   Admission Control Block supports reporting the number of packets in-flight in a
   switch queue
 
+- resets: a single phandle and reset identifier pair. See
+  Documentation/devicetree/binding/reset/reset.txt for details.
+
+- reset-names: If the "reset" property is specified, this property should have
+  the value "switch" to denote the switch reset line.
+
 Port subnodes:
 
 Optional properties:
-- 
2.17.1


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

* [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line
  2019-11-04 21:51 [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
  2019-11-04 21:51 ` [PATCH net-next v2 1/2] dt-bindings: net: Describe BCM7445 switch reset property Florian Fainelli
@ 2019-11-04 21:51 ` Florian Fainelli
  2019-11-04 23:48   ` Andrew Lunn
  2019-11-06  2:06 ` [PATCH net-next v2 0/2] " David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2019-11-04 21:51 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski

Grab an optional and exclusive reset controller line for the switch and
manage it during probe/remove functions accordingly. For 7278 devices we
change bcm_sf2_sw_rst() to use the reset controller line since the
WATCHDOG_CTRL register does not reset the switch contrary to stated
documentation.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++
 drivers/net/dsa/bcm_sf2.h |  3 +++
 2 files changed, 22 insertions(+)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 9add84c79dd6..37fc68792406 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -350,6 +350,18 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv)
 {
 	unsigned int timeout = 1000;
 	u32 reg;
+	int ret;
+
+	/* The watchdog reset does not work on 7278, we need to hit the
+	 * "external" reset line through the reset controller.
+	 */
+	if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) {
+		ret = reset_control_assert(priv->rcdev);
+		if (ret)
+			return ret;
+
+		return reset_control_deassert(priv->rcdev);
+	}
 
 	reg = core_readl(priv, CORE_WATCHDOG_CTRL);
 	reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET;
@@ -1091,6 +1103,11 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
 	priv->core_reg_align = data->core_reg_align;
 	priv->num_cfp_rules = data->num_cfp_rules;
 
+	priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
+								"switch");
+	if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER)
+		return PTR_ERR(priv->rcdev);
+
 	/* Auto-detection using standard registers will not work, so
 	 * provide an indication of what kind of device we are for
 	 * b53_common to work with
@@ -1223,6 +1240,8 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
 	/* Disable all ports and interrupts */
 	bcm_sf2_sw_suspend(priv->dev->ds);
 	bcm_sf2_mdio_unregister(priv);
+	if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev))
+		reset_control_assert(priv->rcdev);
 
 	return 0;
 }
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h
index 1df30ccec42d..de386dd96d66 100644
--- a/drivers/net/dsa/bcm_sf2.h
+++ b/drivers/net/dsa/bcm_sf2.h
@@ -18,6 +18,7 @@
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include <linux/if_vlan.h>
+#include <linux/reset.h>
 
 #include <net/dsa.h>
 
@@ -64,6 +65,8 @@ struct bcm_sf2_priv {
 	void __iomem			*fcb;
 	void __iomem			*acb;
 
+	struct reset_control		*rcdev;
+
 	/* Register offsets indirection tables */
 	u32 				type;
 	const u16			*reg_offsets;
-- 
2.17.1


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

* Re: [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line
  2019-11-04 21:51 ` [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
@ 2019-11-04 23:48   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2019-11-04 23:48 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, vivien.didelot, davem, Jakub Kicinski

On Mon, Nov 04, 2019 at 01:51:39PM -0800, Florian Fainelli wrote:
> Grab an optional and exclusive reset controller line for the switch and
> manage it during probe/remove functions accordingly. For 7278 devices we
> change bcm_sf2_sw_rst() to use the reset controller line since the
> WATCHDOG_CTRL register does not reset the switch contrary to stated
> documentation.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line
  2019-11-04 21:51 [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
  2019-11-04 21:51 ` [PATCH net-next v2 1/2] dt-bindings: net: Describe BCM7445 switch reset property Florian Fainelli
  2019-11-04 21:51 ` [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
@ 2019-11-06  2:06 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-11-06  2:06 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, jakub.kicinski

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon,  4 Nov 2019 13:51:37 -0800

> This patch series definest the optional reset controller line for the
> BCM7445/BCM7278 integrated Ethernet switches and updates the driver to
> drive that reset line in lieu of the internal watchdog based reset since
> it does not work on BCM7278.

Series applied, thanks.

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

end of thread, other threads:[~2019-11-06  2:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 21:51 [PATCH net-next v2 0/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
2019-11-04 21:51 ` [PATCH net-next v2 1/2] dt-bindings: net: Describe BCM7445 switch reset property Florian Fainelli
2019-11-04 21:51 ` [PATCH net-next v2 2/2] net: dsa: bcm_sf2: Add support for optional reset controller line Florian Fainelli
2019-11-04 23:48   ` Andrew Lunn
2019-11-06  2:06 ` [PATCH net-next v2 0/2] " 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.