Perform DC configuration for peripheral device type only if DC
registers are available. This is handy, for example, when DSI
ganged mode is used and slave DSI has no DC associated with it.

Signed-off-by: Svyatoslav Ryhel <[email protected]>
---
 drivers/video/tegra20/tegra-dsi.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index 6cf6cffc0e4..0b395dbf9fa 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -66,12 +66,14 @@ static void tegra_dc_enable_controller(struct udevice *dev)
        struct dc_ctlr *dc = dc_plat->dc;
        u32 value;
 
-       value = readl(&dc->disp.disp_win_opt);
-       value |= DSI_ENABLE;
-       writel(value, &dc->disp.disp_win_opt);
+       if (dc) {
+               value = readl(&dc->disp.disp_win_opt);
+               value |= DSI_ENABLE;
+               writel(value, &dc->disp.disp_win_opt);
 
-       writel(GENERAL_UPDATE, &dc->cmd.state_ctrl);
-       writel(GENERAL_ACT_REQ, &dc->cmd.state_ctrl);
+               writel(GENERAL_UPDATE, &dc->cmd.state_ctrl);
+               writel(GENERAL_ACT_REQ, &dc->cmd.state_ctrl);
+       }
 }
 
 static const char * const error_report[16] = {
-- 
2.43.0

Reply via email to