Skip to content

Commit

Permalink
serial: fsl_lpuart: fix driver stuck
Browse files Browse the repository at this point in the history
The calls reorder done in commit [1] works well in the upstream
kernel. The NXP version of the kernel needs a port to be attached to
the driver earlier, otherwise, the driver is stuck. Move back calls
order as a workaround.
It may break working rs485. The only board that uses this driver for
the RS-485 port is "vf610-zii-scu4-aib" which is quite legacy.

[1] commit b079d37 ("serial: Deassert Transmit Enable on probe in driver-specific way")

Fixes: b9ae52e ("serial: fsl_lpuart: fix merging issue")
Signed-off-by: Oleksandr Suvorov <[email protected]>
  • Loading branch information
MrCry0 committed Feb 8, 2023
1 parent 3248ffc commit 645fce6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/tty/serial/fsl_lpuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,10 @@ 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;
Expand All @@ -2977,9 +2981,7 @@ static int lpuart_probe(struct platform_device *pdev)
sport->port.rs485.delay_rts_after_send)
dev_err(&pdev->dev, "driver doesn't support RTS delays\n");

ret = uart_add_one_port(&lpuart_reg, &sport->port);
if (ret)
goto failed_attach_port;
sport->port.rs485_config(&sport->port, &sport->port.rs485);

ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0,
DRIVER_NAME, sport);
Expand All @@ -2989,10 +2991,10 @@ static int lpuart_probe(struct platform_device *pdev)
return 0;

failed_irq_request:
uart_remove_one_port(&lpuart_reg, &sport->port);
failed_attach_port:
failed_get_rs485:
failed_reset:
uart_remove_one_port(&lpuart_reg, &sport->port);
failed_attach_port:
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
Expand Down

0 comments on commit 645fce6

Please sign in to comment.