/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/gpio/gpio.h>
/ {
// file identification
fragment@0 {
target-path = "/chosen";
__overlay__ {
overlays {
// XXX change property name to the name of this overlay (excluding .dts file suffix)
gpio-demo = __TIMESTAMP__;
};
};
};
// XXX caution: not compatible with cape-universal!
// A udev rule along these lines is recommended to create symlinks in /dev/gpio/
//
// SUBSYSTEM=="subsystem", KERNEL=="gpio", ACTION=="add", \
// RUN+="/bin/mkdir -p /dev/gpio"
//
// SUBSYSTEM=="gpio", ACTION=="add", TEST=="value", ATTR{label}!="sysfs", \
// RUN+="/bin/ln -sT '/sys/class/gpio/%k' /dev/gpio/%s{label}"
fragment@1 {
target-path = "/";
__overlay__ {
// If you want to use multiple overlays that do gpio configuration, be
// sure that each uses a different device tree node!
gpio-demo {
compatible = "gpio-of-helper";
// It is usually not *strictly* required to perform pinmux for
// GPIOs since this is typically their default, but it's good
// practice to do it anyway since:
// 1. it makes *sure* the pinmux is right
// 2. you can configure internal pull-up/down
// 3. it lets the kernel know the pins are in use
pinctrl-names = "default";
pinctrl-0 = <&gpio_demo_pins>;
// Note that gpio numbers for each pin can be found in the
// comments in include/bone/black.h
// input only, active-low; connect button between pin and gnd.
// declaring the gpio as ACTIVE_LOW means the value reads as 1
// when the button is pressed.
button {
gpio = <&gpio2 2 GPIO_ACTIVE_LOW>; // P8.07
input;
};
// output only, active-low, initially high (inactive)
reset-thing {
gpio = <&gpio2 3 GPIO_ACTIVE_LOW>; // P8.08
init-high;
};
// note: GPIO_ACTIVE_LOW inverts the meaning of the value, but it
// does not invert the meaning of "init-low" / "init-high" !
// bidirectional, initially input
input-bidi {
gpio = <&gpio2 5 GPIO_ACTIVE_HIGH>; // P8.09
input;
dir-changeable;
};
// bidirectional, initially output, initially low (inactive)
output-bidi {
gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; // P8.10
init-low;
dir-changeable;
};
};
};
};
fragment@2 {
target = <&am33xx_pinmux>;
__overlay__ {
gpio_demo_pins: gpio-demo {
pinctrl-single,pins = <
BONE_P8_07 (PIN_INPUT_PULLUP | MUX_MODE7 ) // gpio 2.02 / button
BONE_P8_08 (PIN_INPUT_PULLUP | MUX_MODE7 ) // gpio 2.03 / reset-thing
BONE_P8_09 (PIN_INPUT_PULLUP | MUX_MODE7 ) // gpio 2.05 / input-bidi
BONE_P8_10 (PIN_INPUT_PULLUP | MUX_MODE7 ) // gpio 2.04 / output-bidi
>;
};
};
};
};
Comments