Skip to contentSkip to conversation

Brcm ASP 2.0 Ethernet Controller

PATCH Superseded Justin Chen 5 participants 19 messages May 23, 2023 – May 24, 2023

Subsystems (7)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Justin Chen

author maintainer
#0 lore raw

v4 cover Brcm ASP 2.0 Ethernet Controller

Add support for the Broadcom ASP 2.0 Ethernet controller which is first introduced with 72165.

Add support for 74165 10/100 integrated Ethernet PHY which also uses the ASP 2.0 Ethernet controller.

Florian Fainelli (2):
dt-bindings: net: Brcm ASP 2.0 Ethernet controller
net: phy: bcm7xxx: Add EPHY entry for 74165

Justin Chen (4):
dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
net: bcmasp: Add support for ASP2.0 Ethernet controller
net: phy: mdio-bcm-unimac: Add asp v2.0 support
MAINTAINERS: ASP 2.0 Ethernet driver maintainers

 .../devicetree/bindings/net/brcm,asp-v2.0.yaml     |  145 ++
 .../devicetree/bindings/net/brcm,unimac-mdio.yaml  |    2 +
 MAINTAINERS                                        |    9 +
 drivers/net/ethernet/broadcom/Kconfig              |   11 +
 drivers/net/ethernet/broadcom/Makefile             |    1 +
 drivers/net/ethernet/broadcom/asp2/Makefile        |    2 +
 drivers/net/ethernet/broadcom/asp2/bcmasp.c        | 1462 ++++++++++++++++++++
 drivers/net/ethernet/broadcom/asp2/bcmasp.h        |  637 +++++++++
 .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c    |  568 ++++++++
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c   | 1425 +++++++++++++++++++
 .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h  |  238 ++++
 drivers/net/mdio/mdio-bcm-unimac.c                 |    2 +
 drivers/net/phy/bcm7xxx.c                          |    1 +
 include/linux/brcmphy.h                            |    1 +
 14 files changed, 4504 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
 create mode 100644 drivers/net/ethernet/broadcom/asp2/Makefile
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.h
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v4 1/6 dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0

The ASP 2.0 Ethernet controller uses a brcm unimac.

---
 Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml +2 -0
index 0be426ee1e44..6684810fcbf0 100644
@@ -22,6 +22,8 @@ properties:
       - brcm,genet-mdio-v3
       - brcm,genet-mdio-v4
       - brcm,genet-mdio-v5
+      - brcm,asp-v2.0-mdio
+      - brcm,asp-v2.1-mdio
       - brcm,unimac-mdio
 
   reg:
Signature · 1 line
2.7.4
author maintainer
#3 lore raw

PATCH v4 2/6 dt-bindings: net: Brcm ASP 2.0 Ethernet controller

In reply to Justin Chen

From: Florian Fainelli <[email protected]>

Add a binding document for the Broadcom ASP 2.0 Ethernet controller.

---
v3
- Adjust compatible string example to reference SoC and HW ver

v3
- Minor formatting issues
- Change channel prop to brcm,channel for vendor specific format
- Removed redundant v2.0 from compat string
- Fix ranges field

v2
- Minor formatting issues

 .../devicetree/bindings/net/brcm,asp-v2.0.yaml     | 145 +++++++++++++++++++++
 1 file changed, 145 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +145 -0
new file mode 100644
index 000000000000..07f7373b9d64
@@ -0,0 +1,145 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,asp-v2.0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom ASP 2.0 Ethernet controller
+
+maintainers:
+  - Justin Chen <[email protected]>
+  - Florian Fainelli <[email protected]>
+
+description: Broadcom Ethernet controller first introduced with 72165
+
+properties:
+  '#address-cells':
+    const: 1
+  '#size-cells':
+    const: 1
+
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
+
+  reg:
+    maxItems: 1
+
+  ranges: true
+
+  interrupts:
+    minItems: 1
+    items:
+      - description: RX/TX interrupt
+      - description: Port 0 Wake-on-LAN
+      - description: Port 1 Wake-on-LAN
+
+  clocks:
+    maxItems: 1
+
+  ethernet-ports:
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^port@[0-9]+$":
+        type: object
+
+        $ref: ethernet-controller.yaml#
+
+        properties:
+          reg:
+            maxItems: 1
+            description: Port number
+
+          brcm,channel:
+            $ref: /schemas/types.yaml#/definitions/uint32
+            description: ASP channel number
+
+        required:
+          - reg
+          - brcm,channel
+
+    additionalProperties: false
+
+patternProperties:
+  "^mdio@[0-9a-f]+$":
+    type: object
+    $ref: brcm,unimac-mdio.yaml
+
+    description:
+      ASP internal UniMAC MDIO bus
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - ranges
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    ethernet@9c00000 {
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";
+        reg = <0x9c00000 0x1fff14>;
+        interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
+        ranges = <0x0 0x9c00000 0x1fff14>;
+        clocks = <&scmi 14>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        mdio@c614 {
+            compatible = "brcm,asp-v2.0-mdio";
+            reg = <0xc614 0x8>;
+            reg-names = "mdio";
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            phy0: ethernet-phy@1 {
+                reg = <1>;
+            };
+       };
+
+        mdio@ce14 {
+            compatible = "brcm,asp-v2.0-mdio";
+            reg = <0xce14 0x8>;
+            reg-names = "mdio";
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            phy1: ethernet-phy@1 {
+                reg = <1>;
+            };
+        };
+
+        ethernet-ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+                brcm,channel = <8>;
+                phy-mode = "rgmii";
+                phy-handle = <&phy0>;
+            };
+
+            port@1 {
+                reg = <1>;
+                brcm,channel = <9>;
+                phy-mode = "rgmii";
+                phy-handle = <&phy1>;
+            };
+        };
+    };
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Quoted 17 lines · Justin Chen

From: Florian Fainelli <[email protected]>

Add a binding document for the Broadcom ASP 2.0 Ethernet controller.

---
v3
- Adjust compatible string example to reference SoC and HW ver

v3
- Minor formatting issues
- Change channel prop to brcm,channel for vendor specific format
- Removed redundant v2.0 from compat string
- Fix ranges field

Quoted 7 lines

v2
- Minor formatting issues

 .../devicetree/bindings/net/brcm,asp-v2.0.yaml     | 145 +++++++++++++++++++++
 1 file changed, 145 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/brcm,asp-v2.0.example.dtb: ethernet@9c00000: compatible: ['brcm,bcm72165-asp', 'brcm,asp-v2.0'] is too long
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#5 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

In reply to Justin Chen

Hey Justin,

Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

Quoted 8 lines · Justin Chen
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +7 -0
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
 
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";

You can't do this, as Rob's bot has pointed out. Please test the bindings :( You need one of these type of constructs:

compatible:
oneOf:
- items:
- const: brcm,bcm72165-asp
- const: brcm,asp-v2.0
- items:
- const: brcm,bcm74165-asp
- const: brcm,asp-v2.1

Although, given either you or Florian said there are likely to be multiple parts, going for an enum, rather than const for the brcm,bcm.. entry will prevent some churn. Up to you.

Cheers,
Conor.

author maintainer
#6 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Quoted 26 lines · Conor Dooley

Hey Justin,

Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

Quoted 8 lines · Justin Chen
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +7 -0
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
 
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";

You can't do this, as Rob's bot has pointed out. Please test the bindings :( You need one of these type of constructs:

compatible:
oneOf:
- items:
- const: brcm,bcm72165-asp
- const: brcm,asp-v2.0
- items:
- const: brcm,bcm74165-asp
- const: brcm,asp-v2.1

Quoted 4 lines

Although, given either you or Florian said there are likely to be multiple parts, going for an enum, rather than const for the brcm,bcm.. entry will prevent some churn. Up to you.

Urg so close. Thought it was a trivial change, so didn't bother retesting the binding. I think I have it right now...

compatible:
oneOf:
- items:
- enum:
- brcm,bcm72165-asp
- brcm,bcm74165-asp
- enum:
- brcm,asp-v2.0
- brcm,asp-v2.1

Something like this look good? Will submit a v5 tomorrow.

Thanks,
Justin

Quoted 2 lines

Cheers,
Conor.

#7 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Hey Justin,

Quoted 41 lines · Justin Chen
Quoted 23 lines · Conor Dooley

Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

Quoted 8 lines · Justin Chen
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +7 -0
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
 
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";

You can't do this, as Rob's bot has pointed out. Please test the bindings :( You need one of these type of constructs:

compatible:
oneOf:
- items:
- const: brcm,bcm72165-asp
- const: brcm,asp-v2.0
- items:
- const: brcm,bcm74165-asp
- const: brcm,asp-v2.1

Quoted 4 lines

Although, given either you or Florian said there are likely to be multiple parts, going for an enum, rather than const for the brcm,bcm.. entry will prevent some churn. Up to you.

Urg so close. Thought it was a trivial change, so didn't bother retesting the binding. I think I have it right now...

compatible:
oneOf:
- items:
- enum:
- brcm,bcm72165-asp
- brcm,bcm74165-asp
- enum:
- brcm,asp-v2.0
- brcm,asp-v2.1

Quoted 1 line

Something like this look good?

I am still caffeine-less, but this implies that both of "brcm,bcm72165-asp", "brcm,asp-v2.0"
_and_
"brcm,bcm72165-asp", "brcm,asp-v2.1"
are. I suspect that that is not the case, unless "brcm,asp-v2.0" is a valid fallback for "brcm,asp-v2.1"?
The oneOf: also becomes redundant since you only have one items:.

Quoted 1 line

Will submit a v5 tomorrow.

BTW, when you do, could you use the address listed in MAINTAINERS rather than the one you used for this version?

Cheers,
Conor.

#8 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Quoted 43 lines · Conor Dooley

Hey Justin,

Quoted 41 lines · Justin Chen
Quoted 23 lines · Conor Dooley

Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

Quoted 8 lines · Justin Chen
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +7 -0
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
 
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";

You can't do this, as Rob's bot has pointed out. Please test the bindings :( You need one of these type of constructs:

compatible:
oneOf:
- items:
- const: brcm,bcm72165-asp
- const: brcm,asp-v2.0
- items:
- const: brcm,bcm74165-asp
- const: brcm,asp-v2.1

Quoted 4 lines

Although, given either you or Florian said there are likely to be multiple parts, going for an enum, rather than const for the brcm,bcm.. entry will prevent some churn. Up to you.

Urg so close. Thought it was a trivial change, so didn't bother retesting the binding. I think I have it right now...

compatible:
oneOf:
- items:
- enum:
- brcm,bcm72165-asp
- brcm,bcm74165-asp
- enum:
- brcm,asp-v2.0
- brcm,asp-v2.1

Quoted 7 lines
Quoted 1 line

Something like this look good?

I am still caffeine-less, but this implies that both of "brcm,bcm72165-asp", "brcm,asp-v2.0"
_and_
"brcm,bcm72165-asp", "brcm,asp-v2.1"
are. I suspect that that is not the case, unless "brcm,asp-v2.0" is a

I a word. s/are/are valid/

Quoted 10 lines

valid fallback for "brcm,asp-v2.1"?
The oneOf: also becomes redundant since you only have one items:.

Quoted 1 line

Will submit a v5 tomorrow.

BTW, when you do, could you use the address listed in MAINTAINERS rather than the one you used for this version?

Cheers,
Conor.

author maintainer
#9 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Quoted 47 lines · Conor Dooley
Quoted 45 lines · Conor Dooley

Hey Justin,

Quoted 42 lines · Justin Chen
Quoted 23 lines · Conor Dooley

Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml

Quoted 8 lines · Justin Chen
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +7 -0
+  compatible:
+    enum:
+      - brcm,asp-v2.0
+      - brcm,bcm72165-asp
+      - brcm,asp-v2.1
+      - brcm,bcm74165-asp
 
+        compatible = "brcm,bcm72165-asp", "brcm,asp-v2.0";

You can't do this, as Rob's bot has pointed out. Please test the bindings :( You need one of these type of constructs:

compatible:
oneOf:
- items:
- const: brcm,bcm72165-asp
- const: brcm,asp-v2.0
- items:
- const: brcm,bcm74165-asp
- const: brcm,asp-v2.1

Quoted 4 lines

Although, given either you or Florian said there are likely to be multiple parts, going for an enum, rather than const for the brcm,bcm.. entry will prevent some churn. Up to you.

Urg so close. Thought it was a trivial change, so didn't bother retesting the binding. I think I have it right now...

compatible:
oneOf:
- items:
- enum:
- brcm,bcm72165-asp
- brcm,bcm74165-asp
- enum:
- brcm,asp-v2.0
- brcm,asp-v2.1

Something like this look good?

Quoted 8 lines
Quoted 5 lines

I am still caffeine-less, but this implies that both of "brcm,bcm72165-asp", "brcm,asp-v2.0"
_and_
"brcm,bcm72165-asp", "brcm,asp-v2.1"
are. I suspect that that is not the case, unless "brcm,asp-v2.0" is a

I a word. s/are/are valid/

Gotcha. I got something like this now.

compatible:
oneOf:
- items:
- enum:
- brcm,bcm74165-asp
- const: brcm,asp-v2.1
- items:
- enum:
- brcm,bcm72165-asp
- const: brcm,asp-v2.0

Apologies, still getting used to this yaml stuff. Starting to make a bit more sense to me now.

Quoted 8 lines
Quoted 8 lines

valid fallback for "brcm,asp-v2.1"?
The oneOf: also becomes redundant since you only have one items:.

Quoted 1 line

Will submit a v5 tomorrow.

BTW, when you do, could you use the address listed in MAINTAINERS rather than the one you used for this version?

I changed the address listed in MAINTAINERS from the previous versions of this patchset. The current version should match the address that this patch set was sent from. Looks like I forgot to add a changelog for that in v4.

Thanks,
Justin

Quoted 2 lines
Quoted 2 lines

Cheers,
Conor.

#10 lore raw

Re: [PATCH net-next v4 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller

Quoted 4 lines · Justin Chen

On Tue, May 23, 2023 at 11:56 PM Conor Dooley <[email protected]> wrote:

Gotcha. I got something like this now.

Quoted 10 lines

compatible:
oneOf:
- items:
- enum:
- brcm,bcm74165-asp
- const: brcm,asp-v2.1
- items:
- enum:
- brcm,bcm72165-asp
- const: brcm,asp-v2.0

Yes, this is what I had in mind.

Quoted 2 lines

Apologies, still getting used to this yaml stuff. Starting to make a bit more sense to me now.

No worries.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

valid fallback for "brcm,asp-v2.1"?
The oneOf: also becomes redundant since you only have one items:.

Quoted 1 line

Will submit a v5 tomorrow.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

BTW, when you do, could you use the address listed in MAINTAINERS rather than the one you used for this version?

I changed the address listed in MAINTAINERS from the previous versions of this patchset. The current version should match the address that this patch set was sent from. Looks like I forgot to add a changelog for that in v4.

Hmm, I must not have been clear. You sent it to <[email protected]> and I was hoping that you would use <[email protected]> instead so that you end up hitting the right mail filters :) It's not a problem, I was just added to it in -rc1 so get_maintainer.pl probably didn't spit my name out for your original revision.

Thanks,
Conor.

author maintainer
#11 lore raw

PATCH v4 3/6 net: bcmasp: Add support for ASP2.0 Ethernet controller

In reply to Justin Chen

Add support for the Broadcom ASP 2.0 Ethernet controller which is first introduced with 72165. This controller features two distinct Ethernet ports that can be independently operated.

This patch supports:

- Wake-on-LAN using magic packets
- basic ethtool operations (link, counters, message level)
- MAC destination address filtering (promiscuous, ALL_MULTI, etc.)

---
v4
- Address sparse warnings
- Fix one more reverse xmas tree violation
- Improve error logic for bcmasp_netfilt_get_reg_offset()

v3
- Fix logic error with net stats where some stats were missing
- General clean up addressing formatting/spelling/consistency
- Use dev_err_probe to save a few LoCs
- Use put_unaligned when updating net stats

v2
- Replace a couple functions with helper functions
- Fix a few WoL issues

 drivers/net/ethernet/broadcom/Kconfig              |   11 +
 drivers/net/ethernet/broadcom/Makefile             |    1 +
 drivers/net/ethernet/broadcom/asp2/Makefile        |    2 +
 drivers/net/ethernet/broadcom/asp2/bcmasp.c        | 1462 ++++++++++++++++++++
 drivers/net/ethernet/broadcom/asp2/bcmasp.h        |  637 +++++++++
 .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c    |  568 ++++++++
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c   | 1425 +++++++++++++++++++
 .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h  |  238 ++++
 8 files changed, 4344 insertions(+)
 create mode 100644 drivers/net/ethernet/broadcom/asp2/Makefile
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp.h
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
 create mode 100644 drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h
drivers/net/ethernet/broadcom/Kconfig +11 -0
index 948586bf1b5b..d4166141145d 100644
@@ -255,4 +255,15 @@ config BNXT_HWMON
 	  Say Y if you want to expose the thermal sensor data on NetXtreme-C/E
 	  devices, via the hwmon sysfs interface.
 
+config BCMASP
+	tristate "Broadcom ASP 2.0 Ethernet support"
+	default ARCH_BRCMSTB
+	depends on OF
+	select MII
+	select PHYLIB
+	select MDIO_BCM_UNIMAC
+	help
+	  This configuration enables the Broadcom ASP 2.0 Ethernet controller
+	  driver which is present in Broadcom STB SoCs such as 72165.
+
 endif # NET_VENDOR_BROADCOM
drivers/net/ethernet/broadcom/Makefile +1 -0
index 0ddfb5b5d53c..bac5cb6ad0cd 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o
 obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o
 obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
 obj-$(CONFIG_BNXT) += bnxt/
+obj-$(CONFIG_BCMASP) += asp2/
drivers/net/ethernet/broadcom/asp2/Makefile new file +2 -0
new file mode 100644
index 000000000000..e07550315f83
@@ -0,0 +1,2 @@
+obj-$(CONFIG_BCMASP) += bcm-asp.o
+bcm-asp-objs := bcmasp.o bcmasp_intf.o bcmasp_ethtool.o
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +1462 -0

1,462 lines not on this page · raw message

drivers/net/ethernet/broadcom/asp2/bcmasp.h new file +637 -0

637 lines not on this page · raw message

drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +568 -0

568 lines not on this page · raw message

drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +1425 -0

312 lines not on this page · raw message

drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h new file +238 -0

238 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

Reviewed-by on v4 3/6
#12 lore raw

Re: [PATCH net-next v4 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller

Quoted 4 lines · Justin Chen

Add support for the Broadcom ASP 2.0 Ethernet controller which is first introduced with 72165. This controller features two distinct Ethernet ports that can be independently operated.

Quoted 8 lines

This patch supports:

- Wake-on-LAN using magic packets
- basic ethtool operations (link, counters, message level)
- MAC destination address filtering (promiscuous, ALL_MULTI, etc.)

Hi Justin,

As I see there will be a v5 I have added a few nits from my side. Feel free to ignore them as you see fit.

...

drivers/net/ethernet/broadcom/asp2/bcmasp.c line 579

Quoted 2 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +2 -0
+int bcmasp_netfilt_check_dup(struct bcmasp_intf *intf,
+			     struct ethtool_rx_flow_spec *fs)

nit: the return type of this function could be bool

Quoted 61 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +61 -0
+{
+	struct bcmasp_priv *priv = intf->parent;
+	struct ethtool_rx_flow_spec *cur;
+	size_t fs_size = 0;
+	int i;
+
+	for (i = 0; i < NUM_NET_FILTERS; i++) {
+		if (!priv->net_filters[i].claimed ||
+		    priv->net_filters[i].port != intf->port)
+			continue;
+
+		cur = &priv->net_filters[i].fs;
+
+		if (cur->flow_type != fs->flow_type ||
+		    cur->ring_cookie != fs->ring_cookie)
+			continue;
+
+		switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) {
+		case ETHER_FLOW:
+			fs_size = sizeof(struct ethhdr);
+			break;
+		case IP_USER_FLOW:
+			fs_size = sizeof(struct ethtool_usrip4_spec);
+			break;
+		case TCP_V6_FLOW:
+		case UDP_V6_FLOW:
+			fs_size = sizeof(struct ethtool_tcpip6_spec);
+			break;
+		case TCP_V4_FLOW:
+		case UDP_V4_FLOW:
+			fs_size = sizeof(struct ethtool_tcpip4_spec);
+			break;
+		default:
+			continue;
+		}
+
+		if (memcmp(&cur->h_u, &fs->h_u, fs_size) ||
+		    memcmp(&cur->m_u, &fs->m_u, fs_size))
+			continue;
+
+		if (cur->flow_type & FLOW_EXT) {
+			if (cur->h_ext.vlan_etype != fs->h_ext.vlan_etype ||
+			    cur->m_ext.vlan_etype != fs->m_ext.vlan_etype ||
+			    cur->h_ext.vlan_tci != fs->h_ext.vlan_tci ||
+			    cur->m_ext.vlan_tci != fs->m_ext.vlan_tci ||
+			    cur->h_ext.data[0] != fs->h_ext.data[0])
+				continue;
+		}
+		if (cur->flow_type & FLOW_MAC_EXT) {
+			if (memcmp(&cur->h_ext.h_dest,
+				   &fs->h_ext.h_dest, ETH_ALEN) ||
+			    memcmp(&cur->m_ext.h_dest,
+				   &fs->m_ext.h_dest, ETH_ALEN))
+				continue;
+		}
+
+		return 1;
+	}
+
+	return 0;
+}

...

drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1036

Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +7 -0
+static int bcmasp_is_port_valid(struct bcmasp_priv *priv, int port)
+{
+	/* Quick sanity check
+	 *   Ports 0/1 reserved for unimac
+	 *   Max supported ports is 2
+	 */
+	return (port == 0 || port == 1);

nit: unnecessary parentheses

Quoted 1 line

+}

...

author maintainer
#13 lore raw

PATCH v4 4/6 net: phy: mdio-bcm-unimac: Add asp v2.0 support

In reply to Justin Chen

Add mdio compat string for ASP 2.0 ethernet driver.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
index bfc9be23c973..6b26a0803696 100644
@@ -334,6 +334,8 @@ static SIMPLE_DEV_PM_OPS(unimac_mdio_pm_ops,
 			 unimac_mdio_suspend, unimac_mdio_resume);
 
 static const struct of_device_id unimac_mdio_ids[] = {
+	{ .compatible = "brcm,asp-v2.1-mdio", },
+	{ .compatible = "brcm,asp-v2.0-mdio", },
 	{ .compatible = "brcm,genet-mdio-v5", },
 	{ .compatible = "brcm,genet-mdio-v4", },
 	{ .compatible = "brcm,genet-mdio-v3", },
Signature · 1 line
2.7.4
author maintainer
#15 lore raw

PATCH v4 5/6 net: phy: bcm7xxx: Add EPHY entry for 74165

In reply to Justin Chen

From: Florian Fainelli <[email protected]>

74165 is a 16nm process SoC with a 10/100 integrated Ethernet PHY, utilize the recently defined 16nm EPHY macro to configure that PHY.

---
 drivers/net/phy/bcm7xxx.c | 1 +
 include/linux/brcmphy.h   | 1 +
 2 files changed, 2 insertions(+)
drivers/net/phy/bcm7xxx.c +1 -0
index f8c17a253f8b..8478b081c058 100644
@@ -913,6 +913,7 @@ static struct phy_driver bcm7xxx_driver[] = {
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"),
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"),
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"),
+	BCM7XXX_16NM_EPHY(PHY_ID_BCM74165, "Broadcom BCM74165"),
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM74371, "Broadcom BCM74371"),
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"),
 	BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"),
include/linux/brcmphy.h +1 -0
index e9afbfb6d7a5..409ec9d35051 100644
@@ -44,6 +44,7 @@
 #define PHY_ID_BCM7366			0x600d8490
 #define PHY_ID_BCM7346			0x600d8650
 #define PHY_ID_BCM7362			0x600d84b0
+#define PHY_ID_BCM74165			0x359052c0
 #define PHY_ID_BCM7425			0x600d86b0
 #define PHY_ID_BCM7429			0x600d8730
 #define PHY_ID_BCM7435			0x600d8750
Signature · 1 line
2.7.4
Reviewed-by on v4 5/6
#16 lore raw

Re: [PATCH net-next v4 5/6] net: phy: bcm7xxx: Add EPHY entry for 74165

Quoted 8 lines · Justin Chen

From: Florian Fainelli <[email protected]>

74165 is a 16nm process SoC with a 10/100 integrated Ethernet PHY, utilize the recently defined 16nm EPHY macro to configure that PHY.

author maintainer
#17 lore raw

PATCH v4 6/6 MAINTAINERS: ASP 2.0 Ethernet driver maintainers

In reply to Justin Chen

Add maintainers entry for ASP 2.0 Ethernet driver.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index e2fd64c2ebdc..732a099f4a10 100644
@@ -4198,6 +4198,15 @@ F:	drivers/net/mdio/mdio-bcm-unimac.c
 F:	include/linux/platform_data/bcmgenet.h
 F:	include/linux/platform_data/mdio-bcm-unimac.h
 
+BROADCOM ASP 2.0 ETHERNET DRIVER
+M:	Justin Chen <[email protected]>
+M:	Florian Fainelli <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
+F:	drivers/net/ethernet/broadcom/asp2/
+
 BROADCOM IPROC ARM ARCHITECTURE
 M:	Ray Jui <[email protected]>
 M:	Scott Branden <[email protected]>
Signature · 1 line
2.7.4