From: Xiaolei Wang <xiaolei.wang@windriver.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org, lukas@wunner.de
Cc: fugang.duan@nxp.com, sherry.sun@nxp.com,
ilpo.jarvinen@linux.intel.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] serial: fsl_lpuart: Skip the reset for the early console port
Date: Mon, 24 Oct 2022 17:12:20 +0800 [thread overview]
Message-ID: <20221024091220.1619822-1-xiaolei.wang@windriver.com> (raw)
The commit 60f361722ad2 ("serial: fsl_lpuart: Reset prior to
registration") has moved the reset before the port registration,
this change makes the uart_console() in lpuart_global_reset() no sense
since the port is not registered to the system yet. So drop it.
But we sill need to check if the port is used as an early console
before performing the port reset, otherwise the reset will hang the
system.
Fixes: 60f361722ad2 ("serial: fsl_lpuart: Reset prior to registration")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
drivers/tty/serial/fsl_lpuart.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 67fa113f77d4..d0efeba5c695 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -239,6 +239,8 @@
/* IMX lpuart has four extra unused regs located at the beginning */
#define IMX_REG_OFF 0x10
+static resource_size_t lpuart_earlycon_mapbase;
+
enum lpuart_type {
VF610_LPUART,
LS1021A_LPUART,
@@ -410,7 +412,7 @@ static int lpuart_global_reset(struct lpuart_port *sport)
void __iomem *global_addr;
int ret;
- if (uart_console(port))
+ if ((port->mapbase - 0x10) == lpuart_earlycon_mapbase)
return 0;
ret = clk_prepare_enable(sport->ipg_clk);
@@ -2604,6 +2606,7 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic
device->port.iotype = UPIO_MEM32;
device->port.membase += IMX_REG_OFF;
device->con->write = lpuart32_early_write;
+ lpuart_earlycon_mapbase = device->port.mapbase;
return 0;
}
--
2.25.1
next reply other threads:[~2022-10-24 9:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 9:12 Xiaolei Wang [this message]
2022-10-24 9:56 ` 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=20221024091220.1619822-1-xiaolei.wang@windriver.com \
--to=xiaolei.wang@windriver.com \
--cc=fugang.duan@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=sherry.sun@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®