Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Tony Lindgren | dbdf9ced | 2005-07-10 19:58:11 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-omap1/board-innovator.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Board specific inits for OMAP-1510 and OMAP-1610 Innovator |
| 5 | * |
| 6 | * Copyright (C) 2001 RidgeRun, Inc. |
| 7 | * Author: Greg Lonnon <glonnon@ridgerun.com> |
| 8 | * |
| 9 | * Copyright (C) 2002 MontaVista Software, Inc. |
| 10 | * |
| 11 | * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6 |
| 12 | * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com> |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License version 2 as |
| 16 | * published by the Free Software Foundation. |
| 17 | */ |
| 18 | |
| 19 | #include <linux/kernel.h> |
| 20 | #include <linux/init.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 21 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/delay.h> |
| 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/partitions.h> |
| 25 | |
| 26 | #include <asm/hardware.h> |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/flash.h> |
| 30 | #include <asm/mach/map.h> |
| 31 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 32 | #include <asm/arch/mux.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #include <asm/arch/fpga.h> |
| 34 | #include <asm/arch/gpio.h> |
| 35 | #include <asm/arch/tc.h> |
| 36 | #include <asm/arch/usb.h> |
Tony Lindgren | d48af15 | 2005-07-10 19:58:17 +0100 | [diff] [blame] | 37 | #include <asm/arch/common.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | static struct mtd_partition innovator_partitions[] = { |
| 40 | /* bootloader (U-Boot, etc) in first sector */ |
| 41 | { |
| 42 | .name = "bootloader", |
| 43 | .offset = 0, |
| 44 | .size = SZ_128K, |
| 45 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 46 | }, |
| 47 | /* bootloader params in the next sector */ |
| 48 | { |
| 49 | .name = "params", |
| 50 | .offset = MTDPART_OFS_APPEND, |
| 51 | .size = SZ_128K, |
| 52 | .mask_flags = 0, |
| 53 | }, |
| 54 | /* kernel */ |
| 55 | { |
| 56 | .name = "kernel", |
| 57 | .offset = MTDPART_OFS_APPEND, |
| 58 | .size = SZ_2M, |
| 59 | .mask_flags = 0 |
| 60 | }, |
| 61 | /* rest of flash1 is a file system */ |
| 62 | { |
| 63 | .name = "rootfs", |
| 64 | .offset = MTDPART_OFS_APPEND, |
| 65 | .size = SZ_16M - SZ_2M - 2 * SZ_128K, |
| 66 | .mask_flags = 0 |
| 67 | }, |
| 68 | /* file system */ |
| 69 | { |
| 70 | .name = "filesystem", |
| 71 | .offset = MTDPART_OFS_APPEND, |
| 72 | .size = MTDPART_SIZ_FULL, |
| 73 | .mask_flags = 0 |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | static struct flash_platform_data innovator_flash_data = { |
| 78 | .map_name = "cfi_probe", |
| 79 | .width = 2, |
| 80 | .parts = innovator_partitions, |
| 81 | .nr_parts = ARRAY_SIZE(innovator_partitions), |
| 82 | }; |
| 83 | |
| 84 | static struct resource innovator_flash_resource = { |
| 85 | .start = OMAP_CS0_PHYS, |
| 86 | .end = OMAP_CS0_PHYS + SZ_32M - 1, |
| 87 | .flags = IORESOURCE_MEM, |
| 88 | }; |
| 89 | |
| 90 | static struct platform_device innovator_flash_device = { |
| 91 | .name = "omapflash", |
| 92 | .id = 0, |
| 93 | .dev = { |
| 94 | .platform_data = &innovator_flash_data, |
| 95 | }, |
| 96 | .num_resources = 1, |
| 97 | .resource = &innovator_flash_resource, |
| 98 | }; |
| 99 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 100 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | /* Only FPGA needs to be mapped here. All others are done with ioremap */ |
| 103 | static struct map_desc innovator1510_io_desc[] __initdata = { |
Deepak Saxena | 9fe133b | 2005-10-28 15:19:00 +0100 | [diff] [blame] | 104 | { |
| 105 | .virtual = OMAP1510_FPGA_BASE, |
| 106 | .pfn = __phys_to_pfn(OMAP1510_FPGA_START), |
| 107 | .length = OMAP1510_FPGA_SIZE, |
| 108 | .type = MT_DEVICE |
| 109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | static struct resource innovator1510_smc91x_resources[] = { |
| 113 | [0] = { |
| 114 | .start = OMAP1510_FPGA_ETHR_START, /* Physical */ |
| 115 | .end = OMAP1510_FPGA_ETHR_START + 0xf, |
| 116 | .flags = IORESOURCE_MEM, |
| 117 | }, |
| 118 | [1] = { |
| 119 | .start = OMAP1510_INT_ETHER, |
| 120 | .end = OMAP1510_INT_ETHER, |
| 121 | .flags = IORESOURCE_IRQ, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct platform_device innovator1510_smc91x_device = { |
| 126 | .name = "smc91x", |
| 127 | .id = 0, |
| 128 | .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources), |
| 129 | .resource = innovator1510_smc91x_resources, |
| 130 | }; |
| 131 | |
| 132 | static struct platform_device *innovator1510_devices[] __initdata = { |
| 133 | &innovator_flash_device, |
| 134 | &innovator1510_smc91x_device, |
| 135 | }; |
| 136 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 137 | #endif /* CONFIG_ARCH_OMAP15XX */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | |
| 139 | #ifdef CONFIG_ARCH_OMAP16XX |
| 140 | |
| 141 | static struct resource innovator1610_smc91x_resources[] = { |
| 142 | [0] = { |
| 143 | .start = INNOVATOR1610_ETHR_START, /* Physical */ |
| 144 | .end = INNOVATOR1610_ETHR_START + 0xf, |
| 145 | .flags = IORESOURCE_MEM, |
| 146 | }, |
| 147 | [1] = { |
| 148 | .start = OMAP_GPIO_IRQ(0), |
| 149 | .end = OMAP_GPIO_IRQ(0), |
| 150 | .flags = IORESOURCE_IRQ, |
| 151 | }, |
| 152 | }; |
| 153 | |
| 154 | static struct platform_device innovator1610_smc91x_device = { |
| 155 | .name = "smc91x", |
| 156 | .id = 0, |
| 157 | .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources), |
| 158 | .resource = innovator1610_smc91x_resources, |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device *innovator1610_devices[] __initdata = { |
| 162 | &innovator_flash_device, |
| 163 | &innovator1610_smc91x_device, |
| 164 | }; |
| 165 | |
| 166 | #endif /* CONFIG_ARCH_OMAP16XX */ |
| 167 | |
| 168 | static void __init innovator_init_smc91x(void) |
| 169 | { |
| 170 | if (cpu_is_omap1510()) { |
| 171 | fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, |
| 172 | OMAP1510_FPGA_RST); |
| 173 | udelay(750); |
| 174 | } else { |
| 175 | if ((omap_request_gpio(0)) < 0) { |
| 176 | printk("Error requesting gpio 0 for smc91x irq\n"); |
| 177 | return; |
| 178 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | } |
| 180 | } |
| 181 | |
| 182 | void innovator_init_irq(void) |
| 183 | { |
Tony Lindgren | 87bd63f | 2006-02-08 22:06:46 +0000 | [diff] [blame] | 184 | omap1_init_common_hw(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | omap_init_irq(); |
| 186 | omap_gpio_init(); |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 187 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | if (cpu_is_omap1510()) { |
| 189 | omap1510_fpga_init_irq(); |
| 190 | } |
| 191 | #endif |
| 192 | innovator_init_smc91x(); |
| 193 | } |
| 194 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 195 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | static struct omap_usb_config innovator1510_usb_config __initdata = { |
| 197 | /* for bundled non-standard host and peripheral cables */ |
| 198 | .hmc_mode = 4, |
| 199 | |
| 200 | .register_host = 1, |
| 201 | .pins[1] = 6, |
| 202 | .pins[2] = 6, /* Conflicts with UART2 */ |
| 203 | |
| 204 | .register_dev = 1, |
| 205 | .pins[0] = 2, |
| 206 | }; |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 207 | |
| 208 | static struct omap_lcd_config innovator1510_lcd_config __initdata = { |
| 209 | .panel_name = "inn1510", |
| 210 | .ctrl_name = "internal", |
| 211 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | #endif |
| 213 | |
| 214 | #ifdef CONFIG_ARCH_OMAP16XX |
| 215 | static struct omap_usb_config h2_usb_config __initdata = { |
| 216 | /* usb1 has a Mini-AB port and external isp1301 transceiver */ |
| 217 | .otg = 2, |
| 218 | |
| 219 | #ifdef CONFIG_USB_GADGET_OMAP |
| 220 | .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled |
| 221 | // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback) |
| 222 | #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
| 223 | /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ |
| 224 | .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled |
| 225 | #endif |
| 226 | |
| 227 | .pins[1] = 3, |
| 228 | }; |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 229 | |
| 230 | static struct omap_lcd_config innovator1610_lcd_config __initdata = { |
| 231 | .panel_name = "inn1610", |
| 232 | .ctrl_name = "internal", |
| 233 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | #endif |
| 235 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 236 | static struct omap_mmc_config innovator_mmc_config __initdata = { |
| 237 | .mmc [0] = { |
| 238 | .enabled = 1, |
| 239 | .wire4 = 1, |
| 240 | .wp_pin = OMAP_MPUIO(3), |
| 241 | .power_pin = -1, /* FPGA F3 UIO42 */ |
| 242 | .switch_pin = -1, /* FPGA F4 UIO43 */ |
| 243 | }, |
| 244 | }; |
| 245 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 246 | static struct omap_uart_config innovator_uart_config __initdata = { |
| 247 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), |
| 248 | }; |
| 249 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | static struct omap_board_config_kernel innovator_config[] = { |
| 251 | { OMAP_TAG_USB, NULL }, |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 252 | { OMAP_TAG_LCD, NULL }, |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 253 | { OMAP_TAG_MMC, &innovator_mmc_config }, |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 254 | { OMAP_TAG_UART, &innovator_uart_config }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | static void __init innovator_init(void) |
| 258 | { |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 259 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | if (cpu_is_omap1510()) { |
| 261 | platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices)); |
| 262 | } |
| 263 | #endif |
| 264 | #ifdef CONFIG_ARCH_OMAP16XX |
| 265 | if (!cpu_is_omap1510()) { |
| 266 | platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices)); |
| 267 | } |
| 268 | #endif |
| 269 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 270 | #ifdef CONFIG_ARCH_OMAP15XX |
| 271 | if (cpu_is_omap1510()) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | innovator_config[0].data = &innovator1510_usb_config; |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 273 | innovator_config[1].data = &innovator1510_lcd_config; |
| 274 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | #endif |
| 276 | #ifdef CONFIG_ARCH_OMAP16XX |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 277 | if (cpu_is_omap1610()) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | innovator_config[0].data = &h2_usb_config; |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 279 | innovator_config[1].data = &innovator1610_lcd_config; |
| 280 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | #endif |
| 282 | omap_board_config = innovator_config; |
| 283 | omap_board_config_size = ARRAY_SIZE(innovator_config); |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 284 | omap_serial_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | static void __init innovator_map_io(void) |
| 288 | { |
Tony Lindgren | 87bd63f | 2006-02-08 22:06:46 +0000 | [diff] [blame] | 289 | omap1_map_common_io(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 291 | #ifdef CONFIG_ARCH_OMAP15XX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | if (cpu_is_omap1510()) { |
| 293 | iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); |
| 294 | udelay(10); /* Delay needed for FPGA */ |
| 295 | |
| 296 | /* Dump the Innovator FPGA rev early - useful info for support. */ |
| 297 | printk("Innovator FPGA Rev %d.%d Board Rev %d\n", |
| 298 | fpga_read(OMAP1510_FPGA_REV_HIGH), |
| 299 | fpga_read(OMAP1510_FPGA_REV_LOW), |
| 300 | fpga_read(OMAP1510_FPGA_BOARD_REV)); |
| 301 | } |
| 302 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 306 | /* Maintainer: MontaVista Software, Inc. */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 307 | .phys_io = 0xfff00000, |
| 308 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
| 309 | .boot_params = 0x10000100, |
| 310 | .map_io = innovator_map_io, |
| 311 | .init_irq = innovator_init_irq, |
| 312 | .init_machine = innovator_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | .timer = &omap_timer, |
| 314 | MACHINE_END |