netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs
@ 2025-10-13 20:29 Rafał Miłecki
  2025-10-13 20:29 ` [PATCH net-next 2/2] net: phy: broadcom: support "brcm,master-mode" DT property Rafał Miłecki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafał Miłecki @ 2025-10-13 20:29 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Florian Fainelli
  Cc: Heiner Kallweit, Russell King, netdev, devicetree,
	Broadcom internal kernel review list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Some network devices (e.g. access points) come with BCM54210E PHY that
requires being set into master mode to work properly.

Add binding for BCM54210E as found in Luxul AP devices (600d:84a6) and
the "brcm,master-mode" property.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../devicetree/bindings/net/brcm,bcm54xx.yaml | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm54xx.yaml

diff --git a/Documentation/devicetree/bindings/net/brcm,bcm54xx.yaml b/Documentation/devicetree/bindings/net/brcm,bcm54xx.yaml
new file mode 100644
index 000000000000..3ad226efe21d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/brcm,bcm54xx.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm54xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Ethernet PHYs
+
+maintainers:
+  - Rafał Miłecki <rafal@milecki.pl>
+
+allOf:
+  - $ref: ethernet-phy.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ethernet-phy-id600d.84a6
+
+  brcm,master-mode:
+    description: PHY requires setting into master mode
+    type: boolean
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-phy@0 {
+            compatible = "ethernet-phy-id600d.84a6";
+            reg = <0>;
+            brcm,master-mode;
+        };
+    };
-- 
2.51.0


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

* [PATCH net-next 2/2] net: phy: broadcom: support "brcm,master-mode" DT property
  2025-10-13 20:29 [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Rafał Miłecki
@ 2025-10-13 20:29 ` Rafał Miłecki
  2025-10-13 21:18 ` [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Andrew Lunn
  2025-10-15 17:01 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2025-10-13 20:29 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Florian Fainelli
  Cc: Heiner Kallweit, Russell King, netdev, devicetree,
	Broadcom internal kernel review list, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Specifying master mode as required is now possible using DT property
which is a much nicer way. It allows clean per-device hardware
description instead of runtime detection in specific Ethernet drivers.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/phy/broadcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 3459a0e9d8b9..d66b79ea1c38 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -110,11 +110,13 @@ static int bcm54xx_config_clock_delay(struct phy_device *phydev)
 
 static int bcm54210e_config_init(struct phy_device *phydev)
 {
+	struct device_node *np = phydev->mdio.dev.of_node;
 	int val;
 
 	bcm54xx_config_clock_delay(phydev);
 
-	if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
+	if (of_property_read_bool(np, "brcm,master-mode") ||
+	    phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
 		val = phy_read(phydev, MII_CTRL1000);
 		val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
 		phy_write(phydev, MII_CTRL1000, val);
-- 
2.51.0


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

* Re: [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs
  2025-10-13 20:29 [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Rafał Miłecki
  2025-10-13 20:29 ` [PATCH net-next 2/2] net: phy: broadcom: support "brcm,master-mode" DT property Rafał Miłecki
@ 2025-10-13 21:18 ` Andrew Lunn
  2025-10-15 17:01 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2025-10-13 21:18 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Florian Fainelli, Heiner Kallweit, Russell King, netdev,
	devicetree, Broadcom internal kernel review list,
	Rafał Miłecki

On Mon, Oct 13, 2025 at 10:29:43PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Some network devices (e.g. access points) come with BCM54210E PHY that
> requires being set into master mode to work properly.
> 
> Add binding for BCM54210E as found in Luxul AP devices (600d:84a6) and
> the "brcm,master-mode" property.

Is there anything broadcom about master mode? I assume this is just
the usual prefer master:

ethtool -s eth42 [master-slave preferred-master|preferred-slave|forced-master|forced-slave]

Also, is this preferred-master or forced-master?

Humm, also how does this differ to ethernet-phy.yaml:

 timing-role:
    $ref: /schemas/types.yaml#/definitions/string
    enum:
      - forced-master
      - forced-slave
      - preferred-master
      - preferred-slave
    description: |
      Specifies the timing role of the PHY in the network link. This property is
      required for setups where the role must be explicitly assigned via the
      device tree due to limitations in hardware strapping or incorrect strap
      configurations.
      It is applicable to Single Pair Ethernet (1000/100/10Base-T1) and other
      PHY types, including 1000Base-T, where it controls whether the PHY should
      be a master (clock source) or a slave (clock receiver).

      - 'forced-master': The PHY is forced to operate as a master.
      - 'forced-slave': The PHY is forced to operate as a slave.
      - 'preferred-master': Prefer the PHY to be master but allow negotiation.
      - 'preferred-slave': Prefer the PHY to be slave but allow negotiation.

	Andrew

    Andrew

---
pw-bot: cr

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

* Re: [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs
  2025-10-13 20:29 [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Rafał Miłecki
  2025-10-13 20:29 ` [PATCH net-next 2/2] net: phy: broadcom: support "brcm,master-mode" DT property Rafał Miłecki
  2025-10-13 21:18 ` [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Andrew Lunn
@ 2025-10-15 17:01 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2025-10-15 17:01 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli,
	Heiner Kallweit, Russell King, netdev, devicetree,
	Broadcom internal kernel review list, Rafał Miłecki

On Mon, Oct 13, 2025 at 10:29:43PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Some network devices (e.g. access points) come with BCM54210E PHY that
> requires being set into master mode to work properly.
> 
> Add binding for BCM54210E as found in Luxul AP devices (600d:84a6) and
> the "brcm,master-mode" property.

Can't this mode be implied from the compatible string (or id registers)?

> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  .../devicetree/bindings/net/brcm,bcm54xx.yaml | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm54xx.yaml

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

end of thread, other threads:[~2025-10-15 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13 20:29 [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Rafał Miłecki
2025-10-13 20:29 ` [PATCH net-next 2/2] net: phy: broadcom: support "brcm,master-mode" DT property Rafał Miłecki
2025-10-13 21:18 ` [PATCH net-next 1/2] dt-bindings: net: brcm,bcm54xx: add binding for Broadcom Ethernet PHYs Andrew Lunn
2025-10-15 17:01 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).