diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r-- | arch/arm/mach-omap2/board-overo.c | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 87acb2f198ec..4c4843618350 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -58,8 +58,6 @@ | |||
58 | #define OVERO_GPIO_USBH_NRESET 183 | 58 | #define OVERO_GPIO_USBH_NRESET 183 |
59 | 59 | ||
60 | #define NAND_BLOCK_SIZE SZ_128K | 60 | #define NAND_BLOCK_SIZE SZ_128K |
61 | #define GPMC_CS0_BASE 0x60 | ||
62 | #define GPMC_CS_SIZE 0x30 | ||
63 | 61 | ||
64 | #define OVERO_SMSC911X_CS 5 | 62 | #define OVERO_SMSC911X_CS 5 |
65 | #define OVERO_SMSC911X_GPIO 176 | 63 | #define OVERO_SMSC911X_GPIO 176 |
@@ -166,9 +164,26 @@ static struct platform_device overo_smsc911x_device = { | |||
166 | }, | 164 | }, |
167 | }; | 165 | }; |
168 | 166 | ||
167 | static struct platform_device overo_smsc911x2_device = { | ||
168 | .name = "smsc911x", | ||
169 | .id = 1, | ||
170 | .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), | ||
171 | .resource = overo_smsc911x2_resources, | ||
172 | .dev = { | ||
173 | .platform_data = &overo_smsc911x_config, | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | static struct platform_device *smsc911x_devices[] = { | ||
178 | &overo_smsc911x_device, | ||
179 | &overo_smsc911x2_device, | ||
180 | }; | ||
181 | |||
169 | static inline void __init overo_init_smsc911x(void) | 182 | static inline void __init overo_init_smsc911x(void) |
170 | { | 183 | { |
171 | unsigned long cs_mem_base; | 184 | unsigned long cs_mem_base, cs_mem_base2; |
185 | |||
186 | /* set up first smsc911x chip */ | ||
172 | 187 | ||
173 | if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { | 188 | if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { |
174 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); | 189 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); |
@@ -189,7 +204,28 @@ static inline void __init overo_init_smsc911x(void) | |||
189 | overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); | 204 | overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); |
190 | overo_smsc911x_resources[1].end = 0; | 205 | overo_smsc911x_resources[1].end = 0; |
191 | 206 | ||
192 | platform_device_register(&overo_smsc911x_device); | 207 | /* set up second smsc911x chip */ |
208 | |||
209 | if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) { | ||
210 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n"); | ||
211 | return; | ||
212 | } | ||
213 | |||
214 | overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0; | ||
215 | overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff; | ||
216 | |||
217 | if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) && | ||
218 | (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) { | ||
219 | gpio_export(OVERO_SMSC911X2_GPIO, 0); | ||
220 | } else { | ||
221 | printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n"); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO); | ||
226 | overo_smsc911x2_resources[1].end = 0; | ||
227 | |||
228 | platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices)); | ||
193 | } | 229 | } |
194 | 230 | ||
195 | #else | 231 | #else |
@@ -231,28 +267,11 @@ static struct omap_nand_platform_data overo_nand_data = { | |||
231 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | 267 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ |
232 | }; | 268 | }; |
233 | 269 | ||
234 | static struct resource overo_nand_resource = { | ||
235 | .flags = IORESOURCE_MEM, | ||
236 | }; | ||
237 | |||
238 | static struct platform_device overo_nand_device = { | ||
239 | .name = "omap2-nand", | ||
240 | .id = -1, | ||
241 | .dev = { | ||
242 | .platform_data = &overo_nand_data, | ||
243 | }, | ||
244 | .num_resources = 1, | ||
245 | .resource = &overo_nand_resource, | ||
246 | }; | ||
247 | |||
248 | |||
249 | static void __init overo_flash_init(void) | 270 | static void __init overo_flash_init(void) |
250 | { | 271 | { |
251 | u8 cs = 0; | 272 | u8 cs = 0; |
252 | u8 nandcs = GPMC_CS_NUM + 1; | 273 | u8 nandcs = GPMC_CS_NUM + 1; |
253 | 274 | ||
254 | u32 gpmc_base_add = OMAP34XX_GPMC_VIRT; | ||
255 | |||
256 | /* find out the chip-select on which NAND exists */ | 275 | /* find out the chip-select on which NAND exists */ |
257 | while (cs < GPMC_CS_NUM) { | 276 | while (cs < GPMC_CS_NUM) { |
258 | u32 ret = 0; | 277 | u32 ret = 0; |
@@ -274,12 +293,9 @@ static void __init overo_flash_init(void) | |||
274 | 293 | ||
275 | if (nandcs < GPMC_CS_NUM) { | 294 | if (nandcs < GPMC_CS_NUM) { |
276 | overo_nand_data.cs = nandcs; | 295 | overo_nand_data.cs = nandcs; |
277 | overo_nand_data.gpmc_cs_baseaddr = (void *) | ||
278 | (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE); | ||
279 | overo_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add); | ||
280 | 296 | ||
281 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | 297 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); |
282 | if (platform_device_register(&overo_nand_device) < 0) | 298 | if (gpmc_nand_init(&overo_nand_data) < 0) |
283 | printk(KERN_ERR "Unable to register NAND device\n"); | 299 | printk(KERN_ERR "Unable to register NAND device\n"); |
284 | } | 300 | } |
285 | } | 301 | } |
@@ -484,17 +500,11 @@ static void __init overo_init(void) | |||
484 | "OVERO_GPIO_USBH_CPEN\n"); | 500 | "OVERO_GPIO_USBH_CPEN\n"); |
485 | } | 501 | } |
486 | 502 | ||
487 | static void __init overo_map_io(void) | ||
488 | { | ||
489 | omap2_set_globals_343x(); | ||
490 | omap34xx_map_common_io(); | ||
491 | } | ||
492 | |||
493 | MACHINE_START(OVERO, "Gumstix Overo") | 503 | MACHINE_START(OVERO, "Gumstix Overo") |
494 | .phys_io = 0x48000000, | 504 | .phys_io = 0x48000000, |
495 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, | 505 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
496 | .boot_params = 0x80000100, | 506 | .boot_params = 0x80000100, |
497 | .map_io = overo_map_io, | 507 | .map_io = omap3_map_io, |
498 | .reserve = omap_reserve, | 508 | .reserve = omap_reserve, |
499 | .init_irq = overo_init_irq, | 509 | .init_irq = overo_init_irq, |
500 | .init_machine = overo_init, | 510 | .init_machine = overo_init, |