netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe
@ 2019-01-30  0:37 Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 01/10] net: dsa: mv88e6xxx: Remove legacy probe support Andrew Lunn
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

The mv88e6060 is the last device using the legacy method of probing an
DSA Ethernet switch. This patchset applies some cleanups to the
driver, and then adds support for probing the device as an MDIO bus
device. The legacy probe is then removed from the driver, and then
from DSA as a whole.

This is compile tested only. Comment and testing welcome.

It should not be merged yet, and one of the patches should go via
arm-soc.

Andrew Lunn (10):
  net: dsa: mv88e6xxx: Remove legacy probe support
  net: dsa: mv88e6060: Replace ds with priv
  net: dsa: mv88e6060: Replace REG_WRITE macro
  net: dsa: mv88e6060: Replace REG_READ macro
  net: dsa: mv88e6060: Support probing as an mdio device
  net: dsa: mv88e6060: Remove support for legacy probing
  net: dsa: mv88e6060: Add SPDX header
  net: dsa: Remove legacy probing support
  arch: arm: dts: Remove disabled marvell,dsa properties
  bt-bindings: net: DSA: Remove legacy binding

 .../devicetree/bindings/net/dsa/dsa.txt       | 155 ----
 arch/arm/boot/dts/armada-370-rd.dts           |  42 -
 arch/arm/boot/dts/armada-388-clearfog.dts     |  58 --
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts |  47 --
 arch/arm/boot/dts/kirkwood-dir665.dts         |  47 --
 arch/arm/boot/dts/kirkwood-linksys-viper.dts  |  47 --
 .../arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts |  47 --
 arch/arm/boot/dts/kirkwood-rd88f6281.dtsi     |  41 -
 drivers/net/dsa/Kconfig                       |   2 +-
 drivers/net/dsa/mv88e6060.c                   | 217 ++---
 drivers/net/dsa/mv88e6060.h                   |   1 +
 drivers/net/dsa/mv88e6xxx/chip.c              |  71 +-
 include/net/dsa.h                             |  23 -
 net/dsa/Kconfig                               |   9 -
 net/dsa/Makefile                              |   1 -
 net/dsa/dsa.c                                 |   5 -
 net/dsa/dsa_priv.h                            |  12 -
 net/dsa/legacy.c                              | 745 ------------------
 18 files changed, 121 insertions(+), 1449 deletions(-)

-- 
2.20.1


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

* [PATCH RFC RFT net-next 01/10] net: dsa: mv88e6xxx: Remove legacy probe support
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 02/10] net: dsa: mv88e6060: Replace ds with priv Andrew Lunn
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Remove the legacy method of probing the mv88e6xxx driver, now that all
the mainline boards have been converted to use mdio based probing for
a number of cycles.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 71 +-------------------------------
 1 file changed, 1 insertion(+), 70 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 8dca2c949e73..df8d54208c3c 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -4587,56 +4587,6 @@ static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
 	return chip->info->tag_protocol;
 }
 
-#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
-static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
-				       struct device *host_dev, int sw_addr,
-				       void **priv)
-{
-	struct mv88e6xxx_chip *chip;
-	struct mii_bus *bus;
-	int err;
-
-	bus = dsa_host_dev_to_mii_bus(host_dev);
-	if (!bus)
-		return NULL;
-
-	chip = mv88e6xxx_alloc_chip(dsa_dev);
-	if (!chip)
-		return NULL;
-
-	/* Legacy SMI probing will only support chips similar to 88E6085 */
-	chip->info = &mv88e6xxx_table[MV88E6085];
-
-	err = mv88e6xxx_smi_init(chip, bus, sw_addr);
-	if (err)
-		goto free;
-
-	err = mv88e6xxx_detect(chip);
-	if (err)
-		goto free;
-
-	mutex_lock(&chip->reg_lock);
-	err = mv88e6xxx_switch_reset(chip);
-	mutex_unlock(&chip->reg_lock);
-	if (err)
-		goto free;
-
-	mv88e6xxx_phy_init(chip);
-
-	err = mv88e6xxx_mdios_register(chip, NULL);
-	if (err)
-		goto free;
-
-	*priv = chip;
-
-	return chip->info->name;
-free:
-	devm_kfree(dsa_dev, chip);
-
-	return NULL;
-}
-#endif
-
 static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port,
 				      const struct switchdev_obj_port_mdb *mdb)
 {
@@ -4675,9 +4625,6 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
 }
 
 static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
-#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
-	.probe			= mv88e6xxx_drv_probe,
-#endif
 	.get_tag_protocol	= mv88e6xxx_get_tag_protocol,
 	.setup			= mv88e6xxx_setup,
 	.adjust_link		= mv88e6xxx_adjust_link,
@@ -4722,10 +4669,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
 	.get_ts_info		= mv88e6xxx_get_ts_info,
 };
 
-static struct dsa_switch_driver mv88e6xxx_switch_drv = {
-	.ops			= &mv88e6xxx_switch_ops,
-};
-
 static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
 {
 	struct device *dev = chip->dev;
@@ -4951,19 +4894,7 @@ static struct mdio_driver mv88e6xxx_driver = {
 	},
 };
 
-static int __init mv88e6xxx_init(void)
-{
-	register_switch_driver(&mv88e6xxx_switch_drv);
-	return mdio_driver_register(&mv88e6xxx_driver);
-}
-module_init(mv88e6xxx_init);
-
-static void __exit mv88e6xxx_cleanup(void)
-{
-	mdio_driver_unregister(&mv88e6xxx_driver);
-	unregister_switch_driver(&mv88e6xxx_switch_drv);
-}
-module_exit(mv88e6xxx_cleanup);
+mdio_module_driver(mv88e6xxx_driver);
 
 MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>");
 MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips");
-- 
2.20.1


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

* [PATCH RFC RFT net-next 02/10] net: dsa: mv88e6060: Replace ds with priv
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 01/10] net: dsa: mv88e6xxx: Remove legacy probe support Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro Andrew Lunn
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Pass around priv, not ds. This will help with changing to an mdio
driver, and makes this driver more like mv88e6xxx.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6060.c | 43 +++++++++++++++++++------------------
 drivers/net/dsa/mv88e6060.h |  1 +
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 0b3e51f248c2..631358bf3d6b 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -18,10 +18,8 @@
 #include <net/dsa.h>
 #include "mv88e6060.h"
 
-static int reg_read(struct dsa_switch *ds, int addr, int reg)
+static int reg_read(struct mv88e6060_priv *priv, int addr, int reg)
 {
-	struct mv88e6060_priv *priv = ds->priv;
-
 	return mdiobus_read_nested(priv->bus, priv->sw_addr + addr, reg);
 }
 
@@ -29,17 +27,15 @@ static int reg_read(struct dsa_switch *ds, int addr, int reg)
 	({							\
 		int __ret;					\
 								\
-		__ret = reg_read(ds, addr, reg);		\
+		__ret = reg_read(priv, addr, reg);		\
 		if (__ret < 0)					\
 			return __ret;				\
 		__ret;						\
 	})
 
 
-static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
+static int reg_write(struct mv88e6060_priv *priv, int addr, int reg, u16 val)
 {
-	struct mv88e6060_priv *priv = ds->priv;
-
 	return mdiobus_write_nested(priv->bus, priv->sw_addr + addr, reg, val);
 }
 
@@ -47,7 +43,7 @@ static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
 	({							\
 		int __ret;					\
 								\
-		__ret = reg_write(ds, addr, reg, val);		\
+		__ret = reg_write(priv, addr, reg, val);		\
 		if (__ret < 0)					\
 			return __ret;				\
 	})
@@ -97,7 +93,7 @@ static const char *mv88e6060_drv_probe(struct device *dsa_dev,
 	return name;
 }
 
-static int mv88e6060_switch_reset(struct dsa_switch *ds)
+static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 {
 	int i;
 	int ret;
@@ -133,7 +129,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)
 	return 0;
 }
 
