drm/exynos: enable fimd clocks in probe before accessing fimd registers
Subsystems (3)
PATCH v2 1/1 drm/exynos: enable fimd clocks in probe before accessing fimd registers
From: Rahul Sharma <[email protected]>
Fimd probe is accessing fimd Registers without enabling the fimd gate clocks. If FIMD clocks are kept disabled in Uboot or disbaled during kernel boottime, the system hangs during boottime.
This issue got surfaced when verifying with sysmmu enabled. Probe of fimd Sysmmu enables the master clock before accessing sysmmu regs and then disables. Later fimd probe tries to read the register without enabling the clock which is wrong and hangs the system.
---
Rebased on exynos-drm-next branch.
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6 -0
@@ -891,9 +891,15 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display); +clk_prepare_enable (ctx->bus_clk); +clk_prepare_enable (ctx->lcd_clk); +for (win =0 ; win <WINDOWS_NR ; win++)fimd_clear_win (ctx, win); +clk_disable_unprepare (ctx->lcd_clk); +clk_disable_unprepare (ctx->bus_clk); +return 0 ; }
Signature · 1 line
1.7.9.5
Hi Rahul,
Quoted 23 lines · Rahul Sharma
From: Rahul Sharma <[email protected]>
Fimd probe is accessing fimd Registers without enabling the fimd gate clocks. If FIMD clocks are kept disabled in Uboot or disbaled during kernel boottime, the system hangs during boottime.
This issue got surfaced when verifying with sysmmu enabled. Probe of fimd Sysmmu enables the master clock before accessing sysmmu regs and then disables. Later fimd probe tries to read the register without enabling the clock which is wrong and hangs the system.
Signed-off-by Rahul Sharma <[email protected]>---
Rebased on exynos-drm-next branch.drivers/gpu/drm/exynos/exynos_drm_fimd.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_bind(struct device *dev, struct device *master, void *data) · line 894
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-0@@ -891,9 +891,15 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display); +clk_prepare_enable (ctx->bus_clk);
Probably a check for its success?
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_bind(struct device *dev, struct device *master, void *data) · line 895
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-0+clk_prepare_enable (ctx->lcd_clk);
ditto.
Signature · 2 lines
With warm regards, Sachin
Quoted 1 line · Sachin Kamat
Hi Rahul,
[snip]
Quoted 7 lines
Quoted 2 lines
+
clk_prepare_enable(ctx->bus_clk);Probably a check for its success?
Quoted 1 line
+
clk_prepare_enable(ctx->lcd_clk);
Generally we don't check this in any of the driver. It will be quite unnecessary.
Regards,
Rahul Sharma
Quoted 5 lines
ditto.
--
With warm regards,
Sachin
Quoted 6 lines · Rahul Sharma
Quoted 1 line · Sachin Kamat
Hi Rahul,
[snip]
Quoted 3 lines
Quoted 2 lines
+
clk_prepare_enable(ctx->bus_clk);
Quoted 7 lines
Quoted 4 lines
Probably a check for its success?
Quoted 1 line
+
clk_prepare_enable(ctx->lcd_clk);Generally we don't check this in any of the driver. It will be quite unnecessary.
However in your case, since you mentioned if the clock is not enabled, it will hang the system when fimd probe tries to read the register, this check would ensure it doesn't happen (hang) even if clk_prepare_enable fails for whatever reasons.
Signature · 2 lines
With warm regards, Sachin
Quoted 6 lines · Rahul Sharma
Quoted 1 line · Sachin Kamat
Hi Rahul,
[snip]
Quoted 3 lines
Quoted 2 lines
+
clk_prepare_enable(ctx->bus_clk);
Quoted 7 lines
Quoted 4 lines
Probably a check for its success?
Quoted 1 line
+
clk_prepare_enable(ctx->lcd_clk);Generally we don't check this in any of the driver. It will be quite unnecessary.
Then those drivers are all buggy. There's a reason why this function returns an int rather than void. Just because you've never seen it fail doesn't mean it can't.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Thierry Reding
Quoted 11 lines · Rahul Sharma
Quoted 1 line · Sachin Kamat
Hi Rahul,
[snip]
Quoted 7 lines
Quoted 2 lines
+
clk_prepare_enable(ctx->bus_clk);Probably a check for its success?
Quoted 1 line
+
clk_prepare_enable(ctx->lcd_clk);
Quoted 6 lines
Quoted 2 lines
Generally we don't check this in any of the driver. It will be quite unnecessary.
Then those drivers are all buggy. There's a reason why this function returns an int rather than void. Just because you've never seen it fail doesn't mean it can't.
Okay... I don't mind putting extra checks. V3 is coming :).
Best Regards,
Rahul Sharma
Quoted 8 lines
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel