Re: [PATCH v3 3/5] serial: 8250: Support separate rs485 rx-enable GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-05-18 18:35, Andy Shevchenko wrote:
On Mon, May 18, 2020 at 06:13:16PM +0200, Maarten Brock wrote:
On 2020-05-18 17:22, Lukas Wunner wrote:
> On Mon, May 18, 2020 at 06:12:41PM +0300, Andy Shevchenko wrote:
> > On Sun, May 17, 2020 at 11:56:08PM +0200, Heiko Stuebner wrote:
> > > From: Heiko Stuebner <heiko.stuebner@xxxxxxxxxxxxxxxxxxxxx>
> > >
> > > The RE signal is used to control the duplex mode of transmissions,
> > > aka receiving data while sending in full duplex mode, while stopping
> > > receiving data in half-duplex mode.
> > >
> > > On a number of boards the !RE signal is tied to ground so reception
> > > is always enabled except if the UART allows disabling the receiver.
> > > This can be taken advantage of to implement half-duplex mode - like
> > > done on 8250_bcm2835aux.
> > >
> > > Another solution is to tie !RE to RTS always forcing half-duplex mode.
> > >
> > > And finally there is the option to control the RE signal separately,
> > > like done here by introducing a new rs485-specific gpio that can be
> > > set depending on the RX_DURING_TX setting in the common em485 callbacks.
> >
> > ...
> >
> > > +	port->rs485_re_gpio = devm_gpiod_get_optional(dev, "rs485-rx-enable",
> > > +						      GPIOD_OUT_HIGH);
> >
> > While reviewing some other patch I realized that people are missing
> > the
> > point of these GPIO flags when pin is declared to be output.
> >
> > HIGH here means "asserted" (consider active-high vs. active-low in
> > general). Is that the intention here?
> >
> > Lukas, same question to your patch.
>
> Yes.  "High", i.e. asserted, means "termination enabled" in the case of
> my patch and "receiver enabled" in the case of Heiko's patch.

But "High" on a gpio would disable the receiver when connected to !RE.

No, that's exactly the point of the terminology (asserted means active whatever
polarity it is). You need to define active-low in GPIO description.

Is there anything wrong with defining GPIOD_OUT_ACTIVE or GPIOD_OUT_ASSERTED for this very purpose? May I suggest to deprecate GPIOD_OUT_HIGH and replace it?

Maarten




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux