2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-07-24 13:18:15 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
* Written by Jean-Jacques Hiblot <jjhiblot@ti.com>
|
|
|
|
*/
|
|
|
|
|
2020-10-15 10:05:58 +00:00
|
|
|
#include <clk.h>
|
2017-07-24 13:18:15 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <dm.h>
|
|
|
|
#include <dm/device.h>
|
2020-10-15 10:05:58 +00:00
|
|
|
#include <dm/device_compat.h>
|
2017-07-24 13:18:15 +00:00
|
|
|
#include <generic-phy.h>
|
|
|
|
|
2020-10-15 10:05:58 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-07-24 13:18:15 +00:00
|
|
|
static const struct udevice_id nop_phy_ids[] = {
|
|
|
|
{ .compatible = "nop-phy" },
|
2021-03-31 09:21:07 +00:00
|
|
|
{ .compatible = "usb-nop-xceiv" },
|
2017-07-24 13:18:15 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct phy_ops nop_phy_ops = {
|
2020-10-15 10:05:58 +00:00
|
|
|
.init = nop_phy_init,
|
2017-07-24 13:18:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(nop_phy) = {
|
|
|
|
.name = "nop_phy",
|
|
|
|
.id = UCLASS_PHY,
|
|
|
|
.of_match = nop_phy_ids,
|
|
|
|
.ops = &nop_phy_ops,
|
2020-10-15 10:05:58 +00:00
|
|
|
.probe = nop_phy_probe,
|
2020-12-03 23:55:17 +00:00
|
|
|
.priv_auto = sizeof(struct nop_phy_priv),
|
2017-07-24 13:18:15 +00:00
|
|
|
};
|