Ver código fonte

Merge "msm: camera: smmu: Add support for 36 bit address space" into camera-kernel.lnx.5.0

Savita Patted 3 anos atrás
pai
commit
99aebe2c09
1 arquivos alterados com 37 adições e 19 exclusões
  1. 37 19
      drivers/cam_smmu/cam_smmu_api.c

+ 37 - 19
drivers/cam_smmu/cam_smmu_api.c

@@ -3987,6 +3987,10 @@ static int cam_smmu_get_memory_regions_info(struct device_node *of_node,
 	int rc = 0;
 	struct device_node *mem_map_node = NULL;
 	struct device_node *child_node = NULL;
+	dma_addr_t region_start = 0;
+	size_t region_len = 0;
+	uint32_t region_id;
+	uint32_t qdss_region_phy_addr;
 	const char *region_name;
 	int num_regions = 0;
 
@@ -4010,12 +4014,10 @@ static int cam_smmu_get_memory_regions_info(struct device_node *of_node,
 	}
 
 	for_each_available_child_of_node(mem_map_node, child_node) {
-		uint32_t region_start;
-		uint32_t region_len;
-		uint32_t region_id;
-		uint32_t qdss_region_phy_addr = 0;
+		qdss_region_phy_addr = 0;
 
 		num_regions++;
+
 		rc = of_property_read_string(child_node,
 			"iova-region-name", &region_name);
 		if (rc < 0) {
@@ -4024,24 +4026,40 @@ static int cam_smmu_get_memory_regions_info(struct device_node *of_node,
 			return -EINVAL;
 		}
 
-		rc = of_property_read_u32(child_node,
-			"iova-region-start", &region_start);
-		if (rc < 0) {
-			of_node_put(mem_map_node);
-			CAM_ERR(CAM_SMMU, "Failed to read iova-region-start");
-			return -EINVAL;
-		}
+		if (iommu_cb_set.is_expanded_memory) {
+			rc = of_property_read_u64(child_node, "iova-region-start", &region_start);
+			if (rc < 0) {
+				of_node_put(mem_map_node);
+				CAM_ERR(CAM_SMMU, "Failed to read iova-region-start");
+				return -EINVAL;
+			}
 
-		rc = of_property_read_u32(child_node,
-			"iova-region-len", &region_len);
-		if (rc < 0) {
-			of_node_put(mem_map_node);
-			CAM_ERR(CAM_SMMU, "Failed to read iova-region-len");
-			return -EINVAL;
+			rc = of_property_read_u64(child_node, "iova-region-len",
+				(uint64_t *)&region_len);
+			if (rc < 0) {
+				of_node_put(mem_map_node);
+				CAM_ERR(CAM_SMMU, "Failed to read iova-region-len");
+				return -EINVAL;
+			}
+		} else {
+			rc = of_property_read_u32(child_node, "iova-region-start",
+				(uint32_t *)&region_start);
+			if (rc < 0) {
+				of_node_put(mem_map_node);
+				CAM_ERR(CAM_SMMU, "Failed to read iova-region-start");
+				return -EINVAL;
+			}
+
+			rc = of_property_read_u32(child_node, "iova-region-len",
+				(uint32_t *)&region_len);
+			if (rc < 0) {
+				of_node_put(mem_map_node);
+				CAM_ERR(CAM_SMMU, "Failed to read iova-region-len");
+				return -EINVAL;
+			}
 		}
 
-		rc = of_property_read_u32(child_node,
-			"iova-region-id", &region_id);
+		rc = of_property_read_u32(child_node, "iova-region-id", &region_id);
 		if (rc < 0) {
 			of_node_put(mem_map_node);
 			CAM_ERR(CAM_SMMU, "Failed to read iova-region-id");