Advertisement
DenseBrainMatrix

Untitled

Apr 21st, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 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. 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. direction {
  52. gpio = <
  53. &gpio0
  54. 23
  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. step {
  61. gpio = <
  62. &gpio0
  63. 26
  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. // }
  70. };
  71. };
  72.  
  73. // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
  74. &am33xx_pinmux {
  75. // Label "gpio_pins" is arbitrary but must be _globally_ unique among all labels
  76. // in the device tree (base + overlays), hence it's a good idea to make a bit more
  77. // verbose than the node name needs to be. Also, unlike the node name, the label
  78. // needs to be a valid C identifier (so only alphanumeric and underscores).
  79. //
  80. // Node name "gpios" only needs to be unique inside &am33xx_pinmux, so usually
  81. // it's fine to just use the same name as the device it's for.
  82. //
  83. gpio_pins: stepper-gpios {
  84. pinctrl-single,pins = <
  85. // {
  86. PIN_PULLDN( P8_10, 7 )
  87. PIN_PULLDN( P8_11, 7 )
  88. PIN_PULLDN( P8_12, 7 )
  89. PIN_PULLDN( P8_13, 7 )
  90. PIN_PULLDN( P8_14, 7 )
  91. // }
  92. >;
  93. };
  94. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement