fuse_prov.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 2021 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #if !defined(FUSE_PROV_H) && defined(POLICY_FUSE_PROVISION)
  8. #define FUSE_PROV_H
  9. #include <endian.h>
  10. #include <lib/mmio.h>
  11. #define MASK_NONE U(0xFFFFFFFF)
  12. #define ERROR_WRITE U(0xA)
  13. #define ERROR_ALREADY_BLOWN U(0xB)
  14. /* Flag bit shifts */
  15. #define FLAG_POVDD_SHIFT U(0)
  16. #define FLAG_SYSCFG_SHIFT U(1)
  17. #define FLAG_SRKH_SHIFT U(2)
  18. #define FLAG_MC_SHIFT U(3)
  19. #define FLAG_DCV0_SHIFT U(4)
  20. #define FLAG_DCV1_SHIFT U(5)
  21. #define FLAG_DRV0_SHIFT U(6)
  22. #define FLAG_DRV1_SHIFT U(7)
  23. #define FLAG_OUID0_SHIFT U(8)
  24. #define FLAG_OUID1_SHIFT U(9)
  25. #define FLAG_OUID2_SHIFT U(10)
  26. #define FLAG_OUID3_SHIFT U(11)
  27. #define FLAG_OUID4_SHIFT U(12)
  28. #define FLAG_DBG_LVL_SHIFT U(13)
  29. #define FLAG_OTPMK_SHIFT U(16)
  30. #define FLAG_OUID_MASK U(0x1F)
  31. #define FLAG_DEBUG_MASK U(0xF)
  32. #define FLAG_OTPMK_MASK U(0xF)
  33. /* OTPMK flag values */
  34. #define PROG_OTPMK_MIN U(0x0)
  35. #define PROG_OTPMK_RANDOM U(0x1)
  36. #define PROG_OTPMK_USER U(0x2)
  37. #define PROG_OTPMK_RANDOM_MIN U(0x5)
  38. #define PROG_OTPMK_USER_MIN U(0x6)
  39. #define PROG_NO_OTPMK U(0x8)
  40. #define OTPMK_MIM_BITS_MASK U(0xF0000000)
  41. /* System configuration bit shifts */
  42. #define SCB_WP_SHIFT U(0)
  43. #define SCB_ITS_SHIFT U(2)
  44. #define SCB_NSEC_SHIFT U(4)
  45. #define SCB_ZD_SHIFT U(5)
  46. #define SCB_K0_SHIFT U(15)
  47. #define SCB_K1_SHIFT U(14)
  48. #define SCB_K2_SHIFT U(13)
  49. #define SCB_K3_SHIFT U(12)
  50. #define SCB_K4_SHIFT U(11)
  51. #define SCB_K5_SHIFT U(10)
  52. #define SCB_K6_SHIFT U(9)
  53. #define SCB_FR0_SHIFT U(30)
  54. #define SCB_FR1_SHIFT U(31)
  55. /* Fuse Header Structure */
  56. struct fuse_hdr_t {
  57. uint8_t barker[4]; /* 0x00 Barker code */
  58. uint32_t flags; /* 0x04 Script flags */
  59. uint32_t povdd_gpio; /* 0x08 GPIO for POVDD */
  60. uint32_t otpmk[8]; /* 0x0C-0x2B OTPMK */
  61. uint32_t srkh[8]; /* 0x2C-0x4B SRKH */
  62. uint32_t oem_uid[5]; /* 0x4C-0x5F OEM unique id's */
  63. uint32_t dcv[2]; /* 0x60-0x67 Debug Challenge */
  64. uint32_t drv[2]; /* 0x68-0x6F Debug Response */
  65. uint32_t ospr1; /* 0x70 OSPR1 */
  66. uint32_t sc; /* 0x74 OSPR0 (System Configuration) */
  67. uint32_t reserved[2]; /* 0x78-0x7F Reserved */
  68. };
  69. /* Function to do fuse provisioning */
  70. int provision_fuses(unsigned long long fuse_scr_addr,
  71. bool en_povdd_status);
  72. #define EFUSE_POWERUP_DELAY_mSec U(25)
  73. #endif /* FUSE_PROV_H */