bsec2_reg.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (c) 2022, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef BSEC2_REG_H
  7. #define BSEC2_REG_H
  8. #include <lib/utils_def.h>
  9. /* IP configuration */
  10. #define ADDR_LOWER_OTP_PERLOCK_SHIFT 0x03
  11. #define DATA_LOWER_OTP_PERLOCK_BIT 0x03U /* 2 significants bits are used */
  12. #define DATA_LOWER_OTP_PERLOCK_MASK GENMASK(2, 0)
  13. #define ADDR_UPPER_OTP_PERLOCK_SHIFT 0x04
  14. #define DATA_UPPER_OTP_PERLOCK_BIT 0x01U /* 1 significants bits are used */
  15. #define DATA_UPPER_OTP_PERLOCK_MASK GENMASK(3, 0)
  16. /* BSEC REGISTER OFFSET (base relative) */
  17. #define BSEC_OTP_CONF_OFF U(0x000)
  18. #define BSEC_OTP_CTRL_OFF U(0x004)
  19. #define BSEC_OTP_WRDATA_OFF U(0x008)
  20. #define BSEC_OTP_STATUS_OFF U(0x00C)
  21. #define BSEC_OTP_LOCK_OFF U(0x010)
  22. #define BSEC_DEN_OFF U(0x014)
  23. #define BSEC_DISTURBED_OFF U(0x01C)
  24. #define BSEC_DISTURBED1_OFF U(0x020)
  25. #define BSEC_DISTURBED2_OFF U(0x024)
  26. #define BSEC_ERROR_OFF U(0x034)
  27. #define BSEC_ERROR1_OFF U(0x038)
  28. #define BSEC_ERROR2_OFF U(0x03C)
  29. #define BSEC_WRLOCK_OFF U(0x04C) /* Safmem permanent lock */
  30. #define BSEC_WRLOCK1_OFF U(0x050)
  31. #define BSEC_WRLOCK2_OFF U(0x054)
  32. #define BSEC_SPLOCK_OFF U(0x064) /* Program safmem sticky lock */
  33. #define BSEC_SPLOCK1_OFF U(0x068)
  34. #define BSEC_SPLOCK2_OFF U(0x06C)
  35. #define BSEC_SWLOCK_OFF U(0x07C) /* Write in OTP sticky lock */
  36. #define BSEC_SWLOCK1_OFF U(0x080)
  37. #define BSEC_SWLOCK2_OFF U(0x084)
  38. #define BSEC_SRLOCK_OFF U(0x094) /* Shadowing sticky lock */
  39. #define BSEC_SRLOCK1_OFF U(0x098)
  40. #define BSEC_SRLOCK2_OFF U(0x09C)
  41. #define BSEC_JTAG_IN_OFF U(0x0AC)
  42. #define BSEC_JTAG_OUT_OFF U(0x0B0)
  43. #define BSEC_SCRATCH_OFF U(0x0B4)
  44. #define BSEC_OTP_DATA_OFF U(0x200)
  45. #define BSEC_IPHW_CFG_OFF U(0xFF0)
  46. #define BSEC_IPVR_OFF U(0xFF4)
  47. #define BSEC_IP_ID_OFF U(0xFF8)
  48. #define BSEC_IP_MAGIC_ID_OFF U(0xFFC)
  49. #define BSEC_WRLOCK(n) (BSEC_WRLOCK_OFF + U(0x04) * (n))
  50. #define BSEC_SPLOCK(n) (BSEC_SPLOCK_OFF + U(0x04) * (n))
  51. #define BSEC_SWLOCK(n) (BSEC_SWLOCK_OFF + U(0x04) * (n))
  52. #define BSEC_SRLOCK(n) (BSEC_SRLOCK_OFF + U(0x04) * (n))
  53. /* BSEC_CONFIGURATION Register */
  54. #define BSEC_CONF_POWER_UP_MASK BIT(0)
  55. #define BSEC_CONF_POWER_UP_SHIFT 0
  56. #define BSEC_CONF_FRQ_MASK GENMASK(2, 1)
  57. #define BSEC_CONF_FRQ_SHIFT 1
  58. #define BSEC_CONF_PRG_WIDTH_MASK GENMASK(6, 3)
  59. #define BSEC_CONF_PRG_WIDTH_SHIFT 3
  60. #define BSEC_CONF_TREAD_MASK GENMASK(8, 7)
  61. #define BSEC_CONF_TREAD_SHIFT 7
  62. /* BSEC_CONTROL Register */
  63. #define BSEC_READ 0U
  64. #define BSEC_WRITE BIT(8)
  65. #define BSEC_LOCK BIT(9)
  66. /* BSEC_OTP_LOCK register */
  67. #define UPPER_OTP_LOCK_MASK BIT(0)
  68. #define UPPER_OTP_LOCK_SHIFT 0
  69. #define DENREG_LOCK_MASK BIT(2)
  70. #define DENREG_LOCK_SHIFT 2
  71. #define GPLOCK_LOCK_MASK BIT(4)
  72. #define GPLOCK_LOCK_SHIFT 4
  73. /* BSEC_OTP_STATUS Register */
  74. #define BSEC_MODE_STATUS_MASK GENMASK(2, 0)
  75. #define BSEC_MODE_SECURE_MASK BIT(0)
  76. #define BSEC_MODE_FULLDBG_MASK BIT(1)
  77. #define BSEC_MODE_INVALID_MASK BIT(2)
  78. #define BSEC_MODE_BUSY_MASK BIT(3)
  79. #define BSEC_MODE_PROGFAIL_MASK BIT(4)
  80. #define BSEC_MODE_PWR_MASK BIT(5)
  81. #define BSEC_MODE_BIST1_LOCK_MASK BIT(6)
  82. #define BSEC_MODE_BIST2_LOCK_MASK BIT(7)
  83. /* BSEC_DENABLE Register */
  84. #define BSEC_HDPEN BIT(4)
  85. #define BSEC_SPIDEN BIT(5)
  86. #define BSEC_SPINDEN BIT(6)
  87. #define BSEC_DBGSWGEN BIT(10)
  88. #define BSEC_DEN_ALL_MSK GENMASK(10, 0)
  89. /* BSEC_FENABLE Register */
  90. #define BSEC_FEN_ALL_MSK GENMASK(14, 0)
  91. /* BSEC_IPVR Register */
  92. #define BSEC_IPVR_MSK GENMASK(7, 0)
  93. #endif /* BSEC2_REG_H */