pch-uclass.c 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include <dm/root.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. int pch_get_sbase(struct udevice *dev, ulong *sbasep)
  13. {
  14. struct pch_ops *ops = pch_get_ops(dev);
  15. *sbasep = 0;
  16. if (!ops->get_sbase)
  17. return -ENOSYS;
  18. return ops->get_sbase(dev, sbasep);
  19. }
  20. int pch_set_spi_protect(struct udevice *dev, bool protect)
  21. {
  22. struct pch_ops *ops = pch_get_ops(dev);
  23. if (!ops->set_spi_protect)
  24. return -ENOSYS;
  25. return ops->set_spi_protect(dev, protect);
  26. }
  27. static int pch_uclass_post_bind(struct udevice *bus)
  28. {
  29. /*
  30. * Scan the device tree for devices
  31. *
  32. * Before relocation, only bind devices marked for pre-relocation
  33. * use.
  34. */
  35. return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset,
  36. gd->flags & GD_FLG_RELOC ? false : true);
  37. }
  38. UCLASS_DRIVER(pch) = {
  39. .id = UCLASS_PCH,
  40. .name = "pch",
  41. .post_bind = pch_uclass_post_bind,
  42. };