[PATCH net-next v4 1/2] net: lan743x: add RMII strap status detection for PCI11x1x
From: Thangaraj Samynathan
Date: Wed Jun 17 2026 - 01:33:47 EST
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.
Signed-off-by: Thangaraj Samynathan <thangaraj.s@xxxxxxxxxxxxx>
---
drivers/net/ethernet/microchip/lan743x_main.c | 12 ++++++++++--
drivers/net/ethernet/microchip/lan743x_main.h | 3 +++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 1cdce35e1423..0798f3f1f435 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,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)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 1573c8f9c993..1f8d9294a6ef 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)
@@ -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;
--
2.34.1