nop-phy.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. { .compatible = "usb-nop-xceiv" },
  38. { }
  39. };
  40. static struct phy_ops nop_phy_ops = {
  41. .init = nop_phy_init,
  42. };
  43. U_BOOT_DRIVER(nop_phy) = {
  44. .name = "nop_phy",
  45. .id = UCLASS_PHY,
  46. .of_match = nop_phy_ids,
  47. .ops = &nop_phy_ops,
  48. .probe = nop_phy_probe,
  49. .priv_auto = sizeof(struct nop_phy_priv),
  50. };