提交 d9b657a5 编写于 作者: S Simon South 提交者: Thierry Reding

pwm: rockchip: Enable APB clock during register access while probing

Commit 457f74ab ("pwm: rockchip: Keep enabled PWMs running while
probing") modified rockchip_pwm_probe() to access a PWM device's registers
directly to check whether or not the device is enabled, but did not also
change the function so it first enables the device's APB clock to be
certain the device can respond. This risks hanging the kernel on systems
with PWM devices that use more than a single clock.

Avoid this by enabling the device's APB clock before accessing its
registers (and disabling the clock when register access is complete).

Fixes: 457f74ab ("pwm: rockchip: Keep enabled PWMs running while probing")
Reported-by: NThierry Reding <thierry.reding@gmail.com>
Suggested-by: NTrent Piepho <tpiepho@gmail.com>
Signed-off-by: NSimon South <simon@simonsouth.net>
Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
上级 a2bc9b21
...@@ -330,9 +330,9 @@ static int rockchip_pwm_probe(struct platform_device *pdev) ...@@ -330,9 +330,9 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = clk_prepare(pc->pclk); ret = clk_prepare_enable(pc->pclk);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Can't prepare APB clk: %d\n", ret); dev_err(&pdev->dev, "Can't prepare enable APB clk: %d\n", ret);
goto err_clk; goto err_clk;
} }
...@@ -362,10 +362,12 @@ static int rockchip_pwm_probe(struct platform_device *pdev) ...@@ -362,10 +362,12 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
if ((ctrl & enable_conf) != enable_conf) if ((ctrl & enable_conf) != enable_conf)
clk_disable(pc->clk); clk_disable(pc->clk);
clk_disable(pc->pclk);
return 0; return 0;
err_pclk: err_pclk:
clk_unprepare(pc->pclk); clk_disable_unprepare(pc->pclk);
err_clk: err_clk:
clk_disable_unprepare(pc->clk); clk_disable_unprepare(pc->clk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册