diff options
-rw-r--r-- | arch/arm/mach-tegra/common.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-tegra/devices.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-tegra/iovmm-smmu.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra_smmu.h | 24 |
4 files changed, 52 insertions, 16 deletions
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 2eb249c71e7a..3db0c00d7839 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -43,6 +43,7 @@ #include "fuse.h" #include "pm.h" #include "reset.h" +#include "tegra_smmu.h" #define MC_SECURITY_CFG2 0x7c @@ -519,11 +520,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) { @@ -573,7 +571,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; @@ -648,7 +646,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 } diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c index 867c7f92f2e7..b5481f9a3197 100644 --- a/arch/arm/mach-tegra/devices.c +++ b/arch/arm/mach-tegra/devices.c @@ -30,6 +30,7 @@ #include <mach/irqs.h> #include <mach/iomap.h> #include <mach/dma.h> +#include "tegra_smmu.h" #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) #define UART_SOURCE_RATE 408000000 @@ -1193,12 +1194,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, @@ -1212,6 +1207,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/iovmm-smmu.c b/arch/arm/mach-tegra/iovmm-smmu.c index ceb9a5ad803e..9107aecf9ad4 100644 --- a/arch/arm/mach-tegra/iovmm-smmu.c +++ b/arch/arm/mach-tegra/iovmm-smmu.c @@ -35,9 +35,9 @@ #include <asm/cacheflush.h> #include <asm/page.h> #include <asm/cacheflush.h> - #include <mach/iovmm.h> #include <mach/iomap.h> +#include "tegra_smmu.h" /* For debugging */ /*#define SMMU_DEBUG*/ @@ -942,7 +942,8 @@ static struct tegra_iovmm_device_ops tegra_iovmm_smmu_ops = { static int smmu_probe(struct platform_device *pdev) { struct smmu_device *smmu = NULL; - struct resource *regs = NULL, *window = NULL, *regs2 = NULL; + struct resource *regs = NULL, *regs2 = NULL; + struct tegra_smmu_window *window = NULL; int e, asid; if (!pdev) { @@ -963,7 +964,7 @@ static int smmu_probe(struct platform_device *pdev) regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mc"); regs2 = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahbarb"); - window = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smmu"); + window = tegra_smmu_window(0); if (!regs || !regs2 || !window) { pr_err(DRIVER_NAME ": No SMMU resources\n"); @@ -979,7 +980,7 @@ static int smmu_probe(struct platform_device *pdev) smmu->iovmm_base = (tegra_iovmm_addr_t)window->start; smmu->page_count = (window->end + 1 - window->start) >> SMMU_PAGE_SHIFT; smmu->regs = ioremap(regs->start, regs->end + 1 - regs->start); - smmu->regs_ahbarb = ioremap(regs2->start, regs2->end + 1 - regs->start); + smmu->regs_ahbarb = ioremap(regs2->start, regs2->end+1 - regs2->start); if (!smmu->regs || !smmu->regs_ahbarb) { pr_err(DRIVER_NAME ": failed to remap SMMU registers\n"); e = -ENXIO; diff --git a/arch/arm/mach-tegra/tegra_smmu.h b/arch/arm/mach-tegra/tegra_smmu.h new file mode 100644 index 000000000000..b46ae11c6f2e --- /dev/null +++ b/arch/arm/mach-tegra/tegra_smmu.h @@ -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 |