Re: [PATCH 0/7] serial: 8250: Add rs485 emulation to 8250_dw

From: Lukas Wunner
Date: Thu Mar 19 2020 - 01:40:40 EST


On Wed, Mar 18, 2020 at 07:49:08PM +0100, Heiko Stübner wrote:
> Looking at tty-next I notice that you're right. When I started working
> on this I only found the stuff from 2018 I linked to but didn't imagine
> that in that exact moment someone else would also work on that area.

There are some more patches in the pipeline for the next cycle
to add support for an rs485 bus termination GPIO. They're on
the tip of this branch:

https://github.com/RevolutionPi/linux/commits/revpi-4.19

Just so you know in advance and duplicate work is avoided.


> > The DTR-for-RE thing seems a bit nonstandard, I'm not sure if this is
> > eligible for mainline or if it's something that should be kept in your
> > downstream tree. But no harm in submitting it to the list.
>
> I'm fine either way - maybe I also get a pointer on what may be a better
> approach ;-)
>
> At least DTR as "Data Terminal Ready" did sound somewhat matching for
> the "Receive Enable" of RS485 (and it's also the only other output pin
> in the mctrl gpio list).

Some UARTs allow disabling the receiver, this can be taken advantage of
to implement half-duplex mode. It's what I did in 8250_bcm2835aux.c.

On the Revolution Pi devices, !RE is usually connected to ground, so
reception is always enabled and it cannot be disabled in software
except by turning off the UART receiver.

There are also boards out there which connect !RE to RTS. Then only
half-duplex mode is supported by the hardware and there's no way for
software to work around it.

Thanks,

Lukas