From 6fb0bdab0f23d3e1588993eebf5e331de3be2af8 Mon Sep 17 00:00:00 2001 From: lorforlinux Date: Sun, 14 Jun 2020 05:43:24 +0530 Subject: [PATCH 1/3] update comms cape overlay --- src/arm/BBORG_COMMS-00A2.dts | 147 ++++++++++++++++------------------- 1 file changed, 68 insertions(+), 79 deletions(-) diff --git a/src/arm/BBORG_COMMS-00A2.dts b/src/arm/BBORG_COMMS-00A2.dts index 089a940a..1a59f396 100644 --- a/src/arm/BBORG_COMMS-00A2.dts +++ b/src/arm/BBORG_COMMS-00A2.dts @@ -2,6 +2,7 @@ * Copyright (C) 2012,2019 Texas Instruments Incorporated - http://www.ti.com/ * Copyright (C) 2015 Robert Nelson * Copyright (C) 2015 Sebastian Jegerås + * Copyright (C) 2020, Deepak Khatri * * 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 @@ -14,94 +15,82 @@ #include #include -/ { - compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; +/* +* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ +*/ +&{/chosen} { + overlays { + BBORG_COMMS-00A2 = __TIMESTAMP__; + }; +}; - /* identification */ - part-number = "BBORG_COMMS"; - version = "00A2"; +/* + * Free up the pins used by the cape from the pinmux helpers. + */ +&ocp { + P9_24_pinmux { status = "disabled"; }; /* P9_24: uart1_txd.d_can1_rx */ + P9_26_pinmux { status = "disabled"; }; /* P9_26: uart1_rxd.d_can1_tx */ + P9_13_pinmux { status = "disabled"; }; /* P9_13: gpmc_wpn.uart4_txd_mux2 */ + P9_11_pinmux { status = "disabled"; }; /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ + P9_15_pinmux { status = "disabled"; }; /* P9_15: gpmc_a0.gpio1_16 */ + P9_23_pinmux { status = "disabled"; }; /* P9_23: gpmc_a1.gpio1_17 */ +}; - /* state the resources this cape uses */ - exclusive-use = - /* the pin header uses */ - //"P9.15", /* SINK A */ - //"P9.23", /* SINK B */ - //"P9.36", /* LOOP A */ - //"P9.35", /* LOOP B */ - "P9.24", /* can1_rx */ - "P9.26", /* can1_tx */ - "P9.13", // uart4_txd - "P9.11", // uart4_rxd +&am33xx_pinmux { + bborg_comms_can_pins: pinmux_comms_can_pins { + pinctrl-single,pins = < + BONE_P9_24 (PIN_INPUT_PULLUP | MUX_MODE2) /* P9_24: uart1_txd.d_can1_rx */ + BONE_P9_26 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* P9_26: uart1_rxd.d_can1_tx */ + >; + }; + bborg_comms_rs485_pins: pinmux_comms_rs485_pins { + pinctrl-single,pins = < + BONE_P9_13 (PIN_OUTPUT | MUX_MODE6) /* P9_13: gpmc_wpn.uart4_txd_mux2 */ + BONE_P9_11 (PIN_INPUT | MUX_MODE6) /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ + >; + }; + bborg_comms_sink_pins: pinmux_bborg_comms_sink_pins{ + pinctrl-single,pins = < + BONE_P9_15 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_15: gpmc_a0.gpio1_16 */ + BONE_P9_23 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_23: gpmc_a1.gpio1_17 */ + >; + }; +}; - /* the hardware ip uses */ - "uart4", - "dcan1"; +&dcan1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&bborg_comms_can_pins>; +}; + +&uart4 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&bborg_comms_rs485_pins>; + //rs485-rts-delay = <0 0>; + //rts-gpio = <&gpio3 19 1>; /* GPIO_ACTIVE_HIGH>; */ + //rs485-rts-active-high; + //linux,rs485-enabled-at-boot-time; +}; - /* - * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ - */ - fragment@0 { - target-path="/"; - __overlay__ { +&{/} { - chosen { - overlays { - BBORG_COMMS-00A2 = __TIMESTAMP__; - }; - }; - }; - }; + leds { + pinctrl-names = "default"; + pinctrl-0 = <&bborg_comms_sink_pins>; - /* - * Free up the pins used by the cape from the pinmux helpers. - */ - fragment@1 { - target = <&ocp>; - __overlay__ { - P9_24_pinmux { status = "disabled"; }; /* P9_24: uart1_txd.d_can1_rx */ - P9_26_pinmux { status = "disabled"; }; /* P9_26: uart1_rxd.d_can1_tx */ - P9_13_pinmux { status = "disabled"; }; /* P9_13: gpmc_wpn.uart4_txd_mux2 */ - P9_11_pinmux { status = "disabled"; }; /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ - }; - }; + compatible = "gpio-leds"; - fragment@2 { - target = <&am33xx_pinmux>; - __overlay__ { - bborg_comms_can_pins: pinmux_comms_can_pins { - pinctrl-single,pins = < - BONE_P9_24 (PIN_INPUT_PULLUP | MUX_MODE2) /* P9_24: uart1_txd.d_can1_rx */ - BONE_P9_26 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* P9_26: uart1_rxd.d_can1_tx */ - >; - }; - bborg_comms_rs485_pins: pinmux_comms_rs485_pins { - pinctrl-single,pins = < - BONE_P9_13 (PIN_OUTPUT | MUX_MODE6) /* P9_13: gpmc_wpn.uart4_txd_mux2 */ - BONE_P9_11 (PIN_INPUT | MUX_MODE6) /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ - >; - }; + sink@1 { + label = "Sink_A"; + gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; }; - }; - fragment@3 { - target = <&dcan1>; - __overlay__ { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&bborg_comms_can_pins>; - }; - }; - - fragment@4 { - target = <&uart4>; - __overlay__ { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&bborg_comms_rs485_pins>; - //rs485-rts-delay = <0 0>; - //rts-gpio = <&gpio3 19 1>; /* GPIO_ACTIVE_HIGH>; */ - //rs485-rts-active-high; - //linux,rs485-enabled-at-boot-time; + sink@2 { + label = "Sink_B"; + gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; }; }; }; From ea26f2f979cfbd8501dbe3e8560e74441f3a95b3 Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Sun, 21 Jun 2020 20:36:06 +0530 Subject: [PATCH 2/3] fix naming --- src/arm/BBORG_COMMS-00A2.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arm/BBORG_COMMS-00A2.dts b/src/arm/BBORG_COMMS-00A2.dts index 1a59f396..ac375b51 100644 --- a/src/arm/BBORG_COMMS-00A2.dts +++ b/src/arm/BBORG_COMMS-00A2.dts @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + /dts-v1/; /plugin/; @@ -25,8 +26,8 @@ }; /* - * Free up the pins used by the cape from the pinmux helpers. - */ +* Free up the pins used by the cape from the pinmux helpers. +*/ &ocp { P9_24_pinmux { status = "disabled"; }; /* P9_24: uart1_txd.d_can1_rx */ P9_26_pinmux { status = "disabled"; }; /* P9_26: uart1_rxd.d_can1_tx */ @@ -75,10 +76,9 @@ &{/} { - leds { + sinks { pinctrl-names = "default"; pinctrl-0 = <&bborg_comms_sink_pins>; - compatible = "gpio-leds"; sink@1 { From 108f9ba50933f077a94b431392ee3abe045acbef Mon Sep 17 00:00:00 2001 From: Deepak Khatri Date: Tue, 21 Jul 2020 23:09:50 +0530 Subject: [PATCH 3/3] make compatible with BBB and BBAI --- src/arm/BBORG_COMMS-00A2.dts | 87 +++++++++++++----------------------- 1 file changed, 30 insertions(+), 57 deletions(-) diff --git a/src/arm/BBORG_COMMS-00A2.dts b/src/arm/BBORG_COMMS-00A2.dts index ac375b51..119bd204 100644 --- a/src/arm/BBORG_COMMS-00A2.dts +++ b/src/arm/BBORG_COMMS-00A2.dts @@ -1,8 +1,10 @@ /* + * Copyright (C) 2020 Deepak Khatri + * + * Based on older BBORG_COMMS-00A2.dts for kernel <4.14x * Copyright (C) 2012,2019 Texas Instruments Incorporated - http://www.ti.com/ * Copyright (C) 2015 Robert Nelson * Copyright (C) 2015 Sebastian Jegerås - * Copyright (C) 2020, Deepak Khatri * * 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 @@ -12,13 +14,9 @@ /dts-v1/; /plugin/; -#include -#include -#include - /* -* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ -*/ + * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/ + */ &{/chosen} { overlays { BBORG_COMMS-00A2 = __TIMESTAMP__; @@ -26,70 +24,45 @@ }; /* -* Free up the pins used by the cape from the pinmux helpers. -*/ + * Update the default pinmux of the pins. + * See these files for the phandles (&P9_* & &P8_*) + * https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/am335x-bone-common-univ.dtsi + * https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/am572x-bone-common-univ.dtsi + */ &ocp { - P9_24_pinmux { status = "disabled"; }; /* P9_24: uart1_txd.d_can1_rx */ - P9_26_pinmux { status = "disabled"; }; /* P9_26: uart1_rxd.d_can1_tx */ - P9_13_pinmux { status = "disabled"; }; /* P9_13: gpmc_wpn.uart4_txd_mux2 */ - P9_11_pinmux { status = "disabled"; }; /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ - P9_15_pinmux { status = "disabled"; }; /* P9_15: gpmc_a0.gpio1_16 */ - P9_23_pinmux { status = "disabled"; }; /* P9_23: gpmc_a1.gpio1_17 */ -}; - -&am33xx_pinmux { - bborg_comms_can_pins: pinmux_comms_can_pins { - pinctrl-single,pins = < - BONE_P9_24 (PIN_INPUT_PULLUP | MUX_MODE2) /* P9_24: uart1_txd.d_can1_rx */ - BONE_P9_26 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* P9_26: uart1_rxd.d_can1_tx */ - >; - }; - bborg_comms_rs485_pins: pinmux_comms_rs485_pins { - pinctrl-single,pins = < - BONE_P9_13 (PIN_OUTPUT | MUX_MODE6) /* P9_13: gpmc_wpn.uart4_txd_mux2 */ - BONE_P9_11 (PIN_INPUT | MUX_MODE6) /* P9_11: gpmc_wait0.uart4_rxd_mux2 */ - >; - }; - bborg_comms_sink_pins: pinmux_bborg_comms_sink_pins{ - pinctrl-single,pins = < - BONE_P9_15 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_15: gpmc_a0.gpio1_16 */ - BONE_P9_23 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_23: gpmc_a1.gpio1_17 */ - >; - }; + P9_24_pinmux { pinctrl-0 = <&P9_24_can_pin>; }; /* CAN TX */ + P9_26_pinmux { pinctrl-0 = <&P9_26_can_pin>; }; /* CAN TX */ + P9_13_pinmux { pinctrl-0 = <&P9_13_uart_pin>; }; /* UART TX */ + P9_11_pinmux { pinctrl-0 = <&P9_11_uart_pin>; }; /* UART RX */ + P9_15_pinmux { pinctrl-0 = <&P9_15_gpio_pin>; }; /* GPIO: SINK A*/ + P9_23_pinmux { pinctrl-0 = <&P9_23_gpio_pin>; }; /* GPIO: SINK B */ }; -&dcan1 { +/* + * See these files for the phandles (&bone_*) and nodes + * https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/bbai-bone-buses.dtsi + * https://github.com/beagleboard/BeagleBoard-DeviceTrees/src/arm/bbb-bone-buses.dtsi + */ +&bone_can_1 { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&bborg_comms_can_pins>; }; -&uart4 { +&bone_uart_4 { status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&bborg_comms_rs485_pins>; - //rs485-rts-delay = <0 0>; - //rts-gpio = <&gpio3 19 1>; /* GPIO_ACTIVE_HIGH>; */ - //rs485-rts-active-high; - //linux,rs485-enabled-at-boot-time; }; &{/} { - - sinks { - pinctrl-names = "default"; - pinctrl-0 = <&bborg_comms_sink_pins>; - compatible = "gpio-leds"; - - sink@1 { + leds { + // SINK A + led_P9_15 { + status = "okay"; label = "Sink_A"; - gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; default-state = "off"; }; - - sink@2 { + // SINK B + led_P9_23 { + status = "okay"; label = "Sink_B"; - gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; default-state = "off"; }; };