Regression: commit c9712e333809 breaks xilinx_uartps

From: Paul Thomas
Date: Wed Sep 11 2019 - 13:04:32 EST


Hello,

As I was working with a recent 5.2 kernel with a Zynq Ultrascale+
board I found that the serial console wasn't working with a message
like:
xuartps: probe of ff000000.serial failed with error -16

I did a git bisect and found that this came from:
commit: c9712e3338098359a82c3f5d198c92688fa6cd26
serial: uartps: Use the same dynamic major number for all ports

One difference I might have is in the device-tree, I'm using a proper
clock config (zynqmp-clk-ccf.dtsi) using the firmware clock interface.
This is absolutely necessary, for instance, with the Ethernet
negotiation where the macb driver needs to change the clock rate. In
any case I believe this pushes my case to the -EPROBE_DEFER when
devm_clk_get() fails the first time, this might not have been tested
in with the original submission. I'm not sure this makes everything
completely correct, but the patch below does fix the issue for me.

thanks,
Paul

---
drivers/tty/serial/xilinx_uartps.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c
b/drivers/tty/serial/xilinx_uartps.c
index 9dcc4d855ddd..ece7f6caa994 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1565,6 +1565,8 @@ static int cdns_uart_probe(struct platform_device *pdev)

cdns_uart_data->pclk = devm_clk_get(&pdev->dev, "pclk");
if (PTR_ERR(cdns_uart_data->pclk) == -EPROBE_DEFER) {
+ /* If we end up defering then set uartps_major back to 0 */
+ uartps_major = 0;
rc = PTR_ERR(cdns_uart_data->pclk);
goto err_out_unregister_driver;
}
--
2.17.1