RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / arm / mach-omap2 / devices.c
blob52ec2f2d636022300709012b263f623b7dfc2ab5
1 /*
2 * linux/arch/arm/mach-omap2/devices.c
4 * OMAP2 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 <asm/hardware.h>
18 #include <asm/io.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/map.h>
22 #include <asm/arch/tc.h>
23 #include <asm/arch/board.h>
24 #include <asm/arch/mux.h>
25 #include <asm/arch/gpio.h>
27 #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
29 #define OMAP2_I2C_BASE2 0x48072000
30 #define OMAP2_I2C_INT2 57
32 static struct resource i2c_resources2[] = {
34 .start = OMAP2_I2C_BASE2,
35 .end = OMAP2_I2C_BASE2 + 0x3f,
36 .flags = IORESOURCE_MEM,
39 .start = OMAP2_I2C_INT2,
40 .flags = IORESOURCE_IRQ,
44 static struct platform_device omap_i2c_device2 = {
45 .name = "i2c_omap",
46 .id = 2,
47 .num_resources = ARRAY_SIZE(i2c_resources2),
48 .resource = i2c_resources2,
51 /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
52 static void omap_init_i2c(void)
54 /* REVISIT: Second I2C not in use on H4? */
55 if (machine_is_omap_h4())
56 return;
58 omap_cfg_reg(J15_24XX_I2C2_SCL);
59 omap_cfg_reg(H19_24XX_I2C2_SDA);
60 (void) platform_device_register(&omap_i2c_device2);
63 #else
65 static void omap_init_i2c(void) {}
67 #endif
69 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
70 #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
72 static struct resource mbox_resources[] = {
74 .start = OMAP2_MBOX_BASE,
75 .end = OMAP2_MBOX_BASE + 0x11f,
76 .flags = IORESOURCE_MEM,
79 .start = INT_24XX_MAIL_U0_MPU,
80 .flags = IORESOURCE_IRQ,
83 .start = INT_24XX_MAIL_U3_MPU,
84 .flags = IORESOURCE_IRQ,
88 static struct platform_device mbox_device = {
89 .name = "mailbox",
90 .id = -1,
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);
99 #else
100 static inline void omap_init_mbox(void) { }
101 #endif
103 #if defined(CONFIG_OMAP_STI)
105 #define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
106 #define OMAP2_STI_CHANNEL_BASE 0x54000000
107 #define OMAP2_STI_IRQ 4
109 static struct resource sti_resources[] = {
111 .start = OMAP2_STI_BASE,
112 .end = OMAP2_STI_BASE + 0x7ff,
113 .flags = IORESOURCE_MEM,
116 .start = OMAP2_STI_CHANNEL_BASE,
117 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
118 .flags = IORESOURCE_MEM,
121 .start = OMAP2_STI_IRQ,
122 .flags = IORESOURCE_IRQ,
126 static struct platform_device sti_device = {
127 .name = "sti",
128 .id = -1,
129 .num_resources = ARRAY_SIZE(sti_resources),
130 .resource = sti_resources,
133 static inline void omap_init_sti(void)
135 platform_device_register(&sti_device);
137 #else
138 static inline void omap_init_sti(void) {}
139 #endif
141 #if defined(CONFIG_SPI_OMAP24XX)
143 #include <asm/arch/mcspi.h>
145 #define OMAP2_MCSPI1_BASE 0x48098000
146 #define OMAP2_MCSPI2_BASE 0x4809a000
148 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
149 .num_cs = 4,
152 static struct resource omap2_mcspi1_resources[] = {
154 .start = OMAP2_MCSPI1_BASE,
155 .end = OMAP2_MCSPI1_BASE + 0xff,
156 .flags = IORESOURCE_MEM,
160 struct platform_device omap2_mcspi1 = {
161 .name = "omap2_mcspi",
162 .id = 1,
163 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
164 .resource = omap2_mcspi1_resources,
165 .dev = {
166 .platform_data = &omap2_mcspi1_config,
170 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
171 .num_cs = 2,
174 static struct resource omap2_mcspi2_resources[] = {
176 .start = OMAP2_MCSPI2_BASE,
177 .end = OMAP2_MCSPI2_BASE + 0xff,
178 .flags = IORESOURCE_MEM,
182 struct platform_device omap2_mcspi2 = {
183 .name = "omap2_mcspi",
184 .id = 2,
185 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
186 .resource = omap2_mcspi2_resources,
187 .dev = {
188 .platform_data = &omap2_mcspi2_config,
192 static void omap_init_mcspi(void)
194 platform_device_register(&omap2_mcspi1);
195 platform_device_register(&omap2_mcspi2);
198 #else
199 static inline void omap_init_mcspi(void) {}
200 #endif
202 /*-------------------------------------------------------------------------*/
204 static int __init omap2_init_devices(void)
206 /* please keep these calls, and their implementations above,
207 * in alphabetical order so they're easier to sort through.
209 omap_init_i2c();
210 omap_init_mbox();
211 omap_init_mcspi();
212 omap_init_sti();
214 return 0;
216 arch_initcall(omap2_init_devices);