Advertisement
Guest User

Untitled

a guest
Mar 11th, 2023
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.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 "magnet-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 = <&magnet_gpio_pins>; //<--- references the "magnet_gpio_pins:" label below
  18.  
  19. // The node name "magnet_dir" becomes the gpio label and may be arbitrary but
  20. // must be unique for each gpio (globally, not merely those exported by this
  21. // gpio-of-helper device).
  22. magnet_dir {
  23. gpio = <
  24. &gpio0
  25. 31
  26. ACTIVE_HIGH
  27. >;
  28. output; // initial direction: input or output (optional for outputs)
  29. init-low; // if output, whether it's initially low or initially high
  30. };
  31. };
  32. };
  33.  
  34. // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
  35. &am33xx_pinmux {
  36. // Label "magnet_gpio_pins" is arbitrary but must be _globally_ unique among all labels
  37. // in the device tree (base + overlays), hence it's a good idea to make a bit more
  38. // verbose than the node name needs to be. Also, unlike the node name, the label
  39. // needs to be a valid C identifier (so only alphanumeric and underscores).
  40. //
  41. // Node name "magnet-gpios" only needs to be unique inside &am33xx_pinmux, so usually
  42. // it's fine to just use the same name as the device it's for.
  43. //
  44. magnet_gpio_pins: magnet-gpios {
  45. pinctrl-single,pins = <
  46. PIN_PULLDN( P9_13, 7 )
  47. >;
  48. };
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement