Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599563 > unrolled thread

[PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support

Started by<sean.wang@mediatek.com>
First post2017-03-13 17:20 +0100
Last post2017-03-14 08:10 +0100
Articles 15 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
    [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
      Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:40 +0100
      Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Florian Fainelli <f.fainelli@gmail.com> - 2017-03-13 17:50 +0100
        Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Sean Wang <sean.wang@mediatek.com> - 2017-03-14 07:20 +0100
      Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-13 18:10 +0100
        Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Sean Wang <sean.wang@mediatek.com> - 2017-03-14 07:30 +0100
          Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-14 14:50 +0100
    [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
      Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able  to recognize the tag for DSA Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:40 +0100
      Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able  to recognize the tag for DSA Florian Fainelli <f.fainelli@gmail.com> - 2017-03-13 17:50 +0100
    Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek  MT7530 switch Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:50 +0100
    Re: [PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support John Crispin <john@phrozen.org> - 2017-03-13 18:00 +0100
    Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek  MT7530 switch Andrew Lunn <andrew@lunn.ch> - 2017-03-14 00:20 +0100
      Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for  Mediatek MT7530 switch Sean Wang <sean.wang@mediatek.com> - 2017-03-14 08:10 +0100

#1599563 — [PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support

From<sean.wang@mediatek.com>
Date2017-03-13 17:20 +0100
Subject[PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support
Message-ID<tkARr-34n-13@gated-at.bofh.it>
From: Sean Wang <sean.wang@mediatek.com>

MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on
Mediatek router platforms such as MT7623A or MT7623N which includes 7-port
Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports,
The port from 0 to 4 are the user ports connecting with the remote devices
while the port 5 and 6 are the CPU ports connecting into Mediatek Ethernet
GMAC.

The patch series integrated Mediatek MT7530 into DSA support which
includes the most of the essential callbacks such as tag insertion for
port distinguishing, port control, bridge offloading, STP setup and
ethtool operations to allow DSA to model each user port into independently
standalone netdevice as the other DSA driver had done.

Sean Wang (4):
  dt-bindings: net: dsa: add mt7530 binding
  net-next: dsa: add Mediatek tag RX/TX handler
  net-next: ethernet: mediatek: add CMD ingress recognize the special
    tag
  net-next: dsa: add dsa support for Mediatek MT7530 switch

 .../devicetree/bindings/net/dsa/mt7530.txt         |   96 ++
 drivers/net/dsa/Kconfig                            |    8 +
 drivers/net/dsa/Makefile                           |    2 +-
 drivers/net/dsa/mt7530.c                           | 1195 ++++++++++++++++++++
 drivers/net/dsa/mt7530.h                           |  387 +++++++
 drivers/net/ethernet/mediatek/mtk_eth_soc.c        |    8 +
 drivers/net/ethernet/mediatek/mtk_eth_soc.h        |    5 +
 include/net/dsa.h                                  |    1 +
 net/dsa/Kconfig                                    |    2 +
 net/dsa/Makefile                                   |    1 +
 net/dsa/dsa.c                                      |    3 +
 net/dsa/dsa_priv.h                                 |    3 +
 net/dsa/tag_mtk.c                                  |  121 ++
 13 files changed, 1831 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/mt7530.txt
 create mode 100644 drivers/net/dsa/mt7530.c
 create mode 100644 drivers/net/dsa/mt7530.h
 create mode 100644 net/dsa/tag_mtk.c

-- 
1.9.1

[toc] | [next] | [standalone]


#1599568 — [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

From<sean.wang@mediatek.com>
Date2017-03-13 17:20 +0100
Subject[PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkARs-34n-21@gated-at.bofh.it>
In reply to#1599563
From: Sean Wang <sean.wang@mediatek.com>

Add the support for the 4-bytes tag for DSA port distinguishing inserted
allowing receiving and transmitting the packet via the particular port.
The tag is being added after the source MAC address in the ethernet
header.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
---
 include/net/dsa.h  |   1 +
 net/dsa/Kconfig    |   2 +
 net/dsa/Makefile   |   1 +
 net/dsa/dsa.c      |   3 ++
 net/dsa/dsa_priv.h |   3 ++
 net/dsa/tag_mtk.c  | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 131 insertions(+)
 create mode 100644 net/dsa/tag_mtk.c

diff --git a/include/net/dsa.h b/include/net/dsa.h
index b122196..954cff2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -27,6 +27,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_EDSA,
 	DSA_TAG_PROTO_BRCM,
 	DSA_TAG_PROTO_QCA,
+	DSA_TAG_PROTO_MTK,
 	DSA_TAG_LAST,		/* MUST BE LAST */
 };
 
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 96e47c5..43b67e8 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -41,4 +41,6 @@ config NET_DSA_TAG_TRAILER
 config NET_DSA_TAG_QCA
 	bool
 
+config NET_DSA_TAG_MTK
+	bool
 endif
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index a3380ed..97c9891 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -8,3 +8,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
 dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
 dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
 dsa_core-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
+dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 7899919..3586b1e 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -57,6 +57,9 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
 #ifdef CONFIG_NET_DSA_TAG_QCA
 	[DSA_TAG_PROTO_QCA] = &qca_netdev_ops,
 #endif
+#ifdef CONFIG_NET_DSA_TAG_MTK
+	[DSA_TAG_PROTO_MTK] = &mtk_dsa_netdev_ops,
+#endif
 	[DSA_TAG_PROTO_NONE] = &none_ops,
 };
 
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 6cfd738..de61e8f 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -84,4 +84,7 @@ int dsa_slave_netdevice_event(struct notifier_block *unused,
 /* tag_qca.c */
 extern const struct dsa_device_ops qca_netdev_ops;
 
+/* tag_mtk.c */
+extern const struct dsa_device_ops mtk_dsa_netdev_ops;
+
 #endif
diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
new file mode 100644
index 0000000..a2dc014
--- /dev/null
+++ b/net/dsa/tag_mtk.c
@@ -0,0 +1,121 @@
+/*
+ * Mediatek DSA Tag support
+ * Copyright (C) 2017 Landen Chao <landen.chao@mediatek.com>
+ *		      Sean Wang <sean.wang@mediatek.com>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/etherdevice.h>
+#include "dsa_priv.h"
+
+#define MTK_HDR_LEN		4
+#define MTK_HDR_RECV_SOURCE_PORT_MASK	GENMASK(2, 0)
+#define MTK_HDR_XMIT_DP_BIT_MASK	GENMASK(5, 0)
+
+static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
+				    struct net_device *dev)
+{
+	struct dsa_slave_priv *p = netdev_priv(dev);
+	u8 *mtk_tag;
+
+	if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
+		goto out_free;
+
+	skb_push(skb, MTK_HDR_LEN);
+
+	memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
+
+	/* Build the tag after the MAC Source Address */
+	mtk_tag = skb->data + 2 * ETH_ALEN;
+
+	/* Set the ingress opcode, traffic class, tag enforcment is
+	 * deprecated
+	 */
+	mtk_tag[0] = 0;
+	mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;
+	mtk_tag[2] = 0;
+	mtk_tag[3] = 0;
+
+	return skb;
+
+out_free:
+	kfree_skb(skb);
+	return NULL;
+}
+
+static int mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
+		       struct packet_type *pt, struct net_device *orig_dev)
+{
+	struct dsa_switch_tree *dst = dev->dsa_ptr;
+	struct dsa_switch *ds;
+	int port;
+	__be16 *phdr, hdr;
+
+	if (unlikely(!dst))
+		goto out_drop;
+
+	skb = skb_unshare(skb, GFP_ATOMIC);
+	if (!skb)
+		goto out;
+
+	if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
+		goto out_drop;
+
+	/* The MTK header is added by the switch between src addr
+	 * and ethertype at this point, skb->data points to 2bytes
+	 * after src addr so header should be 2 bytes right before.
+	 */
+	phdr = (__be16 *)(skb->data - 2);
+	hdr = ntohs(*phdr);
+
+	/* Remove MTK tag and recalculate checksum. */
+	skb_pull_rcsum(skb, MTK_HDR_LEN);
+
+	memmove(skb->data - ETH_HLEN,
+		skb->data - ETH_HLEN - MTK_HDR_LEN,
+		2 * ETH_ALEN);
+
+	/* This protocol doesn't support cascading multiple
+	 * switches so it's safe to assume the switch is first
+	 * in the tree.
+	 */
+	ds = dst->ds[0];
+	if (!ds)
+		goto out_drop;
+
+	/* Get source port information */
+	port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
+	if (!ds->ports[port].netdev)
+		goto out_drop;
+
+	/* Update skb & forward the frame accordingly */
+	skb_push(skb, ETH_HLEN);
+
+	skb->pkt_type = PACKET_HOST;
+	skb->dev = ds->ports[port].netdev;
+	skb->protocol = eth_type_trans(skb, skb->dev);
+
+	skb->dev->stats.rx_packets++;
+	skb->dev->stats.rx_bytes += skb->len;
+
+	netif_receive_skb(skb);
+
+	return 0;
+
+out_drop:
+	kfree_skb(skb);
+out:
+	return 0;
+}
+
+const struct dsa_device_ops mtk_dsa_netdev_ops = {
+	.xmit	= mtk_tag_xmit,
+	.rcv	= mtk_tag_rcv,
+};
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1599578 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromAndrew Lunn <andrew@lunn.ch>
Date2017-03-13 17:40 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkBaO-3bi-33@gated-at.bofh.it>
In reply to#1599568
On Tue, Mar 14, 2017 at 12:11:26AM +0800, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Add the support for the 4-bytes tag for DSA port distinguishing inserted
> allowing receiving and transmitting the packet via the particular port.
> The tag is being added after the source MAC address in the ethernet
> header.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>

O.K, this one is easy. The others are going to take some work to
review.

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

    Andrew

[toc] | [prev] | [next] | [standalone]


#1599600 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-03-13 17:50 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkBku-3fs-33@gated-at.bofh.it>
In reply to#1599568
On 03/13/2017 09:11 AM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Add the support for the 4-bytes tag for DSA port distinguishing inserted
> allowing receiving and transmitting the packet via the particular port.
> The tag is being added after the source MAC address in the ethernet
> header.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
> ---
>  include/net/dsa.h  |   1 +
>  net/dsa/Kconfig    |   2 +
>  net/dsa/Makefile   |   1 +
>  net/dsa/dsa.c      |   3 ++
>  net/dsa/dsa_priv.h |   3 ++
>  net/dsa/tag_mtk.c  | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 131 insertions(+)
>  create mode 100644 net/dsa/tag_mtk.c
> 
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index b122196..954cff2 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -27,6 +27,7 @@ enum dsa_tag_protocol {
>  	DSA_TAG_PROTO_EDSA,
>  	DSA_TAG_PROTO_BRCM,
>  	DSA_TAG_PROTO_QCA,
> +	DSA_TAG_PROTO_MTK,
>  	DSA_TAG_LAST,		/* MUST BE LAST */
>  };
>  
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 96e47c5..43b67e8 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -41,4 +41,6 @@ config NET_DSA_TAG_TRAILER
>  config NET_DSA_TAG_QCA
>  	bool
>  
> +config NET_DSA_TAG_MTK
> +	bool
>  endif
> diff --git a/net/dsa/Makefile b/net/dsa/Makefile
> index a3380ed..97c9891 100644
> --- a/net/dsa/Makefile
> +++ b/net/dsa/Makefile
> @@ -8,3 +8,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
>  dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
>  dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
>  dsa_core-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
> +dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 7899919..3586b1e 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -57,6 +57,9 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
>  #ifdef CONFIG_NET_DSA_TAG_QCA
>  	[DSA_TAG_PROTO_QCA] = &qca_netdev_ops,
>  #endif
> +#ifdef CONFIG_NET_DSA_TAG_MTK
> +	[DSA_TAG_PROTO_MTK] = &mtk_dsa_netdev_ops,
> +#endif
>  	[DSA_TAG_PROTO_NONE] = &none_ops,
>  };
>  
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index 6cfd738..de61e8f 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -84,4 +84,7 @@ int dsa_slave_netdevice_event(struct notifier_block *unused,
>  /* tag_qca.c */
>  extern const struct dsa_device_ops qca_netdev_ops;
>  
> +/* tag_mtk.c */
> +extern const struct dsa_device_ops mtk_dsa_netdev_ops;
> +
>  #endif
> diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
> new file mode 100644
> index 0000000..a2dc014
> --- /dev/null
> +++ b/net/dsa/tag_mtk.c
> @@ -0,0 +1,121 @@
> +/*
> + * Mediatek DSA Tag support
> + * Copyright (C) 2017 Landen Chao <landen.chao@mediatek.com>
> + *		      Sean Wang <sean.wang@mediatek.com>
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/etherdevice.h>
> +#include "dsa_priv.h"
> +
> +#define MTK_HDR_LEN		4
> +#define MTK_HDR_RECV_SOURCE_PORT_MASK	GENMASK(2, 0)
> +#define MTK_HDR_XMIT_DP_BIT_MASK	GENMASK(5, 0)
> +
> +static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
> +				    struct net_device *dev)
> +{
> +	struct dsa_slave_priv *p = netdev_priv(dev);
> +	u8 *mtk_tag;
> +
> +	if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
> +		goto out_free;
> +
> +	skb_push(skb, MTK_HDR_LEN);
> +
> +	memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
> +
> +	/* Build the tag after the MAC Source Address */
> +	mtk_tag = skb->data + 2 * ETH_ALEN;
> +
> +	/* Set the ingress opcode, traffic class, tag enforcment is
> +	 * deprecated
> +	 */

Sounds like this comment came from tag_brcm.c does it really apply here
as well?

Other than that:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

[toc] | [prev] | [next] | [standalone]


#1600049 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromSean Wang <sean.wang@mediatek.com>
Date2017-03-14 07:20 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkNYl-4rU-7@gated-at.bofh.it>
In reply to#1599600
On Mon, 2017-03-13 at 09:35 -0700, Florian Fainelli wrote:
> On 03/13/2017 09:11 AM, sean.wang@mediatek.com wrote:
> > From: Sean Wang <sean.wang@mediatek.com>
> > 
> > Add the support for the 4-bytes tag for DSA port distinguishing inserted
> > allowing receiving and transmitting the packet via the particular port.
> > The tag is being added after the source MAC address in the ethernet
> > header.
> > 
> > Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> > Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
> > ---
> >  include/net/dsa.h  |   1 +
> >  net/dsa/Kconfig    |   2 +
> >  net/dsa/Makefile   |   1 +
> >  net/dsa/dsa.c      |   3 ++
> >  net/dsa/dsa_priv.h |   3 ++
> >  net/dsa/tag_mtk.c  | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  6 files changed, 131 insertions(+)
> >  create mode 100644 net/dsa/tag_mtk.c
> > 
> > diff --git a/include/net/dsa.h b/include/net/dsa.h
> > index b122196..954cff2 100644
> > --- a/include/net/dsa.h
> > +++ b/include/net/dsa.h
> > @@ -27,6 +27,7 @@ enum dsa_tag_protocol {
> >  	DSA_TAG_PROTO_EDSA,
> >  	DSA_TAG_PROTO_BRCM,
> >  	DSA_TAG_PROTO_QCA,
> > +	DSA_TAG_PROTO_MTK,
> >  	DSA_TAG_LAST,		/* MUST BE LAST */
> >  };
> >  
> > diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> > index 96e47c5..43b67e8 100644
> > --- a/net/dsa/Kconfig
> > +++ b/net/dsa/Kconfig
> > @@ -41,4 +41,6 @@ config NET_DSA_TAG_TRAILER
> >  config NET_DSA_TAG_QCA
> >  	bool
> >  
> > +config NET_DSA_TAG_MTK
> > +	bool
> >  endif
> > diff --git a/net/dsa/Makefile b/net/dsa/Makefile
> > index a3380ed..97c9891 100644
> > --- a/net/dsa/Makefile
> > +++ b/net/dsa/Makefile
> > @@ -8,3 +8,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
> >  dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
> >  dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
> >  dsa_core-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
> > +dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
> > diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> > index 7899919..3586b1e 100644
> > --- a/net/dsa/dsa.c
> > +++ b/net/dsa/dsa.c
> > @@ -57,6 +57,9 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
> >  #ifdef CONFIG_NET_DSA_TAG_QCA
> >  	[DSA_TAG_PROTO_QCA] = &qca_netdev_ops,
> >  #endif
> > +#ifdef CONFIG_NET_DSA_TAG_MTK
> > +	[DSA_TAG_PROTO_MTK] = &mtk_dsa_netdev_ops,
> > +#endif
> >  	[DSA_TAG_PROTO_NONE] = &none_ops,
> >  };
> >  
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index 6cfd738..de61e8f 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -84,4 +84,7 @@ int dsa_slave_netdevice_event(struct notifier_block *unused,
> >  /* tag_qca.c */
> >  extern const struct dsa_device_ops qca_netdev_ops;
> >  
> > +/* tag_mtk.c */
> > +extern const struct dsa_device_ops mtk_dsa_netdev_ops;
> > +
> >  #endif
> > diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
> > new file mode 100644
> > index 0000000..a2dc014
> > --- /dev/null
> > +++ b/net/dsa/tag_mtk.c
> > @@ -0,0 +1,121 @@
> > +/*
> > + * Mediatek DSA Tag support
> > + * Copyright (C) 2017 Landen Chao <landen.chao@mediatek.com>
> > + *		      Sean Wang <sean.wang@mediatek.com>
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 and
> > + * only version 2 as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + */
> > +
> > +#include <linux/etherdevice.h>
> > +#include "dsa_priv.h"
> > +
> > +#define MTK_HDR_LEN		4
> > +#define MTK_HDR_RECV_SOURCE_PORT_MASK	GENMASK(2, 0)
> > +#define MTK_HDR_XMIT_DP_BIT_MASK	GENMASK(5, 0)
> > +
> > +static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
> > +				    struct net_device *dev)
> > +{
> > +	struct dsa_slave_priv *p = netdev_priv(dev);
> > +	u8 *mtk_tag;
> > +
> > +	if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
> > +		goto out_free;
> > +
> > +	skb_push(skb, MTK_HDR_LEN);
> > +
> > +	memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
> > +
> > +	/* Build the tag after the MAC Source Address */
> > +	mtk_tag = skb->data + 2 * ETH_ALEN;
> > +
> > +	/* Set the ingress opcode, traffic class, tag enforcment is
> > +	 * deprecated
> > +	 */
> 
> Sounds like this comment came from tag_brcm.c does it really apply here
> as well?
> 
> Other than that:


It seem a copy-paste error accidentally , i will fix up them in the next
version.  The tag only carried port information only , not complicated
as tag_brcm.c is done.


> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

[toc] | [prev] | [next] | [standalone]


#1599637 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-03-13 18:10 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkBDR-3Ed-21@gated-at.bofh.it>
In reply to#1599568
Hi Sean,

sean.wang@mediatek.com writes:

> +	mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;

This won't apply, the port index in now stored in p->dp->index.

Thanks,

        Vivien

[toc] | [prev] | [next] | [standalone]


#1600051 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromSean Wang <sean.wang@mediatek.com>
Date2017-03-14 07:30 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkO82-4vc-13@gated-at.bofh.it>
In reply to#1599637
On Mon, 2017-03-13 at 12:59 -0400, Vivien Didelot wrote:
> Hi Sean,
> 
> sean.wang@mediatek.com writes:
> 
> > +	mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;
> 
> This won't apply, the port index in now stored in p->dp->index.
> 
> Thanks,
> 
>         Vivien


Hi Vivien,

It seems that I need to upgrade to newer kernel to verify this

thanks for your review , I'll fix this in the next one.

	Sean

[toc] | [prev] | [next] | [standalone]


#1600407 — Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-03-14 14:50 +0100
SubjectRe: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler
Message-ID<tkUZP-Q3-3@gated-at.bofh.it>
In reply to#1600051
Hi Sean,

Sean Wang <sean.wang@mediatek.com> writes:

>> This won't apply, the port index in now stored in p->dp->index.
>
> It seems that I need to upgrade to newer kernel to verify this

Correct. In fact every time you send patches to net-next (or any other
subsystem branch), you must rebase your patch series onto the latest
version of that tree, in order to avoid eventuel conflicts.

Thanks,

        Vivien

[toc] | [prev] | [next] | [standalone]


#1599573 — [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

From<sean.wang@mediatek.com>
Date2017-03-13 17:20 +0100
Subject[PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA
Message-ID<tkARs-34n-39@gated-at.bofh.it>
In reply to#1599563
From: Sean Wang <sean.wang@mediatek.com>

Allowing CDM can recognize these packets with carrying port-distinguishing
tag when CONFIG_NET_DSA_TAG_MTK is enabled. Otherwise, these packets will
be dropped by CDM ingress.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 3dd8788..19944e0 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1848,6 +1848,14 @@ static int mtk_hw_init(struct mtk_eth *eth)
 	/* GE2, Force 1000M/FD, FC ON */
 	mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1));
 
+#if defined(CONFIG_NET_DSA_TAG_MTK)
+	/* Tell CDMQ to parse the MTK special tag from CPU  */
+	/* QDMA Tx Use CDMQ */
+	u32 val2 = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
+
+	mtk_w32(eth, val2 | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
+#endif
+
 	/* Enable RX VLan Offloading */
 	mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
 
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 99b1c8e..79606db 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -70,11 +70,16 @@
 /* Frame Engine Interrupt Grouping Register */
 #define MTK_FE_INT_GRP		0x20
 
+/* CDMP Ingress Control Register */
+#define MTK_CDMQ_IG_CTRL	0x1400
+#define MTK_CDMQ_STAG_EN	BIT(0)
+
 /* CDMP Exgress Control Register */
 #define MTK_CDMP_EG_CTRL	0x404
 
 /* GDM Exgress Control Register */
 #define MTK_GDMA_FWD_CFG(x)	(0x500 + (x * 0x1000))
+#define MTK_GDMA_STAG_EN	BIT(24)
 #define MTK_GDMA_ICS_EN		BIT(22)
 #define MTK_GDMA_TCS_EN		BIT(21)
 #define MTK_GDMA_UCS_EN		BIT(20)
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1599577 — Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

FromAndrew Lunn <andrew@lunn.ch>
Date2017-03-13 17:40 +0100
SubjectRe: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA
Message-ID<tkBaN-3bi-9@gated-at.bofh.it>
In reply to#1599573
On Tue, Mar 14, 2017 at 12:11:27AM +0800, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Allowing CDM can recognize these packets with carrying port-distinguishing
> tag when CONFIG_NET_DSA_TAG_MTK is enabled. Otherwise, these packets will
> be dropped by CDM ingress.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
> ---
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
>  drivers/net/ethernet/mediatek/mtk_eth_soc.h | 5 +++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 3dd8788..19944e0 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -1848,6 +1848,14 @@ static int mtk_hw_init(struct mtk_eth *eth)
>  	/* GE2, Force 1000M/FD, FC ON */
>  	mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1));
>  
> +#if defined(CONFIG_NET_DSA_TAG_MTK)
> +	/* Tell CDMQ to parse the MTK special tag from CPU  */
> +	/* QDMA Tx Use CDMQ */
> +	u32 val2 = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
> +
> +	mtk_w32(eth, val2 | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
> +#endif

Hi Sean

Does this need to be conditional on CONFIG_NET_DSA_TAG_MTK? 
Is there any downside on always having MTK_CDMQ_STAG_EN set?

Thanks
   Andrew

[toc] | [prev] | [next] | [standalone]


#1599592 — Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-03-13 17:50 +0100
SubjectRe: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA
Message-ID<tkBkt-3fs-13@gated-at.bofh.it>
In reply to#1599573
On 03/13/2017 09:11 AM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Allowing CDM can recognize these packets with carrying port-distinguishing
> tag when CONFIG_NET_DSA_TAG_MTK is enabled. Otherwise, these packets will
> be dropped by CDM ingress.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
> ---
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
>  drivers/net/ethernet/mediatek/mtk_eth_soc.h | 5 +++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 3dd8788..19944e0 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -1848,6 +1848,14 @@ static int mtk_hw_init(struct mtk_eth *eth)
>  	/* GE2, Force 1000M/FD, FC ON */
>  	mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1));
>  
> +#if defined(CONFIG_NET_DSA_TAG_MTK)
> +	/* Tell CDMQ to parse the MTK special tag from CPU  */
> +	/* QDMA Tx Use CDMQ */
> +	u32 val2 = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
> +
> +	mtk_w32(eth, val2 | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
> +#endif
> +

Depending on how early you call this function, can you use
netdev_uses_dsa() instead of this? You may want to consider using #if
IS_ENABLED() to cover the modular case as well.

>  	/* Enable RX VLan Offloading */
>  	mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
>  
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> index 99b1c8e..79606db 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
> @@ -70,11 +70,16 @@
>  /* Frame Engine Interrupt Grouping Register */
>  #define MTK_FE_INT_GRP		0x20
>  
> +/* CDMP Ingress Control Register */
> +#define MTK_CDMQ_IG_CTRL	0x1400
> +#define MTK_CDMQ_STAG_EN	BIT(0)
> +
>  /* CDMP Exgress Control Register */
>  #define MTK_CDMP_EG_CTRL	0x404
>  
>  /* GDM Exgress Control Register */
>  #define MTK_GDMA_FWD_CFG(x)	(0x500 + (x * 0x1000))
> +#define MTK_GDMA_STAG_EN	BIT(24)
>  #define MTK_GDMA_ICS_EN		BIT(22)
>  #define MTK_GDMA_TCS_EN		BIT(21)
>  #define MTK_GDMA_UCS_EN		BIT(20)
> 


-- 
Florian

[toc] | [prev] | [next] | [standalone]


#1599597 — Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch

FromAndrew Lunn <andrew@lunn.ch>
Date2017-03-13 17:50 +0100
SubjectRe: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch
Message-ID<tkBku-3fs-25@gated-at.bofh.it>
In reply to#1599563
Hi Sean

Just looking at the GPIO handling at the moment.

> +	/* Reset whole chip through gpio pin or
> +	 * memory-mapped registers for different
> +	 * type of hardware
> +	 */
> +	if (priv->mcm) {
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, RESET_MCM);
> +		usleep_range(1000, 1100);
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, ~RESET_MCM);
> +	} else {
> +		gpio_direction_output(priv->reset, 0);
> +		usleep_range(1000, 1100);
> +		gpio_set_value(priv->reset, 1);
> +	}

....

> +	/* Not MCM that indicates switch works as the remote standalone
> +	 * integrated circuit so the GPIO pin would be used to complete
> +	 * the reset, otherwise memory-mapped register accessing used
> +	 * through syscon provides in the case of MCM.
> +	 */
> +	if (!priv->mcm) {
> +		priv->reset = of_get_named_gpio(dn, "mediatek,reset-pin", 0);
> +		if (!gpio_is_valid(priv->reset))
> +			return priv->reset;
> +
> +		ret = devm_gpio_request_one(&mdiodev->dev,
> +					    priv->reset, GPIOF_OUT_INIT_LOW,
> +					    "mediatek,reset-pin");
> +		if (ret < 0) {
> +			dev_err(&mdiodev->dev,
> +				"fail to devm_gpio_request reset\n");
> +			return ret;
> +		}
> +	}

You are not handling the flags part of the GPIO binding. It is better
to use devm_gpiod_ API calls, which will handle the active low flags
for you.

    Andrew

[toc] | [prev] | [next] | [standalone]


#1599615

FromJohn Crispin <john@phrozen.org>
Date2017-03-13 18:00 +0100
Message-ID<tkBua-3kO-19@gated-at.bofh.it>
In reply to#1599563

On 13/03/17 17:11, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on
> Mediatek router platforms such as MT7623A or MT7623N which includes 7-port
> Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports,
> The port from 0 to 4 are the user ports connecting with the remote devices
> while the port 5 and 6 are the CPU ports connecting into Mediatek Ethernet
> GMAC.
>
> The patch series integrated Mediatek MT7530 into DSA support which
> includes the most of the essential callbacks such as tag insertion for
> port distinguishing, port control, bridge offloading, STP setup and
> ethtool operations to allow DSA to model each user port into independently
> standalone netdevice as the other DSA driver had done.
Hi Sean,

very cool, i'll give this a spin this week and if it works out will 
import it into LEDE to get test coverage from our users.

     John

> Sean Wang (4):
>    dt-bindings: net: dsa: add mt7530 binding
>    net-next: dsa: add Mediatek tag RX/TX handler
>    net-next: ethernet: mediatek: add CMD ingress recognize the special
>      tag
>    net-next: dsa: add dsa support for Mediatek MT7530 switch
>
>   .../devicetree/bindings/net/dsa/mt7530.txt         |   96 ++
>   drivers/net/dsa/Kconfig                            |    8 +
>   drivers/net/dsa/Makefile                           |    2 +-
>   drivers/net/dsa/mt7530.c                           | 1195 ++++++++++++++++++++
>   drivers/net/dsa/mt7530.h                           |  387 +++++++
>   drivers/net/ethernet/mediatek/mtk_eth_soc.c        |    8 +
>   drivers/net/ethernet/mediatek/mtk_eth_soc.h        |    5 +
>   include/net/dsa.h                                  |    1 +
>   net/dsa/Kconfig                                    |    2 +
>   net/dsa/Makefile                                   |    1 +
>   net/dsa/dsa.c                                      |    3 +
>   net/dsa/dsa_priv.h                                 |    3 +
>   net/dsa/tag_mtk.c                                  |  121 ++
>   13 files changed, 1831 insertions(+), 1 deletion(-)
>   create mode 100644 Documentation/devicetree/bindings/net/dsa/mt7530.txt
>   create mode 100644 drivers/net/dsa/mt7530.c
>   create mode 100644 drivers/net/dsa/mt7530.h
>   create mode 100644 net/dsa/tag_mtk.c
>

