fbdev: mdp3: change iommu map sequence for cont splash
smmu fault occurs during boot up with continuous splash enabled
for video mode panels. Before smmu mapping set the attributes
with EARLY_MAP flag and then attach the iommu map.
This will ensure PA=VA mapping works fine.
Change-Id: I3c3d97997f67ac11c24e6079899b236e9217c4f3
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
diff --git a/drivers/video/fbdev/msm/mdp3_ctrl.c b/drivers/video/fbdev/msm/mdp3_ctrl.c
index 7c1b7d9..d4bb61a 100644
--- a/drivers/video/fbdev/msm/mdp3_ctrl.c
+++ b/drivers/video/fbdev/msm/mdp3_ctrl.c
@@ -1325,19 +1325,37 @@
/*Map the splash addr for VIDEO mode panel before smmu attach*/
if ((mfd->panel.type == MIPI_VIDEO_PANEL) &&
(mdp3_session->in_splash_screen)) {
+ rc = mdss_smmu_set_attribute(MDSS_IOMMU_DOMAIN_UNSECURE,
+ EARLY_MAP, 1);
+ if (rc) {
+ pr_err("mdp3 set attribute failed for early map\n");
+ goto reset_error;
+ }
+ rc = mdp3_iommu_enable(MDP3_CLIENT_DMA_P);
+ if (IS_ERR_VALUE((unsigned long)rc)) {
+ pr_err("mdp3 iommu attach failed\n");
+ goto reset_error;
+ }
rc = mdss_smmu_map(MDSS_IOMMU_DOMAIN_UNSECURE,
mdp3_res->splash_mem_addr,
mdp3_res->splash_mem_addr,
mdp3_res->splash_mem_size,
IOMMU_READ | IOMMU_NOEXEC);
- }
+ if (rc)
+ pr_err("iommu memory mapping failed ret=%d\n", rc);
+ else
+ pr_info("iommu map passed for PA=VA\n");
- rc = mdp3_iommu_enable(MDP3_CLIENT_DMA_P);
- if (rc) {
- pr_err("fail to attach dma iommu\n");
- if (mdp3_res->idle_pc)
- mdp3_clk_enable(0, 0);
- goto reset_error;
+ rc = mdss_smmu_set_attribute(MDSS_IOMMU_DOMAIN_UNSECURE,
+ EARLY_MAP, 0);
+ } else {
+ rc = mdp3_iommu_enable(MDP3_CLIENT_DMA_P);
+ if (rc) {
+ pr_err("fail to attach dma iommu\n");
+ if (mdp3_res->idle_pc)
+ mdp3_clk_enable(0, 0);
+ goto reset_error;
+ }
}
vsync_client = mdp3_dma->vsync_client;