Re: [RFC] serial: imx: Fix the polarity of RTS GPIO pin

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

 



Hello,

On Tue, Jan 24, 2017 at 03:00:15PM -0800, Tim Harvey wrote:
> I also have boards that uses a GPIO as an active-high enable to an
> RS485 transceiver. In my device-trees I define as 'rts-gpios = <&gpio7
> 1 GPIO_ACTIVE_HIGH>'. I do find that the polarity is inverted on
> master and your patch does flip the polarity. However, I share your
> concern that this may not be the right way to fix it.

Ack, this doesn't look right.
 
> my understanding is that the TIOCSRS485 ioctl should have 'flags =
> SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND' to assert RTS on transmit.
> The thing I find confusing is that in imx_start_tx the driver calls
> imx_port_rts_inactive if SER_RS485_ENABLED and in imx_stop_tx the
> driver calls imx_port_rts_active. To me that is what seems inverted,
> not the implementation of those functions.

Right, that looks fishy. It was introduced in 58362d5be3521 which keeps
the behaviour of the hw rts. I.e. if SER_RS485_RTS_AFTER_SEND is set it
clears UCR2_CTS. This means "The CTS pin is high (inactive)". This is
wrong, too, isn't it? So the wrong commit is 17b8f2a3fdca and
58362d5be3521 only consistently expanded it.
 
> It's confusing because the driver accounts for two options:
> SER_RS485_RTS_ON_SEND (logic level for RTS pin when sending) and
> SER_RS485_RTS_AFTER_SEND (logic level for RTS pin after sending). I'm
> not sure why there needed to be two options here as they both seem to
> indicate the same thing with an opposite polarity.

I assume this is some standard that is implemented here. Maybe there are
situations where you want to have RTS active all the time?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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