iommu/tegra: smmu: Use tegra_smmu_window() to get iova range
Hiroshi DOYU [Fri, 13 Jul 2012 16:42:22 +0000 (19:42 +0300)]
*HACK*
To adjust legacy name internally to support IOMMU and IOVMM at once.

Change-Id: I765530328e6dda4b3a6fad05e2e55327e29ba5ca
Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
Reviewed-on: http://git-master/r/118707
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

drivers/iommu/tegra-smmu.c

index 622d7d0..915763c 100644 (file)
@@ -1080,7 +1080,8 @@ static int tegra_smmu_resume(struct device *dev)
 static int tegra_smmu_probe(struct platform_device *pdev)
 {
        struct smmu_device *smmu;
-       struct resource *regs, *regs2, *window;
+       struct resource *regs, *regs2;
+       struct tegra_smmu_window *window;
        struct device *dev = &pdev->dev;
        int i, err = 0;
 
@@ -1091,7 +1092,7 @@ static int tegra_smmu_probe(struct platform_device *pdev)
 
        regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        regs2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       window = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+       window = tegra_smmu_window(0);
        if (!regs || !regs2 || !window) {
                dev_err(dev, "No SMMU resources\n");
                return -ENODEV;
@@ -1106,7 +1107,7 @@ static int tegra_smmu_probe(struct platform_device *pdev)
        smmu->dev = dev;
        smmu->num_as = SMMU_NUM_ASIDS;
        smmu->iovmm_base = (unsigned long)window->start;
-       smmu->page_count = resource_size(window) >> SMMU_PAGE_SHIFT;
+       smmu->page_count = (window->end + 1 - window->start) >> SMMU_PAGE_SHIFT;
        smmu->regs = devm_ioremap(dev, regs->start, resource_size(regs));
        smmu->regs_ahbarb = devm_ioremap(dev, regs2->start,
                                         resource_size(regs2));