* [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx B0+ during warm reset
@ 2026-03-05 9:03 Thangaraj Samynathan
2026-03-10 1:46 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Thangaraj Samynathan @ 2026-03-05 9:03 UTC (permalink / raw)
To: bryan.whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
kuba, pabeni, netdev, linux-kernel
A warm reset on boards using an EEPROM-only strap configuration (where
no MAC address is set in the image) can cause the driver to incorrectly
revert to RGMII mode. This occurs because the ENET_CONFIG_LOAD_STARTED
bit may not persist or behave as expected.
Update pci11x1x_strap_get_status() to use revision-specific validation:
- For PCI11x1x A0: Continue using the legacy check (config load started
or reset protection) to validate the SGMII strap.
- For PCI11x1x B0 and later: Use the newly available
STRAP_READ_USE_SGMII_EN_ bit in the upper strap register to validate
the lower SGMII_EN bit.
This ensures the SGMII interface is correctly identified even after a
warm reboot.
Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 11 +++++++----
drivers/net/ethernet/microchip/lan743x_main.h | 1 +
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index a3845edf0e48..866f6a3da0d9 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -32,10 +32,12 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
{
u32 chip_rev;
u32 cfg_load;
+ u32 dev_rev;
u32 hw_cfg;
u32 strap;
int ret;
+ dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
/* Timeout = 100 (i.e. 1 sec (10 msce * 100)) */
ret = lan743x_hs_syslock_acquire(adapter, 100);
if (ret < 0) {
@@ -47,10 +49,11 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
cfg_load = lan743x_csr_read(adapter, ETH_SYS_CONFIG_LOAD_STARTED_REG);
lan743x_hs_syslock_release(adapter);
hw_cfg = lan743x_csr_read(adapter, HW_CFG);
-
- if (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
- hw_cfg & HW_CFG_RST_PROTECT_) {
- strap = lan743x_csr_read(adapter, STRAP_READ);
+ strap = lan743x_csr_read(adapter, STRAP_READ);
+ if ((dev_rev == ID_REV_CHIP_REV_PCI11X1X_A0_ &&
+ (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
+ hw_cfg & HW_CFG_RST_PROTECT_)) ||
+ (strap & STRAP_READ_USE_SGMII_EN_)) {
if (strap & STRAP_READ_SGMII_EN_)
adapter->is_sgmii_en = true;
else
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 02a28b709163..160d94a7cee6 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.h
+++ b/drivers/net/ethernet/microchip/lan743x_main.h
@@ -27,6 +27,7 @@
#define ID_REV_CHIP_REV_MASK_ (0x0000FFFF)
#define ID_REV_CHIP_REV_A0_ (0x00000000)
#define ID_REV_CHIP_REV_B0_ (0x00000010)
+#define ID_REV_CHIP_REV_PCI11X1X_A0_ (0x000000A0)
#define ID_REV_CHIP_REV_PCI11X1X_B0_ (0x000000B0)
#define FPGA_REV (0x04)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx B0+ during warm reset
2026-03-05 9:03 [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx B0+ during warm reset Thangaraj Samynathan
@ 2026-03-10 1:46 ` Jakub Kicinski
2026-03-10 3:45 ` Thangaraj.S
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2026-03-10 1:46 UTC (permalink / raw)
To: Thangaraj Samynathan
Cc: bryan.whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
pabeni, netdev, linux-kernel
On Thu, 5 Mar 2026 14:33:55 +0530 Thangaraj Samynathan wrote:
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -32,10 +32,12 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> {
> u32 chip_rev;
> u32 cfg_load;
> + u32 dev_rev;
> u32 hw_cfg;
> u32 strap;
> int ret;
>
> + dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
> /* Timeout = 100 (i.e. 1 sec (10 msce * 100)) */
> ret = lan743x_hs_syslock_acquire(adapter, 100);
> if (ret < 0) {
> @@ -47,10 +49,11 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> cfg_load = lan743x_csr_read(adapter, ETH_SYS_CONFIG_LOAD_STARTED_REG);
> lan743x_hs_syslock_release(adapter);
> hw_cfg = lan743x_csr_read(adapter, HW_CFG);
> -
> - if (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
> - hw_cfg & HW_CFG_RST_PROTECT_) {
> - strap = lan743x_csr_read(adapter, STRAP_READ);
> + strap = lan743x_csr_read(adapter, STRAP_READ);
> + if ((dev_rev == ID_REV_CHIP_REV_PCI11X1X_A0_ &&
it may be a good idea to a add a little helper like:
static bool pci11x1x_is_a0(const struct lan743x_adapter *adapter)
{
u32 dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
return dev_rev == ID_REV_CHIP_REV_PCI11X1X_A0_;
}
and same thing for b0?
> + (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
> + hw_cfg & HW_CFG_RST_PROTECT_)) ||
> + (strap & STRAP_READ_USE_SGMII_EN_)) {
I don't think this implements the logic you describe in the commit
message? You say:
For PCI11x1x B0 and later: Use the newly available
STRAP_READ_USE_SGMII_EN_
but your condition will also look at the strap & STRAP_READ_USE_SGMII_EN_
if cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ || hw_cfg & HW_CFG_RST_PROTECT_
is also on A0
--
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx B0+ during warm reset
2026-03-10 1:46 ` Jakub Kicinski
@ 2026-03-10 3:45 ` Thangaraj.S
0 siblings, 0 replies; 3+ messages in thread
From: Thangaraj.S @ 2026-03-10 3:45 UTC (permalink / raw)
To: kuba
Cc: Bryan.Whitehead, UNGLinuxDriver, andrew+netdev, davem, edumazet,
pabeni, netdev, linux-kernel
Hi Jakub,
Thanks for reviewing the patch.
> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Tuesday, March 10, 2026 7:16 AM
> To: Thangaraj Samynathan - I53494 <Thangaraj.S@microchip.com>
> Cc: Bryan Whitehead - C21958 <Bryan.Whitehead@microchip.com>;
> UNGLinuxDriver <UNGLinuxDriver@microchip.com>;
> andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com;
> pabeni@redhat.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx
> B0+ during warm reset
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
>
> On Thu, 5 Mar 2026 14:33:55 +0530 Thangaraj Samynathan wrote:
> > --- a/drivers/net/ethernet/microchip/lan743x_main.c
> > +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> > @@ -32,10 +32,12 @@ static void pci11x1x_strap_get_status(struct
> > lan743x_adapter *adapter) {
> > u32 chip_rev;
> > u32 cfg_load;
> > + u32 dev_rev;
> > u32 hw_cfg;
> > u32 strap;
> > int ret;
> >
> > + dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
> > /* Timeout = 100 (i.e. 1 sec (10 msce * 100)) */
> > ret = lan743x_hs_syslock_acquire(adapter, 100);
> > if (ret < 0) {
> > @@ -47,10 +49,11 @@ static void pci11x1x_strap_get_status(struct
> lan743x_adapter *adapter)
> > cfg_load = lan743x_csr_read(adapter,
> ETH_SYS_CONFIG_LOAD_STARTED_REG);
> > lan743x_hs_syslock_release(adapter);
> > hw_cfg = lan743x_csr_read(adapter, HW_CFG);
> > -
> > - if (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
> > - hw_cfg & HW_CFG_RST_PROTECT_) {
> > - strap = lan743x_csr_read(adapter, STRAP_READ);
> > + strap = lan743x_csr_read(adapter, STRAP_READ);
> > + if ((dev_rev == ID_REV_CHIP_REV_PCI11X1X_A0_ &&
>
> it may be a good idea to a add a little helper like:
>
> static bool pci11x1x_is_a0(const struct lan743x_adapter *adapter) {
> u32 dev_rev = adapter->csr.id_rev & ID_REV_CHIP_REV_MASK_;
>
> return dev_rev == ID_REV_CHIP_REV_PCI11X1X_A0_; }
>
> and same thing for b0?
Sure, I will add the helper in the next revision of the patch.
>
> > + (cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ ||
> > + hw_cfg & HW_CFG_RST_PROTECT_)) ||
> > + (strap & STRAP_READ_USE_SGMII_EN_)) {
>
> I don't think this implements the logic you describe in the commit message?
> You say:
>
> For PCI11x1x B0 and later: Use the newly available
> STRAP_READ_USE_SGMII_EN_
>
> but your condition will also look at the strap & STRAP_READ_USE_SGMII_EN_
> if cfg_load & GEN_SYS_LOAD_STARTED_REG_ETH_ || hw_cfg &
> HW_CFG_RST_PROTECT_ is also on A0
This bit was introduced in B0, but in the earlier version this bit always reads zero and makes no difference.
> --
> pw-bot: cr
Regards,
Thangaraj Samynathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-10 3:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 9:03 [PATCH net-next] net: lan743x: fix SGMII detection on PCI1xxxx B0+ during warm reset Thangaraj Samynathan
2026-03-10 1:46 ` Jakub Kicinski
2026-03-10 3:45 ` Thangaraj.S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox