RE: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in lpuart32_shutdown()

From: Sherry Sun
Date: Wed Nov 23 2022 - 06:03:39 EST




> -----Original Message-----
> From: Michael Walle <michael@xxxxxxxx>
> Sent: 2022年11月23日 18:34
> To: Sherry Sun <sherry.sun@xxxxxxx>
> Cc: gregkh@xxxxxxxxxxxxxxxxxxx; jirislaby@xxxxxxxxxx;
> jingchang.lu@xxxxxxxxxxxxx; tomonori.sakita@xxxxxxxxxx;
> atsushi.nemoto@xxxxxxxxxx; linux-serial@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>
> Subject: Re: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in
> lpuart32_shutdown()
>
> Am 2022-11-10 09:17, schrieb Sherry Sun:
> > UARTCTRL_LOOPS bit is set in lpuart32_set_mctrl() for loopback mode,
> > but nowhere clear this bit, it should be cleared when closing the uart
> > port to avoid the loopback mode been enabled by default when reopening
> > the uart.
>
> It's cleared in set_mctrl(). What is the expectation from the serial core here?
>

Hi Michael,

If we call .set_mctrl(TIOCM_LOOP), the UARTCTRL_LOOPS will be set.
Then when we call .shutdown(), serial core won't call .set_mctrl() to clear it, so the UARTCTRL_LOOPS need to be cleared here.
Per my understanding, .shutdown() should clean up all the uart flags, as the transmitter and receiver will been disabled, we will re-configure all the settings needed when re-open the port.

Best Regards
Sherry