Advertisement
DenseBrainMatrix

Untitled

Apr 22nd, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. #include "bone/black.h"
  2. #include "gpio.h"
  3.  
  4. // Since we're creating a virtual device, there's not really a better place to
  5. // put it than root of the device tree.
  6. / {
  7. // Node name "gpios" is arbitrary but should not conflict with other
  8. // nodes or properties in the root of the device tree.
  9. // To list all of these on a running system: ls /proc/device-tree/
  10. motor-gpios {
  11. // configure the driver for this device node, which must be "gpio-of-helper"
  12. compatible = "gpio-of-helper";
  13.  
  14. // Attach pinmux node to this device node. In rare cases devices may have
  15. // multiple pinmux states, but usually you only have a "default" state.
  16. pinctrl-names = "default";
  17. pinctrl-0 = <&gpio_pins>; //<--- references the "gpio_pins:" label below
  18.  
  19. // For each gpio to be setup {
  20.  
  21. // The node name "gpio-label" becomes the gpio label and may be arbitrary but
  22. // must be unique for each gpio (globally, not merely those exported by this
  23. // gpio-of-helper device).
  24. MS1 {
  25. gpio = <
  26. &gpio2
  27. 4
  28. ACTIVE_HIGH
  29. >;
  30. output; // initial direction: input or output (optional for outputs)
  31. init-low; // if output, whether it's initially low or initially high
  32. };
  33. MS2 {
  34. gpio = <
  35. &gpio1
  36. 13
  37. ACTIVE_HIGH
  38. >;
  39. output; // initial direction: input or output (optional for outputs)
  40. init-low; // if output, whether it's initially low or initially high
  41. };
  42. enable {
  43. gpio = <
  44. &gpio1
  45. 12
  46. ACTIVE_LOW
  47. >;
  48. output; // initial direction: input or output (optional for outputs)
  49. init-low; // if output, whether it's initially low or initially high
  50. };
  51. motor_dir {
  52. gpio = <
  53. &gpio0
  54. 31
  55. ACTIVE_HIGH
  56. >;
  57. output; // initial direction: input or output (optional for outputs)
  58. init-low; // if output, whether it's initially low or initially high
  59. };
  60. stepper_dir {
  61. gpio = <
  62. &gpio0
  63. 23
  64. ACTIVE_HIGH
  65. >;
  66. output; // initial direction: input or output (optional for outputs)
  67. init-low; // if output, whether it's initially low or initially high
  68. };
  69. step {
  70. gpio = <
  71. &gpio0
  72. 26
  73. ACTIVE_HIGH
  74. >;
  75. output; // initial direction: input or output (optional for outputs)
  76. init-low; // if output, whether it's initially low or initially high
  77. };
  78. // }
  79. };
  80. };
  81.  
  82. // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
  83. &am33xx_pinmux {
  84. // Label "gpio_pins" is arbitrary but must be _globally_ unique among all labels
  85. // in the device tree (base + overlays), hence it's a good idea to make a bit more
  86. // verbose than the node name needs to be. Also, unlike the node name, the label
  87. // needs to be a valid C identifier (so only alphanumeric and underscores).
  88. //
  89. // Node name "gpios" only needs to be unique inside &am33xx_pinmux, so usually
  90. // it's fine to just use the same name as the device it's for.
  91. //
  92. gpio_pins: motor-gpios {
  93. pinctrl-single,pins = <
  94. // {
  95. PIN_PULLDN( P8_10, 7 )
  96. PIN_PULLDN( P8_11, 7 )
  97. PIN_PULLDN( P8_12, 7 )
  98. PIN_PULLDN( P8_13, 7 )
  99. PIN_PULLDN( P8_14, 7 )
  100. PIN_PULLDN( P9_13, 7 )
  101. // }
  102. >;
  103. };
  104. };
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement