From: "Kamil Horák (2N)" <kamilh@axis.com>
To: <florian.fainelli@broadcom.com>,
<bcm-kernel-feedback-list@broadcom.com>, <andrew@lunn.ch>,
<hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>
Cc: <kamilh@axis.com>, <netdev@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<robh@kernel.org>
Subject: [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode
Date: Fri, 20 Jun 2025 15:44:28 +0200 [thread overview]
Message-ID: <20250620134430.1849344-2-kamilh@axis.com> (raw)
In-Reply-To: <20250620134430.1849344-1-kamilh@axis.com>
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
next prev parent reply other threads:[~2025-06-20 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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) [this message]
2025-06-20 15:19 ` [PATCH 2/3] net: phy: bcm5481x: Implement MII-Lite mode Andrew Lunn
2025-06-23 8:17 ` 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 ` [PATCH 3/3] dt-bindings: ethernet-phy: add optional mii-lite-mode flag Kamil Horák (2N)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250620134430.1849344-2-kamilh@axis.com \
--to=kamilh@axis.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).