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

update comms cape overlay #175

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
147 changes: 68 additions & 79 deletions src/arm/BBORG_COMMS-00A2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (C) 2012,2019 Texas Instruments Incorporated - http://www.ti.com/
* Copyright (C) 2015 Robert Nelson <[email protected]>
* Copyright (C) 2015 Sebastian Jegerås
* Copyright (C) 2020, Deepak Khatri <[email protected]>
*
* 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
Expand All @@ -14,94 +15,82 @@
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/gpio/gpio.h>

/ {
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";
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something wrong with your tabs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, It seems like that. Everything looks good with vscode but not here :(

* 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 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this eventually be an include of the virtual cape?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what do you mean by that. This overlay and the servo cape overlay will be updated to use the new bone bus type format as soon as I test the I2C buses on BBB and BBAI (same binary).

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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't these need to be enabled? When should they?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess when you need Request To Send (RTS) signal.

//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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the udev rules good to enable these?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RS585 seems to be working fine, I have not tested CAN with my MCP2515 CAN module yet. Is there something special with these to require special treatment from udev rules?

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";
};
};
};