diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-05-29 05:04:24 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-05-29 05:04:24 -0400 |
commit | 42f1d2e06a25628ae4ceaadccc4fa67c7787e2b4 (patch) | |
tree | 8aac83e399de7ad13748a59853a0feea9ed2c5cb /arch/arm/mach-davinci/devices.c | |
parent | 9af5324a070e0b2dcb6e22c89e17424eba245fcc (diff) | |
parent | 77bbca138c64cb80259732db6f70e1668123f2a7 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci into devel
Diffstat (limited to 'arch/arm/mach-davinci/devices.c')
-rw-r--r-- | arch/arm/mach-davinci/devices.c | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index a31370b93dd2..c85091c25d11 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c | |||
@@ -23,8 +23,14 @@ | |||
23 | #include <mach/irqs.h> | 23 | #include <mach/irqs.h> |
24 | #include <mach/cputype.h> | 24 | #include <mach/cputype.h> |
25 | #include <mach/mux.h> | 25 | #include <mach/mux.h> |
26 | #include <mach/edma.h> | ||
27 | #include <mach/mmc.h> | ||
28 | #include <mach/time.h> | ||
26 | 29 | ||
27 | #define DAVINCI_I2C_BASE 0x01C21000 | 30 | #define DAVINCI_I2C_BASE 0x01C21000 |
31 | #define DAVINCI_MMCSD0_BASE 0x01E10000 | ||
32 | #define DM355_MMCSD0_BASE 0x01E11000 | ||
33 | #define DM355_MMCSD1_BASE 0x01E00000 | ||
28 | 34 | ||
29 | static struct resource i2c_resources[] = { | 35 | static struct resource i2c_resources[] = { |
30 | { | 36 | { |
@@ -54,3 +60,208 @@ void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) | |||
54 | (void) platform_device_register(&davinci_i2c_device); | 60 | (void) platform_device_register(&davinci_i2c_device); |
55 | } | 61 | } |
56 | 62 | ||
63 | #if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) | ||
64 | |||
65 | static u64 mmcsd0_dma_mask = DMA_32BIT_MASK; | ||
66 | |||
67 | static struct resource mmcsd0_resources[] = { | ||
68 | { | ||
69 | /* different on dm355 */ | ||
70 | .start = DAVINCI_MMCSD0_BASE, | ||
71 | .end = DAVINCI_MMCSD0_BASE + SZ_4K - 1, | ||
72 | .flags = IORESOURCE_MEM, | ||
73 | }, | ||
74 | /* IRQs: MMC/SD, then SDIO */ | ||
75 | { | ||
76 | .start = IRQ_MMCINT, | ||
77 | .flags = IORESOURCE_IRQ, | ||
78 | }, { | ||
79 | /* different on dm355 */ | ||
80 | .start = IRQ_SDIOINT, | ||
81 | .flags = IORESOURCE_IRQ, | ||
82 | }, | ||
83 | /* DMA channels: RX, then TX */ | ||
84 | { | ||
85 | .start = DAVINCI_DMA_MMCRXEVT, | ||
86 | .flags = IORESOURCE_DMA, | ||
87 | }, { | ||
88 | .start = DAVINCI_DMA_MMCTXEVT, | ||
89 | .flags = IORESOURCE_DMA, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | static struct platform_device davinci_mmcsd0_device = { | ||
94 | .name = "davinci_mmc", | ||
95 | .id = 0, | ||
96 | .dev = { | ||
97 | .dma_mask = &mmcsd0_dma_mask, | ||
98 | .coherent_dma_mask = DMA_32BIT_MASK, | ||
99 | }, | ||
100 | .num_resources = ARRAY_SIZE(mmcsd0_resources), | ||
101 | .resource = mmcsd0_resources, | ||
102 | }; | ||
103 | |||
104 | static u64 mmcsd1_dma_mask = DMA_32BIT_MASK; | ||
105 | |||
106 | static struct resource mmcsd1_resources[] = { | ||
107 | { | ||
108 | .start = DM355_MMCSD1_BASE, | ||
109 | .end = DM355_MMCSD1_BASE + SZ_4K - 1, | ||
110 | .flags = IORESOURCE_MEM, | ||
111 | }, | ||
112 | /* IRQs: MMC/SD, then SDIO */ | ||
113 | { | ||
114 | .start = IRQ_DM355_MMCINT1, | ||
115 | .flags = IORESOURCE_IRQ, | ||
116 | }, { | ||
117 | .start = IRQ_DM355_SDIOINT1, | ||
118 | .flags = IORESOURCE_IRQ, | ||
119 | }, | ||
120 | /* DMA channels: RX, then TX */ | ||
121 | { | ||
122 | .start = 30, /* rx */ | ||
123 | .flags = IORESOURCE_DMA, | ||
124 | }, { | ||
125 | .start = 31, /* tx */ | ||
126 | .flags = IORESOURCE_DMA, | ||
127 | }, | ||
128 | }; | ||
129 | |||
130 | static struct platform_device davinci_mmcsd1_device = { | ||
131 | .name = "davinci_mmc", | ||
132 | .id = 1, | ||
133 | .dev = { | ||
134 | .dma_mask = &mmcsd1_dma_mask, | ||
135 | .coherent_dma_mask = DMA_32BIT_MASK, | ||
136 | }, | ||
137 | .num_resources = ARRAY_SIZE(mmcsd1_resources), | ||
138 | .resource = mmcsd1_resources, | ||
139 | }; | ||
140 | |||
141 | |||
142 | void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config) | ||
143 | { | ||
144 | struct platform_device *pdev = NULL; | ||
145 | |||
146 | if (WARN_ON(cpu_is_davinci_dm646x())) | ||
147 | return; | ||
148 | |||
149 | /* REVISIT: update PINMUX, ARM_IRQMUX, and EDMA_EVTMUX here too; | ||
150 | * for example if MMCSD1 is used for SDIO, maybe DAT2 is unused. | ||
151 | * | ||
152 | * FIXME dm6441 (no MMC/SD), dm357 (one), and dm335 (two) are | ||
153 | * not handled right here ... | ||
154 | */ | ||
155 | switch (module) { | ||
156 | case 1: | ||
157 | if (!cpu_is_davinci_dm355()) | ||
158 | break; | ||
159 | |||
160 | /* REVISIT we may not need all these pins if e.g. this | ||
161 | * is a hard-wired SDIO device... | ||
162 | */ | ||
163 | davinci_cfg_reg(DM355_SD1_CMD); | ||
164 | davinci_cfg_reg(DM355_SD1_CLK); | ||
165 | davinci_cfg_reg(DM355_SD1_DATA0); | ||
166 | davinci_cfg_reg(DM355_SD1_DATA1); | ||
167 | davinci_cfg_reg(DM355_SD1_DATA2); | ||
168 | davinci_cfg_reg(DM355_SD1_DATA3); | ||
169 | |||
170 | pdev = &davinci_mmcsd1_device; | ||
171 | break; | ||
172 | case 0: | ||
173 | if (cpu_is_davinci_dm355()) { | ||
174 | mmcsd0_resources[0].start = DM355_MMCSD0_BASE; | ||
175 | mmcsd0_resources[0].end = DM355_MMCSD0_BASE + SZ_4K - 1; | ||
176 | mmcsd0_resources[2].start = IRQ_DM355_SDIOINT0; | ||
177 | |||
178 | /* expose all 6 MMC0 signals: CLK, CMD, DATA[0..3] */ | ||
179 | davinci_cfg_reg(DM355_MMCSD0); | ||
180 | |||
181 | /* enable RX EDMA */ | ||
182 | davinci_cfg_reg(DM355_EVT26_MMC0_RX); | ||
183 | } | ||
184 | |||
185 | else if (cpu_is_davinci_dm644x()) { | ||
186 | /* REVISIT: should this be in board-init code? */ | ||
187 | void __iomem *base = | ||
188 | IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE); | ||
189 | |||
190 | /* Power-on 3.3V IO cells */ | ||
191 | __raw_writel(0, base + DM64XX_VDD3P3V_PWDN); | ||
192 | /*Set up the pull regiter for MMC */ | ||
193 | davinci_cfg_reg(DM644X_MSTK); | ||
194 | } | ||
195 | |||
196 | pdev = &davinci_mmcsd0_device; | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | if (WARN_ON(!pdev)) | ||
201 | return; | ||
202 | |||
203 | pdev->dev.platform_data = config; | ||
204 | platform_device_register(pdev); | ||
205 | } | ||
206 | |||
207 | #else | ||
208 | |||
209 | void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config) | ||
210 | { | ||
211 | } | ||
212 | |||
213 | #endif | ||
214 | |||
215 | /*-------------------------------------------------------------------------*/ | ||
216 | |||
217 | static struct resource wdt_resources[] = { | ||
218 | { | ||
219 | .flags = IORESOURCE_MEM, | ||
220 | }, | ||
221 | }; | ||
222 | |||
223 | struct platform_device davinci_wdt_device = { | ||
224 | .name = "watchdog", | ||
225 | .id = -1, | ||
226 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
227 | .resource = wdt_resources, | ||
228 | }; | ||
229 | |||
230 | static void davinci_init_wdt(void) | ||
231 | { | ||
232 | struct davinci_soc_info *soc_info = &davinci_soc_info; | ||
233 | |||
234 | wdt_resources[0].start = (resource_size_t)soc_info->wdt_base; | ||
235 | wdt_resources[0].end = (resource_size_t)soc_info->wdt_base + SZ_1K - 1; | ||
236 | |||
237 | platform_device_register(&davinci_wdt_device); | ||
238 | } | ||
239 | |||
240 | /*-------------------------------------------------------------------------*/ | ||
241 | |||
242 | struct davinci_timer_instance davinci_timer_instance[2] = { | ||
243 | { | ||
244 | .base = IO_ADDRESS(DAVINCI_TIMER0_BASE), | ||
245 | .bottom_irq = IRQ_TINT0_TINT12, | ||
246 | .top_irq = IRQ_TINT0_TINT34, | ||
247 | }, | ||
248 | { | ||
249 | .base = IO_ADDRESS(DAVINCI_TIMER1_BASE), | ||
250 | .bottom_irq = IRQ_TINT1_TINT12, | ||
251 | .top_irq = IRQ_TINT1_TINT34, | ||
252 | }, | ||
253 | }; | ||
254 | |||
255 | /*-------------------------------------------------------------------------*/ | ||
256 | |||
257 | static int __init davinci_init_devices(void) | ||
258 | { | ||
259 | /* please keep these calls, and their implementations above, | ||
260 | * in alphabetical order so they're easier to sort through. | ||
261 | */ | ||
262 | davinci_init_wdt(); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | arch_initcall(davinci_init_devices); | ||
267 | |||