blob: 84aac806230220c654e63394c31557e10d837275 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +02002/*
3 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
4 * Written by Jean-Jacques Hiblot <jjhiblot@ti.com>
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +02005 */
6
Peng Fan259029f2020-10-15 18:05:58 +08007#include <clk.h>
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +02008#include <common.h>
9#include <dm.h>
10#include <dm/device.h>
Peng Fan259029f2020-10-15 18:05:58 +080011#include <dm/device_compat.h>
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +020012#include <generic-phy.h>
13
Peng Fan259029f2020-10-15 18:05:58 +080014struct nop_phy_priv {
15 struct clk_bulk bulk;
16};
17
18static int nop_phy_init(struct phy *phy)
19{
20 struct nop_phy_priv *priv = dev_get_priv(phy->dev);
21
22 if (CONFIG_IS_ENABLED(CLK))
23 return clk_enable_bulk(&priv->bulk);
24
25 return 0;
26}
27
28static int nop_phy_probe(struct udevice *dev)
29{
30 struct nop_phy_priv *priv = dev_get_priv(dev);
31 int ret;
32
33 if (CONFIG_IS_ENABLED(CLK)) {
34 ret = clk_get_bulk(dev, &priv->bulk);
35 if (ret < 0) {
36 dev_err(dev, "Failed to get clk: %d\n", ret);
37 return ret;
38 }
39 }
40
41 return 0;
42}
43
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +020044static const struct udevice_id nop_phy_ids[] = {
45 { .compatible = "nop-phy" },
46 { }
47};
48
49static struct phy_ops nop_phy_ops = {
Peng Fan259029f2020-10-15 18:05:58 +080050 .init = nop_phy_init,
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +020051};
52
53U_BOOT_DRIVER(nop_phy) = {
54 .name = "nop_phy",
55 .id = UCLASS_PHY,
56 .of_match = nop_phy_ids,
57 .ops = &nop_phy_ops,
Peng Fan259029f2020-10-15 18:05:58 +080058 .probe = nop_phy_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -070059 .priv_auto = sizeof(struct nop_phy_priv),
Jean-Jacques Hiblotc2da3e32017-07-24 15:18:15 +020060};