* [PATCH 0/2] net: phy: micrel: additional clock handling
@ 2023-12-01 15:01 Heiko Stuebner
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Heiko Stuebner @ 2023-12-01 15:01 UTC (permalink / raw)
To: andrew, hkallweit1
Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
quentin.schulz, heiko
Some Micrel phys define a specific rmii-ref clock (added in 2014) while
the generic phy binding specifies an unnamed clock for ethernet phys.
This allows Micrel phys to use both, so as to keep the phys not using
the named rmii-ref clock to conform to the generic binding while allowing
them to enable a supplying clock, when the phy is not supplied by a
dedicated oscillator.
Heiko Stuebner (2):
net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref
clock
net: phy: micrel: allow usage of generic ethernet-phy clock
drivers/net/phy/micrel.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock
2023-12-01 15:01 [PATCH 0/2] net: phy: micrel: additional clock handling Heiko Stuebner
@ 2023-12-01 15:01 ` Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:19 ` Andrew Lunn
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
2023-12-04 22:50 ` [PATCH 0/2] net: phy: micrel: additional clock handling patchwork-bot+netdevbpf
2 siblings, 2 replies; 8+ messages in thread
From: Heiko Stuebner @ 2023-12-01 15:01 UTC (permalink / raw)
To: andrew, hkallweit1
Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
quentin.schulz, heiko, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@cherry.de>
While the external clock input will most likely be enabled, it's not
guaranteed and clk_get_rate in some suppliers will even just return
valid results when the clock is running.
So use devm_clk_get_optional_enabled to retrieve and enable the clock
in one go.
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
drivers/net/phy/micrel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 08e3915001c3..ec6a39dc9053 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2001,7 +2001,7 @@ static int kszphy_probe(struct phy_device *phydev)
kszphy_parse_led_mode(phydev);
- clk = devm_clk_get(&phydev->mdio.dev, "rmii-ref");
+ clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, "rmii-ref");
/* NOTE: clk may be NULL if building without CONFIG_HAVE_CLK */
if (!IS_ERR_OR_NULL(clk)) {
unsigned long rate = clk_get_rate(clk);
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock
2023-12-01 15:01 [PATCH 0/2] net: phy: micrel: additional clock handling Heiko Stuebner
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
@ 2023-12-01 15:01 ` Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:21 ` Andrew Lunn
2023-12-04 22:50 ` [PATCH 0/2] net: phy: micrel: additional clock handling patchwork-bot+netdevbpf
2 siblings, 2 replies; 8+ messages in thread
From: Heiko Stuebner @ 2023-12-01 15:01 UTC (permalink / raw)
To: andrew, hkallweit1
Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
quentin.schulz, heiko, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@cherry.de>
The generic ethernet-phy binding allows describing an external clock since
commit 350b7a258f20 ("dt-bindings: net: phy: Document support for external PHY clk")
for cases where the phy is not supplied by an oscillator but instead
by a clock from the host system.
And the old named "rmii-ref" clock from 2014 is only specified for phys
of the KSZ8021, KSZ8031, KSZ8081, KSZ8091 types.
So allow retrieving and enabling the optional generic clock on phys that
do not provide a rmii-ref clock.
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
drivers/net/phy/micrel.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index ec6a39dc9053..9490849437c0 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2021,6 +2021,11 @@ static int kszphy_probe(struct phy_device *phydev)
rate);
return -EINVAL;
}
+ } else if (!clk) {
+ /* unnamed clock from the generic ethernet-phy binding */
+ clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, NULL);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
}
if (ksz8041_fiber_mode(phydev))
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
@ 2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:19 ` Andrew Lunn
1 sibling, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2023-12-01 17:03 UTC (permalink / raw)
To: Heiko Stuebner, andrew, hkallweit1
Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
quentin.schulz, Heiko Stuebner
On 12/1/23 07:01, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> While the external clock input will most likely be enabled, it's not
> guaranteed and clk_get_rate in some suppliers will even just return
> valid results when the clock is running.
>
> So use devm_clk_get_optional_enabled to retrieve and enable the clock
> in one go.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
@ 2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:21 ` Andrew Lunn
1 sibling, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2023-12-01 17:03 UTC (permalink / raw)
To: Heiko Stuebner, andrew, hkallweit1
Cc: linux, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
quentin.schulz, Heiko Stuebner
On 12/1/23 07:01, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> The generic ethernet-phy binding allows describing an external clock since
> commit 350b7a258f20 ("dt-bindings: net: phy: Document support for external PHY clk")
> for cases where the phy is not supplied by an oscillator but instead
> by a clock from the host system.
>
> And the old named "rmii-ref" clock from 2014 is only specified for phys
> of the KSZ8021, KSZ8031, KSZ8081, KSZ8091 types.
>
> So allow retrieving and enabling the optional generic clock on phys that
> do not provide a rmii-ref clock.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
@ 2023-12-01 22:19 ` Andrew Lunn
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2023-12-01 22:19 UTC (permalink / raw)
To: Heiko Stuebner
Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, quentin.schulz, Heiko Stuebner
On Fri, Dec 01, 2023 at 04:01:30PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> While the external clock input will most likely be enabled, it's not
> guaranteed and clk_get_rate in some suppliers will even just return
> valid results when the clock is running.
>
> So use devm_clk_get_optional_enabled to retrieve and enable the clock
> in one go.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
@ 2023-12-01 22:21 ` Andrew Lunn
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2023-12-01 22:21 UTC (permalink / raw)
To: Heiko Stuebner
Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, quentin.schulz, Heiko Stuebner
On Fri, Dec 01, 2023 at 04:01:31PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> The generic ethernet-phy binding allows describing an external clock since
> commit 350b7a258f20 ("dt-bindings: net: phy: Document support for external PHY clk")
> for cases where the phy is not supplied by an oscillator but instead
> by a clock from the host system.
>
> And the old named "rmii-ref" clock from 2014 is only specified for phys
> of the KSZ8021, KSZ8031, KSZ8081, KSZ8091 types.
>
> So allow retrieving and enabling the optional generic clock on phys that
> do not provide a rmii-ref clock.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] net: phy: micrel: additional clock handling
2023-12-01 15:01 [PATCH 0/2] net: phy: micrel: additional clock handling Heiko Stuebner
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
@ 2023-12-04 22:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-04 22:50 UTC (permalink / raw)
To: =?utf-8?q?Heiko_St=C3=BCbner_=3Cheiko=40sntech=2Ede=3E?=
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, quentin.schulz
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 1 Dec 2023 16:01:29 +0100 you wrote:
> Some Micrel phys define a specific rmii-ref clock (added in 2014) while
> the generic phy binding specifies an unnamed clock for ethernet phys.
>
> This allows Micrel phys to use both, so as to keep the phys not using
> the named rmii-ref clock to conform to the generic binding while allowing
> them to enable a supplying clock, when the phy is not supplied by a
> dedicated oscillator.
>
> [...]
Here is the summary with links:
- [1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock
https://git.kernel.org/netdev/net-next/c/985329462723
- [2/2] net: phy: micrel: allow usage of generic ethernet-phy clock
https://git.kernel.org/netdev/net-next/c/99ac4cbcc2a5
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] 8+ messages in thread
end of thread, other threads:[~2023-12-04 22:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01 15:01 [PATCH 0/2] net: phy: micrel: additional clock handling Heiko Stuebner
2023-12-01 15:01 ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:19 ` Andrew Lunn
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
2023-12-01 17:03 ` Florian Fainelli
2023-12-01 22:21 ` Andrew Lunn
2023-12-04 22:50 ` [PATCH 0/2] net: phy: micrel: additional clock handling patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).