chimp.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2016 - 2020, Broadcom
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SR_CHIMP_H
  7. #define SR_CHIMP_H
  8. #include <common/bl_common.h>
  9. #include <common/debug.h>
  10. #include <lib/mmio.h>
  11. #include <platform_def.h>
  12. #define CHIMP_WINDOW_SIZE 0x400000
  13. #define CHIMP_ERROR_OFFSET 28
  14. #define CHIMP_ERROR_MASK 0xf0000000
  15. #ifndef EMULATION_SETUP
  16. #define CHIMP_HANDSHAKE_TIMEOUT_MS 10000
  17. #else
  18. /*
  19. * 1hr timeout for test in emulator
  20. * By doing this ChiMP is given a chance to boot
  21. * fully from the QSPI
  22. * (on Palladium this takes upto 50 min depending on QSPI clk)
  23. */
  24. #define CHIMP_HANDSHAKE_TIMEOUT_MS 3600000
  25. #endif
  26. #define CHIMP_BPE_MODE_ID_PATTERN (0x25000000)
  27. #define CHIMP_BPE_MODE_ID_MASK (0x7f000000)
  28. #define NIC_RESET_RELEASE_TIMEOUT_US (10)
  29. /* written by M0, used by ChiMP ROM */
  30. #define SR_IN_SMARTNIC_MODE_BIT 0
  31. /* written by M0, used by ChiMP ROM */
  32. #define SR_CHIMP_SECURE_BOOT_BIT 1
  33. /* cleared by AP, set by ChiMP BC2 code */
  34. #define SR_FLASH_ACCESS_DONE_BIT 2
  35. #ifdef USE_CHIMP
  36. void bcm_chimp_write(uintptr_t addr, uint32_t value);
  37. uint32_t bcm_chimp_read(uintptr_t addr);
  38. uint32_t bcm_chimp_read_ctrl(uint32_t offset);
  39. void bcm_chimp_clrbits(uintptr_t addr, uint32_t bits);
  40. void bcm_chimp_setbits(uintptr_t addr, uint32_t bits);
  41. int bcm_chimp_is_nic_mode(void);
  42. void bcm_chimp_fru_prog_done(bool status);
  43. int bcm_chimp_handshake_done(void);
  44. int bcm_chimp_wait_handshake(void);
  45. /* Fastboot-related*/
  46. int bcm_chimp_initiate_fastboot(int fastboot_type);
  47. #else
  48. static inline void bcm_chimp_write(uintptr_t addr, uint32_t value)
  49. {
  50. }
  51. static inline uint32_t bcm_chimp_read(uintptr_t addr)
  52. {
  53. return 0;
  54. }
  55. static inline uint32_t bcm_chimp_read_ctrl(uint32_t offset)
  56. {
  57. return 0;
  58. }
  59. static inline void bcm_chimp_clrbits(uintptr_t addr, uint32_t bits)
  60. {
  61. }
  62. static inline void bcm_chimp_setbits(uintptr_t addr, uint32_t bits)
  63. {
  64. }
  65. static inline int bcm_chimp_is_nic_mode(void)
  66. {
  67. return 0;
  68. }
  69. static inline void bcm_chimp_fru_prog_done(bool status)
  70. {
  71. }
  72. static inline int bcm_chimp_handshake_done(void)
  73. {
  74. return 0;
  75. }
  76. static inline int bcm_chimp_wait_handshake(void)
  77. {
  78. return 0;
  79. }
  80. static inline int bcm_chimp_initiate_fastboot(int fastboot_type)
  81. {
  82. return 0;
  83. }
  84. #endif /* USE_CHIMP */
  85. #endif