Advertisement
Guest User

Untitled

a guest
Sep 27th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.80 KB | None | 0 0
  1. #include "bone/black.h"
  2. #include "gpio.h"
  3.  
  4. // XXX not compatible with cape-universal!
  5.  
  6. // Requires a sufficiently recent kernel by rcn (4.9-bone or 4.9-ti).
  7. //
  8. // A udev rule along these lines is recommended:
  9. //
  10. // SUBSYSTEM=="subsystem", KERNEL=="gpio", ACTION=="add", \
  11. // RUN+="/bin/mkdir -p /dev/gpio"
  12. //
  13. // SUBSYSTEM=="gpio", ACTION=="add", TEST=="value", ATTR{label}!="sysfs", \
  14. // RUN+="/bin/ln -sT '/sys/class/gpio/%k' /dev/gpio/%s{label}"
  15.  
  16. / {
  17. // If you want to use multiple overlays that do gpio configuration, be
  18. // sure that each uses a different device tree node!
  19.  
  20. gpio-demo {
  21. compatible = "gpio-of-helper";
  22.  
  23. // It is usually not *strictly* required to perform pinmux for
  24. // GPIOs since this is typically their default, but it's good
  25. // practice to do it anyway since:
  26. // 1. it makes *sure* the pinmux is right
  27. // 2. you can configure internal pull-up/down
  28. // 3. it lets the kernel know the pins are in use
  29. pinctrl-names = "default";
  30. pinctrl-0 = <&gpio_demo_pins>;
  31.  
  32. // Note that gpio numbers for each pin can be found in the
  33. // comments in include/bone/black.h
  34.  
  35. // custom (new) configuration
  36.  
  37. P9.11 {
  38. gpio = <&gpio0 30 ACTIVE_HIGH>; // P9.11
  39. output;
  40. init-low;
  41. };
  42. P9.12 {
  43. gpio = <&gpio1 28 ACTIVE_HIGH>; // P9.12
  44. input;
  45. };
  46. P9.15 {
  47. gpio = <&gpio1 16 ACTIVE_HIGH>; // P9.15
  48. input;
  49. };
  50.  
  51.  
  52. P9.25 {
  53. gpio = <&gpio3 21 ACTIVE_HIGH>; // P9.25
  54. output;
  55. init-low;
  56. };
  57. P9.27 {
  58. gpio = <&gpio3 19 ACTIVE_HIGH>; // P9.27
  59. input;
  60. };
  61. P9.41 {
  62. gpio = <&gpio0 20 ACTIVE_HIGH>; // P9.41
  63. output;
  64. init-low;
  65. };
  66. P9.42 {
  67. gpio = <&gpio0 7 ACTIVE_HIGH>; // P9.42
  68. output;
  69. init-low;
  70. };
  71. P8.03 {
  72. gpio = <&gpio1 6 ACTIVE_HIGH>; // P8.3
  73. output;
  74. init-low;
  75. };
  76. P8.04 {
  77. gpio = <&gpio1 7 ACTIVE_HIGH>; // P8.4
  78. output;
  79. init-low;
  80. };
  81. P8.05 {
  82. gpio = <&gpio1 2 ACTIVE_HIGH>; // P8.5
  83. output;
  84. init-low;
  85. };
  86. P8.06 {
  87. gpio = <&gpio1 3 ACTIVE_HIGH>; // P8.6
  88. output;
  89. init-low;
  90. };
  91. P8.07 {
  92. gpio = <&gpio2 2 ACTIVE_HIGH>; // P8.7
  93. input;
  94. };
  95. P8.08 {
  96. gpio = <&gpio2 3 ACTIVE_HIGH>; // P8.8
  97. input;
  98. };
  99. P8.11 {
  100. gpio = <&gpio1 13 ACTIVE_HIGH>; // P8.11
  101. output;
  102. init-low;
  103. };
  104. P8.12 {
  105. gpio = <&gpio1 12 ACTIVE_HIGH>; // P8.12
  106. output;
  107. init-low;
  108. };
  109. P8.14 {
  110. gpio = <&gpio0 26 ACTIVE_HIGH>; // P8.14
  111. output;
  112. init-low;
  113. };
  114. P8.15 {
  115. gpio = <&gpio1 15 ACTIVE_HIGH>; // P8.15
  116. output;
  117. init-low;
  118. };
  119. P8.16 {
  120. gpio = <&gpio1 14 ACTIVE_HIGH>; // P8.16
  121. output;
  122. init-low;
  123. };
  124. P8.17 {
  125. gpio = <&gpio0 27 ACTIVE_HIGH>; // P8.17
  126. output;
  127. init-low;
  128. };
  129. P8.18 {
  130. gpio = <&gpio2 1 ACTIVE_HIGH>; // P8.18
  131. output;
  132. init-low;
  133. };
  134. P8.20 {
  135. gpio = <&gpio1 31 ACTIVE_HIGH>; // P8.20
  136. output;
  137. init-low;
  138. };
  139. P8.21 {
  140. gpio = <&gpio1 30 ACTIVE_HIGH>; // P8.21
  141. output;
  142. init-low;
  143. };
  144. P8.22 {
  145. gpio = <&gpio1 5 ACTIVE_HIGH>; // P8.22
  146. output;
  147. init-low;
  148. };
  149. P8.23 {
  150. gpio = <&gpio1 4 ACTIVE_HIGH>; // P8.23
  151. output;
  152. init-low;
  153. };
  154. P8.24 {
  155. gpio = <&gpio1 1 ACTIVE_HIGH>; // P8.24
  156. output;
  157. init-low;
  158. };
  159. P8.25 {
  160. gpio = <&gpio1 0 ACTIVE_HIGH>; // P8.25
  161. output;
  162. init-low;
  163. };
  164. P8.26 {
  165. gpio = <&gpio1 29 ACTIVE_HIGH>; // P8.26
  166. input;
  167. };
  168. P8.27 {
  169. gpio = <&gpio2 22 ACTIVE_HIGH>; // P8.27
  170. input;
  171. };
  172. P8.28 {
  173. gpio = <&gpio2 24 ACTIVE_HIGH>; // P8.28
  174. output;
  175. init-low;
  176. };
  177. P8.29 {
  178. gpio = <&gpio2 23 ACTIVE_HIGH>; // P8.29
  179. output;
  180. init-low;
  181. };
  182. P8.30 {
  183. gpio = <&gpio2 25 ACTIVE_HIGH>; // P8.30
  184. output;
  185. init-low;
  186. };
  187. P8.31 {
  188. gpio = <&gpio0 10 ACTIVE_HIGH>; // P8.31
  189. output;
  190. init-low;
  191. };
  192. P8.39 {
  193. gpio = <&gpio2 12 ACTIVE_HIGH>; // P8.39
  194. output;
  195. init-low;
  196. };
  197. P8.40 {
  198. gpio = <&gpio2 13 ACTIVE_HIGH>; // P8.40
  199. output;
  200. init-low;
  201. };
  202. P8.41 {
  203. gpio = <&gpio2 10 ACTIVE_HIGH>; // P8.41
  204. output;
  205. init-low;
  206. };
  207. P8.42 {
  208. gpio = <&gpio2 11 ACTIVE_HIGH>; // P8.42
  209. output;
  210. init-low;
  211. };
  212. P8.43 {
  213. gpio = <&gpio2 8 ACTIVE_HIGH>; // P8.43
  214. output;
  215. init-low;
  216. };
  217. P8.44 {
  218. gpio = <&gpio2 9 ACTIVE_HIGH>; // P8.44
  219. input;
  220. };
  221. P8.45 {
  222. gpio = <&gpio2 6 ACTIVE_HIGH>; // P8.45
  223. input;
  224. };
  225. P8.46 {
  226. gpio = <&gpio2 7 ACTIVE_HIGH>; // P8.46
  227. input;
  228. };
  229. };
  230. };
  231.  
  232. &am33xx_pinmux {
  233. gpio_demo_pins: gpio-demo {
  234. pinctrl-single,pins = <
  235. // use PIN_PULLUP/PIN_PULLDN/PIN_NOPULL mode 7
  236. //if we want slow slew rate: PIN_PULLUP( P9_26, 3 | SLEW_SLOW)
  237.  
  238. PIN_PULLDN( P9_11, 7 ) //gpio 0.30
  239. PIN_NOPULL( P9_12, 7 ) //gpio 1.28
  240. PIN_NOPULL( P9_15a, 7 ) //gpio 1.16
  241. PIN_NOPULL( P9_15b, 7 ) //gpio 1.16 //for some reason there are two here
  242. PIN_PULLDN( P9_25, 7 ) // gpio 3.21
  243. PIN_NOPULL( P9_27, 7 ) // gpio 3.19
  244. PIN_PULLDN( P9_41, 7 ) // gpio 0.20
  245. PIN_PULLDN( P9_42, 7 ) // gpio 0.7
  246.  
  247. //would have P8.3-6 be pull down, but support warns against pulling these
  248. PIN_NOPULL( P8_03, 7 ) // gpio 1.6
  249. PIN_NOPULL( P8_04, 7 ) // gpio 1.7
  250. PIN_NOPULL( P8_05, 7 ) // gpio 1.2
  251. PIN_NOPULL( P8_06, 7 ) // gpio 1.3
  252. PIN_PULLDN( P8_07, 7 ) // gpio 2.02
  253. PIN_PULLDN( P8_08, 7 ) // gpio 2.03
  254. PIN_PULLDN( P8_11, 7 ) // gpio 1.13
  255. PIN_PULLDN( P8_12, 7 ) // gpio 1.12
  256. PIN_PULLDN( P8_14, 7 ) // gpio 1.26
  257. PIN_PULLDN( P8_15, 7 ) // gpio 1.15
  258. PIN_PULLDN( P8_16, 7 ) // gpio 1.14
  259. PIN_PULLDN( P8_17, 7 ) // gpio 2.1?
  260. PIN_PULLDN( P8_18, 7 ) // gpio 2.1?
  261.  
  262. //would have P8.20-25 be pull down, but support warns against pulling these
  263. PIN_NOPULL( P8_20, 7 ) // gpio 1.31
  264. PIN_NOPULL( P8_21, 7 ) // gpio 1.30
  265. PIN_NOPULL( P8_22, 7 ) // gpio 1.5
  266. PIN_NOPULL( P8_23, 7 ) // gpio 1.4
  267. PIN_NOPULL( P8_24, 7 ) // gpio 1.1
  268. PIN_NOPULL( P8_25, 7 ) // gpio 1.0
  269. PIN_NOPULL( P8_26, 7 ) // gpio 1.29
  270. PIN_NOPULL( P8_27, 7 ) // gpio 2.22
  271. PIN_PULLDN( P8_28, 7 ) // gpio 2.24
  272. PIN_PULLDN( P8_29, 7 ) // gpio 2.23
  273. PIN_PULLDN( P8_30, 7 ) // gpio 2.25
  274. PIN_PULLDN( P8_31, 7 ) // gpio 0.10
  275. PIN_PULLDN( P8_39, 7 ) // gpio 2.12
  276. PIN_PULLDN( P8_40, 7 ) // gpio 2.13
  277. PIN_PULLDN( P8_41, 7 ) // gpio 2.10
  278. PIN_PULLDN( P8_42, 7 ) // gpio 2.11
  279. PIN_PULLDN( P8_43, 7 ) // gpio 2.8
  280. PIN_NOPULL( P8_44, 7 ) // gpio 2.9
  281. PIN_NOPULL( P8_45, 7 ) // gpio 2.6
  282. PIN_NOPULL( P8_46, 7 ) // gpio 2.7
  283. >;
  284. };
  285. };
  286.  
  287. //configure and enable analog pins
  288. &tscadc {
  289. status = "okay";
  290.  
  291. adc {
  292. ti,adc-channels = <0 1 2 3 4 5 6 7>;
  293. ti,chan-step-avg = <16 16 16 16 16 16 16 16>;
  294. ti,chan-step-opendelay = <0 0 0 0 0 0 0 0>;
  295. ti,chan-step-sampledelay = <6 6 6 6 6 6 6 6>;
  296. };
  297. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement