提交 41831902 编写于 作者: C Chunyan Zhang 提交者: Greg Kroah-Hartman

serial: sprd: keep console alive even if missing the 'enable' clock

The sprd serial console can work with only 26M fixed clock,
but the probe() is returning fail if the clock "enable" is not
configured in device tree.

This patch will fix the problem to let the uart device which is
used for console can be initialized even missing "enable" clock
configured in devicetree. We should make sure the debug function
as available as we can.
Signed-off-by: NChunyan Zhang <chunyan.zhang@unisoc.com>
Signed-off-by: NChunyan Zhang <zhang.lyra@gmail.com>
Reviewed-by: NBaolin Wang <baolin.wang@linaro.org>
Tested-by: NBaolin Wang <baolin.wang@linaro.org>
Link: https://lore.kernel.org/r/20190826072929.7696-4-zhang.lyra@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e85c9d67
...@@ -1111,6 +1111,16 @@ static int sprd_remove(struct platform_device *dev) ...@@ -1111,6 +1111,16 @@ static int sprd_remove(struct platform_device *dev)
return 0; return 0;
} }
static bool sprd_uart_is_console(struct uart_port *uport)
{
struct console *cons = sprd_uart_driver.cons;
if (cons && cons->index >= 0 && cons->index == uport->line)
return true;
return false;
}
static int sprd_clk_init(struct uart_port *uport) static int sprd_clk_init(struct uart_port *uport)
{ {
struct clk *clk_uart, *clk_parent; struct clk *clk_uart, *clk_parent;
...@@ -1137,10 +1147,17 @@ static int sprd_clk_init(struct uart_port *uport) ...@@ -1137,10 +1147,17 @@ static int sprd_clk_init(struct uart_port *uport)
u->clk = devm_clk_get(uport->dev, "enable"); u->clk = devm_clk_get(uport->dev, "enable");
if (IS_ERR(u->clk)) { if (IS_ERR(u->clk)) {
if (PTR_ERR(u->clk) != -EPROBE_DEFER) if (PTR_ERR(u->clk) == -EPROBE_DEFER)
dev_err(uport->dev, "uart%d can't get enable clock\n", return -EPROBE_DEFER;
uport->line);
return PTR_ERR(u->clk); dev_warn(uport->dev, "uart%d can't get enable clock\n",
uport->line);
/* To keep console alive even if the error occurred */
if (!sprd_uart_is_console(uport))
return PTR_ERR(u->clk);
u->clk = NULL;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册