-static int mv88e6060_setup_global(struct dsa_switch *ds)
+static int mv88e6060_setup_global(struct mv88e6060_priv *priv)
 {
 	/* Disable discarding of frames with excessive collisions,
 	 * set the maximum frame size to 1536 bytes, and mask all
@@ -149,7 +145,7 @@ static int mv88e6060_setup_global(struct dsa_switch *ds)
 	return 0;
 }
 
-static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
+static int mv88e6060_setup_port(struct mv88e6060_priv *priv, int p)
 {
 	int addr = REG_PORT(p);
 
@@ -159,7 +155,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 	 * port, enable Ingress and Egress Trailer tagging mode.
 	 */
 	REG_WRITE(addr, PORT_CONTROL,
-		  dsa_is_cpu_port(ds, p) ?
+		  dsa_is_cpu_port(priv->ds, p) ?
 			PORT_CONTROL_TRAILER |
 			PORT_CONTROL_INGRESS_MODE |
 			PORT_CONTROL_STATE_FORWARDING :
@@ -172,8 +168,8 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 	 */
 	REG_WRITE(addr, PORT_VLAN_MAP,
 		  ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
-		   (dsa_is_cpu_port(ds, p) ? dsa_user_ports(ds) :
-		    BIT(dsa_to_port(ds, p)->cpu_dp->index)));
+		   (dsa_is_cpu_port(priv->ds, p) ? dsa_user_ports(priv->ds) :
+		    BIT(dsa_to_port(priv->ds, p)->cpu_dp->index)));
 
 	/* Port Association Vector: when learning source addresses
 	 * of packets, add the address to the address database using
@@ -185,7 +181,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
 	return 0;
 }
 
-static int mv88e6060_setup_addr(struct dsa_switch *ds)
+static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
 {
 	u8 addr[ETH_ALEN];
 	u16 val;
@@ -208,25 +204,28 @@ static int mv88e6060_setup_addr(struct dsa_switch *ds)
 
 static int mv88e6060_setup(struct dsa_switch *ds)
 {
+	struct mv88e6060_priv *priv = ds->priv;
 	int ret;
 	int i;
 
-	ret = mv88e6060_switch_reset(ds);
+	priv->ds = ds;
+
+	ret = mv88e6060_switch_reset(priv);
 	if (ret < 0)
 		return ret;
 
 	/* @@@ initialise atu */
 
-	ret = mv88e6060_setup_global(ds);
+	ret = mv88e6060_setup_global(priv);
 	if (ret < 0)
 		return ret;
 
-	ret = mv88e6060_setup_addr(ds);
+	ret = mv88e6060_setup_addr(priv);
 	if (ret < 0)
 		return ret;
 
 	for (i = 0; i < MV88E6060_PORTS; i++) {
-		ret = mv88e6060_setup_port(ds, i);
+		ret = mv88e6060_setup_port(priv, i);
 		if (ret < 0)
 			return ret;
 	}
@@ -243,25 +242,27 @@ static int mv88e6060_port_to_phy_addr(int port)
 
 static int mv88e6060_phy_read(struct dsa_switch *ds, int port, int regnum)
 {
+	struct mv88e6060_priv *priv = ds->priv;
 	int addr;
 
 	addr = mv88e6060_port_to_phy_addr(port);
 	if (addr == -1)
 		return 0xffff;
 
-	return reg_read(ds, addr, regnum);
+	return reg_read(priv, addr, regnum);
 }
 
 static int
 mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
 {
+	struct mv88e6060_priv *priv = ds->priv;
 	int addr;
 
 	addr = mv88e6060_port_to_phy_addr(port);
 	if (addr == -1)
 		return 0xffff;
 
-	return reg_write(ds, addr, regnum, val);
+	return reg_write(priv, addr, regnum, val);
 }
 
 static const struct dsa_switch_ops mv88e6060_switch_ops = {
diff --git a/drivers/net/dsa/mv88e6060.h b/drivers/net/dsa/mv88e6060.h
index 10249bd16292..c0e7a0f2fb6a 100644
--- a/drivers/net/dsa/mv88e6060.h
+++ b/drivers/net/dsa/mv88e6060.h
@@ -117,6 +117,7 @@ struct mv88e6060_priv {
 	 */
 	struct mii_bus *bus;
 	int sw_addr;
+	struct dsa_switch *ds;
 };
 
 #endif
-- 
2.20.1


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

* [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 01/10] net: dsa: mv88e6xxx: Remove legacy probe support Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 02/10] net: dsa: mv88e6060: Replace ds with priv Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  9:24   ` Pavel Machek
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 04/10] net: dsa: mv88e6060: Replace REG_READ macro Andrew Lunn
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

The REG_WRITE macro contains a return statement, making it not very
safe. Remove it by inlining the code.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6060.c | 73 +++++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 32 deletions(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 631358bf3d6b..da88c56e092c 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -39,15 +39,6 @@ static int reg_write(struct mv88e6060_priv *priv, int addr, int reg, u16 val)
 	return mdiobus_write_nested(priv->bus, priv->sw_addr + addr, reg, val);
 }
 
-#define REG_WRITE(addr, reg, val)				\
-	({							\
-		int __ret;					\
-								\
-		__ret = reg_write(priv, addr, reg, val);		\
-		if (__ret < 0)					\
-			return __ret;				\
-	})
-
 static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
 {
 	int ret;
@@ -102,17 +93,21 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 	/* Set all ports to the disabled state. */
 	for (i = 0; i < MV88E6060_PORTS; i++) {
 		ret = REG_READ(REG_PORT(i), PORT_CONTROL);
-		REG_WRITE(REG_PORT(i), PORT_CONTROL,
-			  ret & ~PORT_CONTROL_STATE_MASK);
+		ret = reg_write(priv, REG_PORT(i), PORT_CONTROL,
+				ret & ~PORT_CONTROL_STATE_MASK);
+		if (ret)
+			return ret;
 	}
 
 	/* Wait for transmit queues to drain. */
 	usleep_range(2000, 4000);
 
 	/* Reset the switch. */
-	REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
-		  GLOBAL_ATU_CONTROL_SWRESET |
-		  GLOBAL_ATU_CONTROL_LEARNDIS);
+	ret = reg_write(priv, REG_GLOBAL, GLOBAL_ATU_CONTROL,
+			GLOBAL_ATU_CONTROL_SWRESET |
+			GLOBAL_ATU_CONTROL_LEARNDIS);
+	if (ret)
+		return ret;
 
 	/* Wait up to one second for reset to complete. */
 	timeout = jiffies + 1 * HZ;
@@ -131,59 +126,67 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 
 static int mv88e6060_setup_global(struct mv88e6060_priv *priv)
 {
+	int ret;
+
 	/* Disable discarding of frames with excessive collisions,
 	 * set the maximum frame size to 1536 bytes, and mask all
 	 * interrupt sources.
 	 */
-	REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL, GLOBAL_CONTROL_MAX_FRAME_1536);
+	ret = reg_write(priv, REG_GLOBAL, GLOBAL_CONTROL,
+			GLOBAL_CONTROL_MAX_FRAME_1536);
+	if (ret)
+		return ret;
 
 	/* Disable automatic address learning.
 	 */
-	REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
-		  GLOBAL_ATU_CONTROL_LEARNDIS);
-
-	return 0;
+	return reg_write(priv, REG_GLOBAL, GLOBAL_ATU_CONTROL,
+			 GLOBAL_ATU_CONTROL_LEARNDIS);
 }
 
 static int mv88e6060_setup_port(struct mv88e6060_priv *priv, int p)
 {
 	int addr = REG_PORT(p);
+	int ret;
 
 	/* Do not force flow control, disable Ingress and Egress
 	 * Header tagging, disable VLAN tunneling, and set the port
 	 * state to Forwarding.  Additionally, if this is the CPU
 	 * port, enable Ingress and Egress Trailer tagging mode.
 	 */
-	REG_WRITE(addr, PORT_CONTROL,
-		  dsa_is_cpu_port(priv->ds, p) ?
+	ret = reg_write(priv, addr, PORT_CONTROL,
+			dsa_is_cpu_port(priv->ds, p) ?
 			PORT_CONTROL_TRAILER |
 			PORT_CONTROL_INGRESS_MODE |
 			PORT_CONTROL_STATE_FORWARDING :
 			PORT_CONTROL_STATE_FORWARDING);
+	if (ret)
+		return ret;
 
 	/* Port based VLAN map: give each port its own address
 	 * database, allow the CPU port to talk to each of the 'real'
 	 * ports, and allow each of the 'real' ports to only talk to
 	 * the CPU port.
 	 */
-	REG_WRITE(addr, PORT_VLAN_MAP,
-		  ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
-		   (dsa_is_cpu_port(priv->ds, p) ? dsa_user_ports(priv->ds) :
-		    BIT(dsa_to_port(priv->ds, p)->cpu_dp->index)));
+	ret = reg_write(priv, addr, PORT_VLAN_MAP,
+			((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
+			(dsa_is_cpu_port(priv->ds, p) ?
+			 dsa_user_ports(priv->ds) :
+			 BIT(dsa_to_port(priv->ds, p)->cpu_dp->index)));
+	if (ret)
+		return ret;
 
 	/* Port Association Vector: when learning source addresses
 	 * of packets, add the address to the address database using
 	 * a port bitmap that has only the bit for this port set and
 	 * the other bits clear.
 	 */
-	REG_WRITE(addr, PORT_ASSOC_VECTOR, BIT(p));
-
-	return 0;
+	return reg_write(priv, addr, PORT_ASSOC_VECTOR, BIT(p));
 }
 
 static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
 {
 	u8 addr[ETH_ALEN];
+	int ret;
 	u16 val;
 
 	eth_random_addr(addr);
@@ -195,11 +198,17 @@ static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
 	 */
 	val &= 0xfeff;
 
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, val);
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
+	ret = reg_write(priv, REG_GLOBAL, GLOBAL_MAC_01, val);
+	if (ret)
+		return ret;
+
+	ret = reg_write(priv, REG_GLOBAL, GLOBAL_MAC_23,
+			(addr[2] << 8) | addr[3]);
+	if (ret)
+		return ret;
 
-	return 0;
+	return reg_write(priv, REG_GLOBAL, GLOBAL_MAC_45,
+			 (addr[4] << 8) | addr[5]);
 }
 
 static int mv88e6060_setup(struct dsa_switch *ds)
-- 
2.20.1


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

* [PATCH RFC RFT net-next 04/10] net: dsa: mv88e6060: Replace REG_READ macro
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (2 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 05/10] net: dsa: mv88e6060: Support probing as an mdio device Andrew Lunn
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

The REG_READ macro contains a return statement, making it not very
safe. Remove it by inlining the code.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6060.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index da88c56e092c..00fdf155dcec 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -23,17 +23,6 @@ static int reg_read(struct mv88e6060_priv *priv, int addr, int reg)
 	return mdiobus_read_nested(priv->bus, priv->sw_addr + addr, reg);
 }
 
-#define REG_READ(addr, reg)					\
-	({							\
-		int __ret;					\
-								\
-		__ret = reg_read(priv, addr, reg);		\
-		if (__ret < 0)					\
-			return __ret;				\
-		__ret;						\
-	})
-
-
 static int reg_write(struct mv88e6060_priv *priv, int addr, int reg, u16 val)
 {
 	return mdiobus_write_nested(priv->bus, priv->sw_addr + addr, reg, val);
@@ -92,7 +81,9 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 
 	/* Set all ports to the disabled state. */
 	for (i = 0; i < MV88E6060_PORTS; i++) {
-		ret = REG_READ(REG_PORT(i), PORT_CONTROL);
+		ret = reg_read(priv, REG_PORT(i), PORT_CONTROL);
+		if (ret < 0)
+			return ret;
 		ret = reg_write(priv, REG_PORT(i), PORT_CONTROL,
 				ret & ~PORT_CONTROL_STATE_MASK);
 		if (ret)
@@ -112,7 +103,10 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 	/* Wait up to one second for reset to complete. */
 	timeout = jiffies + 1 * HZ;
 	while (time_before(jiffies, timeout)) {
-		ret = REG_READ(REG_GLOBAL, GLOBAL_STATUS);
+		ret = reg_read(priv, REG_GLOBAL, GLOBAL_STATUS);
+		if (ret < 0)
+			return ret;
+
 		if (ret & GLOBAL_STATUS_INIT_READY)
 			break;
 
-- 
2.20.1


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

* [PATCH RFC RFT net-next 05/10] net: dsa: mv88e6060: Support probing as an mdio device
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (3 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 04/10] net: dsa: mv88e6060: Replace REG_READ macro Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 06/10] net: dsa: mv88e6060: Remove support for legacy probing Andrew Lunn
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Probing DSA devices as platform devices has been superseded by using
normal bus drivers. Add support for probing the mv88e6060 device as an
mdio device.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6060.c | 61 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 00fdf155dcec..aaa176edafc0 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -280,19 +280,78 @@ static struct dsa_switch_driver mv88e6060_switch_drv = {
 	.ops		= &mv88e6060_switch_ops,
 };
 
+static int mv88e6060_probe(struct mdio_device *mdiodev)
+{
+	struct device *dev = &mdiodev->dev;
+	struct mv88e6060_priv *priv;
+	struct dsa_switch *ds;
+	const char *name;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->bus = mdiodev->bus;
+	priv->sw_addr = mdiodev->addr;
+
+	name = mv88e6060_get_name(priv->bus, priv->sw_addr);
+	if (!name)
+		return -ENODEV;
+
+	dev_info(dev, "switch %s detected\n", name);
+
+	ds = dsa_switch_alloc(dev, MV88E6060_PORTS);
+	if (!ds)
+		return -ENOMEM;
+
+	ds->priv = priv;
+	ds->dev = dev;
+	ds->ops = &mv88e6060_switch_ops;
+
+	dev_set_drvdata(dev, ds);
+
+	return dsa_register_switch(ds);
+}
+
+static void mv88e6060_remove(struct mdio_device *mdiodev)
+{
+	struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
+
+	dsa_unregister_switch(ds);
+}
+
+static const struct of_device_id mv88e6060_of_match[] = {
+        {
+                .compatible = "marvell,mv88e6060",
+        },
+        { /* sentinel */ },
+};
+
+static struct mdio_driver mv88e6060_driver = {
+        .probe  = mv88e6060_probe,
+        .remove = mv88e6060_remove,
+        .mdiodrv.driver = {
+                .name = "mv88e6060",
+                .of_match_table = mv88e6060_of_match,
+        },
+};
+
 static int __init mv88e6060_init(void)
 {
 	register_switch_driver(&mv88e6060_switch_drv);
-	return 0;
+	return mdio_driver_register(&mv88e6060_driver);
 }
 module_init(mv88e6060_init);
 
 static void __exit mv88e6060_cleanup(void)
 {
+	mdio_driver_unregister(&mv88e6060_driver);
 	unregister_switch_driver(&mv88e6060_switch_drv);
 }
 module_exit(mv88e6060_cleanup);
 
+
+
 MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>");
 MODULE_DESCRIPTION("Driver for Marvell 88E6060 ethernet switch chip");
 MODULE_LICENSE("GPL");
-- 
2.20.1


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

* [PATCH RFC RFT net-next 06/10] net: dsa: mv88e6060: Remove support for legacy probing
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (4 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 05/10] net: dsa: mv88e6060: Support probing as an mdio device Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 07/10] net: dsa: mv88e6060: Add SPDX header Andrew Lunn
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Now that the driver can be probed as an mdio device, remove the legacy
DSA platform device probing.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/Kconfig     |  2 +-
 drivers/net/dsa/mv88e6060.c | 42 +------------------------------------
 2 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index 71bb3aebded4..82560b710681 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -41,7 +41,7 @@ config NET_DSA_MT7530
 
 config NET_DSA_MV88E6060
 	tristate "Marvell 88E6060 ethernet switch chip support"
-	depends on NET_DSA && NET_DSA_LEGACY
+	depends on NET_DSA
 	select NET_DSA_TAG_TRAILER
 	---help---
 	  This enables support for the Marvell 88E6060 ethernet switch
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index aaa176edafc0..792091a7153b 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -52,27 +52,6 @@ static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
 	return DSA_TAG_PROTO_TRAILER;
 }
 
-static const char *mv88e6060_drv_probe(struct device *dsa_dev,
-				       struct device *host_dev, int sw_addr,
-				       void **_priv)
-{
-	struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
-	struct mv88e6060_priv *priv;
-	const char *name;
-
-	name = mv88e6060_get_name(bus, sw_addr);
-	if (name) {
-		priv = devm_kzalloc(dsa_dev, sizeof(*priv), GFP_KERNEL);
-		if (!priv)
-			return NULL;
-		*_priv = priv;
-		priv->bus = bus;
-		priv->sw_addr = sw_addr;
-	}
-
-	return name;
-}
-
 static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
 {
 	int i;
@@ -270,16 +249,11 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
 
 static const struct dsa_switch_ops mv88e6060_switch_ops = {
 	.get_tag_protocol = mv88e6060_get_tag_protocol,
-	.probe		= mv88e6060_drv_probe,
 	.setup		= mv88e6060_setup,
 	.phy_read	= mv88e6060_phy_read,
 	.phy_write	= mv88e6060_phy_write,
 };
 
-static struct dsa_switch_driver mv88e6060_switch_drv = {
-	.ops		= &mv88e6060_switch_ops,
-};
-
 static int mv88e6060_probe(struct mdio_device *mdiodev)
 {
 	struct device *dev = &mdiodev->dev;
@@ -336,21 +310,7 @@ static struct mdio_driver mv88e6060_driver = {
         },
 };
 
-static int __init mv88e6060_init(void)
-{
-	register_switch_driver(&mv88e6060_switch_drv);
-	return mdio_driver_register(&mv88e6060_driver);
-}
-module_init(mv88e6060_init);
-
-static void __exit mv88e6060_cleanup(void)
-{
-	mdio_driver_unregister(&mv88e6060_driver);
-	unregister_switch_driver(&mv88e6060_switch_drv);
-}
-module_exit(mv88e6060_cleanup);
-
-
+mdio_module_driver(mv88e6060_driver);
 
 MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>");
 MODULE_DESCRIPTION("Driver for Marvell 88E6060 ethernet switch chip");
-- 
2.20.1


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

* [PATCH RFC RFT net-next 07/10] net: dsa: mv88e6060: Add SPDX header
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (5 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 06/10] net: dsa: mv88e6060: Remove support for legacy probing Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 08/10] net: dsa: Remove legacy probing support Andrew Lunn
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Add an SPDX header, and remove the license text.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6060.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 792091a7153b..df5940259604 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -1,11 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * net/dsa/mv88e6060.c - Driver for Marvell 88e6060 switch chips
  * Copyright (c) 2008-2009 Marvell Semiconductor
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 
 #include <linux/delay.h>
-- 
2.20.1


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

* [PATCH RFC RFT net-next 08/10] net: dsa: Remove legacy probing support
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (6 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 07/10] net: dsa: mv88e6060: Add SPDX header Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 09/10] arch: arm: dts: Remove disabled marvell,dsa properties Andrew Lunn
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Now that all drivers can be probed using more traditional methods,
remove the legacy probe code.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 include/net/dsa.h  |  23 --
 net/dsa/Kconfig    |   9 -
 net/dsa/Makefile   |   1 -
 net/dsa/dsa.c      |   5 -
 net/dsa/dsa_priv.h |  12 -
 net/dsa/legacy.c   | 745 ---------------------------------------------
 6 files changed, 795 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7f2a668ef2cc..59a834207f66 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -277,15 +277,6 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
 typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid,
 			      bool is_static, void *data);
 struct dsa_switch_ops {
-#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
-	/*
-	 * Legacy probing.
-	 */
-	const char	*(*probe)(struct device *dsa_dev,
-				  struct device *host_dev, int sw_addr,
-				  void **priv);
-#endif
-
 	enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds,
 						  int port);
 
@@ -474,20 +465,6 @@ struct dsa_switch_driver {
 	const struct dsa_switch_ops *ops;
 };
 
-#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
-/* Legacy driver registration */
-void register_switch_driver(struct dsa_switch_driver *type);
-void unregister_switch_driver(struct dsa_switch_driver *type);
-struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
-
-#else
-static inline void register_switch_driver(struct dsa_switch_driver *type) { }
-static inline void unregister_switch_driver(struct dsa_switch_driver *type) { }
-static inline struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev)
-{
-	return NULL;
-}
-#endif
 struct net_device *dsa_dev_to_net_device(struct device *dev);
 
 /* Keep inline for faster access in hot path */
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 91e52973ee13..80692d6cc531 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -16,15 +16,6 @@ config NET_DSA
 
 if NET_DSA
 
-config NET_DSA_LEGACY
-	bool "Support for older platform device and Device Tree registration"
-	default y
-	---help---
-	  Say Y if you want to enable support for the older platform device and
-	  deprecated Device Tree binding registration.
-
-	  This feature is scheduled for removal in 4.17.
-
 # tagging formats
 config NET_DSA_TAG_BRCM
 	bool
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 6e721f7a2947..cf59f3783c3c 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -2,7 +2,6 @@
 # the core
 obj-$(CONFIG_NET_DSA) += dsa_core.o
 dsa_core-y += dsa.o dsa2.o master.o port.o slave.o switch.o
-dsa_core-$(CONFIG_NET_DSA_LEGACY) += legacy.o
 
 # tagging formats
 dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index aee909bcddc4..70b9d2b9b002 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -344,10 +344,6 @@ static int __init dsa_init_module(void)
 	if (rc)
 		return rc;
 
-	rc = dsa_legacy_register();
-	if (rc)
-		return rc;
-
 	dev_add_pack(&dsa_pack_type);
 
 	return 0;
@@ -358,7 +354,6 @@ static void __exit dsa_cleanup_module(void)
 {
 	dsa_slave_unregister_notifier();
 	dev_remove_pack(&dsa_pack_type);
-	dsa_legacy_unregister();
 	destroy_workqueue(dsa_owq);
 }
 module_exit(dsa_cleanup_module);
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 1f4972dab9f2..9c9d94efafdf 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -88,18 +88,6 @@ const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
 bool dsa_schedule_work(struct work_struct *work);
 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
 
-/* legacy.c */
-#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
-int dsa_legacy_register(void);
-void dsa_legacy_unregister(void);
-#else
-static inline int dsa_legacy_register(void)
-{
-	return 0;
-}
-
-static inline void dsa_legacy_unregister(void) { }
-#endif
 int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 		       struct net_device *dev,
 		       const unsigned char *addr, u16 vid,
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index cb42939db776..e69de29bb2d1 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -1,745 +0,0 @@
-/*
- * net/dsa/legacy.c - Hardware switch handling
- * Copyright (c) 2008-2009 Marvell Semiconductor
- * Copyright (c) 2013 Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#include <linux/device.h>
-#include <linux/list.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_mdio.h>
-#include <linux/of_platform.h>
-#include <linux/of_net.h>
-#include <linux/netdevice.h>
-#include <linux/sysfs.h>
-#include <linux/phy_fixed.h>
-#include <linux/etherdevice.h>
-
-#include "dsa_priv.h"
-
-/* switch driver registration ***********************************************/
-static DEFINE_MUTEX(dsa_switch_drivers_mutex);
-static LIST_HEAD(dsa_switch_drivers);
-
-void register_switch_driver(struct dsa_switch_driver *drv)
-{
-	mutex_lock(&dsa_switch_drivers_mutex);
-	list_add_tail(&drv->list, &dsa_switch_drivers);
-	mutex_unlock(&dsa_switch_drivers_mutex);
-}
-EXPORT_SYMBOL_GPL(register_switch_driver);
-
-void unregister_switch_driver(struct dsa_switch_driver *drv)
-{
-	mutex_lock(&dsa_switch_drivers_mutex);
-	list_del_init(&drv->list);
-	mutex_unlock(&dsa_switch_drivers_mutex);
-}
-EXPORT_SYMBOL_GPL(unregister_switch_driver);
-
-static const struct dsa_switch_ops *
-dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
-		 const char **_name, void **priv)
-{
-	const struct dsa_switch_ops *ret;
-	struct list_head *list;
-	const char *name;
-
-	ret = NULL;
-	name = NULL;
-
-	mutex_lock(&dsa_switch_drivers_mutex);
-	list_for_each(list, &dsa_switch_drivers) {
-		const struct dsa_switch_ops *ops;
-		struct dsa_switch_driver *drv;
-
-		drv = list_entry(list, struct dsa_switch_driver, list);
-		ops = drv->ops;
-
-		name = ops->probe(parent, host_dev, sw_addr, priv);
-		if (name != NULL) {
-			ret = ops;
-			break;
-		}
-	}
-	mutex_unlock(&dsa_switch_drivers_mutex);
-
-	*_name = name;
-
-	return ret;
-}
-
-/* basic switch operations **************************************************/
-static int dsa_cpu_dsa_setups(struct dsa_switch *ds)
-{
-	int ret, port;
-
-	for (port = 0; port < ds->num_ports; port++) {
-		if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
-			continue;
-
-		ret = dsa_port_link_register_of(&ds->ports[port]);
-		if (ret)
-			return ret;
-	}
-	return 0;
-}
-
-static int dsa_switch_setup_one(struct dsa_switch *ds,
-				struct net_device *master)
-{
-	const struct dsa_switch_ops *ops = ds->ops;
-	struct dsa_switch_tree *dst = ds->dst;
-	struct dsa_chip_data *cd = ds->cd;
-	bool valid_name_found = false;
-	int index = ds->index;
-	struct dsa_port *dp;
-	int i, ret;
-
-	/*
-	 * Validate supplied switch configuration.
-	 */
-	for (i = 0; i < ds->num_ports; i++) {
-		char *name;
-
-		dp = &ds->ports[i];
-
-		name = cd->port_names[i];
-		if (name == NULL)
-			continue;
-		dp->name = name;
-
-		if (!strcmp(name, "cpu")) {
-			if (dst->cpu_dp) {
-				netdev_err(master,
-					   "multiple cpu ports?!\n");
-				return -EINVAL;
-			}
-			dst->cpu_dp = &ds->ports[i];
-			dst->cpu_dp->master = master;
-			dp->type = DSA_PORT_TYPE_CPU;
-		} else if (!strcmp(name, "dsa")) {
-			dp->type = DSA_PORT_TYPE_DSA;
-		} else {
-			dp->type = DSA_PORT_TYPE_USER;
-		}
-		valid_name_found = true;
-	}
-
-	if (!valid_name_found && i == ds->num_ports)
-		return -EINVAL;
-
-	/* Make the built-in MII bus mask match the number of ports,
-	 * switch drivers can override this later
-	 */
-	ds->phys_mii_mask |= dsa_user_ports(ds);
-
-	/*
-	 * If the CPU connects to this switch, set the switch tree
-	 * tagging protocol to the preferred tagging format of this
-	 * switch.
-	 */
-	if (dst->cpu_dp->ds == ds) {
-		const struct dsa_device_ops *tag_ops;
-		enum dsa_tag_protocol tag_protocol;
-
-		tag_protocol = ops->get_tag_protocol(ds, dst->cpu_dp->index);
-		tag_ops = dsa_resolve_tag_protocol(tag_protocol);
-		if (IS_ERR(tag_ops))
-			return PTR_ERR(tag_ops);
-
-		dst->cpu_dp->tag_ops = tag_ops;
-
-		/* Few copies for faster access in master receive hot path */
-		dst->cpu_dp->rcv = dst->cpu_dp->tag_ops->rcv;
-		dst->cpu_dp->dst = dst;
-	}
-
-	memcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));
-
-	/*
-	 * Do basic register setup.
-	 */
-	ret = ops->setup(ds);
-	if (ret < 0)
-		return ret;
-
-	ret = dsa_switch_register_notifier(ds);
-	if (ret)
-		return ret;
-
-	if (!ds->slave_mii_bus && ops->phy_read) {
-		ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
-		if (!ds->slave_mii_bus)
-			return -ENOMEM;
-		dsa_slave_mii_bus_init(ds);
-
-		ret = mdiobus_register(ds->slave_mii_bus);
-		if (ret < 0)
-			return ret;
-	}
-
-	/*
-	 * Create network devices for physical switch ports.
-	 */
-	for (i = 0; i < ds->num_ports; i++) {
-		ds->ports[i].dn = cd->port_dn[i];
-		ds->ports[i].cpu_dp = dst->cpu_dp;
-
-		if (!dsa_is_user_port(ds, i))
-			continue;
-
-		ret = dsa_slave_create(&ds->ports[i]);
-		if (ret < 0)
-			netdev_err(master, "[%d]: can't create dsa slave device for port %d(%s): %d\n",
-				   index, i, cd->port_names[i], ret);
-	}
-
-	/* Perform configuration of the CPU and DSA ports */
-	ret = dsa_cpu_dsa_setups(ds);
-	if (ret < 0)
-		netdev_err(master, "[%d] : can't configure CPU and DSA ports\n",
-			   index);
-
-	return 0;
-}
-
-static struct dsa_switch *
-dsa_switch_setup(struct dsa_switch_tree *dst, struct net_device *master,
-		 int index, struct device *parent, struct device *host_dev)
-{
-	struct dsa_chip_data *cd = dst->pd->chip + index;
-	const struct dsa_switch_ops *ops;
-	struct dsa_switch *ds;
-	int ret;
-	const char *name;
-	void *priv;
-
-	/*
-	 * Probe for switch model.
-	 */
-	ops = dsa_switch_probe(parent, host_dev, cd->sw_addr, &name, &priv);
-	if (!ops) {
-		netdev_err(master, "[%d]: could not detect attached switch\n",
-			   index);
-		return ERR_PTR(-EINVAL);
-	}
-	netdev_info(master, "[%d]: detected a %s switch\n",
-		    index, name);
-
-
-	/*
-	 * Allocate and initialise switch state.
-	 */
-	ds = dsa_switch_alloc(parent, DSA_MAX_PORTS);
-	if (!ds)
-		return ERR_PTR(-ENOMEM);
-
-	ds->dst = dst;
-	ds->index = index;
-	ds->cd = cd;
-	ds->ops = ops;
-	ds->priv = priv;
-
-	ret = dsa_switch_setup_one(ds, master);
-	if (ret)
-		return ERR_PTR(ret);
-
-	return ds;
-}
-
-static void dsa_switch_destroy(struct dsa_switch *ds)
-{
-	int port;
-
-	/* Destroy network devices for physical switch ports. */
-	for (port = 0; port < ds->num_ports; port++) {
-		if (!dsa_is_user_port(ds, port))
-			continue;
-
-		if (!ds->ports[port].slave)
-			continue;
-
-		dsa_slave_destroy(ds->ports[port].slave);
-	}
-
-	/* Disable configuration of the CPU and DSA ports */
-	for (port = 0; port < ds->num_ports; port++) {
-		if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
-			continue;
-		dsa_port_link_unregister_of(&ds->ports[port]);
-	}
-
-	if (ds->slave_mii_bus && ds->ops->phy_read)
-		mdiobus_unregister(ds->slave_mii_bus);
-
-	dsa_switch_unregister_notifier(ds);
-}
-
-/* platform driver init and cleanup *****************************************/
-static int dev_is_class(struct device *dev, void *class)
-{
-	if (dev->class != NULL && !strcmp(dev->class->name, class))
-		return 1;
-
-	return 0;
-}
-
-static struct device *dev_find_class(struct device *parent, char *class)
-{
-	if (dev_is_class(parent, class)) {
-		get_device(parent);
-		return parent;
-	}
-
-	return device_find_child(parent, class, dev_is_class);
-}
-
-struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev)
-{
-	struct device *d;
-
-	d = dev_find_class(dev, "mdio_bus");
-	if (d != NULL) {
-		struct mii_bus *bus;
-
-		bus = to_mii_bus(d);
-		put_device(d);
-
-		return bus;
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(dsa_host_dev_to_mii_bus);
-
-#ifdef CONFIG_OF
-static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
-					struct dsa_chip_data *cd,
-					int chip_index, int port_index,
-					struct device_node *link)
-{
-	const __be32 *reg;
-	int link_sw_addr;
-	struct device_node *parent_sw;
-	int len;
-
-	parent_sw = of_get_parent(link);
-	if (!parent_sw)
-		return -EINVAL;
-
-	reg = of_get_property(parent_sw, "reg", &len);
-	if (!reg || (len != sizeof(*reg) * 2))
-		return -EINVAL;
-
-	/*
-	 * Get the destination switch number from the second field of its 'reg'
-	 * property, i.e. for "reg = <0x19 1>" sw_addr is '1'.
-	 */
-	link_sw_addr = be32_to_cpup(reg + 1);
-
-	if (link_sw_addr >= pd->nr_chips)
-		return -EINVAL;
-
-	cd->rtable[link_sw_addr] = port_index;
-
-	return 0;
-}
-
-static int dsa_of_probe_links(struct dsa_platform_data *pd,
-			      struct dsa_chip_data *cd,
-			      int chip_index, int port_index,
-			      struct device_node *port,
-			      const char *port_name)
-{
-	struct device_node *link;
-	int link_index;
-	int ret;
-
-	for (link_index = 0;; link_index++) {
-		link = of_parse_phandle(port, "link", link_index);
-		if (!link)
-			break;
-
-		if (!strcmp(port_name, "dsa") && pd->nr_chips > 1) {
-			ret = dsa_of_setup_routing_table(pd, cd, chip_index,
-							 port_index, link);
-			if (ret)
-				return ret;
-		}
-	}
-	return 0;
-}
-
-static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
-{
-	int i;
-	int port_index;
-
-	for (i = 0; i < pd->nr_chips; i++) {
-		port_index = 0;
-		while (port_index < DSA_MAX_PORTS) {
-			kfree(pd->chip[i].port_names[port_index]);
-			port_index++;
-		}
-
-		/* Drop our reference to the MDIO bus device */
-		put_device(pd->chip[i].host_dev);
-	}
-	kfree(pd->chip);
-}
-
-static int dsa_of_probe(struct device *dev)
-{
-	struct device_node *np = dev->of_node;
-	struct device_node *child, *mdio, *ethernet, *port;
-	struct mii_bus *mdio_bus, *mdio_bus_switch;
-	struct net_device *ethernet_dev;
-	struct dsa_platform_data *pd;
-	struct dsa_chip_data *cd;
-	const char *port_name;
-	int chip_index, port_index;
-	const unsigned int *sw_addr, *port_reg;
-	u32 eeprom_len;
-	int ret;
-
-	mdio = of_parse_phandle(np, "dsa,mii-bus", 0);
-	if (!mdio)
-		return -EINVAL;
-
-	mdio_bus = of_mdio_find_bus(mdio);
-	if (!mdio_bus)
-		return -EPROBE_DEFER;
-
-	ethernet = of_parse_phandle(np, "dsa,ethernet", 0);
-	if (!ethernet) {
-		ret = -EINVAL;
-		goto out_put_mdio;
-	}
-
-	ethernet_dev = of_find_net_device_by_node(ethernet);
-	if (!ethernet_dev) {
-		ret = -EPROBE_DEFER;
-		goto out_put_mdio;
-	}
-
-	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
-	if (!pd) {
-		ret = -ENOMEM;
-		goto out_put_ethernet;
-	}
-
-	dev->platform_data = pd;
-	pd->of_netdev = ethernet_dev;
-	pd->nr_chips = of_get_available_child_count(np);
-	if (pd->nr_chips > DSA_MAX_SWITCHES)
-		pd->nr_chips = DSA_MAX_SWITCHES;
-
-	pd->chip = kcalloc(pd->nr_chips, sizeof(struct dsa_chip_data),
-			   GFP_KERNEL);
-	if (!pd->chip) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-
-	chip_index = -1;
-	for_each_available_child_of_node(np, child) {
-		int i;
-
-		chip_index++;
-		cd = &pd->chip[chip_index];
-
-		cd->of_node = child;
-
-		/* Initialize the routing table */
-		for (i = 0; i < DSA_MAX_SWITCHES; ++i)
-			cd->rtable[i] = DSA_RTABLE_NONE;
-
-		/* When assigning the host device, increment its refcount */
-		cd->host_dev = get_device(&mdio_bus->dev);
-
-		sw_addr = of_get_property(child, "reg", NULL);
-		if (!sw_addr)
-			continue;
-
-		cd->sw_addr = be32_to_cpup(sw_addr);
-		if (cd->sw_addr >= PHY_MAX_ADDR)
-			continue;
-
-		if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))
-			cd->eeprom_len = eeprom_len;
-
-		mdio = of_parse_phandle(child, "mii-bus", 0);
-		if (mdio) {
-			mdio_bus_switch = of_mdio_find_bus(mdio);
-			if (!mdio_bus_switch) {
-				ret = -EPROBE_DEFER;
-				goto out_free_chip;
-			}
-
-			/* Drop the mdio_bus device ref, replacing the host
-			 * device with the mdio_bus_switch device, keeping
-			 * the refcount from of_mdio_find_bus() above.
-			 */
-			put_device(cd->host_dev);
-			cd->host_dev = &mdio_bus_switch->dev;
-		}
-
-		for_each_available_child_of_node(child, port) {
-			port_reg = of_get_property(port, "reg", NULL);
-			if (!port_reg)
-				continue;
-
-			port_index = be32_to_cpup(port_reg);
-			if (port_index >= DSA_MAX_PORTS)
-				break;
-
-			port_name = of_get_property(port, "label", NULL);
-			if (!port_name)
-				continue;
-
-			cd->port_dn[port_index] = port;
-
-			cd->port_names[port_index] = kstrdup(port_name,
-					GFP_KERNEL);
-			if (!cd->port_names[port_index]) {
-				ret = -ENOMEM;
-				goto out_free_chip;
-			}
-
-			ret = dsa_of_probe_links(pd, cd, chip_index,
-						 port_index, port, port_name);
-			if (ret)
-				goto out_free_chip;
-
-		}
-	}
-
-	/* The individual chips hold their own refcount on the mdio bus,
-	 * so drop ours */
-	put_device(&mdio_bus->dev);
-
-	return 0;
-
-out_free_chip:
-	dsa_of_free_platform_data(pd);
-out_free:
-	kfree(pd);
-	dev->platform_data = NULL;
-out_put_ethernet:
-	put_device(&ethernet_dev->dev);
-out_put_mdio:
-	put_device(&mdio_bus->dev);
-	return ret;
-}
-
-static void dsa_of_remove(struct device *dev)
-{
-	struct dsa_platform_data *pd = dev->platform_data;
-
-	if (!dev->of_node)
-		return;
-
-	dsa_of_free_platform_data(pd);
-	put_device(&pd->of_netdev->dev);
-	kfree(pd);
-}
-#else
-static inline int dsa_of_probe(struct device *dev)
-{
-	return 0;
-}
-
-static inline void dsa_of_remove(struct device *dev)
-{
-}
-#endif
-
-static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
-			 struct device *parent, struct dsa_platform_data *pd)
-{
-	int i;
-	unsigned configured = 0;
-
-	dst->pd = pd;
-
-	for (i = 0; i < pd->nr_chips; i++) {
-		struct dsa_switch *ds;
-
-		ds = dsa_switch_setup(dst, dev, i, parent, pd->chip[i].host_dev);
-		if (IS_ERR(ds)) {
-			netdev_err(dev, "[%d]: couldn't create dsa switch instance (error %ld)\n",
-				   i, PTR_ERR(ds));
-			continue;
-		}
-
-		dst->ds[i] = ds;
-
-		++configured;
-	}
-
-	/*
-	 * If no switch was found, exit cleanly
-	 */
-	if (!configured)
-		return -EPROBE_DEFER;
-
-	return dsa_master_setup(dst->cpu_dp->master, dst->cpu_dp);
-}
-
-static int dsa_probe(struct platform_device *pdev)
-{
-	struct dsa_platform_data *pd = pdev->dev.platform_data;
-	struct net_device *dev;
-	struct dsa_switch_tree *dst;
-	int ret;
-
-	if (pdev->dev.of_node) {
-		ret = dsa_of_probe(&pdev->dev);
-		if (ret)
-			return ret;
-
-		pd = pdev->dev.platform_data;
-	}
-
-	if (pd == NULL || (pd->netdev == NULL && pd->of_netdev == NULL))
-		return -EINVAL;
-
-	if (pd->of_netdev) {
-		dev = pd->of_netdev;
-		dev_hold(dev);
-	} else {
-		dev = dsa_dev_to_net_device(pd->netdev);
-	}
-	if (dev == NULL) {
-		ret = -EPROBE_DEFER;
-		goto out;
-	}
-
-	if (dev->dsa_ptr != NULL) {
-		dev_put(dev);
-		ret = -EEXIST;
-		goto out;
-	}
-
-	dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
-	if (dst == NULL) {
-		dev_put(dev);
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	platform_set_drvdata(pdev, dst);
-
-	ret = dsa_setup_dst(dst, dev, &pdev->dev, pd);
-	if (ret) {
-		dev_put(dev);
-		goto out;
-	}
-
-	return 0;
-
-out:
-	dsa_of_remove(&pdev->dev);
-
-	return ret;
-}
-
-static void dsa_remove_dst(struct dsa_switch_tree *dst)
-{
-	int i;
-
-	dsa_master_teardown(dst->cpu_dp->master);
-
-	for (i = 0; i < dst->pd->nr_chips; i++) {
-		struct dsa_switch *ds = dst->ds[i];
-
-		if (ds)
-			dsa_switch_destroy(ds);
-	}
-
-	dev_put(dst->cpu_dp->master);
-}
-
-static int dsa_remove(struct platform_device *pdev)
-{
-	struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
-
-	dsa_remove_dst(dst);
-	dsa_of_remove(&pdev->dev);
-
-	return 0;
-}
-
-static void dsa_shutdown(struct platform_device *pdev)
-{
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int dsa_suspend(struct device *d)
-{
-	struct dsa_switch_tree *dst = dev_get_drvdata(d);
-	int i, ret = 0;
-
-	for (i = 0; i < dst->pd->nr_chips; i++) {
-		struct dsa_switch *ds = dst->ds[i];
-
-		if (ds != NULL)
-			ret = dsa_switch_suspend(ds);
-	}
-
-	return ret;
-}
-
-static int dsa_resume(struct device *d)
-{
-	struct dsa_switch_tree *dst = dev_get_drvdata(d);
-	int i, ret = 0;
-
-	for (i = 0; i < dst->pd->nr_chips; i++) {
-		struct dsa_switch *ds = dst->ds[i];
-
-		if (ds != NULL)
-			ret = dsa_switch_resume(ds);
-	}
-
-	return ret;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(dsa_pm_ops, dsa_suspend, dsa_resume);
-
-static const struct of_device_id dsa_of_match_table[] = {
-	{ .compatible = "marvell,dsa", },
-	{}
-};
-MODULE_DEVICE_TABLE(of, dsa_of_match_table);
-
-static struct platform_driver dsa_driver = {
-	.probe		= dsa_probe,
-	.remove		= dsa_remove,
-	.shutdown	= dsa_shutdown,
-	.driver = {
-		.name	= "dsa",
-		.of_match_table = dsa_of_match_table,
-		.pm	= &dsa_pm_ops,
-	},
-};
-
-int dsa_legacy_register(void)
-{
-	return platform_driver_register(&dsa_driver);
-}
-
-void dsa_legacy_unregister(void)
-{
-	platform_driver_unregister(&dsa_driver);
-}
-- 
2.20.1


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

* [PATCH RFC RFT net-next 09/10] arch: arm: dts: Remove disabled marvell,dsa properties
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (7 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 08/10] net: dsa: Remove legacy probing support Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 10/10] bt-bindings: net: DSA: Remove legacy binding Andrew Lunn
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

These have been disable since the change to probe Marvell Ethernet
switches as MDIO devices. Remove the properties now that the code to
suppport them has also been removed.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/boot/dts/armada-370-rd.dts           | 42 --------------
 arch/arm/boot/dts/armada-388-clearfog.dts     | 58 -------------------
 arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 47 ---------------
 arch/arm/boot/dts/kirkwood-dir665.dts         | 47 ---------------
 arch/arm/boot/dts/kirkwood-linksys-viper.dts  | 47 ---------------
 .../arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts | 47 ---------------
 arch/arm/boot/dts/kirkwood-rd88f6281.dtsi     | 41 -------------
 7 files changed, 329 deletions(-)

diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index 2bfb3108b5b2..c910d157a686 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -114,48 +114,6 @@
 			};
 		};
 	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth1>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <0x10 0>;	/* MDIO address 16, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "lan0";
-			};
-
-			port@1 {
-			       reg = <1>;
-			       label = "lan1";
-			};
-
-			port@2 {
-			       reg = <2>;
-			       label = "lan2";
-			};
-
-			port@3 {
-			       reg = <3>;
-			       label = "lan3";
-			};
-
-			port@5 {
-			      reg = <5>;
-			      label = "cpu";
-			};
-		};
-	 };
 };
 
 &pciec {
diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts
index 89a354b43978..20f8d4667753 100644
--- a/arch/arm/boot/dts/armada-388-clearfog.dts
+++ b/arch/arm/boot/dts/armada-388-clearfog.dts
@@ -30,64 +30,6 @@
 		};
 	};
 
-	dsa@0 {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		dsa,ethernet = <&eth1>;
-		dsa,mii-bus = <&mdio>;
-		pinctrl-0 = <&clearfog_dsa0_clk_pins &clearfog_dsa0_pins>;
-		pinctrl-names = "default";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <4 0>;
-
-			port@0 {
-				reg = <0>;
-				label = "lan5";
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "lan4";
-			};
-
-			port@2 {
-				reg = <2>;
-				label = "lan3";
-			};
-
-			port@3 {
-				reg = <3>;
-				label = "lan2";
-			};
-
-			port@4 {
-				reg = <4>;
-				label = "lan1";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-
-			port@6 {
-				/* 88E1512 external phy */
-				reg = <6>;
-				label = "lan6";
-				fixed-link {
-					speed = <1000>;
-					full-duplex;
-				};
-			};
-		};
-	};
-
 	gpio-keys {
 		compatible = "gpio-keys";
 		pinctrl-0 = <&rear_button_pins>;
diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
index 7a2606c3b62e..8480a16919a0 100644
--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
@@ -210,53 +210,6 @@
 		compatible = "pwm-fan";
 		pwms = <&gpio0 24 4000>;
 	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth0>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <0x0 0>;	/* MDIO address 0, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "lan4";
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "lan3";
-			};
-
-			port@2 {
-				reg = <2>;
-				label = "lan2";
-			};
-
-			port@3 {
-				reg = <3>;
-				label = "lan1";
-			};
-
-			port@4 {
-				reg = <4>;
-				label = "internet";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-		};
-	};
 };
 
 &pciec {
diff --git a/arch/arm/boot/dts/kirkwood-dir665.dts b/arch/arm/boot/dts/kirkwood-dir665.dts
index 31ceacd841de..b3ad3f607d31 100644
--- a/arch/arm/boot/dts/kirkwood-dir665.dts
+++ b/arch/arm/boot/dts/kirkwood-dir665.dts
@@ -190,53 +190,6 @@
 			gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
 		};
 	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth0port>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <0 0>;	/* MDIO address 0, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "lan4";
-			};
-
-			port@1 {
-			       reg = <1>;
-			       label = "lan3";
-			};
-
-			port@2 {
-			       reg = <2>;
-			       label = "lan2";
-			};
-
-			port@3 {
-			       reg = <3>;
-			       label = "lan1";
-			};
-
-			port@4 {
-				reg = <4>;
-				label = "wan";
-			};
-
-			port@6 {
-			       reg = <6>;
-			       label = "cpu";
-			};
-		};
-	};
 };
 
 &mdio {
diff --git a/arch/arm/boot/dts/kirkwood-linksys-viper.dts b/arch/arm/boot/dts/kirkwood-linksys-viper.dts
index a7d659b7145a..2f9660f3b457 100644
--- a/arch/arm/boot/dts/kirkwood-linksys-viper.dts
+++ b/arch/arm/boot/dts/kirkwood-linksys-viper.dts
@@ -66,53 +66,6 @@
 			gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
 		};
 	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth0port>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@16,0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <16 0>;	/* MDIO address 16, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "ethernet1";
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "ethernet2";
-			};
-
-			port@2 {
-				reg = <2>;
-				label = "ethernet3";
-			};
-
-			port@3 {
-				reg = <3>;
-				label = "ethernet4";
-			};
-
-			port@4 {
-				reg = <4>;
-				label = "internet";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-		};
-	};
 };
 
 &pinctrl {
diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
index 86d532916d56..2e1a75348908 100644
--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
+++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
@@ -107,53 +107,6 @@
 			gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
 		};
 	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth0port>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <0 0>;	/* MDIO address 0, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "lan1";
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "lan2";
-			};
-
-			port@2 {
-				reg = <2>;
-				label = "lan3";
-			};
-
-			port@3 {
-				reg = <3>;
-				label = "lan4";
-			};
-
-			port@4 {
-				reg = <4>;
-				label = "wan";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-		};
-	};
 };
 
 &mdio {
diff --git a/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi b/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
index 0f22f0e6f56b..f1f8eee132e8 100644
--- a/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
+++ b/arch/arm/boot/dts/kirkwood-rd88f6281.dtsi
@@ -48,47 +48,6 @@
 			cd-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
 			/* No WP GPIO */
 		};
-	};
-
-	dsa {
-		status = "disabled";
-
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		dsa,ethernet = <&eth0port>;
-		dsa,mii-bus = <&mdio>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			port@0 {
-				reg = <0>;
-				label = "lan1";
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "lan2";
-			};
-
-			port@2 {
-				reg = <2>;
-				label = "lan3";
-			};
-
-			port@3 {
-				reg = <3>;
-				label = "lan4";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-		};
        };
 };
 
-- 
2.20.1


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

* [PATCH RFC RFT net-next 10/10] bt-bindings: net: DSA: Remove legacy binding
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (8 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 09/10] arch: arm: dts: Remove disabled marvell,dsa properties Andrew Lunn
@ 2019-01-30  0:37 ` Andrew Lunn
  2019-01-30  9:27 ` [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Pavel Machek
  2019-02-06 11:31 ` Gregory CLEMENT
  11 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30  0:37 UTC (permalink / raw)
  To: netdev; +Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Now that the code to support the legacy binding has been removed,
remove the documentation for it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 .../devicetree/bindings/net/dsa/dsa.txt       | 155 ------------------
 1 file changed, 155 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index 35694c0c376b..a6759824b061 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -1,12 +1,6 @@
 Distributed Switch Architecture Device Tree Bindings
 ----------------------------------------------------
 
-Two bindings exist, one of which has been deprecated due to
-limitations.
-
-Current Binding
----------------
-
 Switches are true Linux devices and can be probed by any means. Once
 probed, they register to the DSA framework, passing a node
 pointer. This node is expected to fulfil the following binding, and
@@ -257,152 +251,3 @@ linked into one DSA cluster.
 		};
 	};
 };
