2 * linux/arch/arm/mach-omap1/devices.c
4 * OMAP1 platform device setup/initialization
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
17 #include <mach/hardware.h>
19 #include <asm/mach/map.h>
22 #include <mach/board.h>
24 #include <mach/gpio.h>
27 /*-------------------------------------------------------------------------*/
29 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
31 #define OMAP_RTC_BASE 0xfffb4800
33 static struct resource rtc_resources[] = {
35 .start = OMAP_RTC_BASE,
36 .end = OMAP_RTC_BASE + 0x5f,
37 .flags = IORESOURCE_MEM,
40 .start = INT_RTC_TIMER,
41 .flags = IORESOURCE_IRQ,
44 .start = INT_RTC_ALARM,
45 .flags = IORESOURCE_IRQ,
49 static struct platform_device omap_rtc_device = {
52 .num_resources = ARRAY_SIZE(rtc_resources),
53 .resource = rtc_resources,
56 static void omap_init_rtc(void)
58 (void) platform_device_register(&omap_rtc_device);
61 static inline void omap_init_rtc(void) {}
64 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
66 #if defined(CONFIG_ARCH_OMAP15XX)
67 # define OMAP1_MBOX_SIZE 0x23
68 # define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
69 #elif defined(CONFIG_ARCH_OMAP16XX)
70 # define OMAP1_MBOX_SIZE 0x2f
71 # define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
74 #define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE)
76 static struct resource mbox_resources[] = {
78 .start = OMAP1_MBOX_BASE,
79 .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
80 .flags = IORESOURCE_MEM,
83 .start = INT_DSP_MAILBOX1,
84 .flags = IORESOURCE_IRQ,
88 static struct platform_device mbox_device = {
91 .num_resources = ARRAY_SIZE(mbox_resources),
92 .resource = mbox_resources,
95 static inline void omap_init_mbox(void)
97 platform_device_register(&mbox_device);
100 static inline void omap_init_mbox(void) { }
103 /*-------------------------------------------------------------------------*/
105 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
107 #define OMAP1_MMC1_BASE 0xfffb7800
108 #define OMAP1_MMC1_END (OMAP1_MMC1_BASE + 0x7f)
109 #define OMAP1_MMC1_INT INT_MMC
111 #define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
112 #define OMAP1_MMC2_END (OMAP1_MMC2_BASE + 0x7f)
113 #define OMAP1_MMC2_INT INT_1610_MMC2
115 static u64 omap1_mmc1_dmamask = 0xffffffff;
117 static struct resource omap1_mmc1_resources[] = {
119 .start = OMAP1_MMC1_BASE,
120 .end = OMAP1_MMC1_END,
121 .flags = IORESOURCE_MEM,
124 .start = OMAP1_MMC1_INT,
125 .flags = IORESOURCE_IRQ,
129 static struct platform_device omap1_mmc1_device = {
133 .dma_mask = &omap1_mmc1_dmamask,
135 .num_resources = ARRAY_SIZE(omap1_mmc1_resources),
136 .resource = omap1_mmc1_resources,
139 #if defined(CONFIG_ARCH_OMAP16XX)
141 static u64 omap1_mmc2_dmamask = 0xffffffff;
143 static struct resource omap1_mmc2_resources[] = {
145 .start = OMAP1_MMC2_BASE,
146 .end = OMAP1_MMC2_END,
147 .flags = IORESOURCE_MEM,
150 .start = OMAP1_MMC2_INT,
151 .flags = IORESOURCE_IRQ,
155 static struct platform_device omap1_mmc2_device = {
159 .dma_mask = &omap1_mmc2_dmamask,
161 .num_resources = ARRAY_SIZE(omap1_mmc2_resources),
162 .resource = omap1_mmc2_resources,
164 #define OMAP1_MMC2_DEVICE &omap1_mmc2_device
166 #define OMAP1_MMC2_DEVICE &omap1_mmc1_device /* Dummy */
169 static inline void omap1_mmc_mux(struct omap_mmc_platform_data *info)
171 if (info->slots[0].enabled) {
172 omap_cfg_reg(MMC_CMD);
173 omap_cfg_reg(MMC_CLK);
174 omap_cfg_reg(MMC_DAT0);
175 if (cpu_is_omap1710()) {
176 omap_cfg_reg(M15_1710_MMC_CLKI);
177 omap_cfg_reg(P19_1710_MMC_CMDDIR);
178 omap_cfg_reg(P20_1710_MMC_DATDIR0);
180 if (info->slots[0].wire4) {
181 omap_cfg_reg(MMC_DAT1);
182 /* NOTE: DAT2 can be on W10 (here) or M15 */
183 if (!info->slots[0].nomux)
184 omap_cfg_reg(MMC_DAT2);
185 omap_cfg_reg(MMC_DAT3);
189 /* Block 2 is on newer chips, and has many pinout options */
190 if (cpu_is_omap16xx() && info->slots[1].enabled) {
191 if (!info->slots[1].nomux) {
192 omap_cfg_reg(Y8_1610_MMC2_CMD);
193 omap_cfg_reg(Y10_1610_MMC2_CLK);
194 omap_cfg_reg(R18_1610_MMC2_CLKIN);
195 omap_cfg_reg(W8_1610_MMC2_DAT0);
196 if (info->slots[1].wire4) {
197 omap_cfg_reg(V8_1610_MMC2_DAT1);
198 omap_cfg_reg(W15_1610_MMC2_DAT2);
199 omap_cfg_reg(R10_1610_MMC2_DAT3);
202 /* These are needed for the level shifter */
203 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
204 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
205 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
208 /* Feedback clock must be set on OMAP-1710 MMC2 */
209 if (cpu_is_omap1710())
210 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
215 void omap1_init_mmc(struct omap_mmc_platform_data *info)
221 platform_set_drvdata(&omap1_mmc1_device, info);
223 if (cpu_is_omap16xx())
224 platform_set_drvdata(OMAP1_MMC2_DEVICE, info);
226 omap_init_mmc(info, &omap1_mmc1_device, OMAP1_MMC2_DEVICE);
231 /*-------------------------------------------------------------------------*/
233 #if defined(CONFIG_OMAP_STI)
235 #define OMAP1_STI_BASE 0xfffea000
236 #define OMAP1_STI_CHANNEL_BASE (OMAP1_STI_BASE + 0x400)
238 static struct resource sti_resources[] = {
240 .start = OMAP1_STI_BASE,
241 .end = OMAP1_STI_BASE + SZ_1K - 1,
242 .flags = IORESOURCE_MEM,
245 .start = OMAP1_STI_CHANNEL_BASE,
246 .end = OMAP1_STI_CHANNEL_BASE + SZ_1K - 1,
247 .flags = IORESOURCE_MEM,
250 .start = INT_1610_STI,
251 .flags = IORESOURCE_IRQ,
255 static struct platform_device sti_device = {
258 .num_resources = ARRAY_SIZE(sti_resources),
259 .resource = sti_resources,
262 static inline void omap_init_sti(void)
264 platform_device_register(&sti_device);
267 static inline void omap_init_sti(void) {}
270 /*-------------------------------------------------------------------------*/
273 * This gets called after board-specific INIT_MACHINE, and initializes most
274 * on-chip peripherals accessible on this board (except for few like USB):
276 * (a) Does any "standard config" pin muxing needed. Board-specific
277 * code will have muxed GPIO pins and done "nonstandard" setup;
278 * that code could live in the boot loader.
279 * (b) Populating board-specific platform_data with the data drivers
280 * rely on to handle wiring variations.
281 * (c) Creating platform devices as meaningful on this board and
282 * with this kernel configuration.
284 * Claiming GPIOs, and setting their direction and initial values, is the
285 * responsibility of the device drivers. So is responding to probe().
287 * Board-specific knowlege like creating devices or pin setup is to be
288 * kept out of drivers as much as possible. In particular, pin setup
289 * may be handled by the boot loader, and drivers should expect it will
290 * normally have been done by the time they're probed.
292 static int __init omap1_init_devices(void)
294 /* please keep these calls, and their implementations above,
295 * in alphabetical order so they're easier to sort through.
304 arch_initcall(omap1_init_devices);