* [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode
2025-06-20 13:44 [PATCH 0/3] net: phy: bcm54811: Fix the PHY initialization Kamil Horák (2N)
@ 2025-06-20 13:44 ` Kamil Horák (2N)
2025-06-20 15:19 ` Andrew Lunn
2025-06-20 13:44 ` [PATCH 1/3] net: phy: bcm54811: Fix the PHY initialization Kamil Horák (2N)
2025-06-20 13:44 ` [PATCH 3/3] dt-bindings: ethernet-phy: add optional mii-lite-mode flag Kamil Horák (2N)
2 siblings, 1 reply; 6+ messages in thread
From: Kamil Horák (2N) @ 2025-06-20 13:44 UTC (permalink / raw)
To: florian.fainelli, bcm-kernel-feedback-list, andrew, hkallweit1,
linux, davem, edumazet, kuba, pabeni, krzk+dt, conor+dt
Cc: kamilh, netdev, devicetree, linux-kernel, robh
The Broadcom bcm54810 and bcm54811 PHYs are capable to operate in
simplified MII mode, without TXER, RXER, CRS and COL signals as defined
for the MII. While the PHY can be strapped for MII mode, the selection
between MII and MII-Lite must be done by software.
Signed-off-by: Kamil Horák (2N) <kamilh@axis.com>
---
drivers/net/phy/broadcom.c | 32 +++++++++++++++++++++++++++++++-
include/linux/brcmphy.h | 6 ++++++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 75dbb88bec5a..d0ecb12d2d2e 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -16,7 +16,6 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/phy.h>
-#include <linux/device.h>
#include <linux/brcmphy.h>
#include <linux/of.h>
#include <linux/interrupt.h>
@@ -39,6 +38,7 @@ struct bcm54xx_phy_priv {
int wake_irq;
bool wake_irq_enabled;
bool brr_mode;
+ bool mii_lite_mode;
};
/* Link modes for BCM58411 PHY */
@@ -680,6 +680,12 @@ static int bcm5481x_read_abilities(struct phy_device *phydev)
priv->brr_mode = of_property_read_bool(np, "brr-mode");
+ /* Enable MII Lite (No TXER, RXER, CRS, COL) if configured */
+ err = bcm_phy_modify_exp(phydev, BCM_EXP_SYNC_ETHERNET,
+ BCM_EXP_SYNC_ETHERNET_MII_LITE,
+ priv->mii_lite_mode ?
+ BCM_EXP_SYNC_ETHERNET_MII_LITE : 0);
+
/* Set BroadR-Reach mode as configured in the DT. */
err = bcm5481x_set_brrmode(phydev, priv->brr_mode);
if (err)
@@ -1140,6 +1146,7 @@ static int bcm54xx_phy_probe(struct phy_device *phydev)
struct bcm54xx_phy_priv *priv;
struct gpio_desc *wakeup_gpio;
int ret = 0;
+ struct device_node *np = phydev->mdio.dev.of_node;
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -1159,6 +1166,29 @@ static int bcm54xx_phy_probe(struct phy_device *phydev)
if (IS_ERR(priv->ptp))
return PTR_ERR(priv->ptp);
+ priv->mii_lite_mode = of_property_read_bool(np, "mii-lite-mode");
+ if (!phy_interface_is_rgmii(phydev) ||
+ phydev->interface == PHY_INTERFACE_MODE_MII) {
+ /* Enable MII Lite (No TXER, RXER, CRS, COL) if configured */
+ ret = bcm_phy_modify_exp(phydev, BCM_EXP_SYNC_ETHERNET,
+ BCM_EXP_SYNC_ETHERNET_MII_LITE,
+ priv->mii_lite_mode ?
+ BCM_EXP_SYNC_ETHERNET_MII_LITE : 0);
+ if (ret < 0)
+ return ret;
+ /* Misc Control: GMII/MII Mode (not RGMII) */
+ ret = phy_write(phydev, MII_BCM54XX_AUX_CTL,
+ MII_BCM54XX_AUXCTL_MISC_WREN |
+ MII_BCM54XX_AUXCTL_SHDWSEL_MASK |
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC |
+ (MII_BCM54XX_AUXCTL_SHDWSEL_MISC
+ << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT) |
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN |
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD);
+ if (ret < 0)
+ return ret;
+ }
+
/* We cannot utilize the _optional variant here since we want to know
* whether the GPIO descriptor exists or not to advertise Wake-on-LAN
* support or not.
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 350846b010e9..115a964f3006 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -183,6 +183,12 @@
#define BCM_LED_MULTICOLOR_ACT 0x9
#define BCM_LED_MULTICOLOR_PROGRAM 0xa
+/*
+ * Broadcom Synchronous Ethernet Controls (expansion register 0x0E)
+ */
+#define BCM_EXP_SYNC_ETHERNET (MII_BCM54XX_EXP_SEL_ER + 0x0E)
+#define BCM_EXP_SYNC_ETHERNET_MII_LITE BIT(11)
+
/*
* BCM5482: Shadow registers
* Shadow values go into bits [14:10] of register 0x1c to select a shadow
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode
2025-06-20 13:44 ` [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode Kamil Horák (2N)
@ 2025-06-20 15:19 ` Andrew Lunn
2025-06-23 8:17 ` Kamil Horák (2N)
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2025-06-20 15:19 UTC (permalink / raw)
To: Kamil Horák (2N)
Cc: florian.fainelli, bcm-kernel-feedback-list, hkallweit1, linux,
davem, edumazet, kuba, pabeni, krzk+dt, conor+dt, netdev,
devicetree, linux-kernel, robh
On Fri, Jun 20, 2025 at 03:44:28PM +0200, Kamil Horák (2N) wrote:
> The Broadcom bcm54810 and bcm54811 PHYs are capable to operate in
> simplified MII mode, without TXER, RXER, CRS and COL signals as defined
> for the MII. While the PHY can be strapped for MII mode, the selection
> between MII and MII-Lite must be done by software.
Please could you say more about what mii-lite is. Rather than adding a
bool DT property, i'm asking myself should we add interface mode for
it?
Is it a mode of its own? MII normally means Fast Ethernet, 100Mbps. Is
that what MII-Lite supports? How does it differ from RMII? Should we
be calling this PHY_INTERFACE_MODE_LMII?
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode
2025-06-20 15:19 ` Andrew Lunn
@ 2025-06-23 8:17 ` Kamil Horák (2N)
0 siblings, 0 replies; 6+ messages in thread
From: Kamil Horák (2N) @ 2025-06-23 8:17 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev
I wouldn't consider MII-Lite a separate mode (like eg. RMII), only a
special case of MII with just those four signals not connected. As far I
understand it, there is no need to configure the MAC for MII-Lite if the
MAC input signals (RXER, CRS, COL) stay inactive. Because if missing COL
(Collision), half duplex cannot be supported. The clock is limited to 25
MHz, thus no gigabit. Besides 100Mbps, also 10Mbps, full duplex is
supported with 2.5 MHz MII clock.
At least in the case of Broadcom PHYs, only the PHY must be explicitly
told to switch to MII-Lite. No problem with the impossibility of half
duplex, because all BroadR-Reach modes are full duplex only.
In turn, the RMII has less data lines (only two) and the MAC needs to be
configured differently so it is clearly a another mode.
Kamil
On 6/20/25 17:19, Andrew Lunn wrote:
> On Fri, Jun 20, 2025 at 03:44:28PM +0200, Kamil Horák (2N) wrote:
>> The Broadcom bcm54810 and bcm54811 PHYs are capable to operate in
>> simplified MII mode, without TXER, RXER, CRS and COL signals as defined
>> for the MII. While the PHY can be strapped for MII mode, the selection
>> between MII and MII-Lite must be done by software.
>
> Please could you say more about what mii-lite is. Rather than adding a
> bool DT property, i'm asking myself should we add interface mode for
> it?
>
> Is it a mode of its own? MII normally means Fast Ethernet, 100Mbps. Is
> that what MII-Lite supports? How does it differ from RMII? Should we
> be calling this PHY_INTERFACE_MODE_LMII?
>
> Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] net: phy: bcm54811: Fix the PHY initialization
2025-06-20 13:44 [PATCH 0/3] net: phy: bcm54811: Fix the PHY initialization Kamil Horák (2N)
2025-06-20 13:44 ` [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode Kamil Horák (2N)
@ 2025-06-20 13:44 ` Kamil Horák (2N)
2025-06-20 13:44 ` [PATCH 3/3] dt-bindings: ethernet-phy: add optional mii-lite-mode flag Kamil Horák (2N)
2 siblings, 0 replies; 6+ messages in thread
From: Kamil Horák (2N) @ 2025-06-20 13:44 UTC (permalink / raw)
To: florian.fainelli, bcm-kernel-feedback-list, andrew, hkallweit1,
linux, davem, edumazet, kuba, pabeni, krzk+dt, conor+dt
Cc: kamilh, netdev, devicetree, linux-kernel, robh
Reset the bit 12 in PHY's LRE Control register upon initialization.
According to the datasheet, this bit must be written to zero after
every device reset.
Signed-off-by: Kamil Horák (2N) <kamilh@axis.com>
---
drivers/net/phy/broadcom.c | 22 ++++++++++++++++++++--
include/linux/brcmphy.h | 1 +
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 9b1de54fd483..75dbb88bec5a 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -420,11 +420,29 @@ static int bcm54811_config_init(struct phy_device *phydev)
return err;
}
+ err = bcm5481x_set_brrmode(phydev, priv->brr_mode);
+ if (err < 0)
+ return err;
+
/* With BCM54811, BroadR-Reach implies no autoneg */
- if (priv->brr_mode)
+ if (priv->brr_mode) {
phydev->autoneg = 0;
+ /* Disable Long Distance Signaling, the BRR mode autoneg */
+ err = phy_modify(phydev, MII_BCM54XX_LRECR, LRECR_LDSEN, 0);
+ if (err < 0)
+ return err;
+ }
- return bcm5481x_set_brrmode(phydev, priv->brr_mode);
+ if (!phy_interface_is_rgmii(phydev) ||
+ phydev->interface == PHY_INTERFACE_MODE_MII) {
+ /* Misc Control: GMII/MII Mode (not RGMII) */
+ err = bcm54xx_auxctl_write(phydev,
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN |
+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD
+ );
+ }
+ return err;
}
static int bcm54xx_config_init(struct phy_device *phydev)
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 028b3e00378e..350846b010e9 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -137,6 +137,7 @@
#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07
#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010
+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD 0x0060
#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_EN 0x0080
#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100
#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] dt-bindings: ethernet-phy: add optional mii-lite-mode flag
2025-06-20 13:44 [PATCH 0/3] net: phy: bcm54811: Fix the PHY initialization Kamil Horák (2N)
2025-06-20 13:44 ` [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode Kamil Horák (2N)
2025-06-20 13:44 ` [PATCH 1/3] net: phy: bcm54811: Fix the PHY initialization Kamil Horák (2N)
@ 2025-06-20 13:44 ` Kamil Horák (2N)
2 siblings, 0 replies; 6+ messages in thread
From: Kamil Horák (2N) @ 2025-06-20 13:44 UTC (permalink / raw)
To: florian.fainelli, bcm-kernel-feedback-list, andrew, hkallweit1,
linux, davem, edumazet, kuba, pabeni, krzk+dt, conor+dt
Cc: kamilh, netdev, devicetree, linux-kernel, robh
The Broadcom bcm54810 and bcm54811 PHYs support MII and MII-Lite
interface modes. The MII-Lite mode does not use TXR, RXER, CRS and COL
signals. However, the hardware strapping only selects MII mode,
distinction between MII and MII-Lite must be done by software.
Add optional mii-lite-mode flag to switch the PHY to MII-Lite mode.
Signed-off-by: Kamil Horák (2N) <kamilh@axis.com>
---
Documentation/devicetree/bindings/net/ethernet-phy.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
index 71e2cd32580f..edfd16044770 100644
--- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml
@@ -101,6 +101,14 @@ properties:
1BR-10 names. The PHY must be configured to operate in BroadR-Reach mode
by software.
+ mii-lite-mode:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ If set, indicates the use of MII-Lite variant of MII, without the
+ functions of TXER, RXER, CRS and COL signals for Broadcom PHYs. These
+ PHYs can be strapped to use MII mode but the MII or MII-Lite selection
+ must be done by software.
+
clocks:
maxItems: 1
description:
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread