net: lan743x: add RMII support for PCI11x1x
Subsystems (3)
v5 cover net: lan743x: add RMII support for PCI11x1x
From: Thangaraj Samynathan <[email protected]>
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:
===========
v4 -> v5:
- Always write RMII_CTL with explicit set/clear of RMII_ENABLE_, mirroring the SGMII_CTL pattern for a known register state on every probe [Simon Horman, Paolo Abeni]
v3 -> v4:
- Fix dev_dbg() in lan743x_mdiobus_init() to print "RMII operation" instead of "RGMII operation" when RMII is selected [Simon Horman]
v2 -> v3:
- Update debug log to report selected interface (SGMII/RMII/RGMII) instead of only SGMII enable/disable state [patch 1/2]
- Update commit message to document that EEE is disabled by setting lpi_capabilities = 0 [patch 2/2]
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 | 35 ++++++++++++++++--- drivers/net/ethernet/microchip/lan743x_main.h | 6 ++++ 2 files changed, 37 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
PATCH RESEND v5 1/2 net: lan743x: add RMII strap status detection for PCI11x1x
From: Thangaraj Samynathan <[email protected]>
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.
Update the netif_dbg() to report the selected interface as SGMII, RMII, or RGMII.
--- drivers/net/ethernet/microchip/lan743x_main.c | 12 ++++++++++-- drivers/net/ethernet/microchip/lan743x_main.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/lan743x_main.c +10 -2
@@ -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,8 +74,15 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter) adapter->is_sgmii_en = false; } } -netif_dbg (adapter, drv, adapter->netdev, -"SGMII I/F %sable\n" , adapter->is_sgmii_en ?"En" :"Dis" ); + +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,"Selected I/F: %s\n" , + adapter->is_sgmii_en ?"SGMII" : + adapter->is_rmii_en ?"RMII" :"RGMII" ); }static bool is_pci11x1x_chip (struct lan743x_adapter *adapter)
drivers/net/ethernet/microchip/lan743x_main.h +3 -0
@@ -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)
@@ -1072,6 +1074,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;
Signature · 1 line
2.34.1
Paolo Abeni
maintainerRe: [RESEND PATCH net-next v5 1/2] net: lan743x: add RMII strap status detection for PCI11x1x
Quoted 8 lines · Thangaraj Samynathan
From: Thangaraj Samynathan <[email protected]>
Extend
pci11x1x_strap_get_status()to read the RMII strap bits from theSTRAP_READregister. Theis_rmii_enflag 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.
Quoted 4 lines
Update the
netif_dbg()to report the selected interface as SGMII, RMII, or RGMII.Signed-off-by Thangaraj Samynathan <[email protected]>
Noting that this series splitting confused Sashiko quite a bit, but the reported "issues" is actually addresses by the next patch.
Also noting you should have discussed this point proactively, see net-next commit c82ff94592fb.
/P
PATCH RESEND v5 2/2 net: lan743x: add support for RMII interface
In reply to Thangaraj SamynathanFrom: Thangaraj Samynathan <[email protected]>
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.
EEE is not supported with RMII on PCI11x1x: the hardware does not implement LPI signaling over RMII. Clear RMII from lpi_interfaces to prevent phylink from enabling EEE on this interface.
--- drivers/net/ethernet/microchip/lan743x_main.c | 23 +++++++++++++++++-- drivers/net/ethernet/microchip/lan743x_main.h | 3 +++ 2 files changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/lan743x_main.c +21 -2
@@ -1402,6 +1402,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_ ))
@@ -3190,6 +3192,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); }
@@ -3197,6 +3205,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);
@@ -3541,6 +3552,7 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter, {struct lan743x_tx *tx;u32 sgmii_ctl; +u32 rmii_ctl;int index;int ret;
@@ -3562,6 +3574,12 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter, sgmii_ctl |=SGMII_CTL_SGMII_POWER_DN_ ; }lan743x_csr_write (adapter,SGMII_CTL , sgmii_ctl); + rmii_ctl =lan743x_csr_read (adapter,RMII_CTL ); +if (adapter->is_rmii_en) + rmii_ctl |=RMII_CTL_RMII_ENABLE_ ; +else + 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 ;
@@ -3628,8 +3646,9 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter) adapter->mdiobus->name ="lan743x-mdiobus-c45" ;dev_dbg (&adapter->pdev->dev,"lan743x-mdiobus-c45\n" ); }else { -dev_dbg (&adapter->pdev->dev,"RGMII operation\n" ); -// Only C22 support when RGMII I/F +dev_dbg (&adapter->pdev->dev,"%s operation\n" , + adapter->is_rmii_en ?"RMII" :"RGMII" ); +// Only C22 support when RGMII/RMII I/F adapter->mdiobus->read = lan743x_mdiobus_read_c22; adapter->mdiobus->write = lan743x_mdiobus_write_c22; adapter->mdiobus->name ="lan743x-mdiobus" ;
drivers/net/ethernet/microchip/lan743x_main.h +3 -0
@@ -325,6 +325,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)
Signature · 1 line
2.34.1
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 5 lines · On Thu, 23 Jul 2026 10:38:25 +0530 you wrote:
From: Thangaraj Samynathan <[email protected]>
This series adds RMII interface support for the Microchip PCI11x1x Ethernet controller.
Quoted 7 lines
The PCI11x1x device supports RMII as an alternative MAC-PHY interface, selected via the
STRAP_READsoftware strap register. Patch 1 reads the RMII strap bits from this register and sets theis_rmii_enflag. Patch 2 uses this flag to configure the PHY interface mode, phylink supported interfaces, and enables RMII in hardware via theRMII_CTLregister.[...]
Here is the summary with links:
- [RESEND,net-next,v5,1/2] net: lan743x: add RMII strap status detection for PCI11x1x
https://git.kernel.org/netdev/net-next/c/fc2b13acef67 - [RESEND,net-next,v5,2/2] net: lan743x: add support for RMII interface https://git.kernel.org/netdev/net-next/c/c2e2921d7ade
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html