Commit e4b5e96d authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-phy-micrel-additional-clock-handling'

Heiko Stuebner says:

====================
net: phy: micrel: additional clock handling

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.
====================

Link: https://lore.kernel.org/r/20231201150131.326766-1-heiko@sntech.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 8ad55b1e 99ac4cbc
...@@ -2001,7 +2001,7 @@ static int kszphy_probe(struct phy_device *phydev) ...@@ -2001,7 +2001,7 @@ static int kszphy_probe(struct phy_device *phydev)
kszphy_parse_led_mode(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 */ /* NOTE: clk may be NULL if building without CONFIG_HAVE_CLK */
if (!IS_ERR_OR_NULL(clk)) { if (!IS_ERR_OR_NULL(clk)) {
unsigned long rate = clk_get_rate(clk); unsigned long rate = clk_get_rate(clk);
...@@ -2021,6 +2021,11 @@ static int kszphy_probe(struct phy_device *phydev) ...@@ -2021,6 +2021,11 @@ static int kszphy_probe(struct phy_device *phydev)
rate); rate);
return -EINVAL; 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)) if (ksz8041_fiber_mode(phydev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment