pf0100.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2014-2019, Toradex AG
  4. */
  5. /*
  6. * Helpers for Freescale PMIC PF0100
  7. */
  8. #ifndef PF0100_H_
  9. #define PF0100_H_
  10. /* bit definitions */
  11. #define PFUZE100_BIT_0 (0x01 << 0)
  12. #define PFUZE100_BIT_1 (0x01 << 1)
  13. #define PFUZE100_BIT_2 (0x01 << 2)
  14. #define PFUZE100_BIT_3 (0x01 << 3)
  15. #define PFUZE100_BIT_4 (0x01 << 4)
  16. #define PFUZE100_BIT_5 (0x01 << 5)
  17. #define PFUZE100_BIT_6 (0x01 << 6)
  18. #define PFUZE100_BIT_7 (0x01 << 7)
  19. /* 7-bit I2C bus slave address */
  20. #define PFUZE100_I2C_ADDR (0x08)
  21. /* Register Addresses */
  22. #define PFUZE100_DEVICEID (0x0)
  23. #define PFUZE100_REVID (0x3)
  24. #define PFUZE100_INTSTAT3 (0xe)
  25. #define PFUZE100_BIT_OTP_ECCI PFUZE100_BIT_7
  26. #define PFUZE100_SW1AMODE (0x23)
  27. #define PFUZE100_SW1ACON 36
  28. #define PFUZE100_SW1ACON_SPEED_VAL (0x1<<6) /*default */
  29. #define PFUZE100_SW1ACON_SPEED_M (0x3<<6)
  30. #define PFUZE100_SW1CCON 49
  31. #define PFUZE100_SW1CCON_SPEED_VAL (0x1<<6) /*default */
  32. #define PFUZE100_SW1CCON_SPEED_M (0x3<<6)
  33. #define PFUZE100_SW1AVOL 32
  34. #define PFUZE100_SW1AVOL_VSEL_M (0x3f<<0)
  35. #define PFUZE100_SW1CVOL 46
  36. #define PFUZE100_SW1CVOL_VSEL_M (0x3f<<0)
  37. #define PFUZE100_VGEN1CTL (0x6c)
  38. #define PFUZE100_VGEN1_VAL (0x30 + 0x08) /* Always ON, 1.2V */
  39. #define PFUZE100_SWBSTCTL (0x66)
  40. /* Always ON, Auto Switching Mode, 5.0V */
  41. #define PFUZE100_SWBST_VAL (0x40 + 0x08 + 0x00)
  42. /* chooses the extended page (registers 0x80..0xff) */
  43. #define PFUZE100_PAGE_REGISTER 0x7f
  44. #define PFUZE100_PAGE_REGISTER_PAGE_M (0x1f << 0)
  45. #define PFUZE100_PAGE_REGISTER_PAGE1 (0x01 & PFUZE100_PAGE_REGISTER_PAGE_M)
  46. #define PFUZE100_PAGE_REGISTER_PAGE2 (0x02 & PFUZE100_PAGE_REGISTER_PAGE_M)
  47. /* extended page 1 */
  48. #define PFUZE100_OTP_ECC_SE1 0x8a
  49. #define PFUZE100_BIT_ECC1_SE PFUZE100_BIT_0
  50. #define PFUZE100_BIT_ECC2_SE PFUZE100_BIT_1
  51. #define PFUZE100_BIT_ECC3_SE PFUZE100_BIT_2
  52. #define PFUZE100_BIT_ECC4_SE PFUZE100_BIT_3
  53. #define PFUZE100_BIT_ECC5_SE PFUZE100_BIT_4
  54. #define PFUZE100_BITS_ECC_SE1 ((PFUZE100_BIT_ECC1_SE) | \
  55. (PFUZE100_BIT_ECC2_SE) | \
  56. (PFUZE100_BIT_ECC3_SE) | \
  57. (PFUZE100_BIT_ECC4_SE) | \
  58. (PFUZE100_BIT_ECC5_SE))
  59. #define PFUZE100_OTP_ECC_SE2 0x8b
  60. #define PFUZE100_BIT_ECC6_SE PFUZE100_BIT_0
  61. #define PFUZE100_BIT_ECC7_SE PFUZE100_BIT_1
  62. #define PFUZE100_BIT_ECC8_SE PFUZE100_BIT_2
  63. #define PFUZE100_BIT_ECC9_SE PFUZE100_BIT_3
  64. #define PFUZE100_BIT_ECC10_SE PFUZE100_BIT_4
  65. #define PFUZE100_BITS_ECC_SE2 ((PFUZE100_BIT_ECC6_SE) | \
  66. (PFUZE100_BIT_ECC7_SE) | \
  67. (PFUZE100_BIT_ECC8_SE) | \
  68. (PFUZE100_BIT_ECC9_SE) | \
  69. (PFUZE100_BIT_ECC10_SE))
  70. #define PFUZE100_OTP_ECC_DE1 0x8c
  71. #define PFUZE100_BIT_ECC1_DE PFUZE100_BIT_0
  72. #define PFUZE100_BIT_ECC2_DE PFUZE100_BIT_1
  73. #define PFUZE100_BIT_ECC3_DE PFUZE100_BIT_2
  74. #define PFUZE100_BIT_ECC4_DE PFUZE100_BIT_3
  75. #define PFUZE100_BIT_ECC5_DE PFUZE100_BIT_4
  76. #define PFUZE100_BITS_ECC_DE1 ((PFUZE100_BIT_ECC1_DE) | \
  77. (PFUZE100_BIT_ECC2_DE) | \
  78. (PFUZE100_BIT_ECC3_DE) | \
  79. (PFUZE100_BIT_ECC4_DE) | \
  80. (PFUZE100_BIT_ECC5_DE))
  81. #define PFUZE100_OTP_ECC_DE2 0x8d
  82. #define PFUZE100_BIT_ECC6_DE PFUZE100_BIT_0
  83. #define PFUZE100_BIT_ECC7_DE PFUZE100_BIT_1
  84. #define PFUZE100_BIT_ECC8_DE PFUZE100_BIT_2
  85. #define PFUZE100_BIT_ECC9_DE PFUZE100_BIT_3
  86. #define PFUZE100_BIT_ECC10_DE PFUZE100_BIT_4
  87. #define PFUZE100_BITS_ECC_DE2 ((PFUZE100_BIT_ECC6_DE) | \
  88. (PFUZE100_BIT_ECC7_DE) | \
  89. (PFUZE100_BIT_ECC8_DE) | \
  90. (PFUZE100_BIT_ECC9_DE) | \
  91. (PFUZE100_BIT_ECC10_DE))
  92. #define PFUZE100_FUSE_POR1 0xe4
  93. #define PFUZE100_FUSE_POR2 0xe5
  94. #define PFUZE100_FUSE_POR3 0xe6
  95. #define PFUZE100_FUSE_POR_M (0x1 << 1)
  96. /* output some informational messages, return the number FUSE_POR=1 */
  97. /* i.e. 0: unprogrammed, 3: programmed, other: undefined prog. state */
  98. unsigned pmic_init(void);
  99. #endif /* PF0100_H_ */