pch-uclass.c 1.1 KB

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