-
-Deprecated Binding
-------------------
-
-The deprecated binding makes use of a platform device to represent the
-switches. The switches themselves are not Linux devices, and make use
-of an MDIO bus for management.
-
-Required properties:
-- compatible		: Should be "marvell,dsa"
-- #address-cells	: Must be 2, first cell is the address on the MDIO bus
-			  and second cell is the address in the switch tree.
-			  Second cell is used only when cascading/chaining.
-- #size-cells		: Must be 0
-- dsa,ethernet		: Should be a phandle to a valid Ethernet device node
-- dsa,mii-bus		: Should be a phandle to a valid MDIO bus device node
-
-Optional properties:
-- interrupts		: property with a value describing the switch
-			  interrupt number (not supported by the driver)
-
-A DSA node can contain multiple switch chips which are therefore child nodes of
-the parent DSA node. The maximum number of allowed child nodes is 4
-(DSA_MAX_SWITCHES).
-Each of these switch child nodes should have the following required properties:
-
-- reg			: Contains two fields. The first one describes the
-			  address on the MII bus. The second is the switch
-			  number that must be unique in cascaded configurations
-- #address-cells	: Must be 1
-- #size-cells		: Must be 0
-
-A switch child node has the following optional property:
-
-- eeprom-length		: Set to the length of an EEPROM connected to the
-			  switch. Must be set if the switch can not detect
-			  the presence and/or size of a connected EEPROM,
-			  otherwise optional.
-
-A switch may have multiple "port" children nodes
-
-Each port children node must have the following mandatory properties:
-- reg			: Describes the port address in the switch
-- label			: Describes the label associated with this port, special
-			  labels are "cpu" to indicate a CPU port and "dsa" to
-			  indicate an uplink/downlink port.
-
-Note that a port labelled "dsa" will imply checking for the uplink phandle
-described below.
-
-Optional property:
-- link			: Should be a list of phandles to another switch's DSA port.
-			  This property is only used when switches are being
-			  chained/cascaded together. This port is used as outgoing port
-			  towards the phandle port, which can be more than one hop away.
-
-- phy-handle		: Phandle to a PHY on an external MDIO bus, not the
-			  switch internal one. See
-			  Documentation/devicetree/bindings/net/ethernet.txt
-			  for details.
-
-- phy-mode		: String representing the connection to the designated
-			  PHY node specified by the 'phy-handle' property. See
-			  Documentation/devicetree/bindings/net/ethernet.txt
-			  for details.
-
-- mii-bus		: Should be a phandle to a valid MDIO bus device node.
-			  This mii-bus will be used in preference to the
-			  global dsa,mii-bus defined above, for this switch.
-
-Optional subnodes:
-- fixed-link		: Fixed-link subnode describing a link to a non-MDIO
-			  managed entity. See
-			  Documentation/devicetree/bindings/net/fixed-link.txt
-			  for details.
-
-Example:
-
-	dsa@0 {
-		compatible = "marvell,dsa";
-		#address-cells = <2>;
-		#size-cells = <0>;
-
-		interrupts = <10>;
-		dsa,ethernet = <&ethernet0>;
-		dsa,mii-bus = <&mii_bus0>;
-
-		switch@0 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <16 0>;	/* MDIO address 16, switch 0 in tree */
-
-			port@0 {
-				reg = <0>;
-				label = "lan1";
-				phy-handle = <&phy0>;
-			};
-
-			port@1 {
-				reg = <1>;
-				label = "lan2";
-			};
-
-			port@5 {
-				reg = <5>;
-				label = "cpu";
-			};
-
-			switch0port6: port@6 {
-				reg = <6>;
-				label = "dsa";
-				link = <&switch1port0
-				        &switch2port0>;
-			};
-		};
-
-		switch@1 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <17 1>;	/* MDIO address 17, switch 1 in tree */
-			mii-bus = <&mii_bus1>;
-			reset-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
-
-			switch1port0: port@0 {
-				reg = <0>;
-				label = "dsa";
-				link = <&switch0port6>;
-			};
-			switch1port1: port@1 {
-				reg = <1>;
-				label = "dsa";
-				link = <&switch2port1>;
-			};
-		};
-
-		switch@2 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			reg = <18 2>;	/* MDIO address 18, switch 2 in tree */
-			mii-bus = <&mii_bus1>;
-
-			switch2port0: port@0 {
-				reg = <0>;
-				label = "dsa";
-				link = <&switch1port1
-				        &switch0port6>;
-			};
-		};
-	};
-- 
2.20.1


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

