Skip to content

Commit 8a9f9bd

Browse files
lategoodbyekuba-moo
authored andcommitted
net: phy: dp83822: Add optional external PHY clock
In some cases, the PHY can use an external ref clock source instead of a crystal. Add an optional clock in the PHY node to make sure that the clock source is enabled, if specified, before probing. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20260528184642.33424-3-wahrenst@gmx.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d790b70 commit 8a9f9bd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/net/phy/dp83822.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (C) 2017 Texas Instruments Inc.
55
*/
66

7+
#include <linux/clk.h>
78
#include <linux/ethtool.h>
89
#include <linux/etherdevice.h>
910
#include <linux/kernel.h>
@@ -986,11 +987,18 @@ static int dp8382x_probe(struct phy_device *phydev)
986987
{
987988
struct device *dev = &phydev->mdio.dev;
988989
struct dp83822_private *dp83822;
990+
struct clk *clk;
989991

990992
dp83822 = devm_kzalloc(dev, sizeof(*dp83822), GFP_KERNEL);
991993
if (!dp83822)
992994
return -ENOMEM;
993995

996+
clk = devm_clk_get_optional_enabled(dev, NULL);
997+
if (IS_ERR(clk)) {
998+
return dev_err_probe(dev, PTR_ERR(clk),
999+
"Failed to request ref clock\n");
1000+
}
1001+
9941002
dp83822->tx_amplitude_100base_tx_index = -1;
9951003
dp83822->mac_termination_index = -1;
9961004
phydev->priv = dp83822;

0 commit comments

Comments
 (0)