summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2022-11-24 14:44:13 +0100
committerFrancesco Dolcini <francesco.dolcini@toradex.com>2022-12-06 15:43:04 +0000
commitf09e815b71e90f746a904e4fc6b1327090c18cb6 (patch)
treec055891a294eda3a56bad784ab08372bbf52fbad /drivers
parentc14f2a6fea383d254a5e9b57033f4e7728b3799c (diff)
Revert "serial: fsl_lpuart: Reset prior to registration"
This reverts commit 4199425b11325e893661d03f92330dd1adae03b0. The lpuart_global_reset() uses fields set by the registration to find out if we are a console or not. Executing it before registration may make it fail. E.g. on a imx8qm-mek the kernel stops booting without any visable output when the switch to a console is done. [ 1.219604] mxs-dma 5b810000.dma-apbh: initialized [ 1.228743] Bus freq driver module loaded [ 1.241522] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 1.252161] 5a060000.serial: ttyLP0 at MMIO 0x5a060010 (irq = 69, base_baud = 5000000) is a FSL_LPUAR[ 1.261335] printk: console [ttyLP0] enabled [ 1.261335] printk: console [ttyLP0] enabled [ 1.269756] printk: bootconsole [lpuart32] disabled [ 1.269756] printk: bootconsole [lpuart32] disabled While at it also remove the second call to uart_add_one_port() which sneaked in during merging of stable patches. Also, since we now reset after uart_add_one_port() call sport->port.rs485_config() explicitely again. The reset may have reverted the effects of the uart_add_one_port -> sport->port.rs485_config call chain. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index d1627ca94b4c..cf2864a06467 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2960,14 +2960,6 @@ static int lpuart_probe(struct platform_device *pdev)
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
- ret = uart_add_one_port(&lpuart_reg, &sport->port);
- if (ret)
- goto failed_attach_port;
-
- ret = lpuart_global_reset(sport);
- if (ret)
- goto failed_reset;
-
ret = uart_get_rs485_mode(&sport->port);
if (ret)
goto failed_get_rs485;
@@ -2983,6 +2975,12 @@ static int lpuart_probe(struct platform_device *pdev)
if (ret)
goto failed_attach_port;
+ ret = lpuart_global_reset(sport);
+ if (ret)
+ goto failed_reset;
+
+ sport->port.rs485_config(&sport->port, &sport->port.rs485);
+
ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0,
DRIVER_NAME, sport);
if (ret)
@@ -2991,13 +2989,13 @@ static int lpuart_probe(struct platform_device *pdev)
return 0;
failed_irq_request:
-failed_get_rs485:
+failed_reset:
uart_remove_one_port(&lpuart_reg, &sport->port);
failed_attach_port:
+failed_get_rs485:
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
-failed_reset:
lpuart_disable_clks(sport);
return ret;
}