emmc_otp.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef EMMC_OTP_H
  2. #define EMMC_OTP_H
  3. #ifdef CONFIG_COMPAT
  4. #include <linux/compat.h>
  5. #endif
  6. #define OTP_MAGIC_NUM 0x4E3AF28B
  7. struct emmc_otp_config {
  8. u32 (*read)(u32 blkno, void *BufferPtr);
  9. u32 (*write)(u32 blkno, void *BufferPtr);
  10. u32 (*query_length)(u32 *Length);
  11. };
  12. struct otp_ctl {
  13. unsigned int QLength;
  14. unsigned int Offset;
  15. unsigned int Length;
  16. char *BufferPtr;
  17. unsigned int status;
  18. };
  19. #ifdef CONFIG_COMPAT
  20. struct compat_otp_ctl {
  21. compat_uint_t QLength;
  22. compat_uint_t Offset;
  23. compat_uint_t Length;
  24. compat_uptr_t BufferPtr;
  25. unsigned int status;
  26. };
  27. #endif
  28. #define EMMC_OTP_START_ADDRESS (0xc0000000) /* just for debug */
  29. #define EMMC_HOST_NUM 0
  30. #define EMMC_OTP_MAGIC 'k'
  31. /* EMMC OTP IO control number */
  32. #define EMMC_OTP_GET_LENGTH _IOW(EMMC_OTP_MAGIC, 1, int)
  33. #define EMMC_OTP_READ _IOW(EMMC_OTP_MAGIC, 2, int)
  34. #define EMMC_OTP_WRITE _IOW(EMMC_OTP_MAGIC, 3, int)
  35. #ifdef CONFIG_COMPAT
  36. #define COMPAT_EMMC_OTP_GET_LENGTH _IOW(EMMC_OTP_MAGIC, 1, compat_int_t)
  37. #define COMPAT_EMMC_OTP_READ _IOW(EMMC_OTP_MAGIC, 2, compat_int_t)
  38. #define COMPAT_EMMC_OTP_WRITE _IOW(EMMC_OTP_MAGIC, 3, compat_int_t)
  39. #endif
  40. #define FS_EMMC_OTP_READ 0
  41. #define FS_EMMC_OTP_WRITE 1
  42. /* EMMC OTP Error codes */
  43. #define OTP_SUCCESS 0
  44. #define OTP_ERROR_OVERSCOPE -1
  45. #define OTP_ERROR_TIMEOUT -2
  46. #define OTP_ERROR_BUSY -3
  47. #define OTP_ERROR_NOMEM -4
  48. #define OTP_ERROR_RESET -5
  49. #endif /* end of EMMC_OTP_H */