pch.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2015 Google, Inc
  4. * Written by Simon Glass <sjg@chromium.org>
  5. */
  6. #ifndef __pch_h
  7. #define __pch_h
  8. #define PCH_RCBA 0xf0
  9. #define BIOS_CTRL_BIOSWE BIT(0)
  10. /* Operations for the Platform Controller Hub */
  11. struct pch_ops {
  12. /**
  13. * get_spi_base() - get the address of SPI base
  14. *
  15. * @dev: PCH device to check
  16. * @sbasep: Returns address of SPI base if available, else 0
  17. * @return 0 if OK, -ve on error (e.g. there is no SPI base)
  18. */
  19. int (*get_spi_base)(struct udevice *dev, ulong *sbasep);
  20. /**
  21. * set_spi_protect() - set whether SPI flash is protected or not
  22. *
  23. * @dev: PCH device to adjust
  24. * @protect: true to protect, false to unprotect
  25. *
  26. * @return 0 on success, -ENOSYS if not implemented
  27. */
  28. int (*set_spi_protect)(struct udevice *dev, bool protect);
  29. /**
  30. * get_gpio_base() - get the address of GPIO base
  31. *
  32. * @dev: PCH device to check
  33. * @gbasep: Returns address of GPIO base if available, else 0
  34. * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
  35. */
  36. int (*get_gpio_base)(struct udevice *dev, u32 *gbasep);
  37. /**
  38. * get_io_base() - get the address of IO base
  39. *
  40. * @dev: PCH device to check
  41. * @iobasep: Returns address of IO base if available, else 0
  42. * @return 0 if OK, -ve on error (e.g. there is no IO base)
  43. */
  44. int (*get_io_base)(struct udevice *dev, u32 *iobasep);
  45. };
  46. #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
  47. /**
  48. * pch_get_spi_base() - get the address of SPI base
  49. *
  50. * @dev: PCH device to check
  51. * @sbasep: Returns address of SPI base if available, else 0
  52. * @return 0 if OK, -ve on error (e.g. there is no SPI base)
  53. */
  54. int pch_get_spi_base(struct udevice *dev, ulong *sbasep);
  55. /**
  56. * set_spi_protect() - set whether SPI flash is protected or not
  57. *
  58. * @dev: PCH device to adjust
  59. * @protect: true to protect, false to unprotect
  60. *
  61. * @return 0 on success, -ENOSYS if not implemented
  62. */
  63. int pch_set_spi_protect(struct udevice *dev, bool protect);
  64. /**
  65. * pch_get_gpio_base() - get the address of GPIO base
  66. *
  67. * @dev: PCH device to check
  68. * @gbasep: Returns address of GPIO base if available, else 0
  69. * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
  70. */
  71. int pch_get_gpio_base(struct udevice *dev, u32 *gbasep);
  72. /**
  73. * pch_get_io_base() - get the address of IO base
  74. *
  75. * @dev: PCH device to check
  76. * @iobasep: Returns address of IO base if available, else 0
  77. * @return 0 if OK, -ve on error (e.g. there is no IO base)
  78. */
  79. int pch_get_io_base(struct udevice *dev, u32 *iobasep);
  80. #endif