Kconfig 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. menuconfig RT_USING_I2C
  2. bool "Using I2C device drivers"
  3. default n
  4. help
  5. Enable the RT-Thread I2C core so both DM aware controllers and legacy bus
  6. drivers can register `struct rt_i2c_bus_device` objects, and client
  7. drivers can issue transfers through the unified APIs. Select this on any
  8. board that exposes an I2C peripheral or software bit-bang bus; disable it
  9. only if you never interface with I2C sensors/PMICs/MCUs.
  10. if RT_USING_I2C
  11. config RT_I2C_DEBUG
  12. bool "Use I2C debug message"
  13. default n
  14. help
  15. Print verbose I2C transaction logs (start/stop, address, data) to the
  16. console. Helpful while debugging board bring-up, but it slows down the
  17. bus and should remain off in production firmware.
  18. config RT_USING_I2C_BITOPS
  19. bool "Use GPIO to simulate I2C"
  20. default y
  21. help
  22. Build the generic bit-banging algorithm (`dev_i2c_bit_ops.c`) so
  23. controller drivers or the software I2C backend can drive SCL/SDA pins
  24. directly. Disable this only when every I2C controller is hardware-
  25. assisted and you want to shave a few hundred bytes of code.
  26. if RT_USING_I2C_BITOPS
  27. config RT_I2C_BITOPS_DEBUG
  28. bool "Use simulate I2C debug message"
  29. default n
  30. help
  31. Emit timing-level diagnostics from the bit-bang implementation,
  32. showing whether GPIO toggles are happening as expected. Useful to
  33. diagnose board wiring or timing issues, but generates a lot of log
  34. traffic and should stay disabled normally.
  35. endif
  36. menuconfig RT_USING_SOFT_I2C
  37. bool "Use GPIO to soft simulate I2C"
  38. default n
  39. select RT_USING_PIN
  40. select RT_USING_I2C_BITOPS
  41. help
  42. Instantiate one or more fully software I2C buses backed by GPIO pins.
  43. Each enabled bus entry below lets you choose SCL/SDA pin numbers, the
  44. exported bus name, and bit-bang timing. Use this when the SoC lacks an
  45. available controller but you still need to connect low-speed sensors.
  46. if RT_USING_SOFT_I2C
  47. menuconfig RT_USING_SOFT_I2C0
  48. bool "Enable I2C0 Bus (software simulation)"
  49. default y
  50. help
  51. Create a software I2C bus named by `RT_SOFT_I2C0_BUS_NAME`
  52. using the selected SCL/SDA pins. Disable it if the board does
  53. not wire up a first soft I2C channel.
  54. if RT_USING_SOFT_I2C0
  55. config RT_SOFT_I2C0_SCL_PIN
  56. int "SCL pin number"
  57. range 0 32767
  58. default 1
  59. config RT_SOFT_I2C0_SDA_PIN
  60. int "SDA pin number"
  61. range 0 32767
  62. default 2
  63. config RT_SOFT_I2C0_BUS_NAME
  64. string "Bus name"
  65. default "i2c0"
  66. config RT_SOFT_I2C0_TIMING_DELAY
  67. int "Timing delay (us)"
  68. range 0 32767
  69. default 10
  70. config RT_SOFT_I2C0_TIMING_TIMEOUT
  71. int "Timing timeout (tick)"
  72. range 0 32767
  73. default 10
  74. endif
  75. menuconfig RT_USING_SOFT_I2C1
  76. bool "Enable I2C1 Bus (software simulation)"
  77. default y
  78. help
  79. Enable the second software I2C controller and configure its
  80. pins/name/timing below when multiple bit-bang buses are wired
  81. out on the PCB.
  82. if RT_USING_SOFT_I2C1
  83. config RT_SOFT_I2C1_SCL_PIN
  84. int "SCL pin number"
  85. range 0 32767
  86. default 3
  87. config RT_SOFT_I2C1_SDA_PIN
  88. int "SDA pin number"
  89. range 0 32767
  90. default 4
  91. config RT_SOFT_I2C1_BUS_NAME
  92. string "Bus name"
  93. default "i2c1"
  94. config RT_SOFT_I2C1_TIMING_DELAY
  95. int "Timing delay (us)"
  96. range 0 32767
  97. default 10
  98. config RT_SOFT_I2C1_TIMING_TIMEOUT
  99. int "Timing timeout (tick)"
  100. range 0 32767
  101. default 10
  102. endif
  103. menuconfig RT_USING_SOFT_I2C2
  104. bool "Enable I2C2 Bus (software simulation)"
  105. default n
  106. help
  107. Optional third soft I2C bus for boards that expose additional
  108. GPIO pairs. Turn this on only if you really route the
  109. corresponding pins.
  110. if RT_USING_SOFT_I2C2
  111. config RT_SOFT_I2C2_SCL_PIN
  112. int "SCL pin number"
  113. range 0 32767
  114. default 5
  115. config RT_SOFT_I2C2_SDA_PIN
  116. int "SDA pin number"
  117. range 0 32767
  118. default 6
  119. config RT_SOFT_I2C2_BUS_NAME
  120. string "Bus name"
  121. default "i2c2"
  122. config RT_SOFT_I2C2_TIMING_DELAY
  123. int "Timing delay (us)"
  124. range 0 32767
  125. default 10
  126. config RT_SOFT_I2C2_TIMING_TIMEOUT
  127. int "Timing timeout (tick)"
  128. range 0 32767
  129. default 10
  130. endif
  131. menuconfig RT_USING_SOFT_I2C3
  132. bool "Enable I2C3 Bus (software simulation)"
  133. default n
  134. help
  135. Same as above but for the fourth software I2C instance.
  136. if RT_USING_SOFT_I2C3
  137. config RT_SOFT_I2C3_SCL_PIN
  138. int "SCL pin number"
  139. range 0 32767
  140. default 7
  141. config RT_SOFT_I2C3_SDA_PIN
  142. int "SDA pin number"
  143. range 0 32767
  144. default 8
  145. config RT_SOFT_I2C3_BUS_NAME
  146. string "Bus name"
  147. default "i2c3"
  148. config RT_SOFT_I2C3_TIMING_DELAY
  149. int "Timing delay (us)"
  150. range 0 32767
  151. default 10
  152. config RT_SOFT_I2C3_TIMING_TIMEOUT
  153. int "Timing timeout (tick)"
  154. range 0 32767
  155. default 10
  156. endif
  157. menuconfig RT_USING_SOFT_I2C4
  158. bool "Enable I2C4 Bus (software simulation)"
  159. default n
  160. help
  161. Enable the fifth configurable bit-bang bus if more GPIO-based
  162. channels are required.
  163. if RT_USING_SOFT_I2C4
  164. config RT_SOFT_I2C4_SCL_PIN
  165. int "SCL pin number"
  166. range 0 32767
  167. default 9
  168. config RT_SOFT_I2C4_SDA_PIN
  169. int "SDA pin number"
  170. range 0 32767
  171. default 10
  172. config RT_SOFT_I2C4_BUS_NAME
  173. string "Bus name"
  174. default "i2c4"
  175. config RT_SOFT_I2C4_TIMING_DELAY
  176. int "Timing delay (us)"
  177. range 0 32767
  178. default 10
  179. config RT_SOFT_I2C4_TIMING_TIMEOUT
  180. int "Timing timeout (tick)"
  181. range 0 32767
  182. default 10
  183. endif
  184. menuconfig RT_USING_SOFT_I2C5
  185. bool "Enable I2C5 Bus (software simulation)"
  186. default n
  187. help
  188. Enable the sixth configurable bit-bang bus when the hardware
  189. exposes yet another sensor connector.
  190. if RT_USING_SOFT_I2C5
  191. config RT_SOFT_I2C5_SCL_PIN
  192. int "SCL pin number"
  193. range 0 32767
  194. default 11
  195. config RT_SOFT_I2C5_SDA_PIN
  196. int "SDA pin number"
  197. range 0 32767
  198. default 12
  199. config RT_SOFT_I2C5_BUS_NAME
  200. string "Bus name"
  201. default "i2c5"
  202. config RT_SOFT_I2C5_TIMING_DELAY
  203. int "Timing delay (us)"
  204. range 0 32767
  205. default 10
  206. config RT_SOFT_I2C5_TIMING_TIMEOUT
  207. int "Timing timeout (tick)"
  208. range 0 32767
  209. default 10
  210. endif
  211. menuconfig RT_USING_SOFT_I2C6
  212. bool "Enable I2C6 Bus (software simulation)"
  213. default n
  214. help
  215. Enable the seventh software bus; use only on complex boards
  216. because each additional bus increases code/data usage.
  217. if RT_USING_SOFT_I2C6
  218. config RT_SOFT_I2C6_SCL_PIN
  219. int "SCL pin number"
  220. range 0 32767
  221. default 13
  222. config RT_SOFT_I2C6_SDA_PIN
  223. int "SDA pin number"
  224. range 0 32767
  225. default 14
  226. config RT_SOFT_I2C6_BUS_NAME
  227. string "Bus name"
  228. default "i2c6"
  229. config RT_SOFT_I2C6_TIMING_DELAY
  230. int "Timing delay (us)"
  231. range 0 32767
  232. default 10
  233. config RT_SOFT_I2C6_TIMING_TIMEOUT
  234. int "Timing timeout (tick)"
  235. range 0 32767
  236. default 10
  237. endif
  238. menuconfig RT_USING_SOFT_I2C7
  239. bool "Enable I2C7 Bus (software simulation)"
  240. default n
  241. help
  242. Provide an eighth configurable software bus if still more GPIO
  243. pairs are required for isolated peripherals.
  244. if RT_USING_SOFT_I2C7
  245. config RT_SOFT_I2C7_SCL_PIN
  246. int "SCL pin number"
  247. range 0 32767
  248. default 15
  249. config RT_SOFT_I2C7_SDA_PIN
  250. int "SDA pin number"
  251. range 0 32767
  252. default 16
  253. config RT_SOFT_I2C7_BUS_NAME
  254. string "Bus name"
  255. default "i2c7"
  256. config RT_SOFT_I2C7_TIMING_DELAY
  257. int "Timing delay (us)"
  258. range 0 32767
  259. default 10
  260. config RT_SOFT_I2C7_TIMING_TIMEOUT
  261. int "Timing timeout (tick)"
  262. range 0 32767
  263. default 10
  264. endif
  265. menuconfig RT_USING_SOFT_I2C8
  266. bool "Enable I2C8 Bus (software simulation)"
  267. default n
  268. help
  269. Final reserved entry for a ninth soft I2C controller. Enable
  270. it only when the design needs that many bit-bang buses; leave
  271. disabled otherwise to save resources.
  272. if RT_USING_SOFT_I2C8
  273. config RT_SOFT_I2C8_SCL_PIN
  274. int "SCL pin number"
  275. range 0 32767
  276. default 17
  277. config RT_SOFT_I2C8_SDA_PIN
  278. int "SDA pin number"
  279. range 0 32767
  280. default 18
  281. config RT_SOFT_I2C8_BUS_NAME
  282. string "Bus name"
  283. default "i2c8"
  284. config RT_SOFT_I2C8_TIMING_DELAY
  285. int "Timing delay (us)"
  286. range 0 32767
  287. default 10
  288. config RT_SOFT_I2C8_TIMING_TIMEOUT
  289. int "Timing timeout (tick)"
  290. range 0 32767
  291. default 10
  292. endif
  293. endif
  294. endif
  295. if RT_USING_DM && RT_USING_I2C
  296. osource "$(SOC_DM_I2C_DIR)/Kconfig"
  297. endif