pch-uclass.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 2015 Google, Inc
  4. * Written by Simon Glass <sjg@chromium.org>
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <pch.h>
  9. int pch_get_spi_base(struct udevice *dev, ulong *sbasep)
  10. {
  11. struct pch_ops *ops = pch_get_ops(dev);
  12. *sbasep = 0;
  13. if (!ops->get_spi_base)
  14. return -ENOSYS;
  15. return ops->get_spi_base(dev, sbasep);
  16. }
  17. int pch_set_spi_protect(struct udevice *dev, bool protect)
  18. {
  19. struct pch_ops *ops = pch_get_ops(dev);
  20. if (!ops->set_spi_protect)
  21. return -ENOSYS;
  22. return ops->set_spi_protect(dev, protect);
  23. }
  24. int pch_get_gpio_base(struct udevice *dev, u32 *gbasep)
  25. {
  26. struct pch_ops *ops = pch_get_ops(dev);
  27. *gbasep = 0;
  28. if (!ops->get_gpio_base)
  29. return -ENOSYS;
  30. return ops->get_gpio_base(dev, gbasep);
  31. }
  32. int pch_get_io_base(struct udevice *dev, u32 *iobasep)
  33. {
  34. struct pch_ops *ops = pch_get_ops(dev);
  35. *iobasep = 0;
  36. if (!ops->get_io_base)
  37. return -ENOSYS;
  38. return ops->get_io_base(dev, iobasep);
  39. }
  40. UCLASS_DRIVER(pch) = {
  41. .id = UCLASS_PCH,
  42. .name = "pch",
  43. .post_bind = dm_scan_fdt_dev,
  44. };