2 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <generic-phy.h>
12 DECLARE_GLOBAL_DATA_PTR;
14 struct sandbox_phy_priv {
20 static int sandbox_phy_power_on(struct phy *phy)
22 struct sandbox_phy_priv *priv = dev_get_priv(phy->dev);
24 if (!priv->initialized)
35 static int sandbox_phy_power_off(struct phy *phy)
37 struct sandbox_phy_priv *priv = dev_get_priv(phy->dev);
39 if (!priv->initialized)
46 * for validation purpose, let's says that power off
47 * works only for PHY 0
57 static int sandbox_phy_init(struct phy *phy)
59 struct sandbox_phy_priv *priv = dev_get_priv(phy->dev);
61 priv->initialized = true;
67 static int sandbox_phy_exit(struct phy *phy)
69 struct sandbox_phy_priv *priv = dev_get_priv(phy->dev);
71 priv->initialized = false;
77 static int sandbox_phy_probe(struct udevice *dev)
79 struct sandbox_phy_priv *priv = dev_get_priv(dev);
81 priv->initialized = false;
83 priv->broken = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
89 static struct phy_ops sandbox_phy_ops = {
90 .power_on = sandbox_phy_power_on,
91 .power_off = sandbox_phy_power_off,
92 .init = sandbox_phy_init,
93 .exit = sandbox_phy_exit,
96 static const struct udevice_id sandbox_phy_ids[] = {
97 { .compatible = "sandbox,phy" },
101 U_BOOT_DRIVER(phy_sandbox) = {
102 .name = "phy_sandbox",
104 .of_match = sandbox_phy_ids,
105 .ops = &sandbox_phy_ops,
106 .probe = sandbox_phy_probe,
107 .priv_auto_alloc_size = sizeof(struct sandbox_phy_priv),