diff options
Diffstat (limited to 'arch/arm/mach-tegra/io.c')
-rw-r--r-- | arch/arm/mach-tegra/io.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c index 31848a9592f..47279e1d5eb 100644 --- a/arch/arm/mach-tegra/io.c +++ b/arch/arm/mach-tegra/io.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Colin Cross <ccross@google.com> | 7 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 8 | * Erik Gilling <konkers@google.com> |
9 | * | 9 | * |
10 | * Copyright (C) 2010-2011 NVIDIA Corporation | ||
11 | * | ||
10 | * This software is licensed under the terms of the GNU General Public | 12 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 13 | * License version 2, as published by the Free Software Foundation, and |
12 | * may be copied, distributed, and modified under those terms. | 14 | * may be copied, distributed, and modified under those terms. |
@@ -24,7 +26,7 @@ | |||
24 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
25 | #include <linux/io.h> | 27 | #include <linux/io.h> |
26 | 28 | ||
27 | #include <mach/hardware.h> | 29 | #include <mach/iomap.h> |
28 | #include <asm/page.h> | 30 | #include <asm/page.h> |
29 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
30 | 32 | ||
@@ -55,6 +57,30 @@ static struct map_desc tegra_io_desc[] __initdata = { | |||
55 | .length = IO_IRAM_SIZE, | 57 | .length = IO_IRAM_SIZE, |
56 | .type = MT_DEVICE, | 58 | .type = MT_DEVICE, |
57 | }, | 59 | }, |
60 | { | ||
61 | .virtual = IO_HOST1X_VIRT, | ||
62 | .pfn = __phys_to_pfn(IO_HOST1X_PHYS), | ||
63 | .length = IO_HOST1X_SIZE, | ||
64 | .type = MT_DEVICE, | ||
65 | }, | ||
66 | { | ||
67 | .virtual = IO_USB_VIRT, | ||
68 | .pfn = __phys_to_pfn(IO_USB_PHYS), | ||
69 | .length = IO_USB_SIZE, | ||
70 | .type = MT_DEVICE, | ||
71 | }, | ||
72 | { | ||
73 | .virtual = IO_SDMMC_VIRT, | ||
74 | .pfn = __phys_to_pfn(IO_SDMMC_PHYS), | ||
75 | .length = IO_SDMMC_SIZE, | ||
76 | .type = MT_DEVICE, | ||
77 | }, | ||
78 | { | ||
79 | .virtual = IO_PPCS_VIRT, | ||
80 | .pfn = __phys_to_pfn(IO_PPCS_PHYS), | ||
81 | .length = IO_PPCS_SIZE, | ||
82 | .type = MT_DEVICE, | ||
83 | } | ||
58 | }; | 84 | }; |
59 | 85 | ||
60 | void __init tegra_map_common_io(void) | 86 | void __init tegra_map_common_io(void) |
@@ -68,8 +94,27 @@ void __init tegra_map_common_io(void) | |||
68 | void __iomem *tegra_ioremap(unsigned long p, size_t size, unsigned int type) | 94 | void __iomem *tegra_ioremap(unsigned long p, size_t size, unsigned int type) |
69 | { | 95 | { |
70 | void __iomem *v = IO_ADDRESS(p); | 96 | void __iomem *v = IO_ADDRESS(p); |
71 | if (v == NULL) | 97 | |
72 | v = __arm_ioremap(p, size, type); | 98 | /* |
99 | * __arm_ioremap fails to set the domain of ioremapped memory | ||
100 | * correctly, only use it on physical memory. | ||
101 | */ | ||
102 | if (v == NULL) { | ||
103 | if ((p >= TEGRA_DRAM_BASE && | ||
104 | (p + size) <= (TEGRA_DRAM_BASE + TEGRA_DRAM_SIZE)) || | ||
105 | (p >= TEGRA_NOR_FLASH_BASE && | ||
106 | (p + size) <= (TEGRA_NOR_FLASH_BASE + TEGRA_NOR_FLASH_SIZE)) || | ||
107 | (p >= TEGRA_PCIE_BASE && | ||
108 | (p + size) <= (TEGRA_PCIE_BASE + TEGRA_PCIE_SIZE))) | ||
109 | v = __arm_ioremap(p, size, type); | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * If the physical address was not physical memory or statically | ||
114 | * mapped, there's nothing we can do to map it safely. | ||
115 | */ | ||
116 | BUG_ON(v == NULL); | ||
117 | |||
73 | return v; | 118 | return v; |
74 | } | 119 | } |
75 | EXPORT_SYMBOL(tegra_ioremap); | 120 | EXPORT_SYMBOL(tegra_ioremap); |