[PATCH 7/8] serial: imx: use readl() to optimize FIFO reading loop
Sherry Sun
sherry.sun at nxp.com
Tue Jan 17 02:20:08 PST 2023
> -----Original Message-----
> From: Sergey Organov <sorganov at gmail.com>
> Sent: 2023Äê1ÔÂ14ÈÕ 2:44
> To: linux-serial at vger.kernel.org
> Cc: Fabio Estevam <festevam at gmail.com>; Greg Kroah-Hartman
> <gregkh at linuxfoundation.org>; Jiri Slaby <jirislaby at kernel.org>; Richard
> Genoud <richard.genoud at gmail.com>; Sascha Hauer
> <s.hauer at pengutronix.de>; Shawn Guo <shawnguo at kernel.org>;
> tharvey at gateworks.com; Tomasz Mo¨½ <tomasz.mon at camlingroup.com>;
> linux-arm-kernel at lists.infradead.org; dl-linux-imx <linux-imx at nxp.com>;
> Pengutronix Kernel Team <kernel at pengutronix.de>; Sergey Organov
> <sorganov at gmail.com>
> Subject: [PATCH 7/8] serial: imx: use readl() to optimize FIFO reading loop
>
> Use readl() instead of heavier imx_uart_readl() in the Rx ISR, as we know we
> read registers that must not be cached.
>
> Signed-off-by: Sergey Organov <sorganov at gmail.com>
> ---
> drivers/tty/serial/imx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index
> be00362b8b67..f4236e8995fa 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -890,14 +890,15 @@ static irqreturn_t __imx_uart_rxint(int irq, void
> *dev_id)
> struct imx_port *sport = dev_id;
> unsigned int rx, flg;
> struct tty_port *port = &sport->port.state->port;
> + typeof(sport->port.membase) membase = sport->port.membase;
> u32 usr2;
>
> /* If we received something, check for 0xff flood */
> - usr2 = imx_uart_readl(sport, USR2);
> + usr2 = readl(membase + USR2);
> if (usr2 & USR2_RDR)
> imx_uart_check_flood(sport, usr2);
>
> - while ((rx = imx_uart_readl(sport, URXD0)) & URXD_CHARRDY) {
> + while ((rx = readl(membase + URXD0)) & URXD_CHARRDY) {
Actually imx_uart_readl() only set shadow registers for UCRx and UFCR, for the USR2 and URXD0 that you used here, they will not be cached.
Best Regards
Sherry
More information about the linux-arm-kernel
mailing list