You need to sign in or sign up before continuing.
提交 ff8bf852 编写于 作者: J John Garry 提交者: Greg Kroah-Hartman

serial: 8250_of: Fix for lack of interrupt support

[ Upstream commit a27d938251ef40c43db81af16fc26b2cec181d4d ]

In commit c58caaab ("serial: 8250: of: Defer probe on missing IRQ"), a
check was added for the UART driver being probed prior to the parent IRQ
controller.

Unfortunately this breaks certain boards which have no interrupt support,
like Huawei D03.

Indeed, the 8250 DT bindings state that interrupts should be supported -
not must.

To fix, switch from irq_of_parse_and_map() to of_irq_get(), which
does relay whether the IRQ host controller domain is not ready, i.e.
defer probe, instead of assuming it.

Fixes: c58caaab ("serial: 8250: of: Defer probe on missing IRQ")
Signed-off-by: NJohn Garry <john.garry@huawei.com>
Reviewed-by: NRob Herring <robh@kernel.org>
Reviewed-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
Tested-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 19527c62
...@@ -58,7 +58,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, ...@@ -58,7 +58,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
struct resource resource; struct resource resource;
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
u32 clk, spd, prop; u32 clk, spd, prop;
int ret; int ret, irq;
memset(port, 0, sizeof *port); memset(port, 0, sizeof *port);
...@@ -143,21 +143,27 @@ static int of_platform_serial_setup(struct platform_device *ofdev, ...@@ -143,21 +143,27 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
if (ret >= 0) if (ret >= 0)
port->line = ret; port->line = ret;
port->irq = irq_of_parse_and_map(np, 0); irq = of_irq_get(np, 0);
if (!port->irq) { if (irq < 0) {
if (irq == -EPROBE_DEFER) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto err_unprepare; goto err_unprepare;
} }
/* IRQ support not mandatory */
irq = 0;
}
port->irq = irq;
info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
if (IS_ERR(info->rst)) { if (IS_ERR(info->rst)) {
ret = PTR_ERR(info->rst); ret = PTR_ERR(info->rst);
goto err_dispose; goto err_unprepare;
} }
ret = reset_control_deassert(info->rst); ret = reset_control_deassert(info->rst);
if (ret) if (ret)
goto err_dispose; goto err_unprepare;
port->type = type; port->type = type;
port->uartclk = clk; port->uartclk = clk;
...@@ -184,8 +190,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, ...@@ -184,8 +190,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
port->handle_irq = fsl8250_handle_irq; port->handle_irq = fsl8250_handle_irq;
return 0; return 0;
err_dispose:
irq_dispose_mapping(port->irq);
err_unprepare: err_unprepare:
clk_disable_unprepare(info->clk); clk_disable_unprepare(info->clk);
err_pmruntime: err_pmruntime:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册