Skip to content

Commit

Permalink
Revert "serial: fsl_lpuart: Reset prior to registration"
Browse files Browse the repository at this point in the history
This reverts commit 4199425.

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>
  • Loading branch information
MaxKrummenacher committed Nov 24, 2022
1 parent 0dbb0e2 commit a682d46
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions drivers/tty/serial/fsl_lpuart.c
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit a682d46

Please sign in to comment.