Re: SERIAL_IMX shutdown in RS485 mode

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

 



On Mon, Sep 10, 2018 at 08:30:35PM +0200, Adam Rudziński wrote:
> Hello Fabio,
> 
> W dniu 2018-09-10 o 20:13, Fabio Estevam pisze:
> > Hi Adam,
> > 
> > On Mon, Sep 10, 2018 at 3:10 PM, Adam Rudziński
> > <adam.rudzinski@xxxxxxxxxx> wrote:
> > > Hello Fabio,
> > > 
> > > I was trying to use 4.12.4 and 4.14.39.
> > There have been many imx rs485 related changes lately, so I would
> > recommend you to try 4.19-rc3.
> I used those older kernels, because in this design I'm using a module, and
> the manufacturer provides their Linux distro based on 4.12.4. In particular,
> they provide a complete device tree, and that is something where I'm green.
> 
> However, in 4.19-rc3 the problem will be the same, because the shutdown
> function (there called imx_uart_shutdown) seems not to care about rs485, and
> does this near the end:
> 
>     ucr1 = imx_uart_readl(sport, UCR1);
>     ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN |
> UCR1_RXDMAEN | UCR1_ATDMAEN);
> 
>     imx_uart_writel(sport, ucr1, UCR1);
> 
> so it just unconditionally disables the UART, like in the older kernels.

So disabling the UART results in the CTS output going inactive
(according to normal RS232 conventions)? That's independant of UCR2_CTSC
and UCR2_CTS? If so, you probably have a problem during power-on and/or
driver probe, too. As pinmuxing is set up before imx_uart_probe is
called there is a window where your transmitter is already active.

So I'd recommend to stick to the GPIO-variant (i.e. don't use CTS with
it's level being controlled by the UART) or at least change the polarity
of your transmit-enable such that the transmitter is off when the UART
is. (Note that this might enable your transmitter, too, depending on the
initial state of the GPIO. Usually it should be "input", so better make
sure to add a pull in the disable-direction in hardware.)

Fabio, is there something like a "design guide" for hardware people to
communicate this?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



[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