* [PATCH net-next v3 1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently
2025-02-24 16:53 [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
@ 2025-02-24 16:53 ` Russell King (Oracle)
2025-02-24 20:08 ` Andrew Lunn
2025-02-24 16:53 ` [PATCH net-next v3 2/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Russell King (Oracle) @ 2025-02-24 16:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Most of the stmmac driver uses "plat_dat" to name the platform data,
and "data" is used for the glue driver data. make dwc-qos follow
this pattern to avoid silly mistakes.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 32 +++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 392574bdd4a4..acb0a2e1664f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -224,7 +224,7 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
}
static int tegra_eqos_probe(struct platform_device *pdev,
- struct plat_stmmacenet_data *data,
+ struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res)
{
struct device *dev = &pdev->dev;
@@ -241,12 +241,12 @@ static int tegra_eqos_probe(struct platform_device *pdev,
if (!is_of_node(dev->fwnode))
goto bypass_clk_reset_gpio;
- for (int i = 0; i < data->num_clks; i++) {
- if (strcmp(data->clks[i].id, "slave_bus") == 0) {
- eqos->clk_slave = data->clks[i].clk;
- data->stmmac_clk = eqos->clk_slave;
- } else if (strcmp(data->clks[i].id, "tx") == 0) {
- eqos->clk_tx = data->clks[i].clk;
+ for (int i = 0; i < plat_dat->num_clks; i++) {
+ if (strcmp(plat_dat->clks[i].id, "slave_bus") == 0) {
+ eqos->clk_slave = plat_dat->clks[i].clk;
+ plat_dat->stmmac_clk = eqos->clk_slave;
+ } else if (strcmp(plat_dat->clks[i].id, "tx") == 0) {
+ eqos->clk_tx = plat_dat->clks[i].clk;
}
}
@@ -260,7 +260,7 @@ static int tegra_eqos_probe(struct platform_device *pdev,
gpiod_set_value(eqos->reset, 0);
/* MDIO bus was already reset just above */
- data->mdio_bus_data->needs_reset = false;
+ plat_dat->mdio_bus_data->needs_reset = false;
eqos->rst = devm_reset_control_get(&pdev->dev, "eqos");
if (IS_ERR(eqos->rst)) {
@@ -281,10 +281,10 @@ static int tegra_eqos_probe(struct platform_device *pdev,
usleep_range(2000, 4000);
bypass_clk_reset_gpio:
- data->fix_mac_speed = tegra_eqos_fix_speed;
- data->init = tegra_eqos_init;
- data->bsp_priv = eqos;
- data->flags |= STMMAC_FLAG_SPH_DISABLE;
+ plat_dat->fix_mac_speed = tegra_eqos_fix_speed;
+ plat_dat->init = tegra_eqos_init;
+ plat_dat->bsp_priv = eqos;
+ plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE;
err = tegra_eqos_init(pdev, eqos);
if (err < 0)
@@ -309,7 +309,7 @@ static void tegra_eqos_remove(struct platform_device *pdev)
struct dwc_eth_dwmac_data {
int (*probe)(struct platform_device *pdev,
- struct plat_stmmacenet_data *data,
+ struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res);
void (*remove)(struct platform_device *pdev);
};
@@ -387,15 +387,15 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
static void dwc_eth_dwmac_remove(struct platform_device *pdev)
{
const struct dwc_eth_dwmac_data *data = device_get_match_data(&pdev->dev);
- struct plat_stmmacenet_data *plat_data = dev_get_platdata(&pdev->dev);
+ struct plat_stmmacenet_data *plat_dat = dev_get_platdata(&pdev->dev);
stmmac_dvr_remove(&pdev->dev);
if (data->remove)
data->remove(pdev);
- if (plat_data)
- clk_bulk_disable_unprepare(plat_data->num_clks, plat_data->clks);
+ if (plat_dat)
+ clk_bulk_disable_unprepare(plat_dat->num_clks, plat_dat->clks);
}
static const struct of_device_id dwc_eth_dwmac_match[] = {
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net-next v3 1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently
2025-02-24 16:53 ` [PATCH net-next v3 1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently Russell King (Oracle)
@ 2025-02-24 20:08 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2025-02-24 20:08 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Mon, Feb 24, 2025 at 04:53:10PM +0000, Russell King (Oracle) wrote:
> Most of the stmmac driver uses "plat_dat" to name the platform data,
> and "data" is used for the glue driver data. make dwc-qos follow
> this pattern to avoid silly mistakes.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next v3 2/2] net: stmmac: dwc-qos: clean up clock initialisation
2025-02-24 16:53 [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
2025-02-24 16:53 ` [PATCH net-next v3 1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently Russell King (Oracle)
@ 2025-02-24 16:53 ` Russell King (Oracle)
2025-02-24 20:09 ` Andrew Lunn
2025-02-25 18:37 ` [PATCH net-next v3 0/2] " Thierry Reding
2025-02-26 3:10 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 7+ messages in thread
From: Russell King (Oracle) @ 2025-02-24 16:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Clean up the clock initialisation by providing a helper to find a
named clock in the bulk clocks, and provide the name of the stmmac
clock in match data so we can locate the stmmac clock in generic
code.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 33 +++++++++++--------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index acb0a2e1664f..6cadf24a575c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -35,6 +35,16 @@ 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)
{
@@ -121,12 +131,7 @@ static int dwc_qos_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *stmmac_res)
{
- for (int i = 0; i < plat_dat->num_clks; i++) {
- if (strcmp(plat_dat->clks[i].id, "apb_pclk") == 0)
- plat_dat->stmmac_clk = plat_dat->clks[i].clk;
- else if (strcmp(plat_dat->clks[i].id, "phy_ref_clk") == 0)
- plat_dat->pclk = plat_dat->clks[i].clk;
- }
+ plat_dat->pclk = dwc_eth_find_clk(plat_dat, "phy_ref_clk");
return 0;
}
@@ -237,18 +242,12 @@ static int tegra_eqos_probe(struct platform_device *pdev,
eqos->dev = &pdev->dev;
eqos->regs = res->addr;
+ eqos->clk_slave = plat_dat->stmmac_clk;
if (!is_of_node(dev->fwnode))
goto bypass_clk_reset_gpio;
- for (int i = 0; i < plat_dat->num_clks; i++) {
- if (strcmp(plat_dat->clks[i].id, "slave_bus") == 0) {
- eqos->clk_slave = plat_dat->clks[i].clk;
- plat_dat->stmmac_clk = eqos->clk_slave;
- } else if (strcmp(plat_dat->clks[i].id, "tx") == 0) {
- eqos->clk_tx = plat_dat->clks[i].clk;
- }
- }
+ eqos->clk_tx = dwc_eth_find_clk(plat_dat, "tx");
eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH);
if (IS_ERR(eqos->reset)) {
@@ -312,15 +311,18 @@ struct dwc_eth_dwmac_data {
struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res);
void (*remove)(struct platform_device *pdev);
+ const char *stmmac_clk_name;
};
static const struct dwc_eth_dwmac_data dwc_qos_data = {
.probe = dwc_qos_probe,
+ .stmmac_clk_name = "apb_pclk",
};
static const struct dwc_eth_dwmac_data tegra_eqos_data = {
.probe = tegra_eqos_probe,
.remove = tegra_eqos_remove,
+ .stmmac_clk_name = "slave_bus",
};
static int dwc_eth_dwmac_probe(struct platform_device *pdev)
@@ -360,6 +362,9 @@ 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);
+
ret = data->probe(pdev, plat_dat, &stmmac_res);
if (ret < 0) {
dev_err_probe(&pdev->dev, ret, "failed to probe subdriver\n");
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net-next v3 2/2] net: stmmac: dwc-qos: clean up clock initialisation
2025-02-24 16:53 ` [PATCH net-next v3 2/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
@ 2025-02-24 20:09 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2025-02-24 20:09 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
Maxime Coquelin, netdev, Paolo Abeni
On Mon, Feb 24, 2025 at 04:53:15PM +0000, Russell King (Oracle) wrote:
> Clean up the clock initialisation by providing a helper to find a
> named clock in the bulk clocks, and provide the name of the stmmac
> clock in match data so we can locate the stmmac clock in generic
> code.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation
2025-02-24 16:53 [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
2025-02-24 16:53 ` [PATCH net-next v3 1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently Russell King (Oracle)
2025-02-24 16:53 ` [PATCH net-next v3 2/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
@ 2025-02-25 18:37 ` Thierry Reding
2025-02-26 3:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2025-02-25 18:37 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, linux-arm-kernel,
linux-stm32, Maxime Coquelin, netdev, Paolo Abeni
[-- Attachment #1: Type: text/plain, Size: 741 bytes --]
On Mon, Feb 24, 2025 at 04:53:16PM +0000, Russell King (Oracle) wrote:
> Hi,
>
> My single v1 patch has become two patches as a result of the build
> error, as it appears this code uses "data" differently from others.
> v2 still produced build warnings despite local builds being clean,
> so v3 addresses those.
>
> The first patch brings some consistency with other drivers, naming
> local variables that refer to struct plat_stmmacenet_data as
> "plat_dat", as is used elsewhere in this driver.
>
> .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 53 ++++++++++++----------
> 1 file changed, 29 insertions(+), 24 deletions(-)
Tested and works fine on Jetson TX2:
Tested-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation
2025-02-24 16:53 [PATCH net-next v3 0/2] net: stmmac: dwc-qos: clean up clock initialisation Russell King (Oracle)
` (2 preceding siblings ...)
2025-02-25 18:37 ` [PATCH net-next v3 0/2] " Thierry Reding
@ 2025-02-26 3:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-26 3:10 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
edumazet, kuba, linux-arm-kernel, linux-stm32, mcoquelin.stm32,
netdev, pabeni
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 24 Feb 2025 16:53:16 +0000 you wrote:
> Hi,
>
> My single v1 patch has become two patches as a result of the build
> error, as it appears this code uses "data" differently from others.
> v2 still produced build warnings despite local builds being clean,
> so v3 addresses those.
>
> [...]
Here is the summary with links:
- [net-next,v3,1/2] net: stmmac: dwc-qos: name struct plat_stmmacenet_data consistently
https://git.kernel.org/netdev/net-next/c/cff608268baf
- [net-next,v3,2/2] net: stmmac: dwc-qos: clean up clock initialisation
https://git.kernel.org/netdev/net-next/c/196b07ba9104
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread