diff options
author | Peng Fan <peng.fan@nxp.com> | 2020-10-15 18:05:58 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-23 16:38:31 -0400 |
commit | 62ee9576c678cfa3f769987f0177c3ec30a924ab (patch) | |
tree | be39542f530c46a96dff817293feb4ac592587d0 | |
parent | ef4f4f1f5f4ed70d65cb7e79f37c3f597f34a9d4 (diff) | |
download | u-boot-62ee9576c678cfa3f769987f0177c3ec30a924ab.tar.gz |
phy: nop-phy: add clk bulk
Add clk bulk for nop-phy driver.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r-- | drivers/phy/nop-phy.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c index a5eed20f3f..ba71785fe4 100644 --- a/drivers/phy/nop-phy.c +++ b/drivers/phy/nop-phy.c @@ -4,17 +4,50 @@ * Written by Jean-Jacques Hiblot <jjhiblot@ti.com> */ +#include <clk.h> #include <common.h> #include <dm.h> #include <dm/device.h> +#include <dm/device_compat.h> #include <generic-phy.h> +struct nop_phy_priv { + struct clk_bulk bulk; +}; + +static int nop_phy_init(struct phy *phy) +{ + struct nop_phy_priv *priv = dev_get_priv(phy->dev); + + if (CONFIG_IS_ENABLED(CLK)) + return clk_enable_bulk(&priv->bulk); + + return 0; +} + +static int nop_phy_probe(struct udevice *dev) +{ + struct nop_phy_priv *priv = dev_get_priv(dev); + int ret; + + if (CONFIG_IS_ENABLED(CLK)) { + ret = clk_get_bulk(dev, &priv->bulk); + if (ret < 0) { + dev_err(dev, "Failed to get clk: %d\n", ret); + return ret; + } + } + + return 0; +} + static const struct udevice_id nop_phy_ids[] = { { .compatible = "nop-phy" }, { } }; static struct phy_ops nop_phy_ops = { + .init = nop_phy_init, }; U_BOOT_DRIVER(nop_phy) = { @@ -22,4 +55,6 @@ U_BOOT_DRIVER(nop_phy) = { .id = UCLASS_PHY, .of_match = nop_phy_ids, .ops = &nop_phy_ops, + .probe = nop_phy_probe, + .priv_auto_alloc_size = sizeof(struct nop_phy_priv), }; |