blob: 71a9de382d2d9c2bd2a4ce59abbb1c082f5e26f3 [file] [log] [blame]
Tony Lindgren1dbae812005-11-10 14:26:51 +00001/*
2 * linux/arch/arm/mach-omap2/io.c
3 *
4 * OMAP2 I/O mapping code
5 *
6 * Copyright (C) 2005 Nokia Corporation
Tony Lindgren646e3ed2008-10-06 15:49:36 +03007 * Copyright (C) 2007 Texas Instruments
8 *
9 * Author:
10 * Juha Yrjola <juha.yrjola@nokia.com>
11 * Syed Khasim <x0khasim@ti.com>
Tony Lindgren1dbae812005-11-10 14:26:51 +000012 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
Tony Lindgren1dbae812005-11-10 14:26:51 +000018#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21
Tony Lindgren120db2c2006-04-02 17:46:27 +010022#include <asm/tlb.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000023#include <asm/io.h>
Tony Lindgren120db2c2006-04-02 17:46:27 +010024
25#include <asm/mach/map.h>
26
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/mux.h>
28#include <mach/omapfb.h>
Tony Lindgren646e3ed2008-10-06 15:49:36 +030029#include <mach/sram.h>
30
31#include "memory.h"
32
33#include "clock.h"
Tony Lindgren1dbae812005-11-10 14:26:51 +000034
Paul Walmsley97171002008-08-19 11:08:40 +030035#include <mach/powerdomain.h>
36
37#include "powerdomains.h"
38
Paul Walmsley801954d2008-08-19 11:08:44 +030039#include <mach/clockdomain.h>
40#include "clockdomains.h"
41
Tony Lindgren1dbae812005-11-10 14:26:51 +000042/*
43 * The machine specific code may provide the extra mapping besides the
44 * default mapping provided here.
45 */
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030046
47#ifdef CONFIG_ARCH_OMAP24XX
48static struct map_desc omap24xx_io_desc[] __initdata = {
Tony Lindgren1dbae812005-11-10 14:26:51 +000049 {
50 .virtual = L3_24XX_VIRT,
51 .pfn = __phys_to_pfn(L3_24XX_PHYS),
52 .length = L3_24XX_SIZE,
53 .type = MT_DEVICE
54 },
Kyungmin Park09f21ed2008-02-20 15:30:06 -080055 {
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030056 .virtual = L4_24XX_VIRT,
57 .pfn = __phys_to_pfn(L4_24XX_PHYS),
58 .length = L4_24XX_SIZE,
Syed Mohammed Khasim72d0f1c2006-12-06 17:14:05 -080059 .type = MT_DEVICE
60 },
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030061};
62
63#ifdef CONFIG_ARCH_OMAP2420
64static struct map_desc omap242x_io_desc[] __initdata = {
Tony Lindgren1dbae812005-11-10 14:26:51 +000065 {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080066 .virtual = DSP_MEM_24XX_VIRT,
67 .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
68 .length = DSP_MEM_24XX_SIZE,
69 .type = MT_DEVICE
70 },
71 {
72 .virtual = DSP_IPI_24XX_VIRT,
73 .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
74 .length = DSP_IPI_24XX_SIZE,
75 .type = MT_DEVICE
76 },
77 {
78 .virtual = DSP_MMU_24XX_VIRT,
79 .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
80 .length = DSP_MMU_24XX_SIZE,
Tony Lindgren1dbae812005-11-10 14:26:51 +000081 .type = MT_DEVICE
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030082 },
Tony Lindgren1dbae812005-11-10 14:26:51 +000083};
84
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +030085#endif
86
87#ifdef CONFIG_ARCH_OMAP2430
88static struct map_desc omap243x_io_desc[] __initdata = {
89 {
90 .virtual = L4_WK_243X_VIRT,
91 .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
92 .length = L4_WK_243X_SIZE,
93 .type = MT_DEVICE
94 },
95 {
96 .virtual = OMAP243X_GPMC_VIRT,
97 .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
98 .length = OMAP243X_GPMC_SIZE,
99 .type = MT_DEVICE
100 },
101 {
102 .virtual = OMAP243X_SDRC_VIRT,
103 .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
104 .length = OMAP243X_SDRC_SIZE,
105 .type = MT_DEVICE
106 },
107 {
108 .virtual = OMAP243X_SMS_VIRT,
109 .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
110 .length = OMAP243X_SMS_SIZE,
111 .type = MT_DEVICE
112 },
113};
114#endif
115#endif
116
117#ifdef CONFIG_ARCH_OMAP34XX
118static struct map_desc omap34xx_io_desc[] __initdata = {
119 {
120 .virtual = L3_34XX_VIRT,
121 .pfn = __phys_to_pfn(L3_34XX_PHYS),
122 .length = L3_34XX_SIZE,
123 .type = MT_DEVICE
124 },
125 {
126 .virtual = L4_34XX_VIRT,
127 .pfn = __phys_to_pfn(L4_34XX_PHYS),
128 .length = L4_34XX_SIZE,
129 .type = MT_DEVICE
130 },
131 {
132 .virtual = L4_WK_34XX_VIRT,
133 .pfn = __phys_to_pfn(L4_WK_34XX_PHYS),
134 .length = L4_WK_34XX_SIZE,
135 .type = MT_DEVICE
136 },
137 {
138 .virtual = OMAP34XX_GPMC_VIRT,
139 .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
140 .length = OMAP34XX_GPMC_SIZE,
141 .type = MT_DEVICE
142 },
143 {
144 .virtual = OMAP343X_SMS_VIRT,
145 .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
146 .length = OMAP343X_SMS_SIZE,
147 .type = MT_DEVICE
148 },
149 {
150 .virtual = OMAP343X_SDRC_VIRT,
151 .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
152 .length = OMAP343X_SDRC_SIZE,
153 .type = MT_DEVICE
154 },
155 {
156 .virtual = L4_PER_34XX_VIRT,
157 .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
158 .length = L4_PER_34XX_SIZE,
159 .type = MT_DEVICE
160 },
161 {
162 .virtual = L4_EMU_34XX_VIRT,
163 .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
164 .length = L4_EMU_34XX_SIZE,
165 .type = MT_DEVICE
166 },
167};
168#endif
169
Tony Lindgren120db2c2006-04-02 17:46:27 +0100170void __init omap2_map_common_io(void)
Tony Lindgren1dbae812005-11-10 14:26:51 +0000171{
Syed Mohammed, Khasimcc26b3b2008-10-09 17:51:41 +0300172#if defined(CONFIG_ARCH_OMAP2420)
173 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
174 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
175#endif
176
177#if defined(CONFIG_ARCH_OMAP2430)
178 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
179 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
180#endif
181
182#if defined(CONFIG_ARCH_OMAP34XX)
183 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
184#endif
Tony Lindgren120db2c2006-04-02 17:46:27 +0100185
186 /* Normally devicemaps_init() would flush caches and tlb after
187 * mdesc->map_io(), but we must also do it here because of the CPU
188 * revision check below.
189 */
190 local_flush_tlb_all();
191 flush_cache_all();
192
Tony Lindgren1dbae812005-11-10 14:26:51 +0000193 omap2_check_revision();
194 omap_sram_init();
Imre Deakb7cc6d42007-03-06 03:16:36 -0800195 omapfb_reserve_sdram();
Tony Lindgren120db2c2006-04-02 17:46:27 +0100196}
197
198void __init omap2_init_common_hw(void)
199{
Tony Lindgren1dbae812005-11-10 14:26:51 +0000200 omap2_mux_init();
Paul Walmsley97171002008-08-19 11:08:40 +0300201 pwrdm_init(powerdomains_omap);
Paul Walmsley801954d2008-08-19 11:08:44 +0300202 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
Tony Lindgren1dbae812005-11-10 14:26:51 +0000203 omap2_clk_init();
Juha Yrjola33c99072006-12-06 17:13:46 -0800204 omap2_init_memory();
Juha Yrjola4bbbc1a2006-06-26 16:16:16 -0700205 gpmc_init();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000206}