arm: tegra: smmu: Remove IORESOURCE use from SMMU IOVA range
Hiro Sugawara [Wed, 14 Sep 2011 00:20:35 +0000 (17:20 -0700)]
SMMU simply needs to know its assigned IOVA range, but does not need
address space resources.
Bug 874438

Change-Id: I0b9943d06c49363cfc0355586866f3bd6b217274
Reviewed-on: http://git-master/r/54534
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R3f4045ef2858960cd987a7477ec6869168ccec7d

arch/arm/mach-tegra/common.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/tegra_smmu.h [new file with mode: 0644]

index 7cc9ac6..cadf77d 100644 (file)
@@ -477,11 +477,8 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        unsigned long fb2_size)
 {
 #ifdef SUPPORT_TEGRA_3_IOVMM_SMMU_A01
-       extern struct platform_device tegra_smmu_device;
        int smmu_reserved = 0;
-       struct resource *smmu_window =
-                   platform_get_resource_byname(&tegra_smmu_device,
-                                               IORESOURCE_MEM, "smmu");
+       struct tegra_smmu_window *smmu_window = tegra_smmu_window(0);
 #endif
 
        if (carveout_size) {
@@ -531,7 +528,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 
 #ifdef SUPPORT_TEGRA_3_IOVMM_SMMU_A01
        if (!smmu_window) {
-               pr_err("No SMMU resources\n");
+               pr_err("No SMMU resource\n");
        } else {
                size_t smmu_window_size;
 
@@ -606,7 +603,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 
 #ifdef SUPPORT_TEGRA_3_IOVMM_SMMU_A01
        if (smmu_reserved)
-               pr_info("SMMU:                   %08x - %08x\n",
+               pr_info("SMMU:                   %08lx - %08lx\n",
                        smmu_window->start, smmu_window->end);
 #endif
 }
index f87a780..3eebac3 100644 (file)
@@ -33,6 +33,7 @@
 #include "gpio-names.h"
 #include "iomap.h"
 #include "devices.h"
+#include "tegra_smmu.h"
 
 #define TEGRA_DMA_REQ_SEL_I2S_1                        2
 #define TEGRA_DMA_REQ_SEL_SPD_I                        3
@@ -1331,12 +1332,6 @@ static struct resource tegra_smmu_resources[] = {
                .end    = TEGRA_MC_BASE + TEGRA_MC_SIZE - 1,
        },
        [1] = {
-               .name   = "smmu",
-               .flags  = IORESOURCE_MEM,
-               .start  = TEGRA_SMMU_BASE,
-               .end    = TEGRA_SMMU_BASE + TEGRA_SMMU_SIZE - 1,
-       },
-       [2] = {
                .name   = "ahbarb",
                .flags  = IORESOURCE_MEM,
                .start  = TEGRA_AHB_ARB_BASE,
@@ -1350,6 +1345,24 @@ struct platform_device tegra_smmu_device = {
        .num_resources  = ARRAY_SIZE(tegra_smmu_resources),
        .resource       = tegra_smmu_resources
 };
+
+
+static struct tegra_smmu_window tegra_smmu[] = {
+       [0] = {
+               .start  = TEGRA_SMMU_BASE,
+               .end    = TEGRA_SMMU_BASE + TEGRA_SMMU_SIZE - 1,
+       },
+};
+
+struct tegra_smmu_window *tegra_smmu_window(int wnum)
+{
+       return &tegra_smmu[wnum];
+}
+
+int tegra_smmu_window_count(void)
+{
+       return ARRAY_SIZE(tegra_smmu);
+}
 #endif
 
 #if defined(CONFIG_ARCH_TEGRA_2x_SOC)
diff --git a/arch/arm/mach-tegra/tegra_smmu.h b/arch/arm/mach-tegra/tegra_smmu.h
new file mode 100644 (file)
index 0000000..b46ae11
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * arch/arm/mach-tegra/tegra_smmu.h
+ *
+ * Copyright (C) 2011 NVIDIA Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifdef CONFIG_TEGRA_IOVMM_SMMU
+struct tegra_smmu_window {
+       unsigned long start;
+       unsigned long end;
+};
+
+extern struct tegra_smmu_window *tegra_smmu_window(int wnum);
+extern int tegra_smmu_window_count(void);
+#endif