Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBB and BBAI compatible relayCape overlay #186

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 61 additions & 93 deletions src/arm/BBORG_RELAY-00A2.dts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/*
* Copyright (C) 2020 Deepak Khatri <[email protected]>
*
* Based on the BBORG_RELAY-00A2.dts written by
* Robert Nelson & Amilcar Lucas for kernel <4.14
* Copyright (C) 2015 Robert Nelson <[email protected]>
* Copyright (C) 2019 Amilcar Lucas <[email protected]>
*
Expand All @@ -10,107 +14,71 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

/* identification */
part-number = "BBORG_RELAY";
version = "00A2";
/*
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
&{/chosen} {
overlays {
BBORG_RELAY-00A2 = __TIMESTAMP__;
};
};

/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.41", /* gpio0_20 */
"P9.42", /* gpio0_07 */
"P9.30", /* gpio3_16 */
"P9.27", /* gpio3_19 */
/* the hardware ip uses */
"gpio1_16",
"gpio0_07",
"gpio3_16",
"gpio3_19";
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
&ocp {
P9_41_pinmux { status = "disabled"; };
P9_42_pinmux { status = "disabled"; };
P9_30_pinmux { status = "disabled"; };
P9_27_pinmux { status = "disabled"; };
};

/*
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
fragment@0 {
target-path="/";
__overlay__ {
/*
* Enable and Update the default state of the pins
*/
&ocp {
P9_41_pinmux { status = "okay"; pinctrl-0 = <&P9_41_gpio_pin>;};
P9_42_pinmux { status = "okay"; pinctrl-0 = <&P9_42_gpio_pin>;};
P9_30_pinmux { status = "okay"; pinctrl-0 = <&P9_30_gpio_pin>;};
P9_27_pinmux { status = "okay"; pinctrl-0 = <&P9_27_gpio_pin>;};
};

chosen {
overlays {
BBORG_RELAY-00A2 = __TIMESTAMP__;
};
};
/*
* Easy relay control through sysfs (/sys/class/leds/) using gpio-leds driver
* See these files for the led_P8_#/led_P9_# definition
* https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/bbai-bone-buses.dtsi
* https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/bbb-bone-buses.dtsi
*
*/
&{/} {
leds {

// relay1
led_P9_41{
status = "okay";
label = "relay1";
default-state = "keep";
};
};

/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@1 {
target = <&ocp>;
__overlay__ {
P9_41_pinmux { status = "disabled"; }; /* P9_41: gpmc_a0.gpio0_20 */
P9_42_pinmux { status = "disabled"; }; /* P9_42: gpmc_a1.gpio0_07 */
P9_30_pinmux { status = "disabled"; }; /* P9_30: gpmc_be1n.gpio3_16 */
P9_27_pinmux { status = "disabled"; }; /* P9_27: mcasp0_fsr.gpio3_19 */
// relay2
led_P9_42{
status = "okay";
label = "relay2";
default-state = "keep";
};
};

fragment@2 {
target = <&am33xx_pinmux>;
__overlay__ {

bb_gpio_relay_pins: pinmux_bb_gpio_relay_pins {
pinctrl-single,pins = <
BONE_P9_41 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_41: gpmc_a0.gpio0_20 */
BONE_P9_42 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_42: gpmc_a1.gpio0_07 */
BONE_P9_30 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_30: gpmc_be1n.gpio3_16 */
BONE_P9_27 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_27: mcasp0_fsr.gpio3_19 */
>;
};
// realy3
led_P9_30{
status = "okay";
label = "relay3";
default-state = "keep";
};
};

fragment@3 {
target-path="/";
__overlay__ {

leds {
pinctrl-names = "default";
pinctrl-0 = <&bb_gpio_relay_pins>;

compatible = "gpio-leds";

jp@1 {
label = "relay-jp1";
gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
default-state = "keep";
};

jp@2 {
label = "relay-jp2";
gpios = <&gpio0 07 GPIO_ACTIVE_HIGH>;
default-state = "keep";
};

jp@3 {
label = "relay-jp3";
gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
default-state = "keep";
};

jp@4 {
label = "relay-jp4";
gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
default-state = "keep";
};
};
// realy4
led_P9_27{
status = "okay";
label = "relay4";
default-state = "keep";
};
};
};
};