public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: macb: Set MDIO clock divisor for pclk higher than 160MHz
@ 2023-03-16 10:03 Bartosz Wawrzyniak
  2023-03-16 10:35 ` Michal Kubiak
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bartosz Wawrzyniak @ 2023-03-16 10:03 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, nicolas.ferre, claudiu.beznea
  Cc: netdev, linux-kernel, xe-linux-external, danielwa, olicht,
	mawierzb, Bartosz Wawrzyniak

Currently macb sets clock divisor for pclk up to 160 MHz.
Function gem_mdc_clk_div was updated to enable divisor
for higher values of pclk.

Signed-off-by: Bartosz Wawrzyniak <bwawrzyn@cisco.com>
---
 drivers/net/ethernet/cadence/macb.h      | 2 ++
 drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 14dfec4db8f9..c1fc91c97cee 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -692,6 +692,8 @@
 #define GEM_CLK_DIV48				3
 #define GEM_CLK_DIV64				4
 #define GEM_CLK_DIV96				5
+#define GEM_CLK_DIV128				6
+#define GEM_CLK_DIV224				7
 
 /* Constants for MAN register */
 #define MACB_MAN_C22_SOF			1
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 6e141a8bbf43..8708af6d25ed 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2641,8 +2641,12 @@ static u32 gem_mdc_clk_div(struct macb *bp)
 		config = GEM_BF(CLK, GEM_CLK_DIV48);
 	else if (pclk_hz <= 160000000)
 		config = GEM_BF(CLK, GEM_CLK_DIV64);
-	else
+	else if (pclk_hz <= 240000000)
 		config = GEM_BF(CLK, GEM_CLK_DIV96);
+	else if (pclk_hz <= 320000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV128);
+	else
+		config = GEM_BF(CLK, GEM_CLK_DIV224);
 
 	return config;
 }
-- 
2.33.0


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

end of thread, other threads:[~2023-03-19  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-16 10:03 [PATCH] net: macb: Set MDIO clock divisor for pclk higher than 160MHz Bartosz Wawrzyniak
2023-03-16 10:35 ` Michal Kubiak
2023-03-16 16:11 ` Nicolas Ferre
2023-03-16 19:34 ` Andrew Lunn
2023-03-17 14:02   ` Nicolas Ferre
2023-03-17 14:28     ` Andrew Lunn
2023-03-19  8:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox