linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] [DSA] adding fields for holding information about upstream-port
@ 2018-12-11 19:33 Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 2/7] [DSA] add helper functions Frank Wunderlich
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 include/net/dsa.h  | 4 ++++
 net/dsa/dsa_priv.h | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 23690c44e167..3efa81e08993 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -203,6 +203,10 @@ struct dsa_port {
 	struct net_device	*bridge_dev;
 	struct devlink_port	devlink_port;
 	struct phylink		*pl;
+
+	struct net_device	*ethernet;
+	int			upstream;
+
 	/*
 	 * Original copy of the master netdev ethtool_ops
 	 */
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 9e4fd04ab53c..cc0cd7675117 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -81,6 +81,8 @@ struct dsa_slave_priv {
 
 	/* TC context */
 	struct list_head	mall_tc_list;
+
+	struct net_device       *master;
 };
 
 /* dsa.c */
@@ -188,7 +190,10 @@ static inline struct net_device *
 dsa_slave_to_master(const struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
+	struct dsa_slave_priv *p = netdev_priv(dev);
 
+	if (p->master)
+		return p->master;
 	return dp->cpu_dp->master;
 }
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/7] [DSA] add helper functions
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 3/7] [DSA] adding handling of second CPU-Port Frank Wunderlich
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 include/net/dsa.h | 18 ++++++++++++++++++
 net/dsa/dsa2.c    | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 3efa81e08993..612942ac56de 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -319,6 +319,12 @@ static inline unsigned int dsa_towards_port(struct dsa_switch *ds, int device,
 		return ds->rtable[device];
 }
 
+
+static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int p)
+{
+	return dsa_is_cpu_port(ds, p) || dsa_is_dsa_port(ds, p);
+}
+
 /* Return the local port used to reach the dedicated CPU port */
 static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
 {
@@ -331,6 +337,18 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
 	return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
 }
 
+static inline u8 dsa_port_upstream_port(struct dsa_switch *ds, int port)
+{
+	/*
+	 * If this port has a specific upstream cpu port, use it,
+	 * otherwise use the switch default.
+	 */
+	if (ds->ports[port].upstream)
+		return ds->ports[port].upstream;
+	else
+		return dsa_upstream_port(ds, port);
+}
+
 typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid,
 			      bool is_static, void *data);
 struct dsa_switch_ops {
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index a1917025e155..77420675e9ed 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -255,6 +255,24 @@ static void dsa_tree_teardown_default_cpu(struct dsa_switch_tree *dst)
 	dst->cpu_dp = NULL;
 }
 
+static int dsa_user_parse(struct dsa_port *port, u32 index,
+			  struct dsa_switch *ds)
+{
+	struct device_node *cpu_port;
+	const unsigned int *cpu_port_reg;
+	int cpu_port_index;
+
+	cpu_port = of_parse_phandle(port->dn, "cpu", 0);
+	if (cpu_port) {
+		cpu_port_reg = of_get_property(cpu_port, "reg", NULL);
+		if (!cpu_port_reg)
+			return -EINVAL;
+		cpu_port_index = be32_to_cpup(cpu_port_reg);
+		ds->ports[index].upstream = cpu_port_index;
+	}
+	return 0;
+}
+
 static int dsa_port_setup(struct dsa_port *dp)
 {
 	struct dsa_switch *ds = dp->ds;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/7] [DSA] adding handling of second CPU-Port
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 2/7] [DSA] add helper functions Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 4/7] [DSA] add support for GMAC2 wired to ext Frank Wunderlich
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 net/dsa/dsa2.c  | 18 ++++++++++++++++++
 net/dsa/slave.c |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 77420675e9ed..4a6ebfe647f0 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -303,6 +303,8 @@ static int dsa_port_setup(struct dsa_port *dp)
 				ds->index, dp->index);
 			return err;
 		}
+		if (dp->master)
+			dp->master->dsa_ptr = dp;
 		break;
 	case DSA_PORT_TYPE_DSA:
 		/* dp->index is used now as port_number. However
@@ -323,12 +325,17 @@ static int dsa_port_setup(struct dsa_port *dp)
 		devlink_port_attrs_set(&dp->devlink_port,
 				       DEVLINK_PORT_FLAVOUR_PHYSICAL,
 				       dp->index, false, 0);
+		err = dsa_user_parse(dp, dp->index, ds);
+		if (err)
+			return err;
+
 		err = dsa_slave_create(dp);
 		if (err)
 			dev_err(ds->dev, "failed to create slave for port %d.%d\n",
 				ds->index, dp->index);
 		else
 			devlink_port_type_eth_set(&dp->devlink_port, dp->slave);
+
 		break;
 	}
 
@@ -344,6 +351,14 @@ static void dsa_port_teardown(struct dsa_port *dp)
 	case DSA_PORT_TYPE_UNUSED:
 		break;
 	case DSA_PORT_TYPE_CPU:
+		dsa_port_link_unregister_of(dp);
+		if (dp->master)
+			dp->master->dsa_ptr = NULL;
+		if (dp->ethernet) {
+			dev_put(dp->ethernet);
+			dp->ethernet = NULL;
+		}
+		break;
 	case DSA_PORT_TYPE_DSA:
 		dsa_port_link_unregister_of(dp);
 		break;
@@ -598,6 +613,9 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master)
 	dp->master = master;
 	dp->dst = dst;
 
+	dev_hold(master);
+	ds->ports[dp->index].ethernet = master;
+
 	return 0;
 }
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 7d0c19e7edcf..f0fdb9e5d05f 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1312,11 +1312,11 @@ static void dsa_slave_notify(struct net_device *dev, unsigned long val)
 int dsa_slave_create(struct dsa_port *port)
 {
 	const struct dsa_port *cpu_dp = port->cpu_dp;
-	struct net_device *master = cpu_dp->master;
 	struct dsa_switch *ds = port->ds;
 	const char *name = port->name;
 	struct net_device *slave_dev;
 	struct dsa_slave_priv *p;
+	struct net_device *master = ds->ports[port->upstream].ethernet;
 	int ret;
 
 	if (!ds->num_tx_queues)
@@ -1355,6 +1355,7 @@ int dsa_slave_create(struct dsa_port *port)
 	p->dp = port;
 	INIT_LIST_HEAD(&p->mall_tc_list);
 	p->xmit = cpu_dp->tag_ops->xmit;
+	p->master = master;
 	port->slave = slave_dev;
 
 	netif_carrier_off(slave_dev);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4/7] [DSA] add support for GMAC2 wired to ext
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 2/7] [DSA] add helper functions Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 3/7] [DSA] adding handling of second CPU-Port Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 5/7] [DSA] dsa multi cpu (mt7530.c) Frank Wunderlich
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0032-net-dsa-mediatek-add-support-for-GMAC2-wired-to-ext-.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/net/dsa/mt7530.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index a5de9bffe5be..a6a15a063e3e 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1277,6 +1277,11 @@ mt7530_setup(struct dsa_switch *ds)
 	val = mt7530_read(priv, MT7530_MHWTRAP);
 	val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
 	val |= MHWTRAP_MANUAL;
+	if (!dsa_is_cpu_port(ds, 5)) {
+		val |= MHWTRAP_P5_DIS;
+		val |= MHWTRAP_P5_MAC_SEL;
+		val |= MHWTRAP_P5_RGMII_MODE;
+	}
 	mt7530_write(priv, MT7530_MHWTRAP, val);
 
 	/* Enable and reset MIB counters */
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 5/7] [DSA] dsa multi cpu (mt7530.c)
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
                   ` (2 preceding siblings ...)
  2018-12-11 19:33 ` [PATCH 4/7] [DSA] add support for GMAC2 wired to ext Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag Frank Wunderlich
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/net/dsa/mt7530.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index a6a15a063e3e..441320d4d779 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -674,6 +674,9 @@ static int
 mt7530_cpu_port_enable(struct mt7530_priv *priv,
 		       int port)
 {
+	u8 port_mask = 0;
+	int i;
+
 	/* Enable Mediatek header mode on the cpu port */
 	mt7530_write(priv, MT7530_PVC_P(port),
 		     PORT_SPEC_TAG);
@@ -690,8 +693,14 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,
 	/* CPU port gets connected to all user ports of
 	 * the switch
 	 */
+
+	for (i = 0; i < MT7530_NUM_PORTS; i++)
+		if ((priv->ds->ports[port].type == DSA_PORT_TYPE_USER) &&
+		    (dsa_port_upstream_port(priv->ds, i) == port))
+			port_mask |= BIT(i);
+
 	mt7530_write(priv, MT7530_PCR_P(port),
-		     PCR_MATRIX(dsa_user_ports(priv->ds)));
+		     PCR_MATRIX(port_mask));
 
 	return 0;
 }
