Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-stmmac-stmmac_pltfr_find_clk'

Russell King says:

====================
net: stmmac: stmmac_pltfr_find_clk()

The GBETH glue driver that is being proposed duplicates the clock
finding from the bulk clock data in the stmmac platform data structure.
iLet's provide a generic implementation that glue drivers can use, and
convert dwc-qos-eth to use it.
====================

Link: https://patch.msgid.link/Z_Yn3dJjzcOi32uU@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+18 -14
+4 -14
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
··· 34 34 struct gpio_desc *reset; 35 35 }; 36 36 37 - static struct clk *dwc_eth_find_clk(struct plat_stmmacenet_data *plat_dat, 38 - const char *name) 39 - { 40 - for (int i = 0; i < plat_dat->num_clks; i++) 41 - if (strcmp(plat_dat->clks[i].id, name) == 0) 42 - return plat_dat->clks[i].clk; 43 - 44 - return NULL; 45 - } 46 - 47 37 static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, 48 38 struct plat_stmmacenet_data *plat_dat) 49 39 { ··· 122 132 struct plat_stmmacenet_data *plat_dat, 123 133 struct stmmac_resources *stmmac_res) 124 134 { 125 - plat_dat->pclk = dwc_eth_find_clk(plat_dat, "phy_ref_clk"); 135 + plat_dat->pclk = stmmac_pltfr_find_clk(plat_dat, "phy_ref_clk"); 126 136 127 137 return 0; 128 138 } ··· 232 242 if (!is_of_node(dev->fwnode)) 233 243 goto bypass_clk_reset_gpio; 234 244 235 - plat_dat->clk_tx_i = dwc_eth_find_clk(plat_dat, "tx"); 245 + plat_dat->clk_tx_i = stmmac_pltfr_find_clk(plat_dat, "tx"); 236 246 237 247 eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH); 238 248 if (IS_ERR(eqos->reset)) { ··· 352 362 if (ret) 353 363 return dev_err_probe(&pdev->dev, ret, "Failed to enable clocks\n"); 354 364 355 - plat_dat->stmmac_clk = dwc_eth_find_clk(plat_dat, 356 - data->stmmac_clk_name); 365 + plat_dat->stmmac_clk = stmmac_pltfr_find_clk(plat_dat, 366 + data->stmmac_clk_name); 357 367 358 368 if (data->probe) 359 369 ret = data->probe(pdev, plat_dat, &stmmac_res);
+11
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 709 709 #endif /* CONFIG_OF */ 710 710 EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt); 711 711 712 + struct clk *stmmac_pltfr_find_clk(struct plat_stmmacenet_data *plat_dat, 713 + const char *name) 714 + { 715 + for (int i = 0; i < plat_dat->num_clks; i++) 716 + if (strcmp(plat_dat->clks[i].id, name) == 0) 717 + return plat_dat->clks[i].clk; 718 + 719 + return NULL; 720 + } 721 + EXPORT_SYMBOL_GPL(stmmac_pltfr_find_clk); 722 + 712 723 int stmmac_get_platform_resources(struct platform_device *pdev, 713 724 struct stmmac_resources *stmmac_res) 714 725 {
+3
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
··· 14 14 struct plat_stmmacenet_data * 15 15 devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac); 16 16 17 + struct clk *stmmac_pltfr_find_clk(struct plat_stmmacenet_data *plat_dat, 18 + const char *name); 19 + 17 20 int stmmac_get_platform_resources(struct platform_device *pdev, 18 21 struct stmmac_resources *stmmac_res); 19 22