brcm ASP 2.0 Ethernet controller
Subsystems (7)
cover brcm ASP 2.0 Ethernet controller
This patch set adds support for Broadcom's ASP 2.0 Ethernet controller.
Florian Fainelli (1):
dt-bindings: net: Brcm ASP 2.0 Ethernet controller
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 | 147 ++ .../devicetree/bindings/net/brcm,unimac-mdio.yaml | 1 + 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 | 1351 +++++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 565 ++++++++ .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 628 +++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1414 ++++++++++++++++++++ .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h | 187 +++ drivers/net/mdio/mdio-bcm-unimac.c | 1 + 12 files changed, 4317 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
PATCH 1/5 dt-bindings: net: Brcm ASP 2.0 Ethernet controller
From: Florian Fainelli <[email protected]>
Add a binding document for the Broadcom ASP 2.0 Ethernet controller.
--- .../devicetree/bindings/net/brcm,asp-v2.0.yaml | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml new file +147 -0
@@ -0,0 +1,147 @@ +# SPDX-License-Identifier: GPL-2.0 +%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,bcm72165-asp-v2.0 + - brcm,asp-v2.0 + + reg: + maxItems: 1 + description: ASP registers + + ranges: true + + interrupts: + minItems: 1 + maxItems: 3 + items: + - description: RX/TX interrupt + - description: Port 0 Wake-on-LAN + - description: Port 1 Wake-on-LAN + + clocks: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: Phandle to clock controller + + clock-names: + const: sw_asp + + brcm,reserved-net-filters-mask: + $ref: /schemas/types.yaml#/definitions/uint32 + description: bitmap of reserved network filters that the driver will not use. + + mdio: + type: object + $ref: brcm,unimac-mdio.yaml# + + 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 + + channel: + maxItems: 1 + description: ASP channel number + + required: + - reg + - channel + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - ranges + +additionalProperties: false + +examples: + - | + asp@9c00000 { + compatible = "brcm,asp-v2.0"; + reg = <0x9c00000 0x1fff14>; + interrupts = <0x0 0x33 0x4>; + ranges; + clocks = <&scmi 14>; + clock-names = "sw_asp"; + brcm,reserved-net-filters-mask = <0xff>; + #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>; + channel = <8>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + + port@1 { + reg = <1>; + channel = <9>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + }; + };
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH net-next 1/5] dt-bindings: net: Brcm ASP 2.0 Ethernet controller
Quoted 11 lines · Justin Chen
From: Florian Fainelli <[email protected]>
Add a binding document for the Broadcom ASP 2.0 Ethernet controller.
Signed-off-by Florian Fainelli <[email protected]>Signed-off-by Justin Chen <[email protected]>--- .../devicetree/bindings/net/brcm,asp-v2.0.yaml | 147 +++++++++++++++++++++ 1 file changed, 147 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:./Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml:79:10: [warning] wrong indentation: expected 10 but found 9 (indentation)
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/brcm,asp-v2.0.example.dt.yaml: asp@9c00000: 'mdio@c614', 'mdio@ce14' do not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yamlDocumentation/devicetree/bindings/net/brcm,asp-v2.0.example.dt.yaml:0:0: /example-0/asp@9c00000/mdio@c614: failed to match any schema with compatible: ['brcm,asp-v2.0-mdio'] Documentation/devicetree/bindings/net/brcm,asp-v2.0.example.dt.yaml:0:0: /example-0/asp@9c00000/mdio@ce14: failed to match any schema with compatible: ['brcm,asp-v2.0-mdio']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1532528
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
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.
PATCH 2/5 dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
In reply to Justin ChenThe ASP 2.0 Ethernet controller uses a brcm unimac.
--- Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml +1 -0
@@ -20,6 +20,7 @@ properties: - brcm,genet-mdio-v3 - brcm,genet-mdio-v4 - brcm,genet-mdio-v5 + - brcm,asp-v2.0-mdio - brcm,unimac-mdio reg:
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH net-next 2/5] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
Quoted 8 lines · Justin Chen
The ASP 2.0 Ethernet controller uses a brcm unimac.
Signed-off-by Justin Chen <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 1 + 1 file changed, 1 insertion(+)
Running 'make dtbs_check' with the schema in this patch gives the following warnings. Consider if they are expected or the schema is incorrect. These may not be new warnings.
Note that it is not yet a requirement to have 0 warnings for dtbs_check. This will change in the future.
Full log is available here: https://patchwork.ozlabs.org/patch/1532529
mdio@e14: #address-cells:0:0: 1 was expected
arch/arm64/boot/dts/broadcom/bcm2711-rpi-400.dt.yaml arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dt.yaml arch/arm/boot/dts/bcm2711-rpi-400.dt.yaml arch/arm/boot/dts/bcm2711-rpi-4-b.dt.yaml
mdio@e14: #size-cells:0:0: 0 was expected
arch/arm64/boot/dts/broadcom/bcm2711-rpi-400.dt.yaml arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dt.yaml arch/arm/boot/dts/bcm2711-rpi-400.dt.yaml arch/arm/boot/dts/bcm2711-rpi-4-b.dt.yaml
Re: [PATCH net-next 2/5] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0
In reply to Justin ChenQuoted 8 lines · Justin Chen
The ASP 2.0 Ethernet controller uses a brcm unimac.
Signed-off-by Justin Chen <[email protected]>Signed-off-by Florian Fainelli <[email protected]>--- Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 1 + 1 file changed, 1 insertion(+)
PATCH 3/5 net: bcmasp: Add support for ASP2.0 Ethernet controller
In reply to Justin ChenAdd 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.)
--- 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 | 1351 +++++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 565 ++++++++ .../net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 628 +++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1414 ++++++++++++++++++++ .../net/ethernet/broadcom/asp2/bcmasp_intf_defs.h | 187 +++ 8 files changed, 4159 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
@@ -253,4 +253,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
@@ -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
@@ -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 +1351 -0
1,351 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp.h new file +565 -0
565 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +628 -0
628 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +1414 -0
435 lines not on this page · raw message
drivers/net/ethernet/broadcom/asp2/bcmasp_intf_defs.h new file +187 -0
187 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.
Jakub Kicinski
maintainerRe: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 4 lines · On Fri, 24 Sep 2021 14:44:49 -0700 Justin Chen wrote:
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.)Signed-off-by Justin Chen <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Please clean up checkpatch --strict and make W=1 C=1 build of the new driver.
Re: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 12 lines · Jakub Kicinski
Quoted 10 lines · On Fri, 24 Sep 2021 14:44:49 -0700 Justin Chen wrote:
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.)
Quoted 5 lines
Quoted 2 lines
Signed-off-by Justin Chen <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Please clean up checkpatch --strict and make W=1 C=1 build of the new driver.
Apologies, Will fix checkpatch errors in v2
Andrew Lunn
maintainerRe: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
In reply to Justin ChenQuoted 18 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +18
-0+static int bcmasp_probe (struct platform_device *pdev) +{ +struct bcmasp_priv *priv; +struct device_node *ports_node, *intf_node; +struct device *dev = &pdev->dev; +int ret, i, wol_irq, count =0 ; +struct bcmasp_intf *intf; +struct resource *r; +u32 u32_reserved_filters_bitmask; +DECLARE_BITMAP (reserved_filters_bitmask,ASP_RX_NET_FILTER_MAX ); + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->irq =platform_get_irq (pdev,0 ); +if (priv->irq <=0 ) { +dev_err (dev,"invalid interrupt\n" );
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1106
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +10
-0+return -EINVAL ; + } + + priv->clk =devm_clk_get (dev,"sw_asp" ); +if (IS_ERR (priv->clk)) { +if (PTR_ERR (priv->clk) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; +dev_warn (dev,"failed to request clock\n" ); + priv->clk =NULL ; + }
devm_clk_get_optional() makes this simpler/
Quoted 32 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +32
-0+ +/* Base from parent node */ + r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + priv->base =devm_ioremap_resource (&pdev->dev, r); +if (IS_ERR (priv->base)) { +dev_err (dev,"failed to iomap\n" ); +return PTR_ERR (priv->base); + } + + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (40 )); +if (ret) + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (ret) { +dev_err (&pdev->dev,"unable to set DMA mask: %d\n" , ret); +return ret; + } + +dev_set_drvdata (&pdev->dev, priv); + priv->pdev = pdev; +spin_lock_init (&priv->mda_lock); +spin_lock_init (&priv->clk_lock); +mutex_init (&priv->net_lock); + + ret =clk_prepare_enable (priv->clk); +if (ret) +return ret; + +/* Enable all clocks to ensure successful probing */ +bcmasp_core_clock_set (priv,ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE ,0 ); + +/* Switch to the main clock */ +bcmasp_core_clock_select (priv, false);
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1148
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +10
-0+ +_intr2_mask_set (priv,0xffffffff ); +intr2_core_wl (priv,0xffffffff ,ASP_INTR2_CLEAR ); + + ret =devm_request_irq (&pdev->dev, priv->irq, bcmasp_isr,0 , + pdev->name, priv); +if (ret) { +dev_err (dev,"failed to request ASP interrupt: %d\n" , ret); +return ret; + }
Do you need to undo clk_prepare_enable()?
Quoted 90 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +90
-0+ +/* Register mdio child nodes */ +of_platform_populate (dev->of_node, bcmasp_mdio_of_match,NULL , + dev); + + ret =of_property_read_u32 (dev->of_node, +"brcm,reserved-net-filters-mask" , + &u32_reserved_filters_bitmask); +if (ret) + u32_reserved_filters_bitmask =0 ; + + priv->net_filters_count_max =ASP_RX_NET_FILTER_MAX ; +bitmap_zero (reserved_filters_bitmask, priv->net_filters_count_max); +bitmap_from_arr32 (reserved_filters_bitmask, + &u32_reserved_filters_bitmask, + priv->net_filters_count_max); + +/* Discover bitmask of reserved filters */ +for_each_set_bit (i, reserved_filters_bitmask,ASP_RX_NET_FILTER_MAX ) { + priv->net_filters[i].reserved = true; + priv->net_filters_count_max--; + } + +/* +* ASP specific initialization, Needs to be done irregardless of +* of how many interfaces come up. +*/ +bcmasp_core_init (priv); +bcmasp_core_init_filters (priv); + + ports_node =of_find_node_by_name (dev->of_node,"ethernet-ports" ); +if (!ports_node) { +dev_warn (dev,"No ports found\n" ); +return 0 ; + } + + priv->intf_count =of_get_available_child_count (ports_node); + + priv->intfs =devm_kcalloc (dev, priv->intf_count, +sizeof (struct bcmasp_intf *), +GFP_KERNEL ); +if (!priv->intfs) +return -ENOMEM ; + +/* Probe each interface (Initalization should continue even if +* interfaces are unable to come up) +*/ + i =0 ; +for_each_available_child_of_node (ports_node, intf_node) { + wol_irq =platform_get_irq_optional (pdev, i +1 ); + priv->intfs[i++] =bcmasp_interface_create (priv, intf_node, + wol_irq); + } + +/* Drop the clock reference count now and let ndo_open()/ndo_close() +* manage it for us from now on. +*/ +bcmasp_core_clock_set (priv,0 ,ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE ); + +clk_disable_unprepare (priv->clk); + +/* Now do the registration of the network ports which will take care of +* managing the clock properly. +*/ +for (i =0 ; i < priv->intf_count; i++) { + intf = priv->intfs[i]; +if (!intf) +continue ; + + ret =register_netdev (intf->ndev); +if (ret) { +netdev_err (intf->ndev, +"failed to register net_device: %d\n" , ret); +bcmasp_interface_destroy (intf, false); +continue ; + } + count++; + } + +dev_info (dev,"Initialized %d port(s)\n" , count); + +return 0 ; +} + +static int bcmasp_remove (struct platform_device *pdev) +{ +struct bcmasp_priv *priv =dev_get_drvdata (&pdev->dev); +struct bcmasp_intf *intf; +int i; +
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1248
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +10
-0+for (i =0 ; i < priv->intf_count; i++) { + intf = priv->intfs[i]; +if (!intf) +continue ; + +bcmasp_interface_destroy (intf, true); + } + +return 0 ; +}
Do you need to depopulate the mdio children?
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 307
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+static void bcmasp_get_drvinfo (struct net_device *dev, +struct ethtool_drvinfo *info) +{ +strlcpy (info->driver,"bcmasp" ,sizeof (info->driver)); +strlcpy (info->version,"v2.0" ,sizeof (info->version));
Please drop version. The core will fill it in with the kernel version, which is more useful.
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 359
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_nway_reset (struct net_device *dev) +{ +if (!dev->phydev) +return -ENODEV ; + +return genphy_restart_aneg (dev->phydev); +}
phy_ethtool_nway_reset().
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 371
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +11
-0+static void bcmasp_get_wol (struct net_device *dev,struct ethtool_wolinfo *wol) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + wol->supported =WAKE_MAGIC |WAKE_MAGICSECURE |WAKE_FILTER ; + wol->wolopts = intf->wolopts; +memset (wol->sopass,0 ,sizeof (wol->sopass)); + +if (wol->wolopts &WAKE_MAGICSECURE ) +memcpy (wol->sopass, intf->sopass,sizeof (intf->sopass)); +}
Maybe consider calling into the PHY to see what it can do? If the PHY can do the WoL you want, it will do it with less power.
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 537
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_set_priv_flags (struct net_device *dev,u32 flags) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + intf->wol_keep_rx_en = flags &BCMASP_WOL_KEEP_RX_EN ?1 :0 ; + +return 0 ;
Please could you explain this some more. How can you disable RX and still have WoL working?
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+static void bcmasp_adj_link (struct net_device *dev) +{ +struct bcmasp_intf *intf =netdev_priv (dev); +struct phy_device *phydev = dev->phydev; +int changed =0 ; +u32 cmd_bits =0 , reg; + +if (intf->old_link != phydev->link) { + changed =1 ; + intf->old_link = phydev->link;
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 586
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+ } + +if (intf->old_duplex != phydev->duplex) { + changed =1 ; + intf->old_duplex = phydev->duplex; + } + +switch (phydev->speed) { +case SPEED_2500 : + cmd_bits =UMC_CMD_SPEED_2500 ;
All i've seen is references to RGMII. Is 2500 possible?
Quoted 18 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +18
-0+break ; +case SPEED_1000 : + cmd_bits =UMC_CMD_SPEED_1000 ; +break ; +case SPEED_100 : + cmd_bits =UMC_CMD_SPEED_100 ; +break ; +case SPEED_10 : + cmd_bits =UMC_CMD_SPEED_10 ; +break ; +default : +break ; + } + cmd_bits <<=UMC_CMD_SPEED_SHIFT ; + +if (phydev->duplex ==DUPLEX_HALF ) + cmd_bits |=UMC_CMD_HD_EN ; +
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 614
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+if (intf->old_pause != phydev->pause) { + changed =1 ; + intf->old_pause = phydev->pause; + } + +if (!phydev->pause) + cmd_bits |=UMC_CMD_RX_PAUSE_IGNORE |UMC_CMD_TX_PAUSE_IGNORE ; + +if (!changed) +return ;
Shouldn't there be a comparison intd->old_speed != phydev->speed? You are risking the PHY can change speed without doing a link down/up?
Quoted 15 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +15
-0+ +if (phydev->link) { + reg =umac_rl (intf,UMC_CMD ); + reg &= ~((UMC_CMD_SPEED_MASK <<UMC_CMD_SPEED_SHIFT ) | +UMC_CMD_HD_EN |UMC_CMD_RX_PAUSE_IGNORE | +UMC_CMD_TX_PAUSE_IGNORE ); + reg |= cmd_bits; +umac_wl (intf, reg,UMC_CMD ); + +/* Enable RGMII pad */ + reg =rgmii_rl (intf,RGMII_OOB_CNTRL ); + reg |=RGMII_MODE_EN ; +rgmii_wl (intf, reg,RGMII_OOB_CNTRL ); + + intf->eee.eee_active =phy_init_eee (phydev,0 ) >=0 ;
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 639
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+bcmasp_eee_enable_set (intf, intf->eee.eee_active); + }else { +/* Disable RGMII pad */ + reg =rgmii_rl (intf,RGMII_OOB_CNTRL ); + reg &= ~RGMII_MODE_EN ; +rgmii_wl (intf, reg,RGMII_OOB_CNTRL ); + } + +if (changed) +phy_print_status (phydev);
There has already been a return if !changed.
Quoted 16 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +16
-0+static void bcmasp_configure_port (struct bcmasp_intf *intf) +{ +u32 reg, id_mode_dis =0 ; + + reg =rgmii_rl (intf,RGMII_PORT_CNTRL ); + reg &= ~RGMII_PORT_MODE_MASK ; + +switch (intf->phy_interface) { +case PHY_INTERFACE_MODE_RGMII : +/* RGMII_NO_ID: TXC transitions at the same time as TXD +* (requires PCB or receiver-side delay) +* RGMII: Add 2ns delay on TXC (90 degree shift) +* +* ID is implicitly disabled for 100Mbps (RG)MII operation. +*/ + id_mode_dis =RGMII_ID_MODE_DIS ;
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 932
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+ fallthrough; +case PHY_INTERFACE_MODE_RGMII_TXID : + reg |=RGMII_PORT_MODE_EXT_GPHY ; +break ; +case PHY_INTERFACE_MODE_MII : + reg |=RGMII_PORT_MODE_EXT_EPHY ; +break ; +default : +break ; + }
Can we skip this and let the PHY do the delays? Ah, "This is an ugly quirk..." Maybe add a comment here pointing towards bcmasp_netif_init(), which is explains this.
Quoted 49 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +47
-0+static int bcmasp_netif_init (struct net_device *dev,bool phy_connect, +bool init_rx) +{ +struct bcmasp_intf *intf =netdev_priv (dev); +phy_interface_t phy_iface = intf->phy_interface; +u32 phy_flags =PHY_BRCM_AUTO_PWRDWN_ENABLE | +PHY_BRCM_DIS_TXCRXC_NOENRGY | +PHY_BRCM_IDDQ_SUSPEND ; +struct phy_device *phydev =NULL ; +int ret; + +/* Always enable interface clocks */ +bcmasp_core_clock_set_intf (intf, true); + +/* Enable internal PHY before any MAC activity */ +if (intf->internal_phy) +bcmasp_ephy_enable_set (intf, true); + +bcmasp_configure_port (intf); + +/* This is an ugly quirk but we have not been correctly interpreting +* the phy_interface values and we have done that across different +* drivers, so at least we are consistent in our mistakes. +* +* When the Generic PHY driver is in use either the PHY has been +* strapped or programmed correctly by the boot loader so we should +* stick to our incorrect interpretation since we have validated it. +* +* Now when a dedicated PHY driver is in use, we need to reverse the +* meaning of the phy_interface_mode values to something that the PHY +* driver will interpret and act on such that we have two mistakes +* canceling themselves so to speak. We only do this for the two +* modes that GENET driver officially supports on Broadcom STB chips: +* PHY_INTERFACE_MODE_RGMII and PHY_INTERFACE_MODE_RGMII_TXID. Other +* modes are not *officially* supported with the boot loader and the +* scripted environment generating Device Tree blobs for those +* platforms. +* +* Note that internal PHY and fixed-link configurations are not +* affected because they use different phy_interface_t values or the +* Generic PHY driver. +*/ +static inline void bcmasp_map_res (struct bcmasp_priv *priv, +struct bcmasp_intf *intf) +{ +/* Per port */ + intf->res.umac = priv->base +UMC_OFFSET (intf);
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +10
-0+ intf->res.umac2fb = priv->base +UMAC2FB_OFFSET (intf); + intf->res.rgmii = priv->base +RGMII_OFFSET (intf); + +/* Per ch */ + intf->tx_spb_dma = priv->base +TX_SPB_DMA_OFFSET (intf); + intf->res.tx_spb_ctrl = priv->base +TX_SPB_CTRL_OFFSET (intf); +/* +* Stop gap solution. This should be removed when 72165a0 is +* deprecated +*/
Is that an internal commit?
Andrew
Re: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
On 9/25/2021 9:45 AM, Andrew Lunn wrote:
[snip]
Quoted 9 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1106
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +7
-0+ priv->clk =devm_clk_get (dev,"sw_asp" ); +if (IS_ERR (priv->clk)) { +if (PTR_ERR (priv->clk) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; +dev_warn (dev,"failed to request clock\n" ); + priv->clk =NULL ; + }
devm_clk_get_optional()makes this simpler/
Indeed, thanks.
[snip]
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1148
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +6
-0+ ret =devm_request_irq (&pdev->dev, priv->irq, bcmasp_isr,0 , + pdev->name, priv); +if (ret) { +dev_err (dev,"failed to request ASP interrupt: %d\n" , ret); +return ret; + }Do you need to undo
clk_prepare_enable()?
Yes we do need to undo the preceding clk_prepare_enable(), thanks!
[snip]
Quoted 11 lines
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +11
-0+ +static int bcmasp_remove (struct platform_device *pdev) +{ +struct bcmasp_priv *priv =dev_get_drvdata (&pdev->dev); +struct bcmasp_intf *intf; +int i; + +for (i =0 ; i < priv->intf_count; i++) { + intf = priv->intfs[i]; +if (!intf) +continue ;
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c line 1248
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp.c new file +6
-0+ +bcmasp_interface_destroy (intf, true); + } + +return 0 ; +}Do you need to depopulate the mdio children?
I had not given much thought about it first but we ought to do something about it here, I will test it before Justin sends a v2.
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 307
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +5
-0+static void bcmasp_get_drvinfo (struct net_device *dev, +struct ethtool_drvinfo *info) +{ +strlcpy (info->driver,"bcmasp" ,sizeof (info->driver)); +strlcpy (info->version,"v2.0" ,sizeof (info->version));Please drop version. The core will fill it in with the kernel version, which is more useful.
Quoted 9 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 359
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_nway_reset (struct net_device *dev) +{ +if (!dev->phydev) +return -ENODEV ; + +return genphy_restart_aneg (dev->phydev); +}
phy_ethtool_nway_reset().
Yes, thanks!
Quoted 16 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 371
Quoted 13 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +11
-0+static void bcmasp_get_wol (struct net_device *dev,struct ethtool_wolinfo *wol) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + wol->supported =WAKE_MAGIC |WAKE_MAGICSECURE |WAKE_FILTER ; + wol->wolopts = intf->wolopts; +memset (wol->sopass,0 ,sizeof (wol->sopass)); + +if (wol->wolopts &WAKE_MAGICSECURE ) +memcpy (wol->sopass, intf->sopass,sizeof (intf->sopass)); +}Maybe consider calling into the PHY to see what it can do? If the PHY can do the WoL you want, it will do it with less power.
We could do that, especially since one of the ports will typically connect to an external Gigabit PHY, will add for v2.
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 537
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_set_priv_flags (struct net_device *dev,u32 flags) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + intf->wol_keep_rx_en = flags &BCMASP_WOL_KEEP_RX_EN ?1 :0 ; + +return 0 ;Please could you explain this some more. How can you disable RX and still have WoL working?
Wake-on-LAN using Magic Packets and network filters requires keeping the UniMAC's receiver turned on, and then the packets feed into the Magic Packet Detector (MPD) block or the network filter block. In that mode DRAM is in self refresh and there is local matching of frames into a tiny FIFO however in the case of magic packets the packets leading to a wake-up are dropped as there is nowhere to store them. In the case of a network filter match (e.g.: matching a multicast IP address plus protocol, plus source/destination ports) the packets are also discarded because the receive DMA was shut down.
When the wol_keep_rx_en flag is set, the above happens but we also allow the packets that did match a network filter to reach the small FIFO (Justin would know how many entries are there) that is used to push the packets to DRAM. The packet contents are held in there until the system wakes up which is usually just a few hundreds of micro seconds after we received a packet that triggered a wake-up. Once we overflow the receive DMA FIFO capacity subsequent packets get dropped which is fine since we are usually talking about very low bit rates, and we only try to push to DRAM the packets of interest, that is those for which we have a network filter.
This is convenient in scenarios where you want to wake-up from multicast DNS (e.g.: wake on Googlecast, Bonjour etc.) because then the packet that resulted in the system wake-up is not discarded but is then delivered to the network stack.
Quoted 15 lines
Quoted 15 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +14
-0+static void bcmasp_adj_link (struct net_device *dev) +{ +struct bcmasp_intf *intf =netdev_priv (dev); +struct phy_device *phydev = dev->phydev; +int changed =0 ; +u32 cmd_bits =0 , reg; + +if (intf->old_link != phydev->link) { + changed =1 ; + intf->old_link = phydev->link; + } + +if (intf->old_duplex != phydev->duplex) { + changed =1 ;
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 586
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +6
-0+ intf->old_duplex = phydev->duplex; + } + +switch (phydev->speed) { +case SPEED_2500 : + cmd_bits =UMC_CMD_SPEED_2500 ;All i've seen is references to RGMII. Is 2500 possible?
It is not, this has been copied from the GENET driver which also does not support 2.5Gbits avec the external interface level, we should drop it there, too. Thanks!
Quoted 24 lines
Quoted 24 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +23
-0+break ; +case SPEED_1000 : + cmd_bits =UMC_CMD_SPEED_1000 ; +break ; +case SPEED_100 : + cmd_bits =UMC_CMD_SPEED_100 ; +break ; +case SPEED_10 : + cmd_bits =UMC_CMD_SPEED_10 ; +break ; +default : +break ; + } + cmd_bits <<=UMC_CMD_SPEED_SHIFT ; + +if (phydev->duplex ==DUPLEX_HALF ) + cmd_bits |=UMC_CMD_HD_EN ; + +if (intf->old_pause != phydev->pause) { + changed =1 ; + intf->old_pause = phydev->pause; + } +
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 614
Quoted 5 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +5
-0+if (!phydev->pause) + cmd_bits |=UMC_CMD_RX_PAUSE_IGNORE |UMC_CMD_TX_PAUSE_IGNORE ; + +if (!changed) +return ;Shouldn't there be a comparison
intd->old_speed!=phydev->speed? You are risking the PHY can change speed without doing a link down/up?
We can probably remove these comparisons nowadays since the PHY library no longer calls adjust_link whether or not something has changed, it does call when something changed.
Quoted 20 lines
Quoted 20 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +19
-0+ +if (phydev->link) { + reg =umac_rl (intf,UMC_CMD ); + reg &= ~((UMC_CMD_SPEED_MASK <<UMC_CMD_SPEED_SHIFT ) | +UMC_CMD_HD_EN |UMC_CMD_RX_PAUSE_IGNORE | +UMC_CMD_TX_PAUSE_IGNORE ); + reg |= cmd_bits; +umac_wl (intf, reg,UMC_CMD ); + +/* Enable RGMII pad */ + reg =rgmii_rl (intf,RGMII_OOB_CNTRL ); + reg |=RGMII_MODE_EN ; +rgmii_wl (intf, reg,RGMII_OOB_CNTRL ); + + intf->eee.eee_active =phy_init_eee (phydev,0 ) >=0 ; +bcmasp_eee_enable_set (intf, intf->eee.eee_active); + }else { +/* Disable RGMII pad */ + reg =rgmii_rl (intf,RGMII_OOB_CNTRL );
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 639
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +6
-0+ reg &= ~RGMII_MODE_EN ; +rgmii_wl (intf, reg,RGMII_OOB_CNTRL ); + } + +if (changed) +phy_print_status (phydev);There has already been a return if !changed.
Yes indeed.
Quoted 23 lines
Quoted 23 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +22
-0+static void bcmasp_configure_port (struct bcmasp_intf *intf) +{ +u32 reg, id_mode_dis =0 ; + + reg =rgmii_rl (intf,RGMII_PORT_CNTRL ); + reg &= ~RGMII_PORT_MODE_MASK ; + +switch (intf->phy_interface) { +case PHY_INTERFACE_MODE_RGMII : +/* RGMII_NO_ID: TXC transitions at the same time as TXD +* (requires PCB or receiver-side delay) +* RGMII: Add 2ns delay on TXC (90 degree shift) +* +* ID is implicitly disabled for 100Mbps (RG)MII operation. +*/ + id_mode_dis =RGMII_ID_MODE_DIS ; + fallthrough; +case PHY_INTERFACE_MODE_RGMII_TXID : + reg |=RGMII_PORT_MODE_EXT_GPHY ; +break ; +case PHY_INTERFACE_MODE_MII : + reg |=RGMII_PORT_MODE_EXT_EPHY ;
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 493
Quoted 4 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +4
-0+break ; +default : +break ; + }Can we skip this and let the PHY do the delays? Ah, "This is an ugly quirk..." Maybe add a comment here pointing towards
bcmasp_netif_init(), which is explains this.
OK.
[snip]
Quoted 9 lines
Quoted 9 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +9
-0+static inline void bcmasp_map_res (struct bcmasp_priv *priv, +struct bcmasp_intf *intf) +{ +/* Per port */ + intf->res.umac = priv->base +UMC_OFFSET (intf); + intf->res.umac2fb = priv->base +UMAC2FB_OFFSET (intf); + intf->res.rgmii = priv->base +RGMII_OFFSET (intf); + +/* Per ch */
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 1156
Quoted 6 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +6
-0+ intf->tx_spb_dma = priv->base +TX_SPB_DMA_OFFSET (intf); + intf->res.tx_spb_ctrl = priv->base +TX_SPB_CTRL_OFFSET (intf); +/* +* Stop gap solution. This should be removed when 72165a0 is +* deprecated +*/ Is that an internal commit?
Yes this is a revision of the silicon that is not meant to see the light of day.
Signature · 1 line
Florian
Andrew Lunn
maintainerRe: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 30 lines
Quoted 10 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 537
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_set_priv_flags (struct net_device *dev,u32 flags) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + intf->wol_keep_rx_en = flags &BCMASP_WOL_KEEP_RX_EN ?1 :0 ; + +return 0 ;Please could you explain this some more. How can you disable RX and still have WoL working?
Wake-on-LAN using Magic Packets and network filters requires keeping the UniMAC's receiver turned on, and then the packets feed into the Magic Packet Detector (MPD) block or the network filter block. In that mode DRAM is in self refresh and there is local matching of frames into a tiny FIFO however in the case of magic packets the packets leading to a wake-up are dropped as there is nowhere to store them. In the case of a network filter match (e.g.:
matching a multicast IP address plus protocol, plus source/destination ports) the packets are also discarded because the receive DMA was shut down.When the
wol_keep_rx_enflag is set, the above happens but we also allow the packets that did match a network filter to reach the small FIFO (Justin would know how many entries are there) that is used to push the packets to DRAM. The packet contents are held in there until the system wakes up which is usually just a few hundreds of micro seconds after we received a packet that triggered a wake-up. Once we overflow the receive DMA FIFO capacity subsequent packets get dropped which is fine since we are usually talking about very low bit rates, and we only try to push to DRAM the packets of interest, that is those for which we have a network filter.
Quoted 4 lines
This is convenient in scenarios where you want to wake-up from multicast DNS (e.g.: wake on Googlecast, Bonjour etc.) because then the packet that resulted in the system wake-up is not discarded but is then delivered to the network stack.
Thanks for the explanation. It would be easier for the user if you automate this. Enable is by default for WoL types which have user content?
Quoted 10 lines
Quoted 9 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c line 1156
Quoted 7 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +7
-0+/* Per ch */ + intf->tx_spb_dma = priv->base +TX_SPB_DMA_OFFSET (intf); + intf->res.tx_spb_ctrl = priv->base +TX_SPB_CTRL_OFFSET (intf); +/* +* Stop gap solution. This should be removed when 72165a0 is +* deprecated +*/ Is that an internal commit?
Quoted 2 lines
Yes this is a revision of the silicon that is not meant to see the light of day.
So this can all be removed?
Andrew
Re: [PATCH net-next 3/5] net: bcmasp: Add support for ASP2.0 Ethernet controller
Quoted 31 lines · Andrew Lunn
Quoted 31 lines
Quoted 11 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c line 537
Quoted 8 lines
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c new file +7
-0+static int bcmasp_set_priv_flags (struct net_device *dev,u32 flags) +{ +struct bcmasp_intf *intf =netdev_priv (dev); + + intf->wol_keep_rx_en = flags &BCMASP_WOL_KEEP_RX_EN ?1 :0 ; + +return 0 ;Please could you explain this some more. How can you disable RX and still have WoL working?
Wake-on-LAN using Magic Packets and network filters requires keeping the UniMAC's receiver turned on, and then the packets feed into the Magic Packet Detector (MPD) block or the network filter block. In that mode DRAM is in self refresh and there is local matching of frames into a tiny FIFO however in the case of magic packets the packets leading to a wake-up are dropped as there is nowhere to store them. In the case of a network filter match (e.g.:
matching a multicast IP address plus protocol, plus source/destination ports) the packets are also discarded because the receive DMA was shut down.When the
wol_keep_rx_enflag is set, the above happens but we also allow the packets that did match a network filter to reach the small FIFO (Justin would know how many entries are there) that is used to push the packets to DRAM. The packet contents are held in there until the system wakes up which is usually just a few hundreds of micro seconds after we received a packet that triggered a wake-up. Once we overflow the receive DMA FIFO capacity subsequent packets get dropped which is fine since we are usually talking about very low bit rates, and we only try to push to DRAM the packets of interest, that is those for which we have a network filter.
Quoted 9 lines
Quoted 4 lines
This is convenient in scenarios where you want to wake-up from multicast DNS (e.g.: wake on Googlecast, Bonjour etc.) because then the packet that resulted in the system wake-up is not discarded but is then delivered to the network stack.
Thanks for the explanation. It would be easier for the user if you automate this. Enable is by default for WoL types which have user content?
Yup that can work. We can enable it for WAKE_FILTER type wol and leave it disabled otherwise.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
+ /* Per ch */
+intf->tx_spb_dma=priv->base+TX_SPB_DMA_OFFSET(intf);
+intf->res.tx_spb_ctrl=priv->base+TX_SPB_CTRL_OFFSET(intf);
+ /*drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c new file +3
-0+* Stop gap solution. This should be removed when 72165a0 is +* deprecated +*/
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Is that an internal commit?
Yes this is a revision of the silicon that is not meant to see the light of day.
So this can all be removed?
Yup. That can be removed
Quoted 1 line
Andrew
Thanks for the review.
Justin
PATCH 4/5 net: phy: mdio-bcm-unimac: Add asp v2.0 support
In reply to Justin Chen--- drivers/net/mdio/mdio-bcm-unimac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/mdio/mdio-bcm-unimac.c +1 -0
@@ -334,6 +334,7 @@ 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.0-mdio" , }, { .compatible ="brcm,genet-mdio-v5" , }, { .compatible ="brcm,genet-mdio-v4" , }, { .compatible ="brcm,genet-mdio-v3" , },
Signature · 1 line
2.7.4
PATCH 5/5 MAINTAINERS: ASP 2.0 Ethernet driver maintainers
In reply to Justin Chen--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -3762,6 +3762,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
Andrew Lunn
maintainerQuoted 1 line · Justin Chen
This patch set adds support for Broadcom's ASP 2.0 Ethernet controller.
Hi Justin
Does the hardware support L2 switching between the two ports? I'm just wondering if later this is going to be modified into a switchdev driver?
Andrew
Hi Andrew,
Quoted 9 lines · Andrew Lunn
Quoted 1 line · Justin Chen
This patch set adds support for Broadcom's ASP 2.0 Ethernet controller.
Hi Justin
Does the hardware support L2 switching between the two ports? I'm just wondering if later this is going to be modified into a switchdev driver?
It does not, these are just a bunch of Ethernet ports sharing a few resources (clocks, network filters etc.).
Signature · 1 line
Florian