net: stmmac: stmmac_pltfr_find_clk()
Subsystems (4)
cover net: stmmac: stmmac_pltfr_find_clk()
Hi,
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.
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 14 ++------------ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 +++ 3 files changed, 16 insertions(+), 12 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
PATCH 1/2 net: stmmac: provide stmmac_pltfr_find_clk()
Provide a generic way to find a clock in the bulk data.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 +++ 2 files changed, 14 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +11 -0
@@ -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) {
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +3 -0
@@ -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);
Signature · 1 line
2.30.2
Re: [PATCH net-next 1/2] net: stmmac: provide stmmac_pltfr_find_clk()
Quoted 9 lines · Russell King (Oracle)
Provide a generic way to find a clock in the bulk data.
Signed-off-by Russell King (Oracle) <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | 3 +++ 2 files changed, 14 insertions(+)
Cheers,
Prabhakar
Quoted 39 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +11
-0@@ -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) {drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +3
-1@@ -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); --2.30.2
Re: [PATCH net-next 1/2] net: stmmac: provide stmmac_pltfr_find_clk()
In reply to Russell King (Oracle)Quoted 3 lines · Russell King (Oracle)
Provide a generic way to find a clock in the bulk data.
Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
PATCH 2/2 net: stmmac: dwc-qos: use stmmac_pltfr_find_clk()
In reply to Russell King (Oracle)--- .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +2 -12
@@ -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)) {
Signature · 1 line
2.30.2
Re: [PATCH net-next 2/2] net: stmmac: dwc-qos: use stmmac_pltfr_find_clk()
Quoted 6 lines · Russell King (Oracle)
Signed-off-by Russell King (Oracle) <[email protected]>--- .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
Cheers,
Prabhakar
Quoted 42 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +2
-13@@ -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)) { --2.30.2
Re: [PATCH net-next 2/2] net: stmmac: dwc-qos: use stmmac_pltfr_find_clk()
In reply to Russell King (Oracle)Quoted 1 line · Russell King (Oracle)
Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
Jakub Kicinski
maintainerRe: [PATCH net-next 2/2] net: stmmac: dwc-qos: use stmmac_pltfr_find_clk()
In reply to Russell King (Oracle)Quoted 12 lines · On Mon, 07 Apr 2025 19:38:49 +0100 Russell King (Oracle) wrote:
Signed-off-by Russell King (Oracle) <[email protected]>--- .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +0
-0@@ -34,16 +34,6 @@ struct tegra_eqos {struct gpio_desc *reset; };
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c struct tegra_eqos { · line 45
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +0
-9-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 ; -}
Missed one user?
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c:355:25: error: call to undeclared function 'dwc_eth_find_clk'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
355 | plat_dat->stmmac_clk = dwc_eth_find_clk(plat_dat,
| ^drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c:355:23: error: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
355 | plat_dat->stmmac_clk = dwc_eth_find_clk(plat_dat,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
356 | data->stmmac_clk_name);
| ~~~~~~~~~~~~~~~~~~~~~~Signature · 1 line
pw-bot: cr