@@ -701,6 +710,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 		   struct phy_device *phy)
 {
 	struct mt7530_priv *priv = ds->priv;
+	u8 upstream = dsa_port_upstream_port(ds, port);
 
 	mutex_lock(&priv->reg_mutex);
 
@@ -711,7 +721,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 	 * restore the port matrix if the port is the member of a certain
 	 * bridge.
 	 */
-	priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT));
+	priv->ports[port].pm |= PCR_MATRIX(BIT(upstream));
 	priv->ports[port].enable = true;
 	mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
 		   priv->ports[port].pm);
@@ -774,7 +784,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
 			struct net_device *bridge)
 {
 	struct mt7530_priv *priv = ds->priv;
-	u32 port_bitmap = BIT(MT7530_CPU_PORT);
+	u8 upstream = dsa_port_upstream_port(ds, port);
+	u32 port_bitmap = BIT(upstream);
 	int i;
 
 	mutex_lock(&priv->reg_mutex);
@@ -875,6 +886,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 			 struct net_device *bridge)
 {
 	struct mt7530_priv *priv = ds->priv;
+	u8 upstream = dsa_port_upstream_port(ds, port);
 	int i;
 
 	mutex_lock(&priv->reg_mutex);
@@ -902,8 +914,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 	 */
 	if (priv->ports[port].enable)
 		mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
-			   PCR_MATRIX(BIT(MT7530_CPU_PORT)));
-	priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT));
+			   PCR_MATRIX(BIT(upstream)));
+	priv->ports[port].pm = PCR_MATRIX(BIT(upstream));
 
 	mt7530_port_set_vlan_unaware(ds, port);
 
@@ -1194,15 +1206,7 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port,
 static enum dsa_tag_protocol
 mtk_get_tag_protocol(struct dsa_switch *ds, int port)
 {
-	struct mt7530_priv *priv = ds->priv;
-
-	if (port != MT7530_CPU_PORT) {
-		dev_warn(priv->dev,
-			 "port not matched with tagging CPU port\n");
-		return DSA_TAG_PROTO_NONE;
-	} else {
-		return DSA_TAG_PROTO_MTK;
-	}
+	return DSA_TAG_PROTO_MTK;
 }
 
 static int
@@ -1275,7 +1279,7 @@ mt7530_setup(struct dsa_switch *ds)
 
 	/* Enable Port 6 only; P5 as GMAC5 which currently is not supported */
 	val = mt7530_read(priv, MT7530_MHWTRAP);
-	val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
+	val &= ~MHWTRAP_P5_DIS & ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
 	val |= MHWTRAP_MANUAL;
 	if (!dsa_is_cpu_port(ds, 5)) {
 		val |= MHWTRAP_P5_DIS;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
                   ` (3 preceding siblings ...)
  2018-12-11 19:33 ` [PATCH 5/7] [DSA] dsa multi cpu (mt7530.c) Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 19:33 ` [PATCH 7/7] [DSA] mt7530 add linking to mdio Frank Wunderlich
  2018-12-11 22:37 ` [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Florian Fainelli
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0044-net-next-dsa-mediatek-tell-GDMA-when-we-are-turning-.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/net/dsa/mt7530.c | 6 ++++++
 drivers/net/dsa/mt7530.h | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 441320d4d779..83669f53cb36 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -681,6 +681,12 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,
 	mt7530_write(priv, MT7530_PVC_P(port),
 		     PORT_SPEC_TAG);
 
+	/* Enable Mediatek header mode on the GMAC that the cpu port
+	 * connects to
+	 */
+	regmap_write_bits(priv->ethernet, MTK_GDMA_FWD_CFG(port),
+			  GDMA_SPEC_TAG, GDMA_SPEC_TAG);
+
 	/* Setup the MAC by default for the cpu port */
 	mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPUP_LINK);
 
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index d9b407a22a58..310f2536175b 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -23,6 +23,10 @@
 
 #define TRGMII_BASE(x)			(0x10000 + (x))
 
+/* Registers for GDMA configuration access */
+#define MTK_GDMA_FWD_CFG(x)		(0x500 + (x * 0x1000))
+#define GDMA_SPEC_TAG			BIT(24)
+
 /* Registers to ethsys access */
 #define ETHSYS_CLKCFG0			0x2c
 #define  ETHSYS_TRGMII_CLK_SEL362_5	BIT(11)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 7/7] [DSA] mt7530 add linking to mdio
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
                   ` (4 preceding siblings ...)
  2018-12-11 19:33 ` [PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag Frank Wunderlich
@ 2018-12-11 19:33 ` Frank Wunderlich
  2018-12-11 22:37 ` [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Florian Fainelli
  6 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-11 19:33 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Frank Wunderlich

based on
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0045-net-dsa-mediatek-turn-into-platform-driver.patch

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/net/dsa/mt7530.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 83669f53cb36..e529bc334459 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1345,7 +1345,7 @@ static int
 mt7530_probe(struct mdio_device *mdiodev)
 {
 	struct mt7530_priv *priv;
-	struct device_node *dn;
+	struct device_node *dn, *mdio;
 
 	dn = mdiodev->dev.of_node;
 
@@ -1392,8 +1392,14 @@ mt7530_probe(struct mdio_device *mdiodev)
 			return PTR_ERR(priv->reset);
 		}
 	}
+	mdio = of_get_parent(dn);
+	if (!mdio)
+		return -EINVAL;
+
+	priv->bus = of_mdio_find_bus(mdio);
+	if (!priv->bus)
+		return -EPROBE_DEFER;
 
-	priv->bus = mdiodev->bus;
 	priv->dev = &mdiodev->dev;
 	priv->ds->priv = priv;
 	priv->ds->ops = &mt7530_switch_ops;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/7] [DSA] adding fields for holding information about upstream-port
  2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
                   ` (5 preceding siblings ...)
  2018-12-11 19:33 ` [PATCH 7/7] [DSA] mt7530 add linking to mdio Frank Wunderlich
@ 2018-12-11 22:37 ` Florian Fainelli
  2018-12-12 15:12   ` Aw: " Frank Wunderlich
  6 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2018-12-11 22:37 UTC (permalink / raw)
  To: Frank Wunderlich, Andrew Lunn, Vivien Didelot, David S. Miller,
	Matthias Brugger, netdev, linux-kernel, linux-arm-kernel,
	linux-mediatek

Hi,,

On 12/11/18 11:33 AM, Frank Wunderlich wrote:
> based on
> https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch

There are several stylistic as well as logistical/technical issues with
this patch series, so please address those before we can start doing the
technical review:

- this is a multi patch series, so a cover letter should be provided
(can be done with git format-patch --cover-letter)

- subject for the patches should be prefixed with net: dsa: <subject>

- commit messages explaining what is being achieved, how and what
problem/feature this is providing is mandatory, you cannot just take
patches from OpenWrt and provide no context what so ever except from the
subject

Please fix that so we can do a meaningful and constructive technical
review of the patches.

Thank you

> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  include/net/dsa.h  | 4 ++++
>  net/dsa/dsa_priv.h | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 23690c44e167..3efa81e08993 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -203,6 +203,10 @@ struct dsa_port {
>  	struct net_device	*bridge_dev;
>  	struct devlink_port	devlink_port;
>  	struct phylink		*pl;
> +
> +	struct net_device	*ethernet;
> +	int			upstream;
> +
>  	/*
>  	 * Original copy of the master netdev ethtool_ops
>  	 */
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 9e4fd04ab53c..cc0cd7675117 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -81,6 +81,8 @@ struct dsa_slave_priv {
>  
>  	/* TC context */
>  	struct list_head	mall_tc_list;
> +
> +	struct net_device       *master;
>  };
>  
>  /* dsa.c */
> @@ -188,7 +190,10 @@ static inline struct net_device *
>  dsa_slave_to_master(const struct net_device *dev)
>  {
>  	struct dsa_port *dp = dsa_slave_to_port(dev);
> +	struct dsa_slave_priv *p = netdev_priv(dev);
>  
> +	if (p->master)
> +		return p->master;
>  	return dp->cpu_dp->master;
>  }
>  
> 


-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Aw: Re: [PATCH 1/7] [DSA] adding fields for holding information about upstream-port
  2018-12-11 22:37 ` [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Florian Fainelli
@ 2018-12-12 15:12   ` Frank Wunderlich
  0 siblings, 0 replies; 9+ messages in thread
From: Frank Wunderlich @ 2018-12-12 15:12 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Andrew Lunn, Vivien Didelot, netdev, linux-kernel,
	linux-mediatek, Matthias Brugger, David S. Miller,
	linux-arm-kernel

Hi Florian,

thank you for first comments. It was my first Patchset i tried to send ia git send-email. i had searched the Patch 0/x-option but had not found it. i will rework this.

- i did only a porting to 4.15+ dsa-core. how do i credit John in this series?
- maybe i need a fallback to current "first cpu-port option", this was not defined by john, but i can add it in next series
- should i include dts (bananapi r2) also in the series?
- i have a additional patch renaming dts-option to default_cpu instead of cpu (hint of Andrew)

regards Frank


> Gesendet: Dienstag, 11. Dezember 2018 um 23:37 Uhr
> Von: "Florian Fainelli" <f.fainelli@gmail.com>
> An: "Frank Wunderlich" <frank-w@public-files.de>, "Andrew Lunn" <andrew@lunn.ch>, "Vivien Didelot" <vivien.didelot@savoirfairelinux.com>, "David S. Miller" <davem@davemloft.net>, "Matthias Brugger" <matthias.bgg@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org
> Betreff: Re: [PATCH 1/7] [DSA] adding fields for holding information about upstream-port
>
> Hi,,
> 
> On 12/11/18 11:33 AM, Frank Wunderlich wrote:
> > based on
> > https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch
> 
> There are several stylistic as well as logistical/technical issues with
> this patch series, so please address those before we can start doing the
> technical review:
> 
> - this is a multi patch series, so a cover letter should be provided
> (can be done with git format-patch --cover-letter)
> 
> - subject for the patches should be prefixed with net: dsa: <subject>
> 
> - commit messages explaining what is being achieved, how and what
> problem/feature this is providing is mandatory, you cannot just take
> patches from OpenWrt and provide no context what so ever except from the
> subject
> 
> Please fix that so we can do a meaningful and constructive technical
> review of the patches.
> 
> Thank you
> 
> > 
> > Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> > ---
> >  include/net/dsa.h  | 4 ++++
> >  net/dsa/dsa_priv.h | 5 +++++
> >  2 files changed, 9 insertions(+)
> > 
> > diff --git a/include/net/dsa.h b/include/net/dsa.h
> > index 23690c44e167..3efa81e08993 100644
> > --- a/include/net/dsa.h
> > +++ b/include/net/dsa.h
> > @@ -203,6 +203,10 @@ struct dsa_port {
> >  	struct net_device	*bridge_dev;
> >  	struct devlink_port	devlink_port;
> >  	struct phylink		*pl;
> > +
> > +	struct net_device	*ethernet;
> > +	int			upstream;
> > +
> >  	/*
> >  	 * Original copy of the master netdev ethtool_ops
> >  	 */
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index 9e4fd04ab53c..cc0cd7675117 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -81,6 +81,8 @@ struct dsa_slave_priv {
> >  
> >  	/* TC context */
> >  	struct list_head	mall_tc_list;
> > +
> > +	struct net_device       *master;
> >  };
> >  
> >  /* dsa.c */
> > @@ -188,7 +190,10 @@ static inline struct net_device *
> >  dsa_slave_to_master(const struct net_device *dev)
> >  {
> >  	struct dsa_port *dp = dsa_slave_to_port(dev);
> > +	struct dsa_slave_priv *p = netdev_priv(dev);
> >  
> > +	if (p->master)
> > +		return p->master;
> >  	return dp->cpu_dp->master;
> >  }
> >  
> > 
> 
> 
> -- 
> Florian
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2018-12-12 15:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 19:33 [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Frank Wunderlich
2018-12-11 19:33 ` [PATCH 2/7] [DSA] add helper functions Frank Wunderlich
2018-12-11 19:33 ` [PATCH 3/7] [DSA] adding handling of second CPU-Port Frank Wunderlich
2018-12-11 19:33 ` [PATCH 4/7] [DSA] add support for GMAC2 wired to ext Frank Wunderlich
2018-12-11 19:33 ` [PATCH 5/7] [DSA] dsa multi cpu (mt7530.c) Frank Wunderlich
2018-12-11 19:33 ` [PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag Frank Wunderlich
2018-12-11 19:33 ` [PATCH 7/7] [DSA] mt7530 add linking to mdio Frank Wunderlich
2018-12-11 22:37 ` [PATCH 1/7] [DSA] adding fields for holding information about upstream-port Florian Fainelli
2018-12-12 15:12   ` Aw: " Frank Wunderlich

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