* [PATCH net-next v2 0/2] net: lan743x: add RMII support for PCI11x1x
@ 2026-05-26 15:40 Thangaraj Samynathan
2026-05-26 15:40 ` [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection " Thangaraj Samynathan
2026-05-26 15:40 ` [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface Thangaraj Samynathan
0 siblings, 2 replies; 6+ messages in thread
From: Thangaraj Samynathan @ 2026-05-26 15:40 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, bryan.whitehead,
UNGLinuxDriver, linux-kernel
This series adds RMII interface support for the Microchip PCI11x1x
Ethernet controller.
The PCI11x1x device supports RMII as an alternative MAC-PHY interface,
selected via the STRAP_READ software strap register. Patch 1 reads the
RMII strap bits from this register and sets the is_rmii_en flag. Patch 2
uses this flag to configure the PHY interface mode, phylink supported
interfaces, and enables RMII in hardware via the RMII_CTL register.
Change Log:
===========
v1 -> v2:
- Remove redundant mac_capabilities &= ~MAC_1000FD; phylink already
handles capability reduction for RMII via phy_caps_from_interface()
[patch 2/2]
Thangaraj Samynathan (2):
net: lan743x: add RMII strap status detection for PCI11x1x
net: lan743x: add support for RMII interface
drivers/net/ethernet/microchip/lan743x_main.c | 24 +++++++++++++++++++
drivers/net/ethernet/microchip/lan743x_main.h | 6 +++++
2 files changed, 30 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection for PCI11x1x
2026-05-26 15:40 [PATCH net-next v2 0/2] net: lan743x: add RMII support for PCI11x1x Thangaraj Samynathan
@ 2026-05-26 15:40 ` Thangaraj Samynathan
2026-05-26 16:40 ` Andrew Lunn
2026-05-26 15:40 ` [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface Thangaraj Samynathan
1 sibling, 1 reply; 6+ messages in thread
From: Thangaraj Samynathan @ 2026-05-26 15:40 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, bryan.whitehead,
UNGLinuxDriver, linux-kernel
Extend pci11x1x_strap_get_status() to read the RMII strap bits from
the STRAP_READ register. The is_rmii_en flag is initialized to
false and updated based on the hardware strap only if SGMII is not
already enabled. This ensures correct interface identification during
adapter initialization.
Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 7 +++++++
drivers/net/ethernet/microchip/lan743x_main.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index f3332417162e..7d6ffaf13b5e 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -42,6 +42,7 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
u32 strap;
int ret;
+ adapter->is_rmii_en = false;
/* Timeout = 100 (i.e. 1 sec (10 msce * 100)) */
ret = lan743x_hs_syslock_acquire(adapter, 100);
if (ret < 0) {
@@ -73,6 +74,12 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
adapter->is_sgmii_en = false;
}
}
+
+ if (!adapter->is_sgmii_en && strap & STRAP_READ_USE_RMII_EN_) {
+ if (strap & STRAP_READ_RMII_EN_)
+ adapter->is_rmii_en = true;
+ }
+
netif_dbg(adapter, drv, adapter->netdev,
"SGMII I/F %sable\n", adapter->is_sgmii_en ? "En" : "Dis");
}
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 160d94a7cee6..1d7d37456553 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.h
+++ b/drivers/net/ethernet/microchip/lan743x_main.h
@@ -36,7 +36,9 @@
#define FPGA_SGMII_OP BIT(24)
#define STRAP_READ (0x0C)
+#define STRAP_READ_USE_RMII_EN_ BIT(23)
#define STRAP_READ_USE_SGMII_EN_ BIT(22)
+#define STRAP_READ_RMII_EN_ BIT(7)
#define STRAP_READ_SGMII_EN_ BIT(6)
#define STRAP_READ_SGMII_REFCLK_ BIT(5)
#define STRAP_READ_SGMII_2_5G_ BIT(4)
@@ -1071,6 +1073,7 @@ struct lan743x_adapter {
struct lan743x_rx rx[LAN743X_USED_RX_CHANNELS];
bool is_pci11x1x;
bool is_sgmii_en;
+ bool is_rmii_en;
/* protect ethernet syslock */
spinlock_t eth_syslock_spinlock;
bool eth_syslock_en;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface
2026-05-26 15:40 [PATCH net-next v2 0/2] net: lan743x: add RMII support for PCI11x1x Thangaraj Samynathan
2026-05-26 15:40 ` [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection " Thangaraj Samynathan
@ 2026-05-26 15:40 ` Thangaraj Samynathan
2026-05-26 16:49 ` Andrew Lunn
1 sibling, 1 reply; 6+ messages in thread
From: Thangaraj Samynathan @ 2026-05-26 15:40 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, bryan.whitehead,
UNGLinuxDriver, linux-kernel
Enable RMII interface in the lan743x driver for PHY and MAC
configuration.
- Select RMII interface in lan743x_phy_interface_select().
- Update phylink supported_interfaces and MAC capabilities.
- Enable RMII via RMII_CTL in lan743x_hardware_init().
- Define RMII_CTL register and enable bit in lan743x_main.h.
Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 17 +++++++++++++++++
drivers/net/ethernet/microchip/lan743x_main.h | 3 +++
2 files changed, 20 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 7d6ffaf13b5e..1c0484c4705d 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1370,6 +1370,8 @@ static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)
if (adapter->is_pci11x1x && adapter->is_sgmii_en)
adapter->phy_interface = PHY_INTERFACE_MODE_SGMII;
+ else if (adapter->is_pci11x1x && adapter->is_rmii_en)
+ adapter->phy_interface = PHY_INTERFACE_MODE_RMII;
else if (id_rev == ID_REV_ID_LAN7430_)
adapter->phy_interface = PHY_INTERFACE_MODE_GMII;
else if ((id_rev == ID_REV_ID_LAN7431_) && (data & MAC_CR_MII_EN_))
@@ -3158,6 +3160,12 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
__set_bit(PHY_INTERFACE_MODE_MII,
adapter->phylink_config.supported_interfaces);
break;
+ case PHY_INTERFACE_MODE_RMII:
+ __set_bit(PHY_INTERFACE_MODE_RMII,
+ adapter->phylink_config.supported_interfaces);
+ adapter->phylink_config.lpi_capabilities = 0;
+ break;
+
default:
phy_interface_set_rgmii(adapter->phylink_config.supported_interfaces);
}
@@ -3165,6 +3173,9 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
memcpy(adapter->phylink_config.lpi_interfaces,
adapter->phylink_config.supported_interfaces,
sizeof(adapter->phylink_config.lpi_interfaces));
+ if (adapter->phy_interface == PHY_INTERFACE_MODE_RMII)
+ __clear_bit(PHY_INTERFACE_MODE_RMII,
+ adapter->phylink_config.lpi_interfaces);
pl = phylink_create(&adapter->phylink_config, NULL,
adapter->phy_interface, &lan743x_phylink_mac_ops);
@@ -3509,6 +3520,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
{
struct lan743x_tx *tx;
u32 sgmii_ctl;
+ u32 rmii_ctl;
int index;
int ret;
@@ -3530,6 +3542,11 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
sgmii_ctl |= SGMII_CTL_SGMII_POWER_DN_;
}
lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
+ if (adapter->is_rmii_en) {
+ rmii_ctl = lan743x_csr_read(adapter, RMII_CTL);
+ rmii_ctl |= RMII_CTL_RMII_ENABLE_;
+ lan743x_csr_write(adapter, RMII_CTL, rmii_ctl);
+ }
} else {
adapter->max_tx_channels = LAN743X_MAX_TX_CHANNELS;
adapter->used_tx_channels = LAN743X_USED_TX_CHANNELS;
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 1d7d37456553..03f3727ed8f7 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.h
+++ b/drivers/net/ethernet/microchip/lan743x_main.h
@@ -324,6 +324,9 @@
#define MAC_WUCSR2_IPV6_TCPSYN_RCD_ BIT(5)
#define MAC_WUCSR2_IPV4_TCPSYN_RCD_ BIT(4)
+#define RMII_CTL (0x710)
+#define RMII_CTL_RMII_ENABLE_ BIT(0)
+
#define SGMII_ACC (0x720)
#define SGMII_ACC_SGMII_BZY_ BIT(31)
#define SGMII_ACC_SGMII_WR_ BIT(30)
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection for PCI11x1x
2026-05-26 15:40 ` [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection " Thangaraj Samynathan
@ 2026-05-26 16:40 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2026-05-26 16:40 UTC (permalink / raw)
To: Thangaraj Samynathan
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni,
bryan.whitehead, UNGLinuxDriver, linux-kernel
> + if (!adapter->is_sgmii_en && strap & STRAP_READ_USE_RMII_EN_) {
> + if (strap & STRAP_READ_RMII_EN_)
> + adapter->is_rmii_en = true;
> + }
What does it mean when both SGMII and RMII is strapped? What if
neither is strapped?
> +
> netif_dbg(adapter, drv, adapter->netdev,
> "SGMII I/F %sable\n", adapter->is_sgmii_en ? "En" : "Dis");
Since there is a netif_dbg() for sgmii, maybe add one for rmii, so the
code is somewhat symmetrical?
> struct lan743x_rx rx[LAN743X_USED_RX_CHANNELS];
> bool is_pci11x1x;
> bool is_sgmii_en;
> + bool is_rmii_en;
Are there other strapping bits? Are we going to get is_gmii_en, and
is_rgmii_en?
Does a collection of bools make sense, when the interface modes are
typically mutually exclusive at the hardware level? Would an enum be
better? Or why not phy_interface_t ?
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface
2026-05-26 15:40 ` [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface Thangaraj Samynathan
@ 2026-05-26 16:49 ` Andrew Lunn
2026-05-26 19:59 ` Nicolai Buchwitz
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-05-26 16:49 UTC (permalink / raw)
To: Thangaraj Samynathan
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni,
bryan.whitehead, UNGLinuxDriver, linux-kernel
On Tue, May 26, 2026 at 09:10:54PM +0530, Thangaraj Samynathan wrote:
> Enable RMII interface in the lan743x driver for PHY and MAC
> configuration.
>
> - Select RMII interface in lan743x_phy_interface_select().
> - Update phylink supported_interfaces and MAC capabilities.
> - Enable RMII via RMII_CTL in lan743x_hardware_init().
> - Define RMII_CTL register and enable bit in lan743x_main.h.
> + case PHY_INTERFACE_MODE_RMII:
> + __set_bit(PHY_INTERFACE_MODE_RMII,
> + adapter->phylink_config.supported_interfaces);
> + adapter->phylink_config.lpi_capabilities = 0;
So EEE is not supporting with RMII? This is not mentioned in the
commit message.
Humm, is this an 802.3 limitation, or a limitation of this hardware?
If this is 802.3, then this should be in phylink, not drivers.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface
2026-05-26 16:49 ` Andrew Lunn
@ 2026-05-26 19:59 ` Nicolai Buchwitz
0 siblings, 0 replies; 6+ messages in thread
From: Nicolai Buchwitz @ 2026-05-26 19:59 UTC (permalink / raw)
To: Andrew Lunn
Cc: Thangaraj Samynathan, netdev, andrew+netdev, davem, edumazet,
kuba, pabeni, bryan.whitehead, UNGLinuxDriver, linux-kernel
Hi Andrew
On 26.5.2026 18:49, Andrew Lunn wrote:
> On Tue, May 26, 2026 at 09:10:54PM +0530, Thangaraj Samynathan wrote:
>> Enable RMII interface in the lan743x driver for PHY and MAC
>> configuration.
>>
>> - Select RMII interface in lan743x_phy_interface_select().
>> - Update phylink supported_interfaces and MAC capabilities.
>> - Enable RMII via RMII_CTL in lan743x_hardware_init().
>> - Define RMII_CTL register and enable bit in lan743x_main.h.
>
>> + case PHY_INTERFACE_MODE_RMII:
>> + __set_bit(PHY_INTERFACE_MODE_RMII,
>> + adapter->phylink_config.supported_interfaces);
>> + adapter->phylink_config.lpi_capabilities = 0;
>
> So EEE is not supporting with RMII? This is not mentioned in the
> commit message.
>
> Humm, is this an 802.3 limitation, or a limitation of this hardware?
I do not think this is specific to the lan743x. Linux drives EEE from
the MAC side, so mac_enable_tx_lpi() has to signal "assert LPI" to the
PHY across the xMII. On MII and GMII the MAC signals LPI using TX_ER,
and AFAICT RMII has a reduced pin set with no TX_ER, so the MAC has no
standard way to request LPI over RMII. So IMHO EEE does not really
apply to RMII in general, not only on this controller. Please correct
me if I am missing something here.
Today drivers seem to express this themselves through lpi_interfaces.
stmmac is the clearest example I found, in stmmac_phy_setup():
/* The GMAC 3.74a databook states that EEE is only supported
* in MII, GMII, and RGMII interfaces.
*/
__set_bit(PHY_INTERFACE_MODE_MII, config->lpi_interfaces);
__set_bit(PHY_INTERFACE_MODE_GMII, config->lpi_interfaces);
phy_interface_set_rgmii(config->lpi_interfaces);
It deliberately leaves RMII out, and phylink_activate_lpi() then
refuses LPI when cur_interface is not in lpi_interfaces.
> If this is 802.3, then this should be in phylink, not drivers.
Since this seems generic, I agree it belongs in phylink rather than
each driver. I can send a patch excluding RMII (and probably REVRMII)
from EEE centrally, so drivers do not need to special-case it.
>
> Andrew
Nicolai
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-05-26 20:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 15:40 [PATCH net-next v2 0/2] net: lan743x: add RMII support for PCI11x1x Thangaraj Samynathan
2026-05-26 15:40 ` [PATCH net-next v2 1/2] net: lan743x: add RMII strap status detection " Thangaraj Samynathan
2026-05-26 16:40 ` Andrew Lunn
2026-05-26 15:40 ` [PATCH net-next v2 2/2] net: lan743x: add support for RMII interface Thangaraj Samynathan
2026-05-26 16:49 ` Andrew Lunn
2026-05-26 19:59 ` Nicolai Buchwitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox