drm/exynos: enable fimd clocks in probe before accessing fimd registers
Subsystems (3)
PATCH v3 1/1 drm/exynos: enable fimd clocks in probe before accessing fimd registers
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.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +16 -1
@@ -898,16 +898,31 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) {struct fimd_context *ctx = fimd_manager.ctx;struct drm_device *drm_dev = data; -int win; +int win, ret;fimd_mgr_initialize (&fimd_manager, drm_dev);exynos_drm_crtc_create (&fimd_manager);if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display); + ret =clk_prepare_enable (ctx->bus_clk); +if (ret) { +dev_err (dev,"bus clock enable failed.\n" ); +return ret; + } + + ret =clk_prepare_enable (ctx->lcd_clk); +if (ret) { +dev_err (dev,"lcd clock enable failed.\n" ); +return ret; + } +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 29 lines · Rahul Sharma
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]>--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)drivers/gpu/drm/exynos/exynos_drm_fimd.c +1
-1@@ -898,16 +898,31 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) {struct fimd_context *ctx = fimd_manager.ctx;struct drm_device *drm_dev = data; -int win; +int win, ret;fimd_mgr_initialize (&fimd_manager, drm_dev);exynos_drm_crtc_create (&fimd_manager);if (ctx->display)exynos_drm_create_enc_conn (drm_dev, ctx->display);
drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_bind(struct device *dev, struct device *master, void *data) · line 916
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +9
-0+ ret =clk_prepare_enable (ctx->bus_clk); +if (ret) { +dev_err (dev,"bus clock enable failed.\n" ); +return ret; + } + + ret =clk_prepare_enable (ctx->lcd_clk); +if (ret) { +dev_err (dev,"lcd clock enable failed.\n" );
Add clk_disable_unprepare(ctx->bus_clk) before returning on error.
Quoted 15 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6
-1+return ret; + } +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 ; } --1.7.9.5
Signature · 2 lines
With warm regards, Sachin