Re: [PATCH 11/12] net: macb: add SiFive support
From: Sascha Hauer <hidden>
Date: 2021-05-17 06:41:37
On Tue, Apr 27, 2021 at 10:23:08PM +0200, Ahmad Fatoum wrote:
quoted hunk ↗ jump to hunk
The Ethernet controller on the SiFive SoCs needs some special TX clock setup. Port the relevant Linux v5.12 bits to enable it. Tested on qemu-system-riscv64 -M sifive_u with dhcp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/net/macb.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 14a0b45322bf..9c4fdbd5bc4f 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c@@ -52,6 +52,17 @@ #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) #define GEM_Q1_DESC_BYTES (sizeof(struct macb_dma_desc) * GEM_Q1_DESCS) +/* This structure is only used for MACB on SiFive FU540 devices */ +struct sifive_fu540_macb_mgmt { + void __iomem *reg; + unsigned long rate; + struct clk clk; +}; + +struct macb_config { + int (*txclk_init)(struct device_d *dev, struct clk **tx_clk); +}; + struct macb_device { void __iomem *regs;@@ -666,12 +677,101 @@ static void macb_init_rx_buffer_size(struct macb_device *bp, size_t size) size, bp->rx_buffer_size); } +static struct sifive_fu540_macb_mgmt *mgmt; + +static unsigned long fu540_macb_tx_recalc_rate(struct clk *clk, + unsigned long parent_rate) +{ + return mgmt->rate; +}
Unfortunately I had to drop this one. The macb driver is used by some of the old at91 configs which have their own clk implementation. Among other things there is no recalc_rate hook. Can we place the clk code inside a #ifdef CONFIG_COMMON_CLK? Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox