Skip to content

Uart RTS Not Working #55

@bwilcutt

Description

@bwilcutt

For RS485, I've enabled the rts gpio on my uart using OS v4.1:

            uart1: serial@48022000 {
                    compatible = "ti,omap-serial-rs485";
                    ti,hwmods = "uart2";
                    clock-frequency = <0x2dc6c00>;
                    reg = <0x48022000 0x2000>;
                    interrupts = <0x49>;
                    dmas = <&edma 0x1c &edma 0x1d>;
                    dma-names = "tx", "rx";
                    rs485-rts-active-high;
                    rs485-rts-delay = <0 0>;
                    rts-gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>;
                    linux,rs485-enabled-at-boot-time;
                    status = "okay";
            };

gpio3 19 points to P9_27 which is my rts line as verified by a scope (and a working program on the 3.14 of the OS).

My serial driver does successfully find the gpio ("rts-gpio") however I get a kernel crash during boot up:

Running uname_boot ...
loading /boot/vmlinuz-4.1.13-ti-rt-r77 ...
[    5.576334] kobject: 'omap_serial_rs485' (bf003550): kobject_add_internal: parent: 'module', set: 'module'
[    5.576402] kobject: 'holders' (df555500): kobject_add_internal: parent: 'omap_serial_rs485', set: '<NULL>'
[    5.576589] kobject: 'notes' (df58cc80): kobject_add_internal: parent: 'omap_serial_rs485', set: '<NULL>'
[    5.576618] kobject: 'omap_serial_rs485' (bf003550): kobject_uevent_env
[    5.576638] kobject: 'omap_serial_rs485' (bf003550): fill_kobj_path: path = '/module/omap_serial_rs485'
[    5.585686] kobject: 'omap-serial-rs485' (df4efc80): kobject_add_internal: parent: 'drivers', set: 'drivers'
[    5.586061] of_get_named_gpiod_flags: parsed 'rts-gpio' property of node '/ocp/serial@48022000[0]' - status (0)
[    5.586085] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa1ae134
[    5.586095] pgd = df5d4000
[    5.586103] [fa1ae134] *pgd=48011452(bad)
[    5.586128] Internal error: : 1028 [#1] PREEMPT SMP ARM
[    5.586140] Modules linked in: omap_serial_rs485(+)
[    5.586165] CPU: 0 PID: 174 Comm: modprobe Not tainted 4.1.13-ti-rt-r77 #262
[    5.586174] Hardware name: Generic AM33XX (Flattened Device Tree)
[    5.586184] task: df5daac0 ti: df50a000 task.ti: df50a000

This code worked in OS 3.14 but not in 4.1. The biggest change, for this system, is the dts/dtsi files which I've tried to make sure were set up properly.

The crash occurs during the gpio_direction_output function call, see below..
.
.
.
if (omap_up_info->tx_enable_gpio = of_get_named_gpio(dev->of_node, "txe-gpio", 0))
{
gpio_direction_output(omap_up_info->tx_enable_gpio, PIN_HIGH);
.
.
.

By manipulating P9_27 (gpio 115) directly, the problem goes away and the software works as designed.

root@localhost:~# cd /sys/class/gpio/
root@localhost:/sys/class/gpio# echo 115 > export
root@localhost:/sys/class/gpio# cd gpio115
root@localhost:/sys/class/gpio/gpio115# ls
active_low  device  direction  edge  power  subsystem  uevent  value
root@localhost:/sys/class/gpio/gpio115# cat value 
0
root@localhost:/sys/class/gpio/gpio115# cat active_low  
0
root@localhost:/sys/class/gpio/gpio115# ls
active_low  device  direction  edge  power  subsystem  uevent  value
root@localhost:/sys/class/gpio/gpio115# cat direction 
in
root@localhost:/sys/class/gpio/gpio115# echo "out" > direction 
root@localhost:/sys/class/gpio/gpio115#                

Note that the pin is already configured to be "out" yet the devicetree is reporting it set to "in".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions