pch.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef __pch_h
  8. #define __pch_h
  9. #define PCH_RCBA 0xf0
  10. #define BIOS_CTRL_BIOSWE BIT(0)
  11. /* Operations for the Platform Controller Hub */
  12. struct pch_ops {
  13. /**
  14. * get_sbase() - get the address of SPI base
  15. *
  16. * @dev: PCH device to check
  17. * @sbasep: Returns address of SPI base if available, else 0
  18. * @return 0 if OK, -ve on error (e.g. there is no SPI base)
  19. */
  20. int (*get_sbase)(struct udevice *dev, ulong *sbasep);
  21. /**
  22. * set_spi_protect() - set whether SPI flash is protected or not
  23. *
  24. * @dev: PCH device to adjust
  25. * @protect: true to protect, false to unprotect
  26. *
  27. * @return 0 on success, -ENOSYS if not implemented
  28. */
  29. int (*set_spi_protect)(struct udevice *dev, bool protect);
  30. };
  31. #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
  32. /**
  33. * pch_get_sbase() - get the address of SPI base
  34. *
  35. * @dev: PCH device to check
  36. * @sbasep: Returns address of SPI base if available, else 0
  37. * @return 0 if OK, -ve on error (e.g. there is no SPI base)
  38. */
  39. int pch_get_sbase(struct udevice *dev, ulong *sbasep);
  40. /**
  41. * set_spi_protect() - set whether SPI flash is protected or not
  42. *
  43. * @dev: PCH device to adjust
  44. * @protect: true to protect, false to unprotect
  45. *
  46. * @return 0 on success, -ENOSYS if not implemented
  47. */
  48. int pch_set_spi_protect(struct udevice *dev, bool protect);
  49. #endif