Skip to content

Commit

Permalink
net: phy: micrel: allow usage of generic ethernet-phy clock
Browse files Browse the repository at this point in the history
The generic ethernet-phy binding allows describing an external clock since
commit 350b7a2 ("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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20231201150131.326766-3-heiko@sntech.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Heiko Stuebner authored and Jakub Kicinski committed Dec 4, 2023
1 parent 9853294 commit 99ac4cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/phy/micrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 99ac4cb

Please sign in to comment.