Re: SERIAL_IMX shutdown in RS485 mode

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

 



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.

The failure is that when Linux disables the UART peripheral, control over
CTS_B is lost and it defaults to high voltage state. That makes sense for
eg. RS232, but not for using this signal as positive logic "driver enable",
which should default to low voltage state.

I had a look at how it is done in the latest kernels, I think it's the same
thing in principle.

I am going to fix this, just I would like to find out which of the suggested
solutions is better suited for Linux. Personally, I opt for solution 1 -
keep UART enabled all the time - but maybe there is a good reason not to do
that.
Maybe you could submit a RFC patch for discussion.

If you think a RFC patch is a good idea, I'll do that, but please, help! :)
I've never done that before. Could you recommend a good guide?

Thanks

Best regards,
Adam



[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