nop-phy.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  4. * Written by Jean-Jacques Hiblot <jjhiblot@ti.com>
  5. */
  6. #include <clk.h>
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <dm/device.h>
  10. #include <dm/device_compat.h>
  11. #include <generic-phy.h>
  12. struct nop_phy_priv {
  13. struct clk_bulk bulk;
  14. };
  15. static int nop_phy_init(struct phy *phy)
  16. {
  17. struct nop_phy_priv *priv = dev_get_priv(phy->dev);
  18. if (CONFIG_IS_ENABLED(CLK))
  19. return clk_enable_bulk(&priv->bulk);
  20. return 0;
  21. }
  22. static int nop_phy_probe(struct udevice *dev)
  23. {
  24. struct nop_phy_priv *priv = dev_get_priv(dev);
  25. int ret;
  26. if (CONFIG_IS_ENABLED(CLK)) {
  27. ret = clk_get_bulk(dev, &priv->bulk);
  28. if (ret < 0) {
  29. dev_err(dev, "Failed to get clk: %d\n", ret);
  30. return ret;
  31. }
  32. }
  33. return 0;
  34. }
  35. static const struct udevice_id nop_phy_ids[] = {
  36. { .compatible = "nop-phy" },
  37. { }
  38. };
  39. static struct phy_ops nop_phy_ops = {
  40. .init = nop_phy_init,
  41. };
  42. U_BOOT_DRIVER(nop_phy) = {
  43. .name = "nop_phy",
  44. .id = UCLASS_PHY,
  45. .of_match = nop_phy_ids,
  46. .ops = &nop_phy_ops,
  47. .probe = nop_phy_probe,
  48. .priv_auto_alloc_size = sizeof(struct nop_phy_priv),
  49. };