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) |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 130 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 131 | static struct resource bfin_uart0_resources[] = { |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 132 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 133 | .start = UART0_DLL, |
| 134 | .end = UART0_RBR+2, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 135 | .flags = IORESOURCE_MEM, |
| 136 | }, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 137 | { |
| 138 | .start = IRQ_UART0_RX, |
| 139 | .end = IRQ_UART0_RX+1, |
| 140 | .flags = IORESOURCE_IRQ, |
| 141 | }, |
| 142 | { |
| 143 | .start = IRQ_UART0_ERROR, |
| 144 | .end = IRQ_UART0_ERROR, |
| 145 | .flags = IORESOURCE_IRQ, |
| 146 | }, |
| 147 | { |
| 148 | .start = CH_UART0_TX, |
| 149 | .end = CH_UART0_TX, |
| 150 | .flags = IORESOURCE_DMA, |
| 151 | }, |
| 152 | { |
| 153 | .start = CH_UART0_RX, |
| 154 | .end = CH_UART0_RX, |
| 155 | .flags = IORESOURCE_DMA, |
| 156 | }, |
| 157 | }; |
| 158 | |
| 159 | unsigned short bfin_uart0_peripherals[] = { |
| 160 | P_UART0_TX, P_UART0_RX, 0 |
| 161 | }; |
| 162 | |
| 163 | static struct platform_device bfin_uart0_device = { |
| 164 | .name = "bfin-uart", |
| 165 | .id = 0, |
| 166 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), |
| 167 | .resource = bfin_uart0_resources, |
| 168 | .dev = { |
| 169 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 170 | }, |
| 171 | }; |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 172 | #endif |
| 173 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 174 | static struct resource bfin_uart1_resources[] = { |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 175 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 176 | .start = UART1_DLL, |
| 177 | .end = UART1_RBR+2, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 178 | .flags = IORESOURCE_MEM, |
| 179 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 180 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 181 | .start = IRQ_UART1_RX, |
| 182 | .end = IRQ_UART1_RX+1, |
| 183 | .flags = IORESOURCE_IRQ, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 184 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 185 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 186 | .start = IRQ_UART1_ERROR, |
| 187 | .end = IRQ_UART1_ERROR, |
| 188 | .flags = IORESOURCE_IRQ, |
| 189 | }, |
| 190 | { |
| 191 | .start = CH_UART1_TX, |
| 192 | .end = CH_UART1_TX, |
| 193 | .flags = IORESOURCE_DMA, |
| 194 | }, |
| 195 | { |
| 196 | .start = CH_UART1_RX, |
| 197 | .end = CH_UART1_RX, |
| 198 | .flags = IORESOURCE_DMA, |
| 199 | }, |
| 200 | #ifdef CONFIG_BFIN_UART1_CTSRTS |
| 201 | { /* CTS pin -- 0 means not supported */ |
| 202 | .start = GPIO_PE10, |
| 203 | .end = GPIO_PE10, |
| 204 | .flags = IORESOURCE_IO, |
| 205 | }, |
| 206 | { /* RTS pin -- 0 means not supported */ |
| 207 | .start = GPIO_PE9, |
| 208 | .end = GPIO_PE9, |
| 209 | .flags = IORESOURCE_IO, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 210 | }, |
| 211 | #endif |
| 212 | }; |
| 213 | |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 214 | unsigned short bfin_uart1_peripherals[] = { |
| 215 | P_UART1_TX, P_UART1_RX, |
| 216 | #ifdef CONFIG_BFIN_UART1_CTSRTS |
| 217 | P_UART1_RTS, P_UART1_CTS, |
| 218 | #endif |
| 219 | 0 |
| 220 | }; |
| 221 | |
| 222 | static struct platform_device bfin_uart1_device = { |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 223 | .name = "bfin-uart", |
| 224 | .id = 1, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 225 | .num_resources = ARRAY_SIZE(bfin_uart1_resources), |
| 226 | .resource = bfin_uart1_resources, |
| 227 | .dev = { |
| 228 | .platform_data = &bfin_uart1_peripherals, /* Passed to driver */ |
| 229 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 230 | }; |
| 231 | #endif |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 232 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 233 | static struct resource bfin_uart2_resources[] = { |
| 234 | { |
| 235 | .start = UART2_DLL, |
| 236 | .end = UART2_RBR+2, |
| 237 | .flags = IORESOURCE_MEM, |
| 238 | }, |
| 239 | { |
| 240 | .start = IRQ_UART2_RX, |
| 241 | .end = IRQ_UART2_RX+1, |
| 242 | .flags = IORESOURCE_IRQ, |
| 243 | }, |
| 244 | { |
| 245 | .start = IRQ_UART2_ERROR, |
| 246 | .end = IRQ_UART2_ERROR, |
| 247 | .flags = IORESOURCE_IRQ, |
| 248 | }, |
| 249 | { |
| 250 | .start = CH_UART2_TX, |
| 251 | .end = CH_UART2_TX, |
| 252 | .flags = IORESOURCE_DMA, |
| 253 | }, |
| 254 | { |
| 255 | .start = CH_UART2_RX, |
| 256 | .end = CH_UART2_RX, |
| 257 | .flags = IORESOURCE_DMA, |
| 258 | }, |
| 259 | }; |
| 260 | |
| 261 | unsigned short bfin_uart2_peripherals[] = { |
| 262 | P_UART2_TX, P_UART2_RX, 0 |
| 263 | }; |
| 264 | |
| 265 | static struct platform_device bfin_uart2_device = { |
| 266 | .name = "bfin-uart", |
| 267 | .id = 2, |
| 268 | .num_resources = ARRAY_SIZE(bfin_uart2_resources), |
| 269 | .resource = bfin_uart2_resources, |
| 270 | .dev = { |
| 271 | .platform_data = &bfin_uart2_peripherals, /* Passed to driver */ |
| 272 | }, |
| 273 | }; |
| 274 | #endif |
| 275 | #ifdef CONFIG_SERIAL_BFIN_UART3 |
| 276 | static struct resource bfin_uart3_resources[] = { |
| 277 | { |
| 278 | .start = UART3_DLL, |
| 279 | .end = UART3_RBR+2, |
| 280 | .flags = IORESOURCE_MEM, |
| 281 | }, |
| 282 | { |
| 283 | .start = IRQ_UART3_RX, |
| 284 | .end = IRQ_UART3_RX+1, |
| 285 | .flags = IORESOURCE_IRQ, |
| 286 | }, |
| 287 | { |
| 288 | .start = IRQ_UART3_ERROR, |
| 289 | .end = IRQ_UART3_ERROR, |
| 290 | .flags = IORESOURCE_IRQ, |
| 291 | }, |
| 292 | { |
| 293 | .start = CH_UART3_TX, |
| 294 | .end = CH_UART3_TX, |
| 295 | .flags = IORESOURCE_DMA, |
| 296 | }, |
| 297 | { |
| 298 | .start = CH_UART3_RX, |
| 299 | .end = CH_UART3_RX, |
| 300 | .flags = IORESOURCE_DMA, |
| 301 | }, |
| 302 | #ifdef CONFIG_BFIN_UART3_CTSRTS |
| 303 | { /* CTS pin -- 0 means not supported */ |
| 304 | .start = GPIO_PB3, |
| 305 | .end = GPIO_PB3, |
| 306 | .flags = IORESOURCE_IO, |
| 307 | }, |
| 308 | { /* RTS pin -- 0 means not supported */ |
| 309 | .start = GPIO_PB2, |
| 310 | .end = GPIO_PB2, |
| 311 | .flags = IORESOURCE_IO, |
| 312 | }, |
| 313 | #endif |
| 314 | }; |
| 315 | |
| 316 | unsigned short bfin_uart3_peripherals[] = { |
| 317 | P_UART3_TX, P_UART3_RX, |
| 318 | #ifdef CONFIG_BFIN_UART3_CTSRTS |
| 319 | P_UART3_RTS, P_UART3_CTS, |
| 320 | #endif |
| 321 | 0 |
| 322 | }; |
| 323 | |
| 324 | static struct platform_device bfin_uart3_device = { |
| 325 | .name = "bfin-uart", |
| 326 | .id = 3, |
| 327 | .num_resources = ARRAY_SIZE(bfin_uart3_resources), |
| 328 | .resource = bfin_uart3_resources, |
| 329 | .dev = { |
| 330 | .platform_data = &bfin_uart3_peripherals, /* Passed to driver */ |
| 331 | }, |
| 332 | }; |
| 333 | #endif |
| 334 | #endif |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 335 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 336 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 337 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 338 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 339 | { |
| 340 | .start = 0xFFC00400, |
| 341 | .end = 0xFFC004FF, |
| 342 | .flags = IORESOURCE_MEM, |
| 343 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 344 | { |
| 345 | .start = IRQ_UART0_RX, |
| 346 | .end = IRQ_UART0_RX+1, |
| 347 | .flags = IORESOURCE_IRQ, |
| 348 | }, |
| 349 | { |
| 350 | .start = CH_UART0_RX, |
| 351 | .end = CH_UART0_RX+1, |
| 352 | .flags = IORESOURCE_DMA, |
| 353 | }, |
| 354 | }; |
| 355 | static struct platform_device bfin_sir0_device = { |
| 356 | .name = "bfin_sir", |
| 357 | .id = 0, |
| 358 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 359 | .resource = bfin_sir0_resources, |
| 360 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 361 | #endif |
| 362 | #ifdef CONFIG_BFIN_SIR1 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 363 | static struct resource bfin_sir1_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 364 | { |
| 365 | .start = 0xFFC02000, |
| 366 | .end = 0xFFC020FF, |
| 367 | .flags = IORESOURCE_MEM, |
| 368 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 369 | { |
| 370 | .start = IRQ_UART1_RX, |
| 371 | .end = IRQ_UART1_RX+1, |
| 372 | .flags = IORESOURCE_IRQ, |
| 373 | }, |
| 374 | { |
| 375 | .start = CH_UART1_RX, |
| 376 | .end = CH_UART1_RX+1, |
| 377 | .flags = IORESOURCE_DMA, |
| 378 | }, |
| 379 | }; |
| 380 | static struct platform_device bfin_sir1_device = { |
| 381 | .name = "bfin_sir", |
| 382 | .id = 1, |
| 383 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), |
| 384 | .resource = bfin_sir1_resources, |
| 385 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 386 | #endif |
| 387 | #ifdef CONFIG_BFIN_SIR2 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 388 | static struct resource bfin_sir2_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 389 | { |
| 390 | .start = 0xFFC02100, |
| 391 | .end = 0xFFC021FF, |
| 392 | .flags = IORESOURCE_MEM, |
| 393 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 394 | { |
| 395 | .start = IRQ_UART2_RX, |
| 396 | .end = IRQ_UART2_RX+1, |
| 397 | .flags = IORESOURCE_IRQ, |
| 398 | }, |
| 399 | { |
| 400 | .start = CH_UART2_RX, |
| 401 | .end = CH_UART2_RX+1, |
| 402 | .flags = IORESOURCE_DMA, |
| 403 | }, |
| 404 | }; |
| 405 | static struct platform_device bfin_sir2_device = { |
| 406 | .name = "bfin_sir", |
| 407 | .id = 2, |
| 408 | .num_resources = ARRAY_SIZE(bfin_sir2_resources), |
| 409 | .resource = bfin_sir2_resources, |
| 410 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 411 | #endif |
| 412 | #ifdef CONFIG_BFIN_SIR3 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 413 | static struct resource bfin_sir3_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 414 | { |
| 415 | .start = 0xFFC03100, |
| 416 | .end = 0xFFC031FF, |
| 417 | .flags = IORESOURCE_MEM, |
| 418 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 419 | { |
| 420 | .start = IRQ_UART3_RX, |
| 421 | .end = IRQ_UART3_RX+1, |
| 422 | .flags = IORESOURCE_IRQ, |
| 423 | }, |
| 424 | { |
| 425 | .start = CH_UART3_RX, |
| 426 | .end = CH_UART3_RX+1, |
| 427 | .flags = IORESOURCE_DMA, |
| 428 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 429 | }; |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 430 | static struct platform_device bfin_sir3_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 431 | .name = "bfin_sir", |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 432 | .id = 3, |
| 433 | .num_resources = ARRAY_SIZE(bfin_sir3_resources), |
| 434 | .resource = bfin_sir3_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 435 | }; |
| 436 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 437 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 438 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 439 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 440 | #include <linux/smsc911x.h> |
| 441 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 442 | static struct resource smsc911x_resources[] = { |
| 443 | { |
| 444 | .name = "smsc911x-memory", |
| 445 | .start = 0x24000000, |
| 446 | .end = 0x24000000 + 0xFF, |
| 447 | .flags = IORESOURCE_MEM, |
| 448 | }, |
| 449 | { |
| 450 | .start = IRQ_PE6, |
| 451 | .end = IRQ_PE6, |
| 452 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 453 | }, |
| 454 | }; |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 455 | |
| 456 | static struct smsc911x_platform_config smsc911x_config = { |
| 457 | .flags = SMSC911X_USE_16BIT, |
| 458 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 459 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 460 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 461 | }; |
| 462 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 463 | static struct platform_device smsc911x_device = { |
| 464 | .name = "smsc911x", |
| 465 | .id = 0, |
| 466 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 467 | .resource = smsc911x_resources, |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 468 | .dev = { |
| 469 | .platform_data = &smsc911x_config, |
| 470 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 471 | }; |
| 472 | #endif |
| 473 | |
| 474 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 475 | static struct resource musb_resources[] = { |
| 476 | [0] = { |
| 477 | .start = 0xFFC03C00, |
| 478 | .end = 0xFFC040FF, |
| 479 | .flags = IORESOURCE_MEM, |
| 480 | }, |
| 481 | [1] = { /* general IRQ */ |
| 482 | .start = IRQ_USB_INT0, |
| 483 | .end = IRQ_USB_INT0, |
| 484 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 485 | }, |
| 486 | [2] = { /* DMA IRQ */ |
| 487 | .start = IRQ_USB_DMA, |
| 488 | .end = IRQ_USB_DMA, |
| 489 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 490 | }, |
| 491 | }; |
| 492 | |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 493 | static struct musb_hdrc_config musb_config = { |
| 494 | .multipoint = 0, |
| 495 | .dyn_fifo = 0, |
| 496 | .soft_con = 1, |
| 497 | .dma = 1, |
Bryan Wu | fea05da | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 498 | .num_eps = 8, |
| 499 | .dma_channels = 8, |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 500 | .gpio_vrsel = GPIO_PH6, |
| 501 | }; |
| 502 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 503 | static struct musb_hdrc_platform_data musb_plat = { |
| 504 | #if defined(CONFIG_USB_MUSB_OTG) |
| 505 | .mode = MUSB_OTG, |
| 506 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
| 507 | .mode = MUSB_HOST, |
| 508 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
| 509 | .mode = MUSB_PERIPHERAL, |
| 510 | #endif |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame] | 511 | .config = &musb_config, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 512 | }; |
| 513 | |
| 514 | static u64 musb_dmamask = ~(u32)0; |
| 515 | |
| 516 | static struct platform_device musb_device = { |
| 517 | .name = "musb_hdrc", |
| 518 | .id = 0, |
| 519 | .dev = { |
| 520 | .dma_mask = &musb_dmamask, |
| 521 | .coherent_dma_mask = 0xffffffff, |
| 522 | .platform_data = &musb_plat, |
| 523 | }, |
| 524 | .num_resources = ARRAY_SIZE(musb_resources), |
| 525 | .resource = musb_resources, |
| 526 | }; |
| 527 | #endif |
| 528 | |
Sonic Zhang | df5de26 | 2009-09-23 05:01:56 +0000 | [diff] [blame] | 529 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 530 | #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART |
| 531 | static struct resource bfin_sport0_uart_resources[] = { |
| 532 | { |
| 533 | .start = SPORT0_TCR1, |
| 534 | .end = SPORT0_MRCS3+4, |
| 535 | .flags = IORESOURCE_MEM, |
| 536 | }, |
| 537 | { |
| 538 | .start = IRQ_SPORT0_RX, |
| 539 | .end = IRQ_SPORT0_RX+1, |
| 540 | .flags = IORESOURCE_IRQ, |
| 541 | }, |
| 542 | { |
| 543 | .start = IRQ_SPORT0_ERROR, |
| 544 | .end = IRQ_SPORT0_ERROR, |
| 545 | .flags = IORESOURCE_IRQ, |
| 546 | }, |
| 547 | }; |
| 548 | |
| 549 | unsigned short bfin_sport0_peripherals[] = { |
| 550 | P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, |
| 551 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0 |
| 552 | }; |
| 553 | |
| 554 | static struct platform_device bfin_sport0_uart_device = { |
| 555 | .name = "bfin-sport-uart", |
| 556 | .id = 0, |
| 557 | .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources), |
| 558 | .resource = bfin_sport0_uart_resources, |
| 559 | .dev = { |
| 560 | .platform_data = &bfin_sport0_peripherals, /* Passed to driver */ |
| 561 | }, |
| 562 | }; |
| 563 | #endif |
| 564 | #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART |
| 565 | static struct resource bfin_sport1_uart_resources[] = { |
| 566 | { |
| 567 | .start = SPORT1_TCR1, |
| 568 | .end = SPORT1_MRCS3+4, |
| 569 | .flags = IORESOURCE_MEM, |
| 570 | }, |
| 571 | { |
| 572 | .start = IRQ_SPORT1_RX, |
| 573 | .end = IRQ_SPORT1_RX+1, |
| 574 | .flags = IORESOURCE_IRQ, |
| 575 | }, |
| 576 | { |
| 577 | .start = IRQ_SPORT1_ERROR, |
| 578 | .end = IRQ_SPORT1_ERROR, |
| 579 | .flags = IORESOURCE_IRQ, |
| 580 | }, |
| 581 | }; |
| 582 | |
| 583 | unsigned short bfin_sport1_peripherals[] = { |
| 584 | P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, |
| 585 | P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0 |
| 586 | }; |
| 587 | |
| 588 | static struct platform_device bfin_sport1_uart_device = { |
| 589 | .name = "bfin-sport-uart", |
| 590 | .id = 1, |
| 591 | .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources), |
| 592 | .resource = bfin_sport1_uart_resources, |
| 593 | .dev = { |
| 594 | .platform_data = &bfin_sport1_peripherals, /* Passed to driver */ |
| 595 | }, |
| 596 | }; |
| 597 | #endif |
| 598 | #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART |
| 599 | static struct resource bfin_sport2_uart_resources[] = { |
| 600 | { |
| 601 | .start = SPORT2_TCR1, |
| 602 | .end = SPORT2_MRCS3+4, |
| 603 | .flags = IORESOURCE_MEM, |
| 604 | }, |
| 605 | { |
| 606 | .start = IRQ_SPORT2_RX, |
| 607 | .end = IRQ_SPORT2_RX+1, |
| 608 | .flags = IORESOURCE_IRQ, |
| 609 | }, |
| 610 | { |
| 611 | .start = IRQ_SPORT2_ERROR, |
| 612 | .end = IRQ_SPORT2_ERROR, |
| 613 | .flags = IORESOURCE_IRQ, |
| 614 | }, |
| 615 | }; |
| 616 | |
| 617 | unsigned short bfin_sport2_peripherals[] = { |
| 618 | P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS, |
| 619 | P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0 |
| 620 | }; |
| 621 | |
| 622 | static struct platform_device bfin_sport2_uart_device = { |
| 623 | .name = "bfin-sport-uart", |
| 624 | .id = 2, |
| 625 | .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources), |
| 626 | .resource = bfin_sport2_uart_resources, |
| 627 | .dev = { |
| 628 | .platform_data = &bfin_sport2_peripherals, /* Passed to driver */ |
| 629 | }, |
| 630 | }; |
| 631 | #endif |
| 632 | #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART |
| 633 | static struct resource bfin_sport3_uart_resources[] = { |
| 634 | { |
| 635 | .start = SPORT3_TCR1, |
| 636 | .end = SPORT3_MRCS3+4, |
| 637 | .flags = IORESOURCE_MEM, |
| 638 | }, |
| 639 | { |
| 640 | .start = IRQ_SPORT3_RX, |
| 641 | .end = IRQ_SPORT3_RX+1, |
| 642 | .flags = IORESOURCE_IRQ, |
| 643 | }, |
| 644 | { |
| 645 | .start = IRQ_SPORT3_ERROR, |
| 646 | .end = IRQ_SPORT3_ERROR, |
| 647 | .flags = IORESOURCE_IRQ, |
| 648 | }, |
| 649 | }; |
| 650 | |
| 651 | unsigned short bfin_sport3_peripherals[] = { |
| 652 | P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS, |
| 653 | P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0 |
| 654 | }; |
| 655 | |
| 656 | static struct platform_device bfin_sport3_uart_device = { |
| 657 | .name = "bfin-sport-uart", |
| 658 | .id = 3, |
| 659 | .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources), |
| 660 | .resource = bfin_sport3_uart_resources, |
| 661 | .dev = { |
| 662 | .platform_data = &bfin_sport3_peripherals, /* Passed to driver */ |
| 663 | }, |
| 664 | }; |
| 665 | #endif |
| 666 | #endif |
| 667 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 668 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 669 | static struct resource bfin_atapi_resources[] = { |
| 670 | { |
| 671 | .start = 0xFFC03800, |
| 672 | .end = 0xFFC0386F, |
| 673 | .flags = IORESOURCE_MEM, |
| 674 | }, |
| 675 | { |
| 676 | .start = IRQ_ATAPI_ERR, |
| 677 | .end = IRQ_ATAPI_ERR, |
| 678 | .flags = IORESOURCE_IRQ, |
| 679 | }, |
| 680 | }; |
| 681 | |
| 682 | static struct platform_device bfin_atapi_device = { |
| 683 | .name = "pata-bf54x", |
| 684 | .id = -1, |
| 685 | .num_resources = ARRAY_SIZE(bfin_atapi_resources), |
| 686 | .resource = bfin_atapi_resources, |
| 687 | }; |
| 688 | #endif |
| 689 | |
| 690 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 691 | static struct mtd_partition partition_info[] = { |
| 692 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 693 | .name = "linux kernel(nand)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 694 | .offset = 0, |
Mike Frysinger | f4585a0 | 2008-10-13 14:45:21 +0800 | [diff] [blame] | 695 | .size = 4 * 1024 * 1024, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 696 | }, |
| 697 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 698 | .name = "file system(nand)", |
Mike Frysinger | f4585a0 | 2008-10-13 14:45:21 +0800 | [diff] [blame] | 699 | .offset = 4 * 1024 * 1024, |
| 700 | .size = (256 - 4) * 1024 * 1024, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 701 | }, |
| 702 | }; |
| 703 | |
| 704 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 705 | .page_size = NFC_PG_SIZE_256, |
| 706 | .data_width = NFC_NWIDTH_8, |
| 707 | .partitions = partition_info, |
| 708 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 709 | .rd_dly = 3, |
| 710 | .wr_dly = 3, |
| 711 | }; |
| 712 | |
| 713 | static struct resource bf5xx_nand_resources[] = { |
| 714 | { |
| 715 | .start = 0xFFC03B00, |
| 716 | .end = 0xFFC03B4F, |
| 717 | .flags = IORESOURCE_MEM, |
| 718 | }, |
| 719 | { |
| 720 | .start = CH_NFC, |
| 721 | .end = CH_NFC, |
| 722 | .flags = IORESOURCE_IRQ, |
| 723 | }, |
| 724 | }; |
| 725 | |
| 726 | static struct platform_device bf5xx_nand_device = { |
| 727 | .name = "bf5xx-nand", |
| 728 | .id = 0, |
| 729 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 730 | .resource = bf5xx_nand_resources, |
| 731 | .dev = { |
| 732 | .platform_data = &bf5xx_nand_platform, |
| 733 | }, |
| 734 | }; |
| 735 | #endif |
| 736 | |
| 737 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
Mike Frysinger | 8d8921a | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 738 | static struct bfin_sd_host bfin_sdh_data = { |
| 739 | .dma_chan = CH_SDH, |
| 740 | .irq_int0 = IRQ_SDH_MASK0, |
| 741 | .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0}, |
| 742 | }; |
| 743 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 744 | static struct platform_device bf54x_sdh_device = { |
| 745 | .name = "bfin-sdh", |
| 746 | .id = 0, |
Mike Frysinger | 8d8921a | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 747 | .dev = { |
| 748 | .platform_data = &bfin_sdh_data, |
| 749 | }, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 750 | }; |
| 751 | #endif |
| 752 | |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 753 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 754 | static struct mtd_partition para_partitions[] = { |
| 755 | { |
| 756 | .name = "bootloader(nor)", |
| 757 | .size = 0x40000, |
| 758 | .offset = 0, |
| 759 | }, { |
| 760 | .name = "linux kernel(nor)", |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 761 | .size = 0x100000, |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 762 | .offset = MTDPART_OFS_APPEND, |
| 763 | }, { |
| 764 | .name = "file system(nor)", |
| 765 | .size = MTDPART_SIZ_FULL, |
| 766 | .offset = MTDPART_OFS_APPEND, |
| 767 | } |
| 768 | }; |
| 769 | |
| 770 | static struct physmap_flash_data para_flash_data = { |
| 771 | .width = 2, |
| 772 | .parts = para_partitions, |
| 773 | .nr_parts = ARRAY_SIZE(para_partitions), |
| 774 | }; |
| 775 | |
| 776 | static struct resource para_flash_resource = { |
| 777 | .start = 0x20000000, |
| 778 | .end = 0x207fffff, |
| 779 | .flags = IORESOURCE_MEM, |
| 780 | }; |
| 781 | |
| 782 | static struct platform_device para_flash_device = { |
| 783 | .name = "physmap-flash", |
| 784 | .id = 0, |
| 785 | .dev = { |
| 786 | .platform_data = ¶_flash_data, |
| 787 | }, |
| 788 | .num_resources = 1, |
| 789 | .resource = ¶_flash_resource, |
| 790 | }; |
| 791 | #endif |
| 792 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 793 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 794 | /* all SPI peripherals info goes here */ |
| 795 | #if defined(CONFIG_MTD_M25P80) \ |
| 796 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 797 | /* SPI flash chip (m25p16) */ |
| 798 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 799 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 800 | .name = "bootloader(spi)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 801 | .size = 0x00040000, |
| 802 | .offset = 0, |
| 803 | .mask_flags = MTD_CAP_ROM |
| 804 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 805 | .name = "linux kernel(spi)", |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 806 | .size = 0x1c0000, |
| 807 | .offset = 0x40000 |
| 808 | } |
| 809 | }; |
| 810 | |
| 811 | static struct flash_platform_data bfin_spi_flash_data = { |
| 812 | .name = "m25p80", |
| 813 | .parts = bfin_spi_flash_partitions, |
| 814 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 815 | .type = "m25p16", |
| 816 | }; |
| 817 | |
| 818 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 819 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 820 | .bits_per_word = 8, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 821 | }; |
| 822 | #endif |
| 823 | |
| 824 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 825 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 826 | .enable_dma = 0, |
| 827 | .bits_per_word = 16, |
| 828 | }; |
| 829 | |
| 830 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 831 | .model = 7877, |
| 832 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 833 | .x_plate_ohms = 419, |
| 834 | .y_plate_ohms = 486, |
| 835 | .pressure_max = 1000, |
| 836 | .pressure_min = 0, |
| 837 | .stopacq_polarity = 1, |
| 838 | .first_conversion_delay = 3, |
| 839 | .acquisition_time = 1, |
| 840 | .averaging = 1, |
| 841 | .pen_down_acc_interval = 1, |
| 842 | }; |
| 843 | #endif |
| 844 | |
| 845 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 846 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 847 | .enable_dma = 0, |
| 848 | .bits_per_word = 8, |
| 849 | }; |
| 850 | #endif |
| 851 | |
| 852 | static struct spi_board_info bf54x_spi_board_info[] __initdata = { |
| 853 | #if defined(CONFIG_MTD_M25P80) \ |
| 854 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 855 | { |
| 856 | /* the modalias must be the same as spi device driver name */ |
| 857 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 858 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 859 | .bus_num = 0, /* Framework bus number */ |
| 860 | .chip_select = 1, /* SPI_SSEL1*/ |
| 861 | .platform_data = &bfin_spi_flash_data, |
| 862 | .controller_data = &spi_flash_chip_info, |
| 863 | .mode = SPI_MODE_3, |
| 864 | }, |
| 865 | #endif |
| 866 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 867 | { |
| 868 | .modalias = "ad7877", |
| 869 | .platform_data = &bfin_ad7877_ts_info, |
| 870 | .irq = IRQ_PJ11, |
| 871 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 872 | .bus_num = 0, |
| 873 | .chip_select = 2, |
| 874 | .controller_data = &spi_ad7877_chip_info, |
| 875 | }, |
| 876 | #endif |
| 877 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 878 | { |
| 879 | .modalias = "spidev", |
| 880 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 881 | .bus_num = 0, |
| 882 | .chip_select = 1, |
| 883 | .controller_data = &spidev_chip_info, |
| 884 | }, |
| 885 | #endif |
| 886 | }; |
| 887 | |
| 888 | /* SPI (0) */ |
| 889 | static struct resource bfin_spi0_resource[] = { |
| 890 | [0] = { |
| 891 | .start = SPI0_REGBASE, |
| 892 | .end = SPI0_REGBASE + 0xFF, |
| 893 | .flags = IORESOURCE_MEM, |
| 894 | }, |
| 895 | [1] = { |
| 896 | .start = CH_SPI0, |
| 897 | .end = CH_SPI0, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 898 | .flags = IORESOURCE_DMA, |
| 899 | }, |
| 900 | [2] = { |
| 901 | .start = IRQ_SPI0, |
| 902 | .end = IRQ_SPI0, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 903 | .flags = IORESOURCE_IRQ, |
| 904 | } |
| 905 | }; |
| 906 | |
| 907 | /* SPI (1) */ |
| 908 | static struct resource bfin_spi1_resource[] = { |
| 909 | [0] = { |
| 910 | .start = SPI1_REGBASE, |
| 911 | .end = SPI1_REGBASE + 0xFF, |
| 912 | .flags = IORESOURCE_MEM, |
| 913 | }, |
| 914 | [1] = { |
| 915 | .start = CH_SPI1, |
| 916 | .end = CH_SPI1, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 917 | .flags = IORESOURCE_DMA, |
| 918 | }, |
| 919 | [2] = { |
| 920 | .start = IRQ_SPI1, |
| 921 | .end = IRQ_SPI1, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 922 | .flags = IORESOURCE_IRQ, |
| 923 | } |
| 924 | }; |
| 925 | |
| 926 | /* SPI controller data */ |
| 927 | static struct bfin5xx_spi_master bf54x_spi_master_info0 = { |
Yi Li | 4e4d496 | 2009-08-30 20:45:50 +0000 | [diff] [blame] | 928 | .num_chipselect = 3, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 929 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 930 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
| 931 | }; |
| 932 | |
| 933 | static struct platform_device bf54x_spi_master0 = { |
| 934 | .name = "bfin-spi", |
| 935 | .id = 0, /* Bus number */ |
| 936 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 937 | .resource = bfin_spi0_resource, |
| 938 | .dev = { |
| 939 | .platform_data = &bf54x_spi_master_info0, /* Passed to driver */ |
| 940 | }, |
| 941 | }; |
| 942 | |
| 943 | static struct bfin5xx_spi_master bf54x_spi_master_info1 = { |
Yi Li | 4e4d496 | 2009-08-30 20:45:50 +0000 | [diff] [blame] | 944 | .num_chipselect = 3, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 945 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 946 | .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, |
| 947 | }; |
| 948 | |
| 949 | static struct platform_device bf54x_spi_master1 = { |
| 950 | .name = "bfin-spi", |
| 951 | .id = 1, /* Bus number */ |
| 952 | .num_resources = ARRAY_SIZE(bfin_spi1_resource), |
| 953 | .resource = bfin_spi1_resource, |
| 954 | .dev = { |
| 955 | .platform_data = &bf54x_spi_master_info1, /* Passed to driver */ |
| 956 | }, |
| 957 | }; |
| 958 | #endif /* spi master and devices */ |
| 959 | |
| 960 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 961 | static struct resource bfin_twi0_resource[] = { |
| 962 | [0] = { |
| 963 | .start = TWI0_REGBASE, |
| 964 | .end = TWI0_REGBASE + 0xFF, |
| 965 | .flags = IORESOURCE_MEM, |
| 966 | }, |
| 967 | [1] = { |
| 968 | .start = IRQ_TWI0, |
| 969 | .end = IRQ_TWI0, |
| 970 | .flags = IORESOURCE_IRQ, |
| 971 | }, |
| 972 | }; |
| 973 | |
| 974 | static struct platform_device i2c_bfin_twi0_device = { |
| 975 | .name = "i2c-bfin-twi", |
| 976 | .id = 0, |
| 977 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 978 | .resource = bfin_twi0_resource, |
| 979 | }; |
| 980 | |
| 981 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
| 982 | static struct resource bfin_twi1_resource[] = { |
| 983 | [0] = { |
| 984 | .start = TWI1_REGBASE, |
| 985 | .end = TWI1_REGBASE + 0xFF, |
| 986 | .flags = IORESOURCE_MEM, |
| 987 | }, |
| 988 | [1] = { |
| 989 | .start = IRQ_TWI1, |
| 990 | .end = IRQ_TWI1, |
| 991 | .flags = IORESOURCE_IRQ, |
| 992 | }, |
| 993 | }; |
| 994 | |
| 995 | static struct platform_device i2c_bfin_twi1_device = { |
| 996 | .name = "i2c-bfin-twi", |
| 997 | .id = 1, |
| 998 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), |
| 999 | .resource = bfin_twi1_resource, |
| 1000 | }; |
| 1001 | #endif |
| 1002 | #endif |
| 1003 | |
| 1004 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 1005 | #include <linux/gpio_keys.h> |
| 1006 | |
| 1007 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 1008 | {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"}, |
| 1009 | }; |
| 1010 | |
| 1011 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 1012 | .buttons = bfin_gpio_keys_table, |
| 1013 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 1014 | }; |
| 1015 | |
| 1016 | static struct platform_device bfin_device_gpiokeys = { |
| 1017 | .name = "gpio-keys", |
| 1018 | .dev = { |
| 1019 | .platform_data = &bfin_gpio_keys_data, |
| 1020 | }, |
| 1021 | }; |
| 1022 | #endif |
| 1023 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 1024 | static const unsigned int cclk_vlev_datasheet[] = |
| 1025 | { |
| 1026 | /* |
| 1027 | * Internal VLEV BF54XSBBC1533 |
| 1028 | ****temporarily using these values until data sheet is updated |
| 1029 | */ |
| 1030 | VRPAIR(VLEV_085, 150000000), |
| 1031 | VRPAIR(VLEV_090, 250000000), |
| 1032 | VRPAIR(VLEV_110, 276000000), |
| 1033 | VRPAIR(VLEV_115, 301000000), |
| 1034 | VRPAIR(VLEV_120, 525000000), |
| 1035 | VRPAIR(VLEV_125, 550000000), |
| 1036 | VRPAIR(VLEV_130, 600000000), |
| 1037 | }; |
| 1038 | |
| 1039 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 1040 | .tuple_tab = cclk_vlev_datasheet, |
| 1041 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 1042 | .vr_settling_time = 25 /* us */, |
| 1043 | }; |
| 1044 | |
| 1045 | static struct platform_device bfin_dpmc = { |
| 1046 | .name = "bfin dpmc", |
| 1047 | .dev = { |
| 1048 | .platform_data = &bfin_dmpc_vreg_data, |
| 1049 | }, |
| 1050 | }; |
| 1051 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1052 | static struct platform_device *cm_bf548_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 1053 | |
| 1054 | &bfin_dpmc, |
| 1055 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1056 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 1057 | &rtc_device, |
| 1058 | #endif |
| 1059 | |
| 1060 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 1061 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 1062 | &bfin_uart0_device, |
| 1063 | #endif |
| 1064 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 1065 | &bfin_uart1_device, |
| 1066 | #endif |
| 1067 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 1068 | &bfin_uart2_device, |
| 1069 | #endif |
| 1070 | #ifdef CONFIG_SERIAL_BFIN_UART3 |
| 1071 | &bfin_uart3_device, |
| 1072 | #endif |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1073 | #endif |
| 1074 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 1075 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 1076 | #ifdef CONFIG_BFIN_SIR0 |
| 1077 | &bfin_sir0_device, |
| 1078 | #endif |
| 1079 | #ifdef CONFIG_BFIN_SIR1 |
| 1080 | &bfin_sir1_device, |
| 1081 | #endif |
| 1082 | #ifdef CONFIG_BFIN_SIR2 |
| 1083 | &bfin_sir2_device, |
| 1084 | #endif |
| 1085 | #ifdef CONFIG_BFIN_SIR3 |
| 1086 | &bfin_sir3_device, |
| 1087 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 1088 | #endif |
| 1089 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1090 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 1091 | &bf54x_lq043_device, |
| 1092 | #endif |
| 1093 | |
| 1094 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 1095 | &smsc911x_device, |
| 1096 | #endif |
| 1097 | |
| 1098 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 1099 | &musb_device, |
| 1100 | #endif |
| 1101 | |
Sonic Zhang | df5de26 | 2009-09-23 05:01:56 +0000 | [diff] [blame] | 1102 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 1103 | #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART |
| 1104 | &bfin_sport0_uart_device, |
| 1105 | #endif |
| 1106 | #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART |
| 1107 | &bfin_sport1_uart_device, |
| 1108 | #endif |
| 1109 | #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART |
| 1110 | &bfin_sport2_uart_device, |
| 1111 | #endif |
| 1112 | #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART |
| 1113 | &bfin_sport3_uart_device, |
| 1114 | #endif |
| 1115 | #endif |
| 1116 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1117 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 1118 | &bfin_atapi_device, |
| 1119 | #endif |
| 1120 | |
| 1121 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 1122 | &bf5xx_nand_device, |
| 1123 | #endif |
| 1124 | |
| 1125 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
| 1126 | &bf54x_sdh_device, |
| 1127 | #endif |
| 1128 | |
| 1129 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 1130 | &bf54x_spi_master0, |
| 1131 | &bf54x_spi_master1, |
| 1132 | #endif |
| 1133 | |
| 1134 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 1135 | &bf54x_kpad_device, |
| 1136 | #endif |
| 1137 | |
| 1138 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
Mike Frysinger | 10a88a2 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 1139 | &i2c_bfin_twi0_device, |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1140 | #if !defined(CONFIG_BF542) |
| 1141 | &i2c_bfin_twi1_device, |
| 1142 | #endif |
| 1143 | #endif |
| 1144 | |
| 1145 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 1146 | &bfin_device_gpiokeys, |
| 1147 | #endif |
Mike Frysinger | 2de73e7 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 1148 | |
| 1149 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 1150 | ¶_flash_device, |
| 1151 | #endif |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1152 | }; |
| 1153 | |
| 1154 | static int __init cm_bf548_init(void) |
| 1155 | { |
Michael Hennerich | f086f23 | 2008-05-20 16:42:39 +0800 | [diff] [blame] | 1156 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1157 | platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices)); |
| 1158 | |
| 1159 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 1160 | spi_register_board_info(bf54x_spi_board_info, |
| 1161 | ARRAY_SIZE(bf54x_spi_board_info)); |
| 1162 | #endif |
| 1163 | |
| 1164 | return 0; |
| 1165 | } |
| 1166 | |
| 1167 | arch_initcall(cm_bf548_init); |
Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame^] | 1168 | |
| 1169 | static struct platform_device *cm_bf548_early_devices[] __initdata = { |
| 1170 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) |
| 1171 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 1172 | &bfin_uart0_device, |
| 1173 | #endif |
| 1174 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 1175 | &bfin_uart1_device, |
| 1176 | #endif |
| 1177 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 1178 | &bfin_uart2_device, |
| 1179 | #endif |
| 1180 | #ifdef CONFIG_SERIAL_BFIN_UART3 |
| 1181 | &bfin_uart3_device, |
| 1182 | #endif |
| 1183 | #endif |
| 1184 | |
| 1185 | #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE) |
| 1186 | #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART |
| 1187 | &bfin_sport0_uart_device, |
| 1188 | #endif |
| 1189 | #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART |
| 1190 | &bfin_sport1_uart_device, |
| 1191 | #endif |
| 1192 | #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART |
| 1193 | &bfin_sport2_uart_device, |
| 1194 | #endif |
| 1195 | #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART |
| 1196 | &bfin_sport3_uart_device, |
| 1197 | #endif |
| 1198 | #endif |
| 1199 | }; |
| 1200 | |
| 1201 | void __init native_machine_early_platform_add_devices(void) |
| 1202 | { |
| 1203 | printk(KERN_INFO "register early platform devices\n"); |
| 1204 | early_platform_add_devices(cm_bf548_early_devices, |
| 1205 | ARRAY_SIZE(cm_bf548_early_devices)); |
| 1206 | } |