Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Copyright 2004-2009 Analog Devices Inc. |
| 3 | * 2008-2009 Bluetechnix |
| 4 | * 2005 National ICT Australia (NICTA) |
| 5 | * Aidan Williams <aidan@nicta.com.au> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 6 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 7 | * Licensed under the GPL-2 or later. |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <linux/device.h> |
| 11 | #include <linux/platform_device.h> |
| 12 | #include <linux/mtd/mtd.h> |
| 13 | #include <linux/mtd/partitions.h> |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 14 | #include <linux/mtd/physmap.h> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 15 | #include <linux/spi/spi.h> |
| 16 | #include <linux/spi/flash.h> |
| 17 | #include <linux/irq.h> |
| 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/usb/musb.h> |
| 20 | #include <asm/bfin5xx_spi.h> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 21 | #include <asm/dma.h> |
| 22 | #include <asm/gpio.h> |
| 23 | #include <asm/nand.h> |
| 24 | #include <asm/portmux.h> |
Mike Frysinger | 8d8921a | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 25 | #include <asm/bfin_sdh.h> |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 26 | #include <mach/bf54x_keys.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 27 | #include <asm/dpmc.h> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 28 | #include <linux/input.h> |
| 29 | #include <linux/spi/ad7877.h> |
| 30 | |
| 31 | /* |
| 32 | * Name the Board for the /proc/cpuinfo |
| 33 | */ |
| 34 | const char bfin_board_name[] = "Bluetechnix CM-BF548"; |
| 35 | |
| 36 | /* |
| 37 | * Driver needs to know address, irq and flag pin. |
| 38 | */ |
| 39 | |
| 40 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 41 | |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 42 | #include <mach/bf54x-lq043.h> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 43 | |
| 44 | static struct bfin_bf54xfb_mach_info bf54x_lq043_data = { |
| 45 | .width = 480, |
| 46 | .height = 272, |
| 47 | .xres = {480, 480, 480}, |
| 48 | .yres = {272, 272, 272}, |
| 49 | .bpp = {24, 24, 24}, |
| 50 | .disp = GPIO_PE3, |
| 51 | }; |
| 52 | |
| 53 | static struct resource bf54x_lq043_resources[] = { |
| 54 | { |
| 55 | .start = IRQ_EPPI0_ERR, |
| 56 | .end = IRQ_EPPI0_ERR, |
| 57 | .flags = IORESOURCE_IRQ, |
| 58 | }, |
| 59 | }; |
| 60 | |
| 61 | static struct platform_device bf54x_lq043_device = { |
| 62 | .name = "bf54x-lq043", |
| 63 | .id = -1, |
| 64 | .num_resources = ARRAY_SIZE(bf54x_lq043_resources), |
| 65 | .resource = bf54x_lq043_resources, |
| 66 | .dev = { |
| 67 | .platform_data = &bf54x_lq043_data, |
| 68 | }, |
| 69 | }; |
| 70 | #endif |
| 71 | |
| 72 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 73 | static unsigned int bf548_keymap[] = { |
| 74 | KEYVAL(0, 0, KEY_ENTER), |
| 75 | KEYVAL(0, 1, KEY_HELP), |
| 76 | KEYVAL(0, 2, KEY_0), |
| 77 | KEYVAL(0, 3, KEY_BACKSPACE), |
| 78 | KEYVAL(1, 0, KEY_TAB), |
| 79 | KEYVAL(1, 1, KEY_9), |
| 80 | KEYVAL(1, 2, KEY_8), |
| 81 | KEYVAL(1, 3, KEY_7), |
| 82 | KEYVAL(2, 0, KEY_DOWN), |
| 83 | KEYVAL(2, 1, KEY_6), |
| 84 | KEYVAL(2, 2, KEY_5), |
| 85 | KEYVAL(2, 3, KEY_4), |
| 86 | KEYVAL(3, 0, KEY_UP), |
| 87 | KEYVAL(3, 1, KEY_3), |
| 88 | KEYVAL(3, 2, KEY_2), |
| 89 | KEYVAL(3, 3, KEY_1), |
| 90 | }; |
| 91 | |
| 92 | static struct bfin_kpad_platform_data bf54x_kpad_data = { |
| 93 | .rows = 4, |
| 94 | .cols = 4, |
| 95 | .keymap = bf548_keymap, |
| 96 | .keymapsize = ARRAY_SIZE(bf548_keymap), |
| 97 | .repeat = 0, |
| 98 | .debounce_time = 5000, /* ns (5ms) */ |
| 99 | .coldrive_time = 1000, /* ns (1ms) */ |
| 100 | .keyup_test_interval = 50, /* ms (50ms) */ |
| 101 | }; |
| 102 | |
| 103 | static struct resource bf54x_kpad_resources[] = { |
| 104 | { |
| 105 | .start = IRQ_KEY, |
| 106 | .end = IRQ_KEY, |
| 107 | .flags = IORESOURCE_IRQ, |
| 108 | }, |
| 109 | }; |
| 110 | |
| 111 | static struct platform_device bf54x_kpad_device = { |
| 112 | .name = "bf54x-keys", |
| 113 | .id = -1, |
| 114 | .num_resources = ARRAY_SIZE(bf54x_kpad_resources), |
| 115 | .resource = bf54x_kpad_resources, |
| 116 | .dev = { |
| 117 | .platform_data = &bf54x_kpad_data, |
| 118 | }, |
| 119 | }; |
| 120 | #endif |
| 121 | |
| 122 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 123 | static struct platform_device rtc_device = { |
| 124 | .name = "rtc-bfin", |
| 125 | .id = -1, |
| 126 | }; |
| 127 | #endif |
| 128 | |
| 129 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 130 | static struct resource bfin_uart_resources[] = { |
| 131 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 132 | { |
| 133 | .start = 0xFFC00400, |
| 134 | .end = 0xFFC004FF, |
| 135 | .flags = IORESOURCE_MEM, |
| 136 | }, |
| 137 | #endif |
| 138 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 139 | { |
| 140 | .start = 0xFFC02000, |
| 141 | .end = 0xFFC020FF, |
| 142 | .flags = IORESOURCE_MEM, |
| 143 | }, |
| 144 | #endif |
| 145 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 146 | { |
| 147 | .start = 0xFFC02100, |
| 148 | .end = 0xFFC021FF, |
| 149 | .flags = IORESOURCE_MEM, |
| 150 | }, |
| 151 | #endif |
| 152 | #ifdef CONFIG_SERIAL_BFIN_UART3 |
| 153 | { |
| 154 | .start = 0xFFC03100, |
| 155 | .end = 0xFFC031FF, |
Sonic Zhang | 8606801 | 2008-10-09 13:55:33 +0800 | [diff] [blame] | 156 | .flags = IORESOURCE_MEM, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 157 | }, |
| 158 | #endif |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device bfin_uart_device = { |
| 162 | .name = "bfin-uart", |
| 163 | .id = 1, |
| 164 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 165 | .resource = bfin_uart_resources, |
| 166 | }; |
| 167 | #endif |
| 168 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 169 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 170 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 171 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 172 | { |
| 173 | .start = 0xFFC00400, |
| 174 | .end = 0xFFC004FF, |
| 175 | .flags = IORESOURCE_MEM, |
| 176 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 177 | { |
| 178 | .start = IRQ_UART0_RX, |
| 179 | .end = IRQ_UART0_RX+1, |
| 180 | .flags = IORESOURCE_IRQ, |
| 181 | }, |
| 182 | { |
| 183 | .start = CH_UART0_RX, |
| 184 | .end = CH_UART0_RX+1, |
| 185 | .flags = IORESOURCE_DMA, |
| 186 | }, |
| 187 | }; |
| 188 | static struct platform_device bfin_sir0_device = { |
| 189 | .name = "bfin_sir", |
| 190 | .id = 0, |
| 191 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 192 | .resource = bfin_sir0_resources, |
| 193 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 194 | #endif |
| 195 | #ifdef CONFIG_BFIN_SIR1 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 196 | static struct resource bfin_sir1_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 197 | { |
| 198 | .start = 0xFFC02000, |
| 199 | .end = 0xFFC020FF, |
| 200 | .flags = IORESOURCE_MEM, |
| 201 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 202 | { |
| 203 | .start = IRQ_UART1_RX, |
| 204 | .end = IRQ_UART1_RX+1, |
| 205 | .flags = IORESOURCE_IRQ, |
| 206 | }, |
| 207 | { |
| 208 | .start = CH_UART1_RX, |
| 209 | .end = CH_UART1_RX+1, |
| 210 | .flags = IORESOURCE_DMA, |
| 211 | }, |
| 212 | }; |
| 213 | static struct platform_device bfin_sir1_device = { |
| 214 | .name = "bfin_sir", |
| 215 | .id = 1, |
| 216 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), |
| 217 | .resource = bfin_sir1_resources, |
| 218 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 219 | #endif |
| 220 | #ifdef CONFIG_BFIN_SIR2 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 221 | static struct resource bfin_sir2_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 222 | { |
| 223 | .start = 0xFFC02100, |
| 224 | .end = 0xFFC021FF, |
| 225 | .flags = IORESOURCE_MEM, |
| 226 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 227 | { |
| 228 | .start = IRQ_UART2_RX, |
| 229 | .end = IRQ_UART2_RX+1, |
| 230 | .flags = IORESOURCE_IRQ, |
| 231 | }, |
| 232 | { |
| 233 | .start = CH_UART2_RX, |
| 234 | .end = CH_UART2_RX+1, |
| 235 | .flags = IORESOURCE_DMA, |
| 236 | }, |
| 237 | }; |
| 238 | static struct platform_device bfin_sir2_device = { |
| 239 | .name = "bfin_sir", |
| 240 | .id = 2, |
| 241 | .num_resources = ARRAY_SIZE(bfin_sir2_resources), |
| 242 | .resource = bfin_sir2_resources, |
| 243 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 244 | #endif |
| 245 | #ifdef CONFIG_BFIN_SIR3 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 246 | static struct resource bfin_sir3_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 247 | { |
| 248 | .start = 0xFFC03100, |
| 249 | .end = 0xFFC031FF, |
| 250 | .flags = IORESOURCE_MEM, |
| 251 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 252 | { |
| 253 | .start = IRQ_UART3_RX, |
| 254 | .end = IRQ_UART3_RX+1, |
| 255 | .flags = IORESOURCE_IRQ, |
| 256 | }, |
| 257 | { |
| 258 | .start = CH_UART3_RX, |
| 259 | .end = CH_UART3_RX+1, |
| 260 | .flags = IORESOURCE_DMA, |
| 261 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 262 | }; |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 263 | static struct platform_device bfin_sir3_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 264 | .name = "bfin_sir", |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 265 | .id = 3, |
| 266 | .num_resources = ARRAY_SIZE(bfin_sir3_resources), |
| 267 | .resource = bfin_sir3_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 268 | }; |
| 269 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 270 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 271 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 272 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 273 | #include <linux/smsc911x.h> |
| 274 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 275 | static struct resource smsc911x_resources[] = { |
| 276 | { |
| 277 | .name = "smsc911x-memory", |
| 278 | .start = 0x24000000, |
| 279 | .end = 0x24000000 + 0xFF, |
| 280 | .flags = IORESOURCE_MEM, |
| 281 | }, |
| 282 | { |
| 283 | .start = IRQ_PE6, |
| 284 | .end = IRQ_PE6, |
| 285 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 286 | }, |
| 287 | }; |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 288 | |
| 289 | static struct smsc911x_platform_config smsc911x_config = { |
| 290 | .flags = SMSC911X_USE_16BIT, |
| 291 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 292 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 293 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 294 | }; |
| 295 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 296 | static struct platform_device smsc911x_device = { |
| 297 | .name = "smsc911x", |
| 298 | .id = 0, |
| 299 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 300 | .resource = smsc911x_resources, |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 301 | .dev = { |
| 302 | .platform_data = &smsc911x_config, |
| 303 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 304 | }; |
| 305 | #endif |
| 306 | |
| 307 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 308 | static struct resource musb_resources[] = { |
| 309 | [0] = { |
| 310 | .start = 0xFFC03C00, |
| 311 | .end = 0xFFC040FF, |
| 312 | .flags = IORESOURCE_MEM, |
| 313 | }, |
| 314 | [1] = { /* general IRQ */ |
| 315 | .start = IRQ_USB_INT0, |
| 316 | .end = IRQ_USB_INT0, |
| 317 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 318 | }, |
| 319 | [2] = { /* DMA IRQ */ |
| 320 | .start = IRQ_USB_DMA, |
| 321 | .end = IRQ_USB_DMA, |
| 322 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 323 | }, |
| 324 | }; |
| 325 | |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 326 | static struct musb_hdrc_config musb_config = { |
| 327 | .multipoint = 0, |
| 328 | .dyn_fifo = 0, |
| 329 | .soft_con = 1, |
| 330 | .dma = 1, |
Bryan Wu | fea05da | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 331 | .num_eps = 8, |
| 332 | .dma_channels = 8, |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 333 | .gpio_vrsel = GPIO_PH6, |
| 334 | }; |
| 335 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 336 | static struct musb_hdrc_platform_data musb_plat = { |
| 337 | #if defined(CONFIG_USB_MUSB_OTG) |
| 338 | .mode = MUSB_OTG, |
| 339 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
| 340 | .mode = MUSB_HOST, |
| 341 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
| 342 | .mode = MUSB_PERIPHERAL, |
| 343 | #endif |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 344 | .config = &musb_config, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 345 | }; |
| 346 | |
| 347 | static u64 musb_dmamask = ~(u32)0; |
| 348 | |
| 349 | static struct platform_device musb_device = { |
| 350 | .name = "musb_hdrc", |
| 351 | .id = 0, |
| 352 | .dev = { |
| 353 | .dma_mask = &musb_dmamask, |
| 354 | .coherent_dma_mask = 0xffffffff, |
| 355 | .platform_data = &musb_plat, |
| 356 | }, |
| 357 | .num_resources = ARRAY_SIZE(musb_resources), |
| 358 | .resource = musb_resources, |
| 359 | }; |
| 360 | #endif |
| 361 | |
| 362 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 363 | static struct resource bfin_atapi_resources[] = { |
| 364 | { |
| 365 | .start = 0xFFC03800, |
| 366 | .end = 0xFFC0386F, |
| 367 | .flags = IORESOURCE_MEM, |
| 368 | }, |
| 369 | { |
| 370 | .start = IRQ_ATAPI_ERR, |
| 371 | .end = IRQ_ATAPI_ERR, |
| 372 | .flags = IORESOURCE_IRQ, |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | static struct platform_device bfin_atapi_device = { |
| 377 | .name = "pata-bf54x", |
| 378 | .id = -1, |
| 379 | .num_resources = ARRAY_SIZE(bfin_atapi_resources), |
| 380 | .resource = bfin_atapi_resources, |
| 381 | }; |
| 382 | #endif |
| 383 | |
| 384 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 385 | static struct mtd_partition partition_info[] = { |
| 386 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 387 | .name = "linux kernel(nand)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 388 | .offset = 0, |
Mike Frysinger | f4585a0 | 2008-10-13 14:45:21 +0800 | [diff] [blame] | 389 | .size = 4 * 1024 * 1024, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 390 | }, |
| 391 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 392 | .name = "file system(nand)", |
Mike Frysinger | f4585a0 | 2008-10-13 14:45:21 +0800 | [diff] [blame] | 393 | .offset = 4 * 1024 * 1024, |
| 394 | .size = (256 - 4) * 1024 * 1024, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 395 | }, |
| 396 | }; |
| 397 | |
| 398 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 399 | .page_size = NFC_PG_SIZE_256, |
| 400 | .data_width = NFC_NWIDTH_8, |
| 401 | .partitions = partition_info, |
| 402 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 403 | .rd_dly = 3, |
| 404 | .wr_dly = 3, |
| 405 | }; |
| 406 | |
| 407 | static struct resource bf5xx_nand_resources[] = { |
| 408 | { |
| 409 | .start = 0xFFC03B00, |
| 410 | .end = 0xFFC03B4F, |
| 411 | .flags = IORESOURCE_MEM, |
| 412 | }, |
| 413 | { |
| 414 | .start = CH_NFC, |
| 415 | .end = CH_NFC, |
| 416 | .flags = IORESOURCE_IRQ, |
| 417 | }, |
| 418 | }; |
| 419 | |
| 420 | static struct platform_device bf5xx_nand_device = { |
| 421 | .name = "bf5xx-nand", |
| 422 | .id = 0, |
| 423 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 424 | .resource = bf5xx_nand_resources, |
| 425 | .dev = { |
| 426 | .platform_data = &bf5xx_nand_platform, |
| 427 | }, |
| 428 | }; |
| 429 | #endif |
| 430 | |
| 431 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
Mike Frysinger | 8d8921a | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 432 | static struct bfin_sd_host bfin_sdh_data = { |
| 433 | .dma_chan = CH_SDH, |
| 434 | .irq_int0 = IRQ_SDH_MASK0, |
| 435 | .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0}, |
| 436 | }; |
| 437 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 438 | static struct platform_device bf54x_sdh_device = { |
| 439 | .name = "bfin-sdh", |
| 440 | .id = 0, |
Mike Frysinger | 8d8921a | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 441 | .dev = { |
| 442 | .platform_data = &bfin_sdh_data, |
| 443 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 444 | }; |
| 445 | #endif |
| 446 | |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 447 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 448 | static struct mtd_partition para_partitions[] = { |
| 449 | { |
| 450 | .name = "bootloader(nor)", |
| 451 | .size = 0x40000, |
| 452 | .offset = 0, |
| 453 | }, { |
| 454 | .name = "linux kernel(nor)", |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 455 | .size = 0x100000, |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 456 | .offset = MTDPART_OFS_APPEND, |
| 457 | }, { |
| 458 | .name = "file system(nor)", |
| 459 | .size = MTDPART_SIZ_FULL, |
| 460 | .offset = MTDPART_OFS_APPEND, |
| 461 | } |
| 462 | }; |
| 463 | |
| 464 | static struct physmap_flash_data para_flash_data = { |
| 465 | .width = 2, |
| 466 | .parts = para_partitions, |
| 467 | .nr_parts = ARRAY_SIZE(para_partitions), |
| 468 | }; |
| 469 | |
| 470 | static struct resource para_flash_resource = { |
| 471 | .start = 0x20000000, |
| 472 | .end = 0x207fffff, |
| 473 | .flags = IORESOURCE_MEM, |
| 474 | }; |
| 475 | |
| 476 | static struct platform_device para_flash_device = { |
| 477 | .name = "physmap-flash", |
| 478 | .id = 0, |
| 479 | .dev = { |
| 480 | .platform_data = ¶_flash_data, |
| 481 | }, |
| 482 | .num_resources = 1, |
| 483 | .resource = ¶_flash_resource, |
| 484 | }; |
| 485 | #endif |
| 486 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 487 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 488 | /* all SPI peripherals info goes here */ |
| 489 | #if defined(CONFIG_MTD_M25P80) \ |
| 490 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 491 | /* SPI flash chip (m25p16) */ |
| 492 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 493 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 494 | .name = "bootloader(spi)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 495 | .size = 0x00040000, |
| 496 | .offset = 0, |
| 497 | .mask_flags = MTD_CAP_ROM |
| 498 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 499 | .name = "linux kernel(spi)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 500 | .size = 0x1c0000, |
| 501 | .offset = 0x40000 |
| 502 | } |
| 503 | }; |
| 504 | |
| 505 | static struct flash_platform_data bfin_spi_flash_data = { |
| 506 | .name = "m25p80", |
| 507 | .parts = bfin_spi_flash_partitions, |
| 508 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 509 | .type = "m25p16", |
| 510 | }; |
| 511 | |
| 512 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 513 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 514 | .bits_per_word = 8, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 515 | }; |
| 516 | #endif |
| 517 | |
| 518 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 519 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 520 | .enable_dma = 0, |
| 521 | .bits_per_word = 16, |
| 522 | }; |
| 523 | |
| 524 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 525 | .model = 7877, |
| 526 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 527 | .x_plate_ohms = 419, |
| 528 | .y_plate_ohms = 486, |
| 529 | .pressure_max = 1000, |
| 530 | .pressure_min = 0, |
| 531 | .stopacq_polarity = 1, |
| 532 | .first_conversion_delay = 3, |
| 533 | .acquisition_time = 1, |
| 534 | .averaging = 1, |
| 535 | .pen_down_acc_interval = 1, |
| 536 | }; |
| 537 | #endif |
| 538 | |
| 539 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 540 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 541 | .enable_dma = 0, |
| 542 | .bits_per_word = 8, |
| 543 | }; |
| 544 | #endif |
| 545 | |
| 546 | static struct spi_board_info bf54x_spi_board_info[] __initdata = { |
| 547 | #if defined(CONFIG_MTD_M25P80) \ |
| 548 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 549 | { |
| 550 | /* the modalias must be the same as spi device driver name */ |
| 551 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 552 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 553 | .bus_num = 0, /* Framework bus number */ |
| 554 | .chip_select = 1, /* SPI_SSEL1*/ |
| 555 | .platform_data = &bfin_spi_flash_data, |
| 556 | .controller_data = &spi_flash_chip_info, |
| 557 | .mode = SPI_MODE_3, |
| 558 | }, |
| 559 | #endif |
| 560 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 561 | { |
| 562 | .modalias = "ad7877", |
| 563 | .platform_data = &bfin_ad7877_ts_info, |
| 564 | .irq = IRQ_PJ11, |
| 565 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 566 | .bus_num = 0, |
| 567 | .chip_select = 2, |
| 568 | .controller_data = &spi_ad7877_chip_info, |
| 569 | }, |
| 570 | #endif |
| 571 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 572 | { |
| 573 | .modalias = "spidev", |
| 574 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 575 | .bus_num = 0, |
| 576 | .chip_select = 1, |
| 577 | .controller_data = &spidev_chip_info, |
| 578 | }, |
| 579 | #endif |
| 580 | }; |
| 581 | |
| 582 | /* SPI (0) */ |
| 583 | static struct resource bfin_spi0_resource[] = { |
| 584 | [0] = { |
| 585 | .start = SPI0_REGBASE, |
| 586 | .end = SPI0_REGBASE + 0xFF, |
| 587 | .flags = IORESOURCE_MEM, |
| 588 | }, |
| 589 | [1] = { |
| 590 | .start = CH_SPI0, |
| 591 | .end = CH_SPI0, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 592 | .flags = IORESOURCE_DMA, |
| 593 | }, |
| 594 | [2] = { |
| 595 | .start = IRQ_SPI0, |
| 596 | .end = IRQ_SPI0, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 597 | .flags = IORESOURCE_IRQ, |
| 598 | } |
| 599 | }; |
| 600 | |
| 601 | /* SPI (1) */ |
| 602 | static struct resource bfin_spi1_resource[] = { |
| 603 | [0] = { |
| 604 | .start = SPI1_REGBASE, |
| 605 | .end = SPI1_REGBASE + 0xFF, |
| 606 | .flags = IORESOURCE_MEM, |
| 607 | }, |
| 608 | [1] = { |
| 609 | .start = CH_SPI1, |
| 610 | .end = CH_SPI1, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 611 | .flags = IORESOURCE_DMA, |
| 612 | }, |
| 613 | [2] = { |
| 614 | .start = IRQ_SPI1, |
| 615 | .end = IRQ_SPI1, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 616 | .flags = IORESOURCE_IRQ, |
| 617 | } |
| 618 | }; |
| 619 | |
| 620 | /* SPI controller data */ |
| 621 | static struct bfin5xx_spi_master bf54x_spi_master_info0 = { |
Yi Li | 4e4d496 | 2009-08-30 20:45:50 +0000 | [diff] [blame] | 622 | .num_chipselect = 3, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 623 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 624 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
| 625 | }; |
| 626 | |
| 627 | static struct platform_device bf54x_spi_master0 = { |
| 628 | .name = "bfin-spi", |
| 629 | .id = 0, /* Bus number */ |
| 630 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 631 | .resource = bfin_spi0_resource, |
| 632 | .dev = { |
| 633 | .platform_data = &bf54x_spi_master_info0, /* Passed to driver */ |
| 634 | }, |
| 635 | }; |
| 636 | |
| 637 | static struct bfin5xx_spi_master bf54x_spi_master_info1 = { |
Yi Li | 4e4d496 | 2009-08-30 20:45:50 +0000 | [diff] [blame] | 638 | .num_chipselect = 3, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 639 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 640 | .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, |
| 641 | }; |
| 642 | |
| 643 | static struct platform_device bf54x_spi_master1 = { |
| 644 | .name = "bfin-spi", |
| 645 | .id = 1, /* Bus number */ |
| 646 | .num_resources = ARRAY_SIZE(bfin_spi1_resource), |
| 647 | .resource = bfin_spi1_resource, |
| 648 | .dev = { |
| 649 | .platform_data = &bf54x_spi_master_info1, /* Passed to driver */ |
| 650 | }, |
| 651 | }; |
| 652 | #endif /* spi master and devices */ |
| 653 | |
| 654 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 655 | static struct resource bfin_twi0_resource[] = { |
| 656 | [0] = { |
| 657 | .start = TWI0_REGBASE, |
| 658 | .end = TWI0_REGBASE + 0xFF, |
| 659 | .flags = IORESOURCE_MEM, |
| 660 | }, |
| 661 | [1] = { |
| 662 | .start = IRQ_TWI0, |
| 663 | .end = IRQ_TWI0, |
| 664 | .flags = IORESOURCE_IRQ, |
| 665 | }, |
| 666 | }; |
| 667 | |
| 668 | static struct platform_device i2c_bfin_twi0_device = { |
| 669 | .name = "i2c-bfin-twi", |
| 670 | .id = 0, |
| 671 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 672 | .resource = bfin_twi0_resource, |
| 673 | }; |
| 674 | |
| 675 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
| 676 | static struct resource bfin_twi1_resource[] = { |
| 677 | [0] = { |
| 678 | .start = TWI1_REGBASE, |
| 679 | .end = TWI1_REGBASE + 0xFF, |
| 680 | .flags = IORESOURCE_MEM, |
| 681 | }, |
| 682 | [1] = { |
| 683 | .start = IRQ_TWI1, |
| 684 | .end = IRQ_TWI1, |
| 685 | .flags = IORESOURCE_IRQ, |
| 686 | }, |
| 687 | }; |
| 688 | |
| 689 | static struct platform_device i2c_bfin_twi1_device = { |
| 690 | .name = "i2c-bfin-twi", |
| 691 | .id = 1, |
| 692 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), |
| 693 | .resource = bfin_twi1_resource, |
| 694 | }; |
| 695 | #endif |
| 696 | #endif |
| 697 | |
| 698 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 699 | #include <linux/gpio_keys.h> |
| 700 | |
| 701 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 702 | {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"}, |
| 703 | }; |
| 704 | |
| 705 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 706 | .buttons = bfin_gpio_keys_table, |
| 707 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 708 | }; |
| 709 | |
| 710 | static struct platform_device bfin_device_gpiokeys = { |
| 711 | .name = "gpio-keys", |
| 712 | .dev = { |
| 713 | .platform_data = &bfin_gpio_keys_data, |
| 714 | }, |
| 715 | }; |
| 716 | #endif |
| 717 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 718 | static const unsigned int cclk_vlev_datasheet[] = |
| 719 | { |
| 720 | /* |
| 721 | * Internal VLEV BF54XSBBC1533 |
| 722 | ****temporarily using these values until data sheet is updated |
| 723 | */ |
| 724 | VRPAIR(VLEV_085, 150000000), |
| 725 | VRPAIR(VLEV_090, 250000000), |
| 726 | VRPAIR(VLEV_110, 276000000), |
| 727 | VRPAIR(VLEV_115, 301000000), |
| 728 | VRPAIR(VLEV_120, 525000000), |
| 729 | VRPAIR(VLEV_125, 550000000), |
| 730 | VRPAIR(VLEV_130, 600000000), |
| 731 | }; |
| 732 | |
| 733 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 734 | .tuple_tab = cclk_vlev_datasheet, |
| 735 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 736 | .vr_settling_time = 25 /* us */, |
| 737 | }; |
| 738 | |
| 739 | static struct platform_device bfin_dpmc = { |
| 740 | .name = "bfin dpmc", |
| 741 | .dev = { |
| 742 | .platform_data = &bfin_dmpc_vreg_data, |
| 743 | }, |
| 744 | }; |
| 745 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 746 | static struct platform_device *cm_bf548_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 747 | |
| 748 | &bfin_dpmc, |
| 749 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 750 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 751 | &rtc_device, |
| 752 | #endif |
| 753 | |
| 754 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 755 | &bfin_uart_device, |
| 756 | #endif |
| 757 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 758 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 759 | #ifdef CONFIG_BFIN_SIR0 |
| 760 | &bfin_sir0_device, |
| 761 | #endif |
| 762 | #ifdef CONFIG_BFIN_SIR1 |
| 763 | &bfin_sir1_device, |
| 764 | #endif |
| 765 | #ifdef CONFIG_BFIN_SIR2 |
| 766 | &bfin_sir2_device, |
| 767 | #endif |
| 768 | #ifdef CONFIG_BFIN_SIR3 |
| 769 | &bfin_sir3_device, |
| 770 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 771 | #endif |
| 772 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 773 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 774 | &bf54x_lq043_device, |
| 775 | #endif |
| 776 | |
| 777 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 778 | &smsc911x_device, |
| 779 | #endif |
| 780 | |
| 781 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 782 | &musb_device, |
| 783 | #endif |
| 784 | |
| 785 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 786 | &bfin_atapi_device, |
| 787 | #endif |
| 788 | |
| 789 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 790 | &bf5xx_nand_device, |
| 791 | #endif |
| 792 | |
| 793 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
| 794 | &bf54x_sdh_device, |
| 795 | #endif |
| 796 | |
| 797 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 798 | &bf54x_spi_master0, |
| 799 | &bf54x_spi_master1, |
| 800 | #endif |
| 801 | |
| 802 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 803 | &bf54x_kpad_device, |
| 804 | #endif |
| 805 | |
| 806 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
Mike Frysinger | 10a88a2 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 807 | &i2c_bfin_twi0_device, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 808 | #if !defined(CONFIG_BF542) |
| 809 | &i2c_bfin_twi1_device, |
| 810 | #endif |
| 811 | #endif |
| 812 | |
| 813 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 814 | &bfin_device_gpiokeys, |
| 815 | #endif |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 816 | |
| 817 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 818 | ¶_flash_device, |
| 819 | #endif |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 820 | }; |
| 821 | |
| 822 | static int __init cm_bf548_init(void) |
| 823 | { |
Michael Hennerich | f086f23 | 2008-05-20 16:42:39 +0800 | [diff] [blame] | 824 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 825 | platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices)); |
| 826 | |
| 827 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 828 | spi_register_board_info(bf54x_spi_board_info, |
| 829 | ARRAY_SIZE(bf54x_spi_board_info)); |
| 830 | #endif |
| 831 | |
| 832 | return 0; |
| 833 | } |
| 834 | |
| 835 | arch_initcall(cm_bf548_init); |