* [PATCH net-next 1/2] net: ethernet: cortina: use devm to enable clocks
2026-02-20 2:19 [PATCH net-next 0/2] net: ethernet: cortina: support deferral Rosen Penev
@ 2026-02-20 2:19 ` Rosen Penev
2026-02-20 2:19 ` [PATCH net-next 2/2] net: ethernet: cortina: fix nvmem mac addresses Rosen Penev
2026-02-20 8:40 ` [PATCH net-next 0/2] net: ethernet: cortina: support deferral Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2026-02-20 2:19 UTC (permalink / raw)
To: netdev
Cc: Hans Ulli Kroll, Linus Walleij, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
Avoid manually disabling them. devm can handle this.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/cortina/gemini.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index a55f4b82d1ba..8726e5ffbce7 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2348,7 +2348,6 @@ static void gemini_port_remove(struct gemini_ethernet_port *port)
phy_disconnect(port->netdev->phydev);
unregister_netdev(port->netdev);
}
- clk_disable_unprepare(port->pclk);
geth_cleanup_freeq(port->geth);
}
@@ -2475,14 +2474,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
port->irq = irq;
/* Clock the port */
- port->pclk = devm_clk_get(dev, "PCLK");
+ port->pclk = devm_clk_get_enabled(dev, "PCLK");
if (IS_ERR(port->pclk)) {
dev_err(dev, "no PCLK\n");
return PTR_ERR(port->pclk);
}
- ret = clk_prepare_enable(port->pclk);
- if (ret)
- return ret;
/* Maybe there is a nice ethernet address we should use */
gemini_port_save_mac_addr(port);
@@ -2491,8 +2487,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
port->reset = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(port->reset)) {
dev_err(dev, "no reset\n");
- ret = PTR_ERR(port->reset);
- goto unprepare;
+ return PTR_ERR(port->reset);
}
reset_control_reset(port->reset);
usleep_range(100, 500);
@@ -2554,24 +2549,16 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
port_names[port->id],
port);
if (ret)
- goto unprepare;
+ return ret;
ret = gmac_setup_phy(netdev);
if (ret) {
netdev_err(netdev,
"PHY init failed\n");
- goto unprepare;
+ return ret;
}
- ret = register_netdev(netdev);
- if (ret)
- goto unprepare;
-
- return 0;
-
-unprepare:
- clk_disable_unprepare(port->pclk);
- return ret;
+ return register_netdev(netdev);
}
static void gemini_ethernet_port_remove(struct platform_device *pdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net-next 2/2] net: ethernet: cortina: fix nvmem mac addresses
2026-02-20 2:19 [PATCH net-next 0/2] net: ethernet: cortina: support deferral Rosen Penev
2026-02-20 2:19 ` [PATCH net-next 1/2] net: ethernet: cortina: use devm to enable clocks Rosen Penev
@ 2026-02-20 2:19 ` Rosen Penev
2026-02-20 8:40 ` [PATCH net-next 0/2] net: ethernet: cortina: support deferral Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2026-02-20 2:19 UTC (permalink / raw)
To: netdev
Cc: Hans Ulli Kroll, Linus Walleij, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
of_get_mac_address can return EPROBE_DEFER in case an nvmem driver needs
to be loaded. Handle to allow nvmem mac address overrides.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/cortina/gemini.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index 8726e5ffbce7..4225676662c8 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2525,6 +2525,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
netif_napi_add(netdev, &port->napi, gmac_napi_poll);
ret = of_get_mac_address(np, mac);
+ if (ret == -EPROBE_DEFER)
+ return ret;
if (!ret) {
dev_info(dev, "Setting macaddr from DT %pM\n", mac);
memcpy(port->mac_addr, mac, ETH_ALEN);
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next 0/2] net: ethernet: cortina: support deferral
2026-02-20 2:19 [PATCH net-next 0/2] net: ethernet: cortina: support deferral Rosen Penev
2026-02-20 2:19 ` [PATCH net-next 1/2] net: ethernet: cortina: use devm to enable clocks Rosen Penev
2026-02-20 2:19 ` [PATCH net-next 2/2] net: ethernet: cortina: fix nvmem mac addresses Rosen Penev
@ 2026-02-20 8:40 ` Linus Walleij
2026-02-20 13:04 ` Andrew Lunn
2 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2026-02-20 8:40 UTC (permalink / raw)
To: Rosen Penev
Cc: netdev, Hans Ulli Kroll, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
On Fri, Feb 20, 2026 at 3:20 AM Rosen Penev <rosenp@gmail.com> wrote:
> When using nvmem, it may be necessary to defer probe until the specific
> nvmem driver is loaded to get the proper MAC.
>
> Rosen Penev (2):
> net: ethernet: cortina: use devm to enable clocks
> net: ethernet: cortina: fix nvmem mac addresses
Net-next is closed so you will have to resend this:
https://netdev.bots.linux.dev/net-next.html
But I like what I see :)
Reviewed-by: Linus Walleij <linusw@kernel.org>
What I actually most of all want to achieve here is to support loading
the PHY as module, but I suspect that then the ethernet driver has to
be a module as well so modprobe can do its job.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] net: ethernet: cortina: support deferral
2026-02-20 8:40 ` [PATCH net-next 0/2] net: ethernet: cortina: support deferral Linus Walleij
@ 2026-02-20 13:04 ` Andrew Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2026-02-20 13:04 UTC (permalink / raw)
To: Linus Walleij
Cc: Rosen Penev, netdev, Hans Ulli Kroll, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE,
open list
> What I actually most of all want to achieve here is to support loading
> the PHY as module, but I suspect that then the ethernet driver has to
> be a module as well so modprobe can do its job.
I don't think that is true. You should be able to have a built in MAC
and a modular PHY. phylib will call out to modprobe, passing the ID of
the PHY in order to load the driver. There are some interesting race
conditions when interface open() is called while the PHY module is
still loading, so you end up with genphy. But the race exists
independent of built in vs modular MAC.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread