From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: qianfan <qianfanguijin@163.com>
Cc: linux-serial <linux-serial@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Subject: Re: serial8250: can not change baudrate while the controller is busy
Date: Fri, 14 Apr 2023 15:10:11 +0300 (EEST) [thread overview]
Message-ID: <ab524eb-da1d-bf74-6d73-2defb7f7118@linux.intel.com> (raw)
In-Reply-To: <289bb78a-7509-1c5c-2923-a04ed3b6487d@163.com>
On Fri, 14 Apr 2023, qianfan wrote:
> Hi:
>
> My custom board is based on allwinner R40, the uart is compatibled with
> serial8250. Based on it's datasheet:
>
> > When TX transmit data, or RX receives data, or TX FIFO is not empty, then
> the
> > BUSY flag bit can be set to 1 by hardware, which indicates the UART
> > controller is busy.
>
> We cannot write LCR and DLL to update UART params such as baudrate and partity
> while the UART is busy, however `serial8250_do_set_termios` is a void
> function,
> the upper level always assume the uart params is updated.
>
> The upper level `uart_set_termios` do noting if ktermios params is not
> changed,
> it will not update when the user space program running tcsetattr set a same
> baudrate again.
>
> So we can not fix the baudrate when
> `serial8250_do_set_termios`
> failed.
>
> Allwinner R40's datasheet provided a way for this case.
>
> > CHCFG_AT_BUSY(configure at busy): Enable the bit, software can also set UART
> > controller when UART is busy, such as the LCR, DLH, DLL register.
> > CHANGE_UPDATE(change update): If CHCFG_AT_BUSY is enabled, and CHANGE_UPDATE
> > is written to 1, the configuration of UART controller can be updated.
> > After completed update, the bit is cleared to 0 automatically.
>
> I can't know this feature is expanded by allwinner, or it is a common
> functiton
> of serial8250. Perhaps the serial8250 driver need this.
tcsetattr() can be given a flag which enforces TX empty condition before
core calls into the lower layer HW set_termios function. Would that be
enough to solve the case you're interested in?
Obviously, nothing can prevent Rx from occuring as it's not under local
UART's control (e.g. a busy flag check would still be racy). But does
writing those registers actually break something or just corrupts the
character under Tx/Rx (which can be handled by flushing)?
--
i.
next prev parent reply other threads:[~2023-04-14 12:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 9:31 serial8250: can not change baudrate while the controller is busy qianfan
2023-04-14 12:10 ` Ilpo Järvinen [this message]
2023-04-15 1:09 ` qianfan
2023-05-05 2:58 ` qianfan
2023-05-08 10:17 ` Ilpo Järvinen
2023-05-08 11:33 ` qianfan
2023-05-08 13:34 ` Ilpo Järvinen
2023-05-09 0:57 ` qianfan
2023-05-09 11:03 ` Ilpo Järvinen
[not found] ` <6cefcc6d-266f-64f0-91fc-93815b627828@163.com>
2023-05-10 10:58 ` Ilpo Järvinen
2023-08-31 13:27 ` Ilpo Järvinen
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=ab524eb-da1d-bf74-6d73-2defb7f7118@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=qianfanguijin@163.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.