netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip
@ 2018-09-15 12:08 Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 1/5] dt-bindings: net: lantiq,xrx200-net: Use lower case in hex Hauke Mehrtens
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

These are mostly minor fixes to problems addresses in the latests round 
of the review of the original series adding these driver, which were not 
applied before the patches got merged into net-next.
In addition it fixes a data bus error on poweroff.

Hauke Mehrtens (5):
  dt-bindings: net: lantiq,xrx200-net: Use lower case in hex
  dt-bindings: net: dsa: lantiq,xrx200-gswip: Fix minor style fixes
  net: lantiq: lantiq_xrx200: Move clock prepare to probe function
  net: dsa: lantiq_gswip: Minor code style improvements
  net: dsa: tag_gswip: Add gswip to dsa_tag_protocol_to_str()

 .../devicetree/bindings/net/dsa/lantiq-gswip.txt   | 18 +++++-----
 .../devicetree/bindings/net/lantiq,xrx200-net.txt  |  4 +--
 drivers/net/dsa/lantiq_gswip.c                     | 38 ++++++++++------------
 drivers/net/ethernet/lantiq_xrx200.c               | 21 +++++++-----
 net/dsa/dsa.c                                      |  3 ++
 5 files changed, 45 insertions(+), 39 deletions(-)

-- 
2.11.0

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

* [PATCH net-next 1/5] dt-bindings: net: lantiq,xrx200-net: Use lower case in hex
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
@ 2018-09-15 12:08 ` Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 2/5] dt-bindings: net: dsa: lantiq,xrx200-gswip: Fix minor style fixes Hauke Mehrtens
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

Use lower case letters in the addresses of the device tree binding.
In addition replace eth with ethernet and fix the size of the reg
element in the example. The additional range does not contain any
registers but is used for the IP block on the this SoC.

Fixes: 839790e88a3c ("dt-bindings: net: Add lantiq, xrx200-net DT bindings")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: devicetree@vger.kernel.org
---
 Documentation/devicetree/bindings/net/lantiq,xrx200-net.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/lantiq,xrx200-net.txt b/Documentation/devicetree/bindings/net/lantiq,xrx200-net.txt
index 8a2fe5200cdc..5ff5e68bbbb6 100644
--- a/Documentation/devicetree/bindings/net/lantiq,xrx200-net.txt
+++ b/Documentation/devicetree/bindings/net/lantiq,xrx200-net.txt
@@ -11,11 +11,11 @@ Required properties:
 
 Example:
 
-eth0: eth@E10B308 {
+ethernet@e10b308 {
 	#address-cells = <1>;
 	#size-cells = <0>;
 	compatible = "lantiq,xrx200-net";
-	reg = <0xE10B308 0x30>;
+	reg = <0xe10b308 0xcf8>;
 	interrupts = <73>, <72>;
 	interrupt-names = "tx", "rx";
 };
-- 
2.11.0

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

* [PATCH net-next 2/5] dt-bindings: net: dsa: lantiq,xrx200-gswip: Fix minor style fixes
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 1/5] dt-bindings: net: lantiq,xrx200-net: Use lower case in hex Hauke Mehrtens
@ 2018-09-15 12:08 ` Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 3/5] net: lantiq: lantiq_xrx200: Move clock prepare to probe function Hauke Mehrtens
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

* Use one compatible line per line in the documentation
* Remove SoC revision depended compatible lines, we can detect that in
  the driver
* Use lower case letters in hex addresses
* Fix the size of the address ranges in the example, this now matches
  the sizes used by the SoC. The old ones will also work, this just adds
  some empty address space.
* Change the reg size of the gphy-fw node

Fixes: 86ce2bc73c7a ("dt-bindings: net: dsa: Add lantiq, xrx200-gswip DT bindings")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: devicetree@vger.kernel.org
---
 .../devicetree/bindings/net/dsa/lantiq-gswip.txt       | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt b/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
index a089f5856778..886cbe8ffb38 100644
--- a/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
+++ b/Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt
@@ -22,9 +22,9 @@ required and optional properties.
 
 
 Required properties for GPHY firmware loading:
