otp.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * OTP Masks
  3. */
  4. #ifndef __BFIN_PERIPHERAL_OTP__
  5. #define __BFIN_PERIPHERAL_OTP__
  6. #ifndef __ASSEMBLY__
  7. #include "bootrom.h"
  8. static uint32_t (* const bfrom_OtpCommand)(uint32_t command, uint32_t value) = (void *)_BOOTROM_OTP_COMMAND;
  9. static uint32_t (* const bfrom_OtpRead)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_READ;
  10. static uint32_t (* const bfrom_OtpWrite)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_WRITE;
  11. #endif
  12. /* otp_command(): defines for "command" */
  13. #define OTP_INIT 0x00000001
  14. #define OTP_CLOSE 0x00000002
  15. /* otp_{read,write}(): defines for "flags" */
  16. #define OTP_LOWER_HALF 0x00000000 /* select upper/lower 64-bit half (bit 0) */
  17. #define OTP_UPPER_HALF 0x00000001
  18. #define OTP_NO_ECC 0x00000010 /* do not use ECC */
  19. #define OTP_LOCK 0x00000020 /* sets page protection bit for page */
  20. #define OTP_CHECK_FOR_PREV_WRITE 0x00000080
  21. /* Return values for all functions */
  22. #define OTP_SUCCESS 0x00000000
  23. #define OTP_MASTER_ERROR 0x001
  24. #define OTP_WRITE_ERROR 0x003
  25. #define OTP_READ_ERROR 0x005
  26. #define OTP_ACC_VIO_ERROR 0x009
  27. #define OTP_DATA_MULT_ERROR 0x011
  28. #define OTP_ECC_MULT_ERROR 0x021
  29. #define OTP_PREV_WR_ERROR 0x041
  30. #define OTP_DATA_SB_WARN 0x100
  31. #define OTP_ECC_SB_WARN 0x200
  32. /* Predefined otp pages: Factory Programmed Settings */
  33. #define FPS00 0x0004
  34. #define FPS01 0x0005
  35. #define FPS02 0x0006
  36. #define FPS03 0x0007
  37. #define FPS04 0x0008
  38. #define FPS05 0x0009
  39. #define FPS06 0x000A
  40. #define FPS07 0x000B
  41. #define FPS08 0x000C
  42. #define FPS09 0x000D
  43. #define FPS10 0x000E
  44. #define FPS11 0x000F
  45. /* Predefined otp pages: Customer Programmed Settings */
  46. #define CPS00 0x0010
  47. #define CPS01 0x0011
  48. #define CPS02 0x0012
  49. #define CPS03 0x0013
  50. #define CPS04 0x0014
  51. #define CPS05 0x0015
  52. #define CPS06 0x0016
  53. #define CPS07 0x0017
  54. /* Predefined otp pages: Pre-Boot Settings */
  55. #define PBS00 0x0018
  56. #define PBS01 0x0019
  57. #define PBS02 0x001A
  58. #define PBS03 0x001B
  59. #endif