diff options
author | Flynn xu <flynn.xu@nxp.com> | 2019-03-01 17:59:31 -0500 |
---|---|---|
committer | Flynn xu <flynn.xu@nxp.com> | 2019-03-01 19:52:19 -0500 |
commit | 3c7b2d39cc371afb40c160e2bb91117e0e8b2bd2 (patch) | |
tree | 33ca6ab61e7411de582b12279bace2277e009fe0 /drivers/tty/serial/fsl_lpuart.c | |
parent | 5c256f82c17b7d190a5fedbe8dc4b4512390e353 (diff) |
MLK-21006 Driver: lpuart: Disable interrupts before request irq
Commit b311ef1d549b ("MLK-20989: Driver: lpuart: reset registers
before enable lpuart") breaks early console function, and the
commit already was reverted. The reworked patch is to fix the
issue correctly.
This patch has been tested on i.MX8QM/QXP.
change log:
V1 -> V2:
1. Remove lock, since there is no race condition.
Suggested-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Flynn xu <flynn.xu@nxp.com>
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r-- | drivers/tty/serial/fsl_lpuart.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 421b0eb5f3e6..8363bfaab107 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2395,6 +2395,8 @@ static int lpuart_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct lpuart_port *sport; struct resource *res; + unsigned long cr_32; + unsigned char cr_8; int ret; sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); @@ -2468,6 +2470,17 @@ static int lpuart_probe(struct platform_device *pdev) platform_set_drvdata(pdev, &sport->port); + /* Disable interrupts before request irq */ + if (lpuart_is_32(sport)) { + cr_32 = lpuart32_read(&sport->port, UARTCTRL); + cr_32 &= ~(UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE | UARTCTRL_ILIE); + lpuart32_write(&sport->port, cr_32, UARTCTRL); + } else { + cr_8 = readb(sport->port.membase + UARTCR2); + cr_8 &= ~(UARTCR2_TIE | UARTCR2_TCIE | UARTCR2_RIE | UARTCR2_ILIE); + writeb(cr_8, sport->port.membase + UARTCR2); + } + if (lpuart_is_32(sport)) { lpuart_reg.cons = LPUART32_CONSOLE; ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0, |