-- compatible	: "lantiq,gphy-fw" and "lantiq,xrx200-gphy-fw",
-		  "lantiq,xrx200a1x-gphy-fw", "lantiq,xrx200a2x-gphy-fw",
-		  "lantiq,xrx300-gphy-fw", or "lantiq,xrx330-gphy-fw"
+- compatible	: "lantiq,xrx200-gphy-fw", "lantiq,gphy-fw"
+		  "lantiq,xrx300-gphy-fw", "lantiq,gphy-fw"
+		  "lantiq,xrx330-gphy-fw", "lantiq,gphy-fw"
 		  for the loading of the firmware into the embedded
 		  GPHY core of the SoC.
 - lantiq,rcu	: reference to the rcu syscon
@@ -41,13 +41,13 @@ Example:
 
 Ethernet switch on the VRX200 SoC:
 
-gswip: gswip@E108000 {
+switch@e108000 {
 	#address-cells = <1>;
 	#size-cells = <0>;
 	compatible = "lantiq,xrx200-gswip";
-	reg = <	0xE108000 0x3000 /* switch */
-		0xE10B100 0x70 /* mdio */
-		0xE10B1D8 0x30 /* mii */
+	reg = <	0xe108000 0x3100	/* switch */
+		0xe10b100 0xd8		/* mdio */
+		0xe10b1d8 0x130		/* mii */
 		>;
 	dsa,member = <0 0>;
 
@@ -97,7 +97,7 @@ gswip: gswip@E108000 {
 		};
 	};
 
-	mdio@0 {
+	mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		compatible = "lantiq,xrx200-mdio";
@@ -123,6 +123,8 @@ gswip: gswip@E108000 {
 	gphy-fw {
 		compatible = "lantiq,xrx200-gphy-fw", "lantiq,gphy-fw";
 		lantiq,rcu = <&rcu0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
 
 		gphy@20 {
 			reg = <0x20>;
-- 
2.11.0

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

* [PATCH net-next 3/5] net: lantiq: lantiq_xrx200: Move clock prepare to probe function
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 1/5] dt-bindings: net: lantiq,xrx200-net: Use lower case in hex Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 2/5] dt-bindings: net: dsa: lantiq,xrx200-gswip: Fix minor style fixes Hauke Mehrtens
@ 2018-09-15 12:08 ` Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 4/5] net: dsa: lantiq_gswip: Minor code style improvements Hauke Mehrtens
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

The switch and the MAC are in one IP core and they use the same clock
signal from the clock generation unit.
Currently the clock architecture in the lantiq SoC code does not allow
to easily share the same clocks, this has to be fixed by switching to
the common clock framework.
As a workaround the clock of the switch and MAC should be activated when
the MAC gets probed and only disabled when the MAC gets removed. This
way it is ensured that the clock is always enabled when the switch or
MAC is used. The switch can not be used without the MAC.

This fixes a data bus error when rebooting the system and deactivating
the switch and mac and later accessing some registers in the cleanup
while the clocks are disabled.

Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/ethernet/lantiq_xrx200.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index c8b6d908f0cc..14b20ce0dd43 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -115,12 +115,6 @@ static void xrx200_flush_dma(struct xrx200_chan *ch)
 static int xrx200_open(struct net_device *net_dev)
 {
 	struct xrx200_priv *priv = netdev_priv(net_dev);
-	int err;
-
-	/* enable clock gate */
-	err = clk_prepare_enable(priv->clk);
-	if (err)
-		return err;
 
 	napi_enable(&priv->chan_tx.napi);
 	ltq_dma_open(&priv->chan_tx.dma);
@@ -155,8 +149,6 @@ static int xrx200_close(struct net_device *net_dev)
 	napi_disable(&priv->chan_tx.napi);
 	ltq_dma_close(&priv->chan_tx.dma);
 
-	clk_disable_unprepare(priv->clk);
-
 	return 0;
 }
 
@@ -497,6 +489,11 @@ static int xrx200_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
+	/* enable clock gate */
+	err = clk_prepare_enable(priv->clk);
+	if (err)
+		goto err_uninit_dma;
+
 	/* set IPG to 12 */
 	xrx200_pmac_mask(priv, PMAC_RX_IPG_MASK, 0xb, PMAC_RX_IPG);
 
@@ -514,9 +511,12 @@ static int xrx200_probe(struct platform_device *pdev)
 
 	err = register_netdev(net_dev);
 	if (err)
-		goto err_uninit_dma;
+		goto err_unprepare_clk;
 	return err;
 
+err_unprepare_clk:
+	clk_disable_unprepare(priv->clk);
+
 err_uninit_dma:
 	xrx200_hw_cleanup(priv);
 
@@ -536,6 +536,9 @@ static int xrx200_remove(struct platform_device *pdev)
 	/* remove the actual device */
 	unregister_netdev(net_dev);
 
+	/* release the clock */
+	clk_disable_unprepare(priv->clk);
+
 	/* shut down hardware */
 	xrx200_hw_cleanup(priv);
 
-- 
2.11.0

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

* [PATCH net-next 4/5] net: dsa: lantiq_gswip: Minor code style improvements
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2018-09-15 12:08 ` [PATCH net-next 3/5] net: lantiq: lantiq_xrx200: Move clock prepare to probe function Hauke Mehrtens
@ 2018-09-15 12:08 ` Hauke Mehrtens
  2018-09-15 12:08 ` [PATCH net-next 5/5] net: dsa: tag_gswip: Add gswip to dsa_tag_protocol_to_str() Hauke Mehrtens
  2018-09-17 15:13 ` [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

Use one code block when returning because the interface type is
unsupported and also check if some unsupported port gets configured.
In addition fix a double the and use dsa_is_cpu_port() instated of
manually getting the CPU port.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/dsa/lantiq_gswip.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 9c28d0b2fcdb..4e3732b5790f 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -615,32 +615,24 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port,
 		if (!phy_interface_mode_is_rgmii(state->interface) &&
 		    state->interface != PHY_INTERFACE_MODE_MII &&
 		    state->interface != PHY_INTERFACE_MODE_REVMII &&
-		    state->interface != PHY_INTERFACE_MODE_RMII) {
-			bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-			dev_err(ds->dev,
-			"Unsupported interface: %d\n", state->interface);
-			return;
-		}
+		    state->interface != PHY_INTERFACE_MODE_RMII)
+			goto unsupported;
 		break;
 	case 2:
 	case 3:
 	case 4:
-		if (state->interface != PHY_INTERFACE_MODE_INTERNAL) {
-			bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-			dev_err(ds->dev,
-			"Unsupported interface: %d\n", state->interface);
-			return;
-		}
+		if (state->interface != PHY_INTERFACE_MODE_INTERNAL)
+			goto unsupported;
 		break;
 	case 5:
 		if (!phy_interface_mode_is_rgmii(state->interface) &&
-		    state->interface != PHY_INTERFACE_MODE_INTERNAL) {
-			bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-			dev_err(ds->dev,
-			"Unsupported interface: %d\n", state->interface);
-			return;
-		}
+		    state->interface != PHY_INTERFACE_MODE_INTERNAL)
+			goto unsupported;
 		break;
+	default:
+		bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+		dev_err(ds->dev, "Unsupported port: %i\n", port);
+		return;
 	}
 
 	/* Allow all the expected bits */
@@ -667,6 +659,12 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port,
 		   __ETHTOOL_LINK_MODE_MASK_NBITS);
 	bitmap_and(state->advertising, state->advertising, mask,
 		   __ETHTOOL_LINK_MODE_MASK_NBITS);
+	return;
+
+unsupported:
+	bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+	dev_err(ds->dev, "Unsupported interface: %d\n", state->interface);
+	return;
 }
 
 static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
@@ -970,7 +968,7 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv,
 	int err;
 	int i = 0;
 
-	/* The The VRX200 rev 1.1 uses the GSWIP 2.0 and needs the older
+	/* The VRX200 rev 1.1 uses the GSWIP 2.0 and needs the older
 	 * GPHY firmware. The VRX200 rev 1.2 uses the GSWIP 2.1 and also
 	 * needs a different GPHY firmware.
 	 */
@@ -1097,7 +1095,7 @@ static int gswip_probe(struct platform_device *pdev)
 		dev_err(dev, "dsa switch register failed: %i\n", err);
 		goto mdio_bus;
 	}
-	if (priv->ds->dst->cpu_dp->index != priv->hw_info->cpu_port) {
+	if (!dsa_is_cpu_port(priv->ds, priv->hw_info->cpu_port)) {
 		dev_err(dev, "wrong CPU port defined, HW only supports port: %i",
 			priv->hw_info->cpu_port);
 		err = -EINVAL;
-- 
2.11.0

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

* [PATCH net-next 5/5] net: dsa: tag_gswip: Add gswip to dsa_tag_protocol_to_str()
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
                   ` (3 preceding siblings ...)
  2018-09-15 12:08 ` [PATCH net-next 4/5] net: dsa: lantiq_gswip: Minor code style improvements Hauke Mehrtens
@ 2018-09-15 12:08 ` Hauke Mehrtens
  2018-09-17 15:13 ` [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2018-09-15 12:08 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree, Hauke Mehrtens

The gswip tag was missing in the dsa_tag_protocol_to_str() function, add it.

Fixes: 7969119293f5 ("net: dsa: Add Lantiq / Intel GSWIP tag support")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 net/dsa/dsa.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 5f73e96cc9e6..a69c1790bbfc 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -88,6 +88,9 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
 #ifdef CONFIG_NET_DSA_TAG_EDSA
 		[DSA_TAG_PROTO_EDSA] = "edsa",
 #endif
+#ifdef CONFIG_NET_DSA_TAG_GSWIP
+		[DSA_TAG_PROTO_GSWIP] = "gswip",
+#endif
 #ifdef CONFIG_NET_DSA_TAG_KSZ
 		[DSA_TAG_PROTO_KSZ] = "ksz",
 #endif
-- 
2.11.0

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

* Re: [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip
  2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
                   ` (4 preceding siblings ...)
  2018-09-15 12:08 ` [PATCH net-next 5/5] net: dsa: tag_gswip: Add gswip to dsa_tag_protocol_to_str() Hauke Mehrtens
@ 2018-09-17 15:13 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-09-17 15:13 UTC (permalink / raw)
  To: hauke
  Cc: netdev, andrew, vivien.didelot, f.fainelli, john, linux-mips, dev,
	hauke.mehrtens, devicetree

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 15 Sep 2018 14:08:44 +0200

> These are mostly minor fixes to problems addresses in the latests round 
> of the review of the original series adding these driver, which were not 
> applied before the patches got merged into net-next.
> In addition it fixes a data bus error on poweroff.

Series applied.

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

end of thread, other threads:[~2018-09-17 20:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-15 12:08 [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip Hauke Mehrtens
2018-09-15 12:08 ` [PATCH net-next 1/5] dt-bindings: net: lantiq,xrx200-net: Use lower case in hex Hauke Mehrtens
2018-09-15 12:08 ` [PATCH net-next 2/5] dt-bindings: net: dsa: lantiq,xrx200-gswip: Fix minor style fixes Hauke Mehrtens
2018-09-15 12:08 ` [PATCH net-next 3/5] net: lantiq: lantiq_xrx200: Move clock prepare to probe function Hauke Mehrtens
2018-09-15 12:08 ` [PATCH net-next 4/5] net: dsa: lantiq_gswip: Minor code style improvements Hauke Mehrtens
2018-09-15 12:08 ` [PATCH net-next 5/5] net: dsa: tag_gswip: Add gswip to dsa_tag_protocol_to_str() Hauke Mehrtens
2018-09-17 15:13 ` [PATCH net-next 0/5] net: lantiq: Minor fixes for vrx200 and gswip David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).