All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: linux-serial@vger.kernel.org
Cc: "Fabio Estevam" <festevam@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Richard Genoud" <richard.genoud@gmail.com>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Tim Harvey" <tharvey@gateworks.com>,
	"Tomasz Moń" <tomasz.mon@camlingroup.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Johan Hovold" <johan@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Sherry Sun" <sherry.sun@nxp.com>,
	linux-arm-kernel@lists.infradead.org,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Sergey Organov" <sorganov@gmail.com>
Subject: [PATCH v1 0/7] serial: imx: work-around for hardware RX flood, and then isr improvements
Date: Sat, 21 Jan 2023 18:36:32 +0300	[thread overview]
Message-ID: <20230121153639.15402-1-sorganov@gmail.com> (raw)
In-Reply-To: <87bko4e65y.fsf@osv.gnss.ru>

These series contain a work-around for hardware RX flood in first 2
commits, and then further cleanups and optimizations of the receive IRQ
handler.

WARNING: the flood fix is extensively tested with older version of the
kernel with DMA turned off. The DMA path is tested only a bit, as DMA has
receive problems on my kernel version.

Changes in v1:

  * Missing braces fixed.

  * Withdrawn patch optimizing imx_uart_readl() -> readl(), on request of
    Uwe Kleine-König.

Sergey Organov (7):
  serial: imx: factor-out common code to imx_uart_soft_reset()
  serial: imx: work-around for hardware RX flood
  serial: imx: do not sysrq broken chars
  serial: imx: do not break from FIFO reading loop prematurely
  serial: imx: remove redundant USR2 read from FIFO reading loop
  serial: imx: stop using USR2 in FIFO reading loop
  serial: imx: refine local variables in rxint()

 drivers/tty/serial/imx.c | 225 ++++++++++++++++++++++++---------------
 1 file changed, 140 insertions(+), 85 deletions(-)

Interdiff against v0:
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 45327ff6dd14..447b9060d9df 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -889,15 +889,14 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
 {
 	struct imx_port *sport = dev_id;
 	struct tty_port *port = &sport->port.state->port;
-	typeof(sport->port.membase) membase = sport->port.membase;
 	u32 usr2, rx;
 
 	/* If we received something, check for 0xff flood */
-	usr2 = readl(membase + USR2);
+	usr2 = imx_uart_readl(sport, USR2);
 	if (usr2 & USR2_RDR)
 		imx_uart_check_flood(sport, usr2);
 
-	while ((rx = readl(membase + URXD0)) & URXD_CHARRDY) {
+	while ((rx = imx_uart_readl(sport, URXD0)) & URXD_CHARRDY) {
 		unsigned int flg = TTY_NORMAL;
 		sport->port.icount.rx++;
 
@@ -929,8 +928,9 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
 				flg = TTY_OVERRUN;
 
 			sport->port.sysrq = 0;
-		} else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
+		} else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) {
 			continue;
+		}
 
 		if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
 			continue;
-- 
2.30.1


WARNING: multiple messages have this Message-ID (diff)
From: Sergey Organov <sorganov@gmail.com>
To: linux-serial@vger.kernel.org
Cc: "Fabio Estevam" <festevam@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Richard Genoud" <richard.genoud@gmail.com>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Tim Harvey" <tharvey@gateworks.com>,
	"Tomasz Moń" <tomasz.mon@camlingroup.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Johan Hovold" <johan@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Sherry Sun" <sherry.sun@nxp.com>,
	linux-arm-kernel@lists.infradead.org,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Sergey Organov" <sorganov@gmail.com>
Subject: [PATCH v1 0/7] serial: imx: work-around for hardware RX flood, and then isr improvements
Date: Sat, 21 Jan 2023 18:36:32 +0300	[thread overview]
Message-ID: <20230121153639.15402-1-sorganov@gmail.com> (raw)
In-Reply-To: <87bko4e65y.fsf@osv.gnss.ru>

These series contain a work-around for hardware RX flood in first 2
commits, and then further cleanups and optimizations of the receive IRQ
handler.

WARNING: the flood fix is extensively tested with older version of the
kernel with DMA turned off. The DMA path is tested only a bit, as DMA has
receive problems on my kernel version.

Changes in v1:

  * Missing braces fixed.

  * Withdrawn patch optimizing imx_uart_readl() -> readl(), on request of
    Uwe Kleine-König.

Sergey Organov (7):
  serial: imx: factor-out common code to imx_uart_soft_reset()
  serial: imx: work-around for hardware RX flood
  serial: imx: do not sysrq broken chars
  serial: imx: do not break from FIFO reading loop prematurely
  serial: imx: remove redundant USR2 read from FIFO reading loop
  serial: imx: stop using USR2 in FIFO reading loop
  serial: imx: refine local variables in rxint()

 drivers/tty/serial/imx.c | 225 ++++++++++++++++++++++++---------------
 1 file changed, 140 insertions(+), 85 deletions(-)

Interdiff against v0:
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 45327ff6dd14..447b9060d9df 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -889,15 +889,14 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
 {
 	struct imx_port *sport = dev_id;
 	struct tty_port *port = &sport->port.state->port;
-	typeof(sport->port.membase) membase = sport->port.membase;
 	u32 usr2, rx;
 
 	/* If we received something, check for 0xff flood */
-	usr2 = readl(membase + USR2);
+	usr2 = imx_uart_readl(sport, USR2);
 	if (usr2 & USR2_RDR)
 		imx_uart_check_flood(sport, usr2);
 
-	while ((rx = readl(membase + URXD0)) & URXD_CHARRDY) {
+	while ((rx = imx_uart_readl(sport, URXD0)) & URXD_CHARRDY) {
 		unsigned int flg = TTY_NORMAL;
 		sport->port.icount.rx++;
 
@@ -929,8 +928,9 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
 				flg = TTY_OVERRUN;
 
 			sport->port.sysrq = 0;
-		} else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
+		} else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) {
 			continue;
+		}
 
 		if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
 			continue;
