Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bone/black.h"
- #include "gpio.h"
- // disable conflicting cape-universal nodes
- USES_PIN( P9_13 );
- // Since we're creating a virtual device, there's not really a better place to
- // put it than root of the device tree.
- / {
- // Node name "magnet-gpios" is arbitrary but should not conflict with other
- // nodes or properties in the root of the device tree.
- // To list all of these on a running system: ls /proc/device-tree/
- magnet-gpios {
- // configure the driver for this device node, which must be "gpio-of-helper"
- compatible = "gpio-of-helper";
- // Attach pinmux node to this device node. In rare cases devices may have
- // multiple pinmux states, but usually you only have a "default" state.
- pinctrl-names = "default";
- pinctrl-0 = <&magnet_gpio_pins>; //<--- references the "magnet_gpio_pins:" label below
- // The node name "magnet_dir" becomes the gpio label and may be arbitrary but
- // must be unique for each gpio (globally, not merely those exported by this
- // gpio-of-helper device).
- magnet_dir {
- gpio = <
- &gpio0
- 31
- ACTIVE_HIGH
- >;
- output; // initial direction: input or output (optional for outputs)
- init-low; // if output, whether it's initially low or initially high
- };
- };
- };
- // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
- &am33xx_pinmux {
- // Label "magnet_gpio_pins" is arbitrary but must be _globally_ unique among all labels
- // in the device tree (base + overlays), hence it's a good idea to make a bit more
- // verbose than the node name needs to be. Also, unlike the node name, the label
- // needs to be a valid C identifier (so only alphanumeric and underscores).
- //
- // Node name "magnet-gpios" only needs to be unique inside &am33xx_pinmux, so usually
- // it's fine to just use the same name as the device it's for.
- //
- magnet_gpio_pins: magnet-gpios {
- pinctrl-single,pins = <
- PIN_PULLDN( P9_13, 7 )
- >;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement