copper: Enabling secure mode for MDSS

MDSS VBIF registers need secure access. Enabling
secure mode.

Change-Id: I235f9f95b12dc9d0446942b722271d8f29c1f1e8
diff --git a/platform/msm_shared/include/mdp5.h b/platform/msm_shared/include/mdp5.h
index 38b39df..2091ed1 100644
--- a/platform/msm_shared/include/mdp5.h
+++ b/platform/msm_shared/include/mdp5.h
@@ -98,6 +98,7 @@
 #define MMSS_MDP_SMP_ALLOC_R_0                  REG_MDP(0x0230)
 #define MMSS_MDP_SMP_ALLOC_R_1                  REG_MDP(0x0234)
 
+#define VBIF_VBIF_DDR_FORCE_CLK_ON              REG_MDP(0x24004)
 #define VBIF_VBIF_DDR_OUT_MAX_BURST             REG_MDP(0x240D8)
 
 void mdp_set_revision(int rev);
diff --git a/platform/msm_shared/mdp5.c b/platform/msm_shared/mdp5.c
index b374fd7..54fc33b 100644
--- a/platform/msm_shared/mdp5.c
+++ b/platform/msm_shared/mdp5.c
@@ -39,6 +39,9 @@
 #include <err.h>
 #include <clock.h>
 #include <mdp5.h>
+#include <scm.h>
+
+int restore_secure_cfg(uint32_t id);
 
 static int mdp_rev;
 
@@ -73,6 +76,7 @@
 	uint32_t display_hctl, active_hctl, hsync_ctl, display_vstart, display_vend;
 	struct lcdc_panel_info *lcdc = NULL;
 	unsigned mdp_rgb_size;
+	int access_secure = 0;
 
 	if (pinfo == NULL)
 		return ERR_INVALID_ARGS;
@@ -111,8 +115,17 @@
 	/* Underrun(Interface 0/1/2/3) VSYNC Interrupt Enable  */
 	writel(0xFF777713, MDP_INTR_EN);
 
+	access_secure = restore_secure_cfg(SECURE_DEVICE_MDSS);
+
 	mdp_clk_gating_ctrl();
 
+	if (!access_secure) {
+		/* Force VBIF Clocks on  */
+		writel(0x1, VBIF_VBIF_DDR_FORCE_CLK_ON);
+		/* Configure DDR burst length */
+		writel(0x00000707, VBIF_VBIF_DDR_OUT_MAX_BURST);
+	}
+
 	/* Allocate SMP blocks */
 	writel(0x00101010, MMSS_MDP_SMP_ALLOC_W_0);
 	writel(0x00000010, MMSS_MDP_SMP_ALLOC_W_1);