pch.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_spi_base() - 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_spi_base)(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. * get_gpio_base() - get the address of GPIO base
  32. *
  33. * @dev: PCH device to check
  34. * @gbasep: Returns address of GPIO base if available, else 0
  35. * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
  36. */
  37. int (*get_gpio_base)(struct udevice *dev, u32 *gbasep);
  38. /**
  39. * get_io_base() - get the address of IO base
  40. *
  41. * @dev: PCH device to check
  42. * @iobasep: Returns address of IO base if available, else 0
  43. * @return 0 if OK, -ve on error (e.g. there is no IO base)
  44. */
  45. int (*get_io_base)(struct udevice *dev, u32 *iobasep);
  46. };
  47. #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
  48. /**
  49. * pch_get_spi_base() - get the address of SPI base
  50. *
  51. * @dev: PCH device to check
  52. * @sbasep: Returns address of SPI base if available, else 0
  53. * @return 0 if OK, -ve on error (e.g. there is no SPI base)
  54. */
  55. int pch_get_spi_base(struct udevice *dev, ulong *sbasep);
  56. /**
  57. * set_spi_protect() - set whether SPI flash is protected or not
  58. *
  59. * @dev: PCH device to adjust
  60. * @protect: true to protect, false to unprotect
  61. *
  62. * @return 0 on success, -ENOSYS if not implemented
  63. */
  64. int pch_set_spi_protect(struct udevice *dev, bool protect);
  65. /**
  66. * pch_get_gpio_base() - get the address of GPIO base
  67. *
  68. * @dev: PCH device to check
  69. * @gbasep: Returns address of GPIO base if available, else 0
  70. * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
  71. */
  72. int pch_get_gpio_base(struct udevice *dev, u32 *gbasep);
  73. /**
  74. * pch_get_io_base() - get the address of IO base
  75. *
  76. * @dev: PCH device to check
  77. * @iobasep: Returns address of IO base if available, else 0
  78. * @return 0 if OK, -ve on error (e.g. there is no IO base)
  79. */
  80. int pch_get_io_base(struct udevice *dev, u32 *iobasep);
  81. #endif