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>
This commit is contained in:
Jakub Kicinski
2025-04-10 18:31:56 -07:00
3 changed files with 18 additions and 14 deletions
@@ -34,16 +34,6 @@ struct tegra_eqos {
struct gpio_desc *reset;
};
static struct clk *dwc_eth_find_clk(struct plat_stmmacenet_data *plat_dat,
const char *name)
{
for (int i = 0; i < plat_dat->num_clks; i++)
if (strcmp(plat_dat->clks[i].id, name) == 0)
return plat_dat->clks[i].clk;
return NULL;
}
static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat)
{
@@ -132,7 +122,7 @@ static int dwc_qos_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *stmmac_res)
{
plat_dat->pclk = dwc_eth_find_clk(plat_dat, "phy_ref_clk");
plat_dat->pclk = stmmac_pltfr_find_clk(plat_dat, "phy_ref_clk");
return 0;
}
@@ -242,7 +232,7 @@ static int tegra_eqos_probe(struct platform_device *pdev,
if (!is_of_node(dev->fwnode))
goto bypass_clk_reset_gpio;
plat_dat->clk_tx_i = dwc_eth_find_clk(plat_dat, "tx");
plat_dat->clk_tx_i = stmmac_pltfr_find_clk(plat_dat, "tx");
eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH);
if (IS_ERR(eqos->reset)) {
@@ -362,8 +352,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
if (ret)
return dev_err_probe(&pdev->dev, ret, "Failed to enable clocks\n");
plat_dat->stmmac_clk = dwc_eth_find_clk(plat_dat,
data->stmmac_clk_name);
plat_dat->stmmac_clk = stmmac_pltfr_find_clk(plat_dat,
data->stmmac_clk_name);
if (data->probe)
ret = data->probe(pdev, plat_dat, &stmmac_res);
@@ -709,6 +709,17 @@ devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
#endif /* CONFIG_OF */
EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt);
struct clk *stmmac_pltfr_find_clk(struct plat_stmmacenet_data *plat_dat,
const char *name)
{
for (int i = 0; i < plat_dat->num_clks; i++)
if (strcmp(plat_dat->clks[i].id, name) == 0)
return plat_dat->clks[i].clk;
return NULL;
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_find_clk);
int stmmac_get_platform_resources(struct platform_device *pdev,
struct stmmac_resources *stmmac_res)
{
@@ -14,6 +14,9 @@
struct plat_stmmacenet_data *
devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac);
struct clk *stmmac_pltfr_find_clk(struct plat_stmmacenet_data *plat_dat,
const char *name);
int stmmac_get_platform_resources(struct platform_device *pdev,
struct stmmac_resources *stmmac_res);