Skip to content

Commit 7985244

Browse files
xdarklightkuba-moo
authored andcommitted
net: stmmac: dwmac-meson8b: move RGMII delays into a separate function
Newer SoCs starting with the Amlogic Meson G12A have more a precise RGMII RX delay configuration register. This means more complexity in the code. Extract the existing RGMII delay configuration code into a separate function to make it easier to read/understand even when adding more logic in the future. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 140ddf0 commit 7985244

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac,
268268
return 0;
269269
}
270270

271-
static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
271+
static int meson8b_init_rgmii_delays(struct meson8b_dwmac *dwmac)
272272
{
273273
u32 tx_dly_config, rx_dly_config, delay_config;
274274
int ret;
@@ -323,6 +323,13 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
323323
PRG_ETH0_ADJ_DELAY | PRG_ETH0_ADJ_SKEW,
324324
delay_config);
325325

326+
return 0;
327+
}
328+
329+
static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
330+
{
331+
int ret;
332+
326333
if (phy_interface_mode_is_rgmii(dwmac->phy_mode)) {
327334
/* only relevant for RMII mode -> disable in RGMII mode */
328335
meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
@@ -430,6 +437,10 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
430437
goto err_remove_config_dt;
431438
}
432439

440+
ret = meson8b_init_rgmii_delays(dwmac);
441+
if (ret)
442+
goto err_remove_config_dt;
443+
433444
ret = meson8b_init_rgmii_tx_clk(dwmac);
434445
if (ret)
435446
goto err_remove_config_dt;

0 commit comments

Comments
 (0)