net-next: dsa: add QCA8K support
Subsystems (5)
v3 cover net-next: dsa: add QCA8K support
This series is based on the AR8xxx series posted by Matthieu Olivari in may 2015. The following changes were made since then
* fixed the nitpicks from the previous review
* updated to latest API
* turned it into an mdio device
* added callbacks for fdb, bridge offloading, stp, eee, port status
* fixed several minor issues to the port setup and arp learning
* changed the namespacing as this driver to qca8k
The driver has so far only been tested on qca8337/N. It should work on other QCA switches such as the qca8327 with minor changes.
John Crispin (3):
Documentation: devicetree: add qca8k binding
net-next: dsa: add Qualcomm tag RX/TX handler
net-next: dsa: add new driver for qca8xxx family
.../devicetree/bindings/net/dsa/qca8k.txt | 89 ++ drivers/net/dsa/Kconfig | 9 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/qca8k.c | 1060 ++++++++++++++++++++ drivers/net/dsa/qca8k.h | 185 ++++ include/net/dsa.h | 1 + net/dsa/Kconfig | 3 + net/dsa/Makefile | 1 + net/dsa/dsa.c | 3 + net/dsa/dsa_priv.h | 2 + net/dsa/tag_qca.c | 138 +++ 11 files changed, 1492 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txt create mode 100644 drivers/net/dsa/qca8k.c create mode 100644 drivers/net/dsa/qca8k.h create mode 100644 net/dsa/tag_qca.c
Signature · 1 line
1.7.10.4
PATCH v3 1/3 Documentation: devicetree: add qca8k binding
Add device-tree binding for ar8xxx switch families.
---
Changes in V2
* fixup example to include phy nodes and corresponding phandles
* add a note explaining why we need to phy nodes
Changes in V3
* add note stating that the cpu port is always 0
.../devicetree/bindings/net/dsa/qca8k.txt | 89 ++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txt
Documentation/devicetree/bindings/net/dsa/qca8k.txt new file +89 -0
@@ -0,0 +1,89 @@ +* Qualcomm Atheros QCA8xxx switch family + +Required properties: + +- compatible: should be "qca,qca8337" +- #size-cells: must be 0 +- #address-cells: must be 1 + +Subnodes: + +The integrated switch subnode should be specified according to the binding +described in dsa/dsa.txt. As the QCA8K switches do not have a N:N mapping of +port and PHY id, each subnode describing a port needs to have a valid phandle +referencing the internal PHY connected to it. The CPU port of this switch is +always port 0. + +Example: + + + &mdio0 { + phy_port1: phy@0 { + reg = <0>; + }; + + phy_port2: phy@1 { + reg = <1>; + }; + + phy_port3: phy@2 { + reg = <2>; + }; + + phy_port4: phy@3 { + reg = <3>; + }; + + phy_port5: phy@4 { + reg = <4>; + }; + + switch0@0 { + compatible = "qca,qca8337"; + #address-cells = <1>; + #size-cells = <0>; + + reg = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + label = "cpu"; + ethernet = <&gmac1>; + phy-mode = "rgmii"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&phy_port1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-handle = <&phy_port3>; + }; + + port@4 { + reg = <4>; + label = "lan4"; + phy-handle = <&phy_port4>; + }; + + port@5 { + reg = <5>; + label = "wan"; + phy-handle = <&phy_port5>; + }; + }; + }; + };
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V3 1/3] Documentation: devicetree: add qca8k binding
Quoted 4 lines · John Crispin
Add device-tree binding for ar8xxx switch families.
Signed-off-by John Crispin <[email protected]>
Andrew
Re: [PATCH V3 1/3] Documentation: devicetree: add qca8k binding
In reply to John CrispinQuoted 4 lines · John Crispin
Add device-tree binding for ar8xxx switch families.
Signed-off-by John Crispin <[email protected]>
Signature · 5 lines
Florian -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
maintainerRe: [PATCH V3 1/3] Documentation: devicetree: add qca8k binding
In reply to John CrispinQuoted 53 lines · John Crispin
Add device-tree binding for ar8xxx switch families.
Signed-off-by John Crispin <[email protected]>---
Changes in V2
* fixup example to include phy nodes and corresponding phandles
* add a note explaining why we need to phy nodesChanges in V3
* add note stating that the cpu port is always 0.../devicetree/bindings/net/dsa/qca8k.txt | 89 ++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txtDocumentation/devicetree/bindings/net/dsa/qca8k.txt new file +31
-0@@ -0,0 +1,89 @@ +* Qualcomm Atheros QCA8xxx switch family + +Required properties: + +- compatible: should be "qca,qca8337" +- #size-cells: must be 0 +- #address-cells: must be 1 + +Subnodes: + +The integrated switch subnode should be specified according to the binding +described in dsa/dsa.txt. As the QCA8K switches do not have a N:N mapping of +port and PHY id, each subnode describing a port needs to have a valid phandle +referencing the internal PHY connected to it. The CPU port of this switch is +always port 0. + +Example: + + + &mdio0 { + phy_port1: phy@0 { + reg = <0>; + }; + + phy_port2: phy@1 { + reg = <1>; + }; + + phy_port3: phy@2 { + reg = <2>; + };
Documentation/devicetree/bindings/net/dsa/qca8k.txt line 41
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/qca8k.txt new file +10
-0+ + phy_port4: phy@3 { + reg = <3>; + }; + + phy_port5: phy@4 { + reg = <4>; + }; + + switch0@0 {
The unit address here is the mdio device address and should be unique. You have 2 devices at 0.
Documentation/devicetree/bindings/net/dsa/qca8k.txt line 46
Quoted 5 lines
Documentation/devicetree/bindings/net/dsa/qca8k.txt new file +5
-0+ compatible = "qca,qca8337"; + #address-cells = <1>; + #size-cells = <0>; + + reg = <0>;
Not documented.
Quoted 50 lines
Documentation/devicetree/bindings/net/dsa/qca8k.txt new file +43
-0+ + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + label = "cpu"; + ethernet = <&gmac1>; + phy-mode = "rgmii"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&phy_port1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; + phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; + phy-handle = <&phy_port3>; + }; + + port@4 { + reg = <4>; + label = "lan4"; + phy-handle = <&phy_port4>; + }; + + port@5 { + reg = <5>; + label = "wan"; + phy-handle = <&phy_port5>; + }; + }; + }; + };Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/3 net-next: dsa: add Qualcomm tag RX/TX handler
In reply to John CrispinAdd support for the 2-bytes Qualcomm tag that gigabit switches such as the QCA8337/N might insert when receiving packets, or that we need to insert while targeting specific switch ports. The tag is inserted directly behind the ethernet header.
---
Changes in V2
* fix some comments
* remove dead code
* rename variable from phy->reg
include/net/dsa.h | 1 + net/dsa/Kconfig | 3 ++ net/dsa/Makefile | 1 + net/dsa/dsa.c | 3 ++ net/dsa/dsa_priv.h | 2 + net/dsa/tag_qca.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 148 insertions(+) create mode 100644 net/dsa/tag_qca.c
include/net/dsa.h +1 -0
@@ -26,6 +26,7 @@ enum dsa_tag_protocol {DSA_TAG_PROTO_TRAILER ,DSA_TAG_PROTO_EDSA ,DSA_TAG_PROTO_BRCM , +DSA_TAG_PROTO_QCA , DSA_TAG_LAST, /* MUST BE LAST */ };
net/dsa/Kconfig +3 -0
@@ -38,4 +38,7 @@ config NET_DSA_TAG_EDSA config NET_DSA_TAG_TRAILER bool +config NET_DSA_TAG_QCA + bool + endif
net/dsa/Makefile +1 -0
@@ -7,3 +7,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o 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
net/dsa/dsa.c +3 -0
@@ -54,6 +54,9 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = { #ifdef CONFIG_NET_DSA_TAG_BRCM [DSA_TAG_PROTO_BRCM ] = &brcm_netdev_ops, #endif +#ifdef CONFIG_NET_DSA_TAG_QCA + [DSA_TAG_PROTO_QCA] = &qca_netdev_ops, +#endif [DSA_TAG_PROTO_NONE] = &none_ops, };
net/dsa/dsa_priv.h +2 -0
@@ -81,5 +81,7 @@ extern const struct dsa_device_ops trailer_netdev_ops;/* tag_brcm.c */ extern const struct dsa_device_ops brcm_netdev_ops; +/* tag_qca.c */ +extern const struct dsa_device_ops qca_netdev_ops;#endif
net/dsa/tag_qca.c new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v3 3/3 net-next: dsa: add new driver for qca8xxx family
In reply to John CrispinThis patch contains initial support for the QCA8337 switch. It will detect a QCA8337 switch, if present and declared in the DT.
Each port will be represented through a standalone net_device interface, as for other DSA switches. CPU can communicate with any of the ports by setting an IP@ on ethN interface. Most of the extra callbacks of the DSA subsystem are already supported, such as bridge offloading, stp, fdb.
---
Changes in V2
* add proper locking for the FDB table
* remove udelay when changing the page. neither datasheet nore SDK code requires a sleep
* add a cond_resched to the busy wait loop
* use nested locking when accessing the mdio bus
* remove the phy_to_port() wrappers
* remove mmd access function and use existing phy helpers
* fix a copy/paste bug breaking the eee callbacks
* use default vid 1 when fdb entries are added fro vid 0
* remove the phy id check and add a switch id check instead
* add error handling to the mdio read/write functions
* remove inline usage
Changes in V3
* remove qca8k_to_priv() helper
* turn fdb mutex into a generic register mutex
* verify that port0 is the cpu port
* flush MIB counters on startup
* more PHY->port
* implement fdb_prepare properly
* power ports up/down on PM event and shutdown
drivers/net/dsa/Kconfig | 9 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/qca8k.c | 1060 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/qca8k.h | 185 ++++++++ 4 files changed, 1255 insertions(+) create mode 100644 drivers/net/dsa/qca8k.c create mode 100644 drivers/net/dsa/qca8k.h
drivers/net/dsa/Kconfig +9 -0
@@ -25,4 +25,13 @@ source "drivers/net/dsa/b53/Kconfig" source "drivers/net/dsa/mv88e6xxx/Kconfig" +config NET_DSA_QCA8K + tristate "Qualcomm Atheros QCA8K Ethernet switch family support" + depends on NET_DSA + select NET_DSA_TAG_QCA + select REGMAP + ---help--- + This enables support for the Qualcomm Atheros QCA8K Ethernet + switch chips. + endmenu
drivers/net/dsa/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm_sf2.o +obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o obj-y += b53/ obj-y += mv88e6xxx/
drivers/net/dsa/qca8k.c new file +1060 -0
1,060 lines not on this page · raw message
drivers/net/dsa/qca8k.h new file +185 -0
185 lines not on this page · raw message
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: John Crispin <[email protected]>
Date: Thu, 15 Sep 2016 16:26:38 +0200
Quoted 10 lines
This series is based on the AR8xxx series posted by Matthieu Olivari in may 2015. The following changes were made since then
* fixed the nitpicks from the previous review
* updated to latest API
* turned it into an mdio device
* added callbacks for fdb, bridge offloading, stp, eee, port status
* fixed several minor issues to the port setup and arp learning
* changed the namespacing as this driver to qca8k
Quoted 2 lines
The driver has so far only been tested on qca8337/N. It should work on other QCA switches such as the qca8327 with minor changes.
Series applied.