* Re: [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro Andrew Lunn
@ 2019-01-30  9:24   ` Pavel Machek
  2019-01-30 15:42     ` Andrew Lunn
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Machek @ 2019-01-30  9:24 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, Vivien Didelot, Florian Fainelli

[-- Attachment #1: Type: text/plain, Size: 5780 bytes --]

On Wed 2019-01-30 01:37:51, Andrew Lunn wrote:
> The REG_WRITE macro contains a return statement, making it not very
> safe. Remove it by inlining the code.

Not bad, but maybe there should be dev_err() or something in case of
reg_write() returns an error?

Because no errors are expected in this case... AFAICT.
								Pavel

> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/net/dsa/mv88e6060.c | 73 +++++++++++++++++++++----------------
>  1 file changed, 41 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index 631358bf3d6b..da88c56e092c 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
> @@ -39,15 +39,6 @@ static int reg_write(struct mv88e6060_priv *priv, int addr, int reg, u16 val)
>  	return mdiobus_write_nested(priv->bus, priv->sw_addr + addr, reg, val);
>  }
>  
> -#define REG_WRITE(addr, reg, val)				\
> -	({							\
> -		int __ret;					\
> -								\
> -		__ret = reg_write(priv, addr, reg, val);		\
> -		if (__ret < 0)					\
> -			return __ret;				\
> -	})
> -
>  static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
>  {
>  	int ret;
> @@ -102,17 +93,21 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
>  	/* Set all ports to the disabled state. */
>  	for (i = 0; i < MV88E6060_PORTS; i++) {
>  		ret = REG_READ(REG_PORT(i), PORT_CONTROL);
> -		REG_WRITE(REG_PORT(i), PORT_CONTROL,
> -			  ret & ~PORT_CONTROL_STATE_MASK);
> +		ret = reg_write(priv, REG_PORT(i), PORT_CONTROL,
> +				ret & ~PORT_CONTROL_STATE_MASK);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	/* Wait for transmit queues to drain. */
>  	usleep_range(2000, 4000);
>  
>  	/* Reset the switch. */
> -	REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
> -		  GLOBAL_ATU_CONTROL_SWRESET |
> -		  GLOBAL_ATU_CONTROL_LEARNDIS);
> +	ret = reg_write(priv, REG_GLOBAL, GLOBAL_ATU_CONTROL,
> +			GLOBAL_ATU_CONTROL_SWRESET |
> +			GLOBAL_ATU_CONTROL_LEARNDIS);
> +	if (ret)
> +		return ret;
>  
>  	/* Wait up to one second for reset to complete. */
>  	timeout = jiffies + 1 * HZ;
> @@ -131,59 +126,67 @@ static int mv88e6060_switch_reset(struct mv88e6060_priv *priv)
>  
>  static int mv88e6060_setup_global(struct mv88e6060_priv *priv)
>  {
> +	int ret;
> +
>  	/* Disable discarding of frames with excessive collisions,
>  	 * set the maximum frame size to 1536 bytes, and mask all
>  	 * interrupt sources.
>  	 */
> -	REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL, GLOBAL_CONTROL_MAX_FRAME_1536);
> +	ret = reg_write(priv, REG_GLOBAL, GLOBAL_CONTROL,
> +			GLOBAL_CONTROL_MAX_FRAME_1536);
> +	if (ret)
> +		return ret;
>  
>  	/* Disable automatic address learning.
>  	 */
> -	REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,
> -		  GLOBAL_ATU_CONTROL_LEARNDIS);
> -
> -	return 0;
> +	return reg_write(priv, REG_GLOBAL, GLOBAL_ATU_CONTROL,
> +			 GLOBAL_ATU_CONTROL_LEARNDIS);
>  }
>  
>  static int mv88e6060_setup_port(struct mv88e6060_priv *priv, int p)
>  {
>  	int addr = REG_PORT(p);
> +	int ret;
>  
>  	/* Do not force flow control, disable Ingress and Egress
>  	 * Header tagging, disable VLAN tunneling, and set the port
>  	 * state to Forwarding.  Additionally, if this is the CPU
>  	 * port, enable Ingress and Egress Trailer tagging mode.
>  	 */
> -	REG_WRITE(addr, PORT_CONTROL,
> -		  dsa_is_cpu_port(priv->ds, p) ?
> +	ret = reg_write(priv, addr, PORT_CONTROL,
> +			dsa_is_cpu_port(priv->ds, p) ?
>  			PORT_CONTROL_TRAILER |
>  			PORT_CONTROL_INGRESS_MODE |
>  			PORT_CONTROL_STATE_FORWARDING :
>  			PORT_CONTROL_STATE_FORWARDING);
> +	if (ret)
> +		return ret;
>  
>  	/* Port based VLAN map: give each port its own address
>  	 * database, allow the CPU port to talk to each of the 'real'
>  	 * ports, and allow each of the 'real' ports to only talk to
>  	 * the CPU port.
>  	 */
> -	REG_WRITE(addr, PORT_VLAN_MAP,
> -		  ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
> -		   (dsa_is_cpu_port(priv->ds, p) ? dsa_user_ports(priv->ds) :
> -		    BIT(dsa_to_port(priv->ds, p)->cpu_dp->index)));
> +	ret = reg_write(priv, addr, PORT_VLAN_MAP,
> +			((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
> +			(dsa_is_cpu_port(priv->ds, p) ?
> +			 dsa_user_ports(priv->ds) :
> +			 BIT(dsa_to_port(priv->ds, p)->cpu_dp->index)));
> +	if (ret)
> +		return ret;
>  
>  	/* Port Association Vector: when learning source addresses
>  	 * of packets, add the address to the address database using
>  	 * a port bitmap that has only the bit for this port set and
>  	 * the other bits clear.
>  	 */
> -	REG_WRITE(addr, PORT_ASSOC_VECTOR, BIT(p));
> -
> -	return 0;
> +	return reg_write(priv, addr, PORT_ASSOC_VECTOR, BIT(p));
>  }
>  
>  static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
>  {
>  	u8 addr[ETH_ALEN];
> +	int ret;
>  	u16 val;
>  
>  	eth_random_addr(addr);
> @@ -195,11 +198,17 @@ static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
>  	 */
>  	val &= 0xfeff;
>  
> -	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, val);
> -	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
> -	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
> +	ret = reg_write(priv, REG_GLOBAL, GLOBAL_MAC_01, val);
> +	if (ret)
> +		return ret;
> +
> +	ret = reg_write(priv, REG_GLOBAL, GLOBAL_MAC_23,
> +			(addr[2] << 8) | addr[3]);
> +	if (ret)
> +		return ret;
>  
> -	return 0;
> +	return reg_write(priv, REG_GLOBAL, GLOBAL_MAC_45,
> +			 (addr[4] << 8) | addr[5]);
>  }
>  
>  static int mv88e6060_setup(struct dsa_switch *ds)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (9 preceding siblings ...)
  2019-01-30  0:37 ` [PATCH RFC RFT net-next 10/10] bt-bindings: net: DSA: Remove legacy binding Andrew Lunn
@ 2019-01-30  9:27 ` Pavel Machek
  2019-02-06 11:31 ` Gregory CLEMENT
  11 siblings, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2019-01-30  9:27 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, Vivien Didelot, Florian Fainelli

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

On Wed 2019-01-30 01:37:48, Andrew Lunn wrote:
> The mv88e6060 is the last device using the legacy method of probing an
> DSA Ethernet switch. This patchset applies some cleanups to the
> driver, and then adds support for probing the device as an MDIO bus
> device. The legacy probe is then removed from the driver, and then
> from DSA as a whole.
> 
> This is compile tested only. Comment and testing welcome.

Series looks good to me. But I have out of tree board 6065, not 6060,
so testing is not too easy.

								Pavel

Acked-by: Pavel Machek <pavel@ucw.cz>

		
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro
  2019-01-30  9:24   ` Pavel Machek
@ 2019-01-30 15:42     ` Andrew Lunn
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-01-30 15:42 UTC (permalink / raw)
  To: Pavel Machek; +Cc: netdev, Vivien Didelot, Florian Fainelli

On Wed, Jan 30, 2019 at 10:24:51AM +0100, Pavel Machek wrote:
> On Wed 2019-01-30 01:37:51, Andrew Lunn wrote:
> > The REG_WRITE macro contains a return statement, making it not very
> > safe. Remove it by inlining the code.
> 
> Not bad, but maybe there should be dev_err() or something in case of
> reg_write() returns an error?

Hi Pavel

An error is always returned to the caller. It should be the caller who
handles error recovery, and if need be prints an error message. The
only time we would print an error message is in a void function, when
we cannot return an error code.

I've also followed what we do in mv88e6xxx. It works fine there, so i
don't see the need to do anything different here.

      Andrew

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

* Re: [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe
  2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
                   ` (10 preceding siblings ...)
  2019-01-30  9:27 ` [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Pavel Machek
@ 2019-02-06 11:31 ` Gregory CLEMENT
  2019-02-06 12:58   ` Andrew Lunn
  11 siblings, 1 reply; 16+ messages in thread
From: Gregory CLEMENT @ 2019-02-06 11:31 UTC (permalink / raw)
  To: Andrew Lunn, netdev
  Cc: Vivien Didelot, Florian Fainelli, Pavel Machek, Andrew Lunn

Hi Andrew,
 
 On mer., janv. 30 2019, Andrew Lunn <andrew@lunn.ch> wrote:

> The mv88e6060 is the last device using the legacy method of probing an
> DSA Ethernet switch. This patchset applies some cleanups to the
> driver, and then adds support for probing the device as an MDIO bus
> device. The legacy probe is then removed from the driver, and then
> from DSA as a whole.
>
> This is compile tested only. Comment and testing welcome.
>
> It should not be merged yet, and one of the patches should go via
> arm-soc.
>
> Andrew Lunn (10):
>   net: dsa: mv88e6xxx: Remove legacy probe support
>   net: dsa: mv88e6060: Replace ds with priv
>   net: dsa: mv88e6060: Replace REG_WRITE macro
>   net: dsa: mv88e6060: Replace REG_READ macro
>   net: dsa: mv88e6060: Support probing as an mdio device
>   net: dsa: mv88e6060: Remove support for legacy probing
>   net: dsa: mv88e6060: Add SPDX header
>   net: dsa: Remove legacy probing support
>   arch: arm: dts: Remove disabled marvell,dsa properties
>   bt-bindings: net: DSA: Remove legacy binding

I saw there was some test already done on this series, but unless I am
wrong it was not applied yet.

Do you plan to send a new iteration soon?

I am asking because this week the dt part can be applied to be merged in
v5.1, whereas next week, it will be doable but as rc6 will be released
there will be less chance to be accepted.

Thanks,

Gregory


>
>  .../devicetree/bindings/net/dsa/dsa.txt       | 155 ----
>  arch/arm/boot/dts/armada-370-rd.dts           |  42 -
>  arch/arm/boot/dts/armada-388-clearfog.dts     |  58 --
>  arch/arm/boot/dts/armada-xp-linksys-mamba.dts |  47 --
>  arch/arm/boot/dts/kirkwood-dir665.dts         |  47 --
>  arch/arm/boot/dts/kirkwood-linksys-viper.dts  |  47 --
>  .../arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts |  47 --
>  arch/arm/boot/dts/kirkwood-rd88f6281.dtsi     |  41 -
>  drivers/net/dsa/Kconfig                       |   2 +-
>  drivers/net/dsa/mv88e6060.c                   | 217 ++---
>  drivers/net/dsa/mv88e6060.h                   |   1 +
>  drivers/net/dsa/mv88e6xxx/chip.c              |  71 +-
>  include/net/dsa.h                             |  23 -
>  net/dsa/Kconfig                               |   9 -
>  net/dsa/Makefile                              |   1 -
>  net/dsa/dsa.c                                 |   5 -
>  net/dsa/dsa_priv.h                            |  12 -
>  net/dsa/legacy.c                              | 745 ------------------
>  18 files changed, 121 insertions(+), 1449 deletions(-)
>
> -- 
> 2.20.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe
  2019-02-06 11:31 ` Gregory CLEMENT
@ 2019-02-06 12:58   ` Andrew Lunn
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2019-02-06 12:58 UTC (permalink / raw)
  To: Gregory CLEMENT; +Cc: netdev, Vivien Didelot, Florian Fainelli, Pavel Machek

> I am asking because this week the dt part can be applied to be merged in
> v5.1, whereas next week, it will be doable but as rc6 will be released
> there will be less chance to be accepted.


Hi Gregory

The DT changes can be applied anyway. They just remove disabled
nodes. I will repost that patch today, without the RFC.

       Andrew

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

end of thread, other threads:[~2019-02-06 12:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30  0:37 [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 01/10] net: dsa: mv88e6xxx: Remove legacy probe support Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 02/10] net: dsa: mv88e6060: Replace ds with priv Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 03/10] net: dsa: mv88e6060: Replace REG_WRITE macro Andrew Lunn
2019-01-30  9:24   ` Pavel Machek
2019-01-30 15:42     ` Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 04/10] net: dsa: mv88e6060: Replace REG_READ macro Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 05/10] net: dsa: mv88e6060: Support probing as an mdio device Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 06/10] net: dsa: mv88e6060: Remove support for legacy probing Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 07/10] net: dsa: mv88e6060: Add SPDX header Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 08/10] net: dsa: Remove legacy probing support Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 09/10] arch: arm: dts: Remove disabled marvell,dsa properties Andrew Lunn
2019-01-30  0:37 ` [PATCH RFC RFT net-next 10/10] bt-bindings: net: DSA: Remove legacy binding Andrew Lunn
2019-01-30  9:27 ` [PATCH RFC RFT net-next 00/10] Modernize mv88e6060 and remove legacy probe Pavel Machek
2019-02-06 11:31 ` Gregory CLEMENT
2019-02-06 12:58   ` Andrew Lunn

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).