netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] gianfar: Don't force RGMII mode after reset, use defaults
@ 2019-11-12 14:55 Claudiu Manoil
  2019-11-12 16:47 ` Daniel Walker
  2019-11-21 15:58 ` Daniel Walker (danielwa)
  0 siblings, 2 replies; 11+ messages in thread
From: Claudiu Manoil @ 2019-11-12 14:55 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, danielwa

We received reports that forcing the MAC into RGMII (1 Gbps)
interface mode after MAC reset occasionally disrupts operation
of PHYs capable only of 100Mbps, even after adjust_link kicks
in and re-adjusts the interface mode in MACCFG2 accordingly.
Instead of forcing MACCFG2 into RGMII mode, let's use the default
reset value of MACCFG2 (that leaves the IF_Mode field unset) and
let adjust_link configure the correct mode from the beginning.
MACCFG2_INIT_SETTINGS is dropped, only the PAD_CRC bit is preserved,
the remaining fields (IF_Mode and Duplex) are left for adjust_link.
Tested on boards with gigabit PHYs.

MACCFG2_INIT_SETTINGS is there since day one, but the issue
got visible after introducing the MAC reset and reconfig support,
which added MAC reset at runtime, at interface open.

Fixes: a328ac92d314 ("gianfar: Implement MAC reset and reconfig procedure")

Reported-by: Daniel Walker <danielwa@cisco.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
---
 drivers/net/ethernet/freescale/gianfar.c | 3 ++-
 drivers/net/ethernet/freescale/gianfar.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 51ad864..0f4d13d 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3173,7 +3173,8 @@ void gfar_mac_reset(struct gfar_private *priv)
 	gfar_write(&regs->minflr, MINFLR_INIT_SETTINGS);
 
 	/* Initialize MACCFG2. */
-	tempval = MACCFG2_INIT_SETTINGS;
+	tempval = gfar_read(&regs->maccfg2);
+	tempval |= MACCFG2_PAD_CRC;
 
 	/* eTSEC74 erratum: Rx frames of length MAXFRM or MAXFRM-1
 	 * are marked as truncated.  Avoid this by MACCFG2[Huge Frame]=1,
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h
index f472a6d..cc70e03 100644
--- a/drivers/net/ethernet/freescale/gianfar.h
+++ b/drivers/net/ethernet/freescale/gianfar.h
@@ -150,8 +150,8 @@ extern const char gfar_driver_version[];
 #define MACCFG1_SYNCD_TX_EN	0x00000002
 #define MACCFG1_TX_EN		0x00000001
 
-#define MACCFG2_INIT_SETTINGS	0x00007205
 #define MACCFG2_FULL_DUPLEX	0x00000001
+#define MACCFG2_PAD_CRC         0x00000004
 #define MACCFG2_IF              0x00000300
 #define MACCFG2_MII             0x00000100
 #define MACCFG2_GMII            0x00000200
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-02-20 11:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 14:55 [PATCH net] gianfar: Don't force RGMII mode after reset, use defaults Claudiu Manoil
2019-11-12 16:47 ` Daniel Walker
2019-11-12 16:55   ` HEMANT RAMDASI (hramdasi)
2019-11-12 17:09     ` Claudiu Manoil
2019-11-12 17:28       ` HEMANT RAMDASI (hramdasi)
2019-11-13 14:00         ` Claudiu Manoil
2019-11-13 14:21           ` HEMANT RAMDASI (hramdasi)
2019-11-13 16:01             ` Claudiu Manoil
2020-02-19 18:57               ` Daniel Walker (danielwa)
2020-02-20 11:42                 ` Claudiu Manoil
2019-11-21 15:58 ` Daniel Walker (danielwa)

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).