From: Michael Walle <michael@walle.cc>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
jingchang.lu@freescale.com, tomonori.sakita@sord.co.jp,
atsushi.nemoto@sord.co.jp, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, dl-linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in lpuart32_shutdown()
Date: Wed, 23 Nov 2022 12:42:47 +0100 [thread overview]
Message-ID: <45769b238521d4b41638406863e31ded@walle.cc> (raw)
In-Reply-To: <AS8PR04MB8404825F21A72C22C6D09B49920C9@AS8PR04MB8404.eurprd04.prod.outlook.com>
Hi Sherry,
Am 2022-11-23 12:30, schrieb Sherry Sun:
>> -----Original Message-----
>> From: Michael Walle <michael@walle.cc>
>> Sent: 2022年11月23日 19:09
>> To: Sherry Sun <sherry.sun@nxp.com>
>> Cc: gregkh@linuxfoundation.org; jirislaby@kernel.org;
>> jingchang.lu@freescale.com; tomonori.sakita@sord.co.jp;
>> atsushi.nemoto@sord.co.jp; linux-serial@vger.kernel.org; linux-
>> kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
>> Subject: Re: [PATCH V2 2/5] tty: serial: fsl_lpuart: clear
>> UARTCTRL_LOOPS in
>> lpuart32_shutdown()
>>
>> Am 2022-11-23 11:58, schrieb Sherry Sun:
>> >> -----Original Message-----
>> >> From: Michael Walle <michael@walle.cc>
>> >> Sent: 2022年11月23日 18:34
>> >> To: Sherry Sun <sherry.sun@nxp.com>
>> >> Cc: gregkh@linuxfoundation.org; jirislaby@kernel.org;
>> >> jingchang.lu@freescale.com; tomonori.sakita@sord.co.jp;
>> >> atsushi.nemoto@sord.co.jp; linux-serial@vger.kernel.org; linux-
>> >> kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
>> >> 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.
>>
>> Two things,
>> (1) should the loopback be cleared on a newly opened serial device?
>> (2) as mentioned in my other reply, this can also be handled in
>> the startup. Eg. the startup can clear the loopback flag.
>> (together with possible hardware events).
>>
>> I'm not that deep into the serial core, thus my question about the
>> expectations from the serial core. I guess the answer to
>> (1) is yes, but better to ask.
>>
>
> Hi Michael,
>
> For the (1), I have checked the serial core, seems the answer is no, .
> startup() won't clean the status, only when the uart device is probed,
> lpuart will do the global reset to all the registers instead of
> .startup(). So I think the uart running status cleared in .shutdown()
> is reasonable.
That's not what I've meant. Even with this patch as it is right now,
the loopback flag is cleared on a "newly opened serial device". Just
with one difference, you are clearing the flag in shutdown.
My question was rather, should the loopback (or generally any mctrl
flags)
be persistent across close/open cycles. E.g. looking at omap-serial.c,
this driver doesn't seem to handle the loopback flag at .startup() or
.shutdown(). Same seems to be true for sh-sci.c.
Greg?
-michael
next prev parent reply other threads:[~2022-11-23 11:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 8:17 [PATCH V2 0/5] fsl_lpuart: improve Idle Line Interrupt and registers handle in .shutdown() Sherry Sun
2022-11-10 8:17 ` [PATCH V2 1/5] tty: serial: fsl_lpuart: only enable Idle Line Interrupt for non-dma case Sherry Sun
2022-11-22 16:56 ` Greg KH
2022-11-23 10:28 ` Sherry Sun
2022-11-10 8:17 ` [PATCH V2 2/5] tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in lpuart32_shutdown() Sherry Sun
2022-11-23 10:34 ` Michael Walle
2022-11-23 10:58 ` Sherry Sun
2022-11-23 11:09 ` Michael Walle
2022-11-23 11:30 ` Sherry Sun
2022-11-23 11:42 ` Michael Walle [this message]
2022-11-23 13:06 ` Sherry Sun
2022-11-10 8:17 ` [PATCH V2 3/5] tty: serial: fsl_lpuart: clear UARTMODIR register " Sherry Sun
2022-11-10 8:17 ` [PATCH V2 4/5] tty: serial: fsl_lpuart: disable Rx/Tx DMA " Sherry Sun
2022-11-10 8:17 ` [PATCH V2 5/5] tty: serial: fsl_lpuart: clear LPUART Status Register " Sherry Sun
2022-11-23 10:36 ` Michael Walle
2022-11-23 11:34 ` Sherry Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45769b238521d4b41638406863e31ded@walle.cc \
--to=michael@walle.cc \
--cc=atsushi.nemoto@sord.co.jp \
--cc=gregkh@linuxfoundation.org \
--cc=jingchang.lu@freescale.com \
--cc=jirislaby@kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sherry.sun@nxp.com \
--cc=tomonori.sakita@sord.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox