pch-uclass.c 1.3 KB

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