[toc] | [prev] | [next] | [standalone]


#1599914 — Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch

FromAndrew Lunn <andrew@lunn.ch>
Date2017-03-14 00:20 +0100
SubjectRe: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch
Message-ID<tkHpT-85V-7@gated-at.bofh.it>
In reply to#1599563
> +static int
> +mt7530_setup(struct dsa_switch *ds)
> +{
> +	struct mt7530_priv *priv = ds->priv;
> +	int ret, i, phy_mode;
> +	u8  cpup_mask = 0;
> +	u32 id, val;
> +	struct regmap *regmap;
> +
> +	/* Make sure that cpu port specfied on the dt is appropriate */
> +	if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {
> +		dev_err(priv->dev, "port not matched with the CPU port\n");
> +		return -EINVAL;
> +	}
> +
> +	regmap = devm_regmap_init(ds->dev, NULL, priv,
> +				  &mt7530_regmap_config);
> +	if (IS_ERR(regmap))
> +		dev_warn(priv->dev, "phy regmap initialization failed");
> +
> +	phy_mode = of_get_phy_mode(ds->ports[ds->dst->cpu_port].dn);
> +	if (phy_mode < 0) {
> +		dev_err(priv->dev, "Can't find phy-mode for master device\n");
> +		return phy_mode;
> +	}
> +	dev_info(priv->dev, "phy-mode for master device = %x\n", phy_mode);

Hi Sean

It is not documented in the binding that a phy-mode is mandatory for
the cpu port.

    Andrew

[toc] | [prev] | [next] | [standalone]


#1600062 — Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch

FromSean Wang <sean.wang@mediatek.com>
Date2017-03-14 08:10 +0100
SubjectRe: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch
Message-ID<tkOKK-4Zd-17@gated-at.bofh.it>
In reply to#1599914
On Tue, 2017-03-14 at 00:11 +0100, Andrew Lunn wrote:
> > +static int
> > +mt7530_setup(struct dsa_switch *ds)
> > +{
> > +	struct mt7530_priv *priv = ds->priv;
> > +	int ret, i, phy_mode;
> > +	u8  cpup_mask = 0;
> > +	u32 id, val;
> > +	struct regmap *regmap;
> > +
> > +	/* Make sure that cpu port specfied on the dt is appropriate */
> > +	if (!dsa_is_cpu_port(ds, MT7530_CPU_PORT)) {
> > +		dev_err(priv->dev, "port not matched with the CPU port\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	regmap = devm_regmap_init(ds->dev, NULL, priv,
> > +				  &mt7530_regmap_config);
> > +	if (IS_ERR(regmap))
> > +		dev_warn(priv->dev, "phy regmap initialization failed");
> > +
> > +	phy_mode = of_get_phy_mode(ds->ports[ds->dst->cpu_port].dn);
> > +	if (phy_mode < 0) {
> > +		dev_err(priv->dev, "Can't find phy-mode for master device\n");
> > +		return phy_mode;
> > +	}
> > +	dev_info(priv->dev, "phy-mode for master device = %x\n", phy_mode);
> 
> Hi Sean
> 
> It is not documented in the binding that a phy-mode is mandatory for
> the cpu port.
> 
>     Andrew

Hi Andrew,

thanks for your reviewing. I'll also add the missing part into the next
one. 
	Sean

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web