From 77c49f81595897989a99bd6cb64fa078ac10f484 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Tue, 7 Jul 2020 14:40:38 +0530 Subject: [PATCH 1/3] Rewritting the overlay To make it compatible for both BBB and BBAI by using code from beagleboard/BeagleBoard-DeviceTrees/pull/17 and new DT format. --- src/arm/BBORG_RELAY-00A2.dts | 116 ----------------------------------- 1 file changed, 116 deletions(-) diff --git a/src/arm/BBORG_RELAY-00A2.dts b/src/arm/BBORG_RELAY-00A2.dts index c4ee0fb0..e69de29b 100644 --- a/src/arm/BBORG_RELAY-00A2.dts +++ b/src/arm/BBORG_RELAY-00A2.dts @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2015 Robert Nelson - * Copyright (C) 2019 Amilcar Lucas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/dts-v1/; -/plugin/; - -#include -#include -#include - -/ { - compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; - - /* identification */ - part-number = "BBORG_RELAY"; - version = "00A2"; - - /* 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"; - - /* - * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ - */ - fragment@0 { - target-path="/"; - __overlay__ { - - chosen { - overlays { - BBORG_RELAY-00A2 = __TIMESTAMP__; - }; - }; - }; - }; - - /* - * 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 */ - }; - }; - - 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 */ - >; - }; - }; - }; - - 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"; - }; - }; - }; - }; -}; From fe1ebfef1eb8db072386f2a5e87108914771aecc Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Tue, 7 Jul 2020 14:43:22 +0530 Subject: [PATCH 2/3] BBB and BBAI compatible relayCape DT overlay This DT is using code from beagleboard/BeagleBoard-DeviceTrees/pull/17 to create compatible led_P8_* / led_P8_* nodes for both BBB and BBAI. Rewritten and based on the BBORG_RELAY-00A2.dts written by Robert Nelson & Amilcar Lucas for kernel <=4.14 --- src/arm/BBORG_RELAY-00A2.dts | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/arm/BBORG_RELAY-00A2.dts b/src/arm/BBORG_RELAY-00A2.dts index e69de29b..6268041e 100644 --- a/src/arm/BBORG_RELAY-00A2.dts +++ b/src/arm/BBORG_RELAY-00A2.dts @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2020 Deepak Khatri + * + * Based on the BBORG_RELAY-00A2.dts written by + * Robert Nelson & Amilcar Lucas for kernel <=4.14 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/dts-v1/; +/plugin/; + +/* + * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ + */ +&{/chosen} { + overlays { + BBORG_RELAY-00A2 = __TIMESTAMP__; + }; +}; + +/* + * 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"; }; +}; + +/* + * 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>;}; +}; + +/* + * 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 { + led_P9_41{ + status = "okay"; + label = "relay1"; + default-state = "keep"; + }; + + led_P9_42{ + status = "okay"; + label = "relay2"; + default-state = "keep"; + }; + + led_P9_30{ + status = "okay"; + label = "relay3"; + default-state = "keep"; + }; + + led_P9_27{ + status = "okay"; + label = "relay4"; + default-state = "keep"; + }; + }; +}; \ No newline at end of file From b4036ade59e2ad3211259dc3fae8b31ce8188878 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Tue, 14 Jul 2020 14:28:20 +0530 Subject: [PATCH 3/3] Update copyright info --- src/arm/BBORG_RELAY-00A2.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/arm/BBORG_RELAY-00A2.dts b/src/arm/BBORG_RELAY-00A2.dts index 6268041e..1ae54a21 100644 --- a/src/arm/BBORG_RELAY-00A2.dts +++ b/src/arm/BBORG_RELAY-00A2.dts @@ -2,7 +2,9 @@ * Copyright (C) 2020 Deepak Khatri * * Based on the BBORG_RELAY-00A2.dts written by - * Robert Nelson & Amilcar Lucas for kernel <=4.14 + * Robert Nelson & Amilcar Lucas for kernel <4.14 + * Copyright (C) 2015 Robert Nelson + * Copyright (C) 2019 Amilcar Lucas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -50,24 +52,29 @@ */ &{/} { leds { + + // relay1 led_P9_41{ status = "okay"; label = "relay1"; default-state = "keep"; }; + // relay2 led_P9_42{ status = "okay"; label = "relay2"; default-state = "keep"; }; + // realy3 led_P9_30{ status = "okay"; label = "relay3"; default-state = "keep"; }; + // realy4 led_P9_27{ status = "okay"; label = "relay4";