-- 
2.30.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-01-21 15:37 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87bko4e65y.fsf@osv.gnss.ru>
2022-12-15 21:38 ` serial: imx: sudden rx flood: hardware bug? Fabio Estevam
2022-12-15 22:58   ` Fabio Estevam
2022-12-16 17:08   ` Sergey Organov
2023-01-13 18:43 ` [PATCH 0/8] serial: imx: work-around for hardware RX flood, and then isr improvements Sergey Organov
2023-01-13 18:43   ` Sergey Organov
2023-01-13 18:43   ` [PATCH 1/8] serial: imx: factor-out common code to imx_uart_soft_reset() Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-16 10:30     ` Ilpo Järvinen
2023-01-16 10:30       ` Ilpo Järvinen
2023-01-17 13:42       ` Sergey Organov
2023-01-17 13:42         ` Sergey Organov
2023-01-13 18:43   ` [PATCH 2/8] serial: imx: work-around for hardware RX flood Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-13 18:43   ` [PATCH 3/8] serial: imx: do not sysrq broken chars Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-16 10:41     ` Ilpo Järvinen
2023-01-16 10:41       ` Ilpo Järvinen
2023-01-16 15:24     ` Johan Hovold
2023-01-16 15:24       ` Johan Hovold
2023-01-17 17:35       ` Sergey Organov
2023-01-17 17:35         ` Sergey Organov
2023-01-18  8:06         ` Johan Hovold
2023-01-18  8:06           ` Johan Hovold
2023-01-13 18:43   ` [PATCH 4/8] serial: imx: do not break from FIFO reading loop prematurely Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-13 18:43   ` [PATCH 5/8] serial: imx: remove redundant USR2 read from FIFO reading loop Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-16 10:50     ` Ilpo Järvinen
2023-01-16 10:50       ` Ilpo Järvinen
2023-01-13 18:43   ` [PATCH 6/8] serial: imx: stop using USR2 in " Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-16 10:54     ` Ilpo Järvinen
2023-01-16 10:54       ` Ilpo Järvinen
2023-01-17 13:30       ` Sergey Organov
2023-01-17 13:30         ` Sergey Organov
2023-01-13 18:43   ` [PATCH 7/8] serial: imx: use readl() to optimize " Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-16 11:03     ` Ilpo Järvinen
2023-01-16 11:03       ` Ilpo Järvinen
2023-01-17 17:43       ` Sergey Organov
2023-01-17 17:43         ` Sergey Organov
2023-01-18  8:24         ` Ilpo Järvinen
2023-01-18  8:24           ` Ilpo Järvinen
2023-01-18 15:43           ` Sergey Organov
2023-01-18 15:43             ` Sergey Organov
2023-01-18 19:29             ` Ilpo Järvinen
2023-01-18 19:29               ` Ilpo Järvinen
2023-01-17 10:20     ` Sherry Sun
2023-01-17 10:20       ` Sherry Sun
2023-01-17 17:48       ` Sergey Organov
2023-01-17 17:48         ` Sergey Organov
2023-01-17 11:32     ` Uwe Kleine-König
2023-01-17 11:32       ` Uwe Kleine-König
2023-01-17 13:22       ` Sergey Organov
2023-01-17 13:22         ` Sergey Organov
2023-01-17 21:27         ` Uwe Kleine-König
2023-01-17 21:27           ` Uwe Kleine-König
2023-01-18 15:40           ` Sergey Organov
2023-01-18 15:40             ` Sergey Organov
2023-01-19  7:01             ` Uwe Kleine-König
2023-01-19  7:01               ` Uwe Kleine-König
2023-01-21 18:04               ` Sergey Organov
2023-01-21 18:04                 ` Sergey Organov
2023-01-13 18:43   ` [PATCH 8/8] serial: imx: refine local variables in rxint() Sergey Organov
2023-01-13 18:43     ` Sergey Organov
2023-01-21 15:36 ` Sergey Organov [this message]
2023-01-21 15:36   ` [PATCH v1 0/7] serial: imx: work-around for hardware RX flood, and then isr improvements Sergey Organov
2023-01-21 15:36   ` [PATCH v1 1/7] serial: imx: factor-out common code to imx_uart_soft_reset() Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 2/7] serial: imx: work-around for hardware RX flood Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 3/7] serial: imx: do not sysrq broken chars Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 16:12     ` Stefan Wahren
2023-01-21 16:12       ` Stefan Wahren
2023-01-21 21:04       ` Sergey Organov
2023-01-21 21:04         ` Sergey Organov
2023-01-23 12:38         ` Ilpo Järvinen
2023-01-23 12:38           ` Ilpo Järvinen
2023-01-23 16:34           ` Sergey Organov
2023-01-23 16:34             ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 4/7] serial: imx: do not break from FIFO reading loop prematurely Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 5/7] serial: imx: remove redundant USR2 read from FIFO reading loop Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 6/7] serial: imx: stop using USR2 in " Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-01-21 15:36   ` [PATCH v1 7/7] serial: imx: refine local variables in rxint() Sergey Organov
2023-01-21 15:36     ` Sergey Organov
2023-02-01 14:16 ` [PATCH RESEND] serial: imx: get rid of registers shadowing Sergey Organov
2023-02-01 14:16   ` Sergey Organov
2023-02-01 14:26 ` [PATCH v1 RESEND 0/7] serial: imx: work-around for hardware RX flood, and then isr improvements Sergey Organov
2023-02-01 14:26   ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 1/7] serial: imx: factor-out common code to imx_uart_soft_reset() Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 2/7] serial: imx: work-around for hardware RX flood Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 3/7] serial: imx: do not sysrq broken chars Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 4/7] serial: imx: do not break from FIFO reading loop prematurely Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 5/7] serial: imx: remove redundant USR2 read from FIFO reading loop Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:26   ` [PATCH v1 6/7] serial: imx: stop using USR2 in " Sergey Organov
2023-02-01 14:26     ` Sergey Organov
2023-02-01 14:27   ` [PATCH v1 7/7] serial: imx: refine local variables in rxint() Sergey Organov
2023-02-01 14:27     ` Sergey Organov

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=20230121153639.15402-1-sorganov@gmail.com \
    --to=sorganov@gmail.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=richard.genoud@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sherry.sun@nxp.com \
    --cc=tharvey@gateworks.com \
    --cc=tomasz.mon@camlingroup.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.