Advertisement
Guest User

Untitled

a guest
Mar 11th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 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. magnet-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. magnet_dir {
  25. gpio = <
  26. &gpio0
  27. 31
  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. };
  34. };
  35.  
  36. // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
  37. &am33xx_pinmux {
  38. // Label "gpio_pins" is arbitrary but must be _globally_ unique among all labels
  39. // in the device tree (base + overlays), hence it's a good idea to make a bit more
  40. // verbose than the node name needs to be. Also, unlike the node name, the label
  41. // needs to be a valid C identifier (so only alphanumeric and underscores).
  42. //
  43. // Node name "gpios" only needs to be unique inside &am33xx_pinmux, so usually
  44. // it's fine to just use the same name as the device it's for.
  45. //
  46. gpio_pins: magnet-gpios {
  47. pinctrl-single,pins = <
  48. // {
  49. PIN_PULLDN( P9_13, 7:x )
  50. // }
  51. >;
  52. };
  53. };
  54. 49,23-44 All
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement