]> bbs.cooldavid.org Git - net-next-2.6.git/blob - arch/blackfin/mach-bf548/boards/cm_bf548.c
Blackfin: move on-chip UART resources to boards files
[net-next-2.6.git] / arch / blackfin / mach-bf548 / boards / cm_bf548.c
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
3  *           2008-2009 Bluetechnix
4  *                2005 National ICT Australia (NICTA)
5  *                      Aidan Williams <aidan@nicta.com.au>
6  *
7  * Licensed under the GPL-2 or later.
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>
14 #include <linux/mtd/physmap.h>
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>
21 #include <asm/dma.h>
22 #include <asm/gpio.h>
23 #include <asm/nand.h>
24 #include <asm/portmux.h>
25 #include <asm/bfin_sdh.h>
26 #include <mach/bf54x_keys.h>
27 #include <asm/dpmc.h>
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
42 #include <mach/bf54x-lq043.h>
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 #ifdef CONFIG_SERIAL_BFIN_UART0
131 static struct resource bfin_uart0_resources[] = {
132         {
133                 .start = UART0_DLL,
134                 .end = UART0_RBR+2,
135                 .flags = IORESOURCE_MEM,
136         },
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 };
172 #endif
173 #ifdef CONFIG_SERIAL_BFIN_UART1
174 static struct resource bfin_uart1_resources[] = {
175         {
176                 .start = UART1_DLL,
177                 .end = UART1_RBR+2,
178                 .flags = IORESOURCE_MEM,
179         },
180         {
181                 .start = IRQ_UART1_RX,
182                 .end = IRQ_UART1_RX+1,
183                 .flags = IORESOURCE_IRQ,
184         },
185         {
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,
210         },
211 #endif
212 };
213
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 = {
223         .name = "bfin-uart",
224         .id = 1,
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         },
230 };
231 #endif
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
335
336 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
337 #ifdef CONFIG_BFIN_SIR0
338 static struct resource bfin_sir0_resources[] = {
339         {
340                 .start = 0xFFC00400,
341                 .end = 0xFFC004FF,
342                 .flags = IORESOURCE_MEM,
343         },
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 };
361 #endif
362 #ifdef CONFIG_BFIN_SIR1
363 static struct resource bfin_sir1_resources[] = {
364         {
365                 .start = 0xFFC02000,
366                 .end = 0xFFC020FF,
367                 .flags = IORESOURCE_MEM,
368         },
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 };
386 #endif
387 #ifdef CONFIG_BFIN_SIR2
388 static struct resource bfin_sir2_resources[] = {
389         {
390                 .start = 0xFFC02100,
391                 .end = 0xFFC021FF,
392                 .flags = IORESOURCE_MEM,
393         },
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 };
411 #endif
412 #ifdef CONFIG_BFIN_SIR3
413 static struct resource bfin_sir3_resources[] = {
414         {
415                 .start = 0xFFC03100,
416                 .end = 0xFFC031FF,
417                 .flags = IORESOURCE_MEM,
418         },
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         },
429 };
430 static struct platform_device bfin_sir3_device = {
431         .name = "bfin_sir",
432         .id = 3,
433         .num_resources = ARRAY_SIZE(bfin_sir3_resources),
434         .resource = bfin_sir3_resources,
435 };
436 #endif
437 #endif
438
439 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
440 #include <linux/smsc911x.h>
441
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 };
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
463 static struct platform_device smsc911x_device = {
464         .name = "smsc911x",
465         .id = 0,
466         .num_resources = ARRAY_SIZE(smsc911x_resources),
467         .resource = smsc911x_resources,
468         .dev = {
469                 .platform_data = &smsc911x_config,
470         },
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
493 static struct musb_hdrc_config musb_config = {
494         .multipoint     = 0,
495         .dyn_fifo       = 0,
496         .soft_con       = 1,
497         .dma            = 1,
498         .num_eps        = 8,
499         .dma_channels   = 8,
500         .gpio_vrsel     = GPIO_PH6,
501 };
502
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
511         .config         = &musb_config,
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
529 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
530 static struct resource bfin_atapi_resources[] = {
531         {
532                 .start = 0xFFC03800,
533                 .end = 0xFFC0386F,
534                 .flags = IORESOURCE_MEM,
535         },
536         {
537                 .start = IRQ_ATAPI_ERR,
538                 .end = IRQ_ATAPI_ERR,
539                 .flags = IORESOURCE_IRQ,
540         },
541 };
542
543 static struct platform_device bfin_atapi_device = {
544         .name = "pata-bf54x",
545         .id = -1,
546         .num_resources = ARRAY_SIZE(bfin_atapi_resources),
547         .resource = bfin_atapi_resources,
548 };
549 #endif
550
551 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
552 static struct mtd_partition partition_info[] = {
553         {
554                 .name = "linux kernel(nand)",
555                 .offset = 0,
556                 .size = 4 * 1024 * 1024,
557         },
558         {
559                 .name = "file system(nand)",
560                 .offset = 4 * 1024 * 1024,
561                 .size = (256 - 4) * 1024 * 1024,
562         },
563 };
564
565 static struct bf5xx_nand_platform bf5xx_nand_platform = {
566         .page_size = NFC_PG_SIZE_256,
567         .data_width = NFC_NWIDTH_8,
568         .partitions = partition_info,
569         .nr_partitions = ARRAY_SIZE(partition_info),
570         .rd_dly = 3,
571         .wr_dly = 3,
572 };
573
574 static struct resource bf5xx_nand_resources[] = {
575         {
576                 .start = 0xFFC03B00,
577                 .end = 0xFFC03B4F,
578                 .flags = IORESOURCE_MEM,
579         },
580         {
581                 .start = CH_NFC,
582                 .end = CH_NFC,
583                 .flags = IORESOURCE_IRQ,
584         },
585 };
586
587 static struct platform_device bf5xx_nand_device = {
588         .name = "bf5xx-nand",
589         .id = 0,
590         .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
591         .resource = bf5xx_nand_resources,
592         .dev = {
593                 .platform_data = &bf5xx_nand_platform,
594         },
595 };
596 #endif
597
598 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
599 static struct bfin_sd_host bfin_sdh_data = {
600         .dma_chan = CH_SDH,
601         .irq_int0 = IRQ_SDH_MASK0,
602         .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
603 };
604
605 static struct platform_device bf54x_sdh_device = {
606         .name = "bfin-sdh",
607         .id = 0,
608         .dev = {
609                 .platform_data = &bfin_sdh_data,
610         },
611 };
612 #endif
613
614 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
615 static struct mtd_partition para_partitions[] = {
616         {
617                 .name       = "bootloader(nor)",
618                 .size       = 0x40000,
619                 .offset     = 0,
620         }, {
621                 .name       = "linux kernel(nor)",
622                 .size       = 0x100000,
623                 .offset     = MTDPART_OFS_APPEND,
624         }, {
625                 .name       = "file system(nor)",
626                 .size       = MTDPART_SIZ_FULL,
627                 .offset     = MTDPART_OFS_APPEND,
628         }
629 };
630
631 static struct physmap_flash_data para_flash_data = {
632         .width      = 2,
633         .parts      = para_partitions,
634         .nr_parts   = ARRAY_SIZE(para_partitions),
635 };
636
637 static struct resource para_flash_resource = {
638         .start = 0x20000000,
639         .end   = 0x207fffff,
640         .flags = IORESOURCE_MEM,
641 };
642
643 static struct platform_device para_flash_device = {
644         .name          = "physmap-flash",
645         .id            = 0,
646         .dev = {
647                 .platform_data = &para_flash_data,
648         },
649         .num_resources = 1,
650         .resource      = &para_flash_resource,
651 };
652 #endif
653
654 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
655 /* all SPI peripherals info goes here */
656 #if defined(CONFIG_MTD_M25P80) \
657         || defined(CONFIG_MTD_M25P80_MODULE)
658 /* SPI flash chip (m25p16) */
659 static struct mtd_partition bfin_spi_flash_partitions[] = {
660         {
661                 .name = "bootloader(spi)",
662                 .size = 0x00040000,
663                 .offset = 0,
664                 .mask_flags = MTD_CAP_ROM
665         }, {
666                 .name = "linux kernel(spi)",
667                 .size = 0x1c0000,
668                 .offset = 0x40000
669         }
670 };
671
672 static struct flash_platform_data bfin_spi_flash_data = {
673         .name = "m25p80",
674         .parts = bfin_spi_flash_partitions,
675         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
676         .type = "m25p16",
677 };
678
679 static struct bfin5xx_spi_chip spi_flash_chip_info = {
680         .enable_dma = 0,         /* use dma transfer with this chip*/
681         .bits_per_word = 8,
682 };
683 #endif
684
685 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
686 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
687         .enable_dma = 0,
688         .bits_per_word = 16,
689 };
690
691 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
692         .model                  = 7877,
693         .vref_delay_usecs       = 50,   /* internal, no capacitor */
694         .x_plate_ohms           = 419,
695         .y_plate_ohms           = 486,
696         .pressure_max           = 1000,
697         .pressure_min           = 0,
698         .stopacq_polarity       = 1,
699         .first_conversion_delay = 3,
700         .acquisition_time       = 1,
701         .averaging              = 1,
702         .pen_down_acc_interval  = 1,
703 };
704 #endif
705
706 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
707 static struct bfin5xx_spi_chip spidev_chip_info = {
708         .enable_dma = 0,
709         .bits_per_word = 8,
710 };
711 #endif
712
713 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
714 #if defined(CONFIG_MTD_M25P80) \
715         || defined(CONFIG_MTD_M25P80_MODULE)
716         {
717                 /* the modalias must be the same as spi device driver name */
718                 .modalias = "m25p80", /* Name of spi_driver for this device */
719                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
720                 .bus_num = 0, /* Framework bus number */
721                 .chip_select = 1, /* SPI_SSEL1*/
722                 .platform_data = &bfin_spi_flash_data,
723                 .controller_data = &spi_flash_chip_info,
724                 .mode = SPI_MODE_3,
725         },
726 #endif
727 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
728 {
729         .modalias               = "ad7877",
730         .platform_data          = &bfin_ad7877_ts_info,
731         .irq                    = IRQ_PJ11,
732         .max_speed_hz           = 12500000,     /* max spi clock (SCK) speed in HZ */
733         .bus_num                = 0,
734         .chip_select            = 2,
735         .controller_data = &spi_ad7877_chip_info,
736 },
737 #endif
738 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
739         {
740                 .modalias = "spidev",
741                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
742                 .bus_num = 0,
743                 .chip_select = 1,
744                 .controller_data = &spidev_chip_info,
745         },
746 #endif
747 };
748
749 /* SPI (0) */
750 static struct resource bfin_spi0_resource[] = {
751         [0] = {
752                 .start = SPI0_REGBASE,
753                 .end   = SPI0_REGBASE + 0xFF,
754                 .flags = IORESOURCE_MEM,
755         },
756         [1] = {
757                 .start = CH_SPI0,
758                 .end   = CH_SPI0,
759                 .flags = IORESOURCE_DMA,
760         },
761         [2] = {
762                 .start = IRQ_SPI0,
763                 .end   = IRQ_SPI0,
764                 .flags = IORESOURCE_IRQ,
765         }
766 };
767
768 /* SPI (1) */
769 static struct resource bfin_spi1_resource[] = {
770         [0] = {
771                 .start = SPI1_REGBASE,
772                 .end   = SPI1_REGBASE + 0xFF,
773                 .flags = IORESOURCE_MEM,
774         },
775         [1] = {
776                 .start = CH_SPI1,
777                 .end   = CH_SPI1,
778                 .flags = IORESOURCE_DMA,
779         },
780         [2] = {
781                 .start = IRQ_SPI1,
782                 .end   = IRQ_SPI1,
783                 .flags = IORESOURCE_IRQ,
784         }
785 };
786
787 /* SPI controller data */
788 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
789         .num_chipselect = 3,
790         .enable_dma = 1,  /* master has the ability to do dma transfer */
791         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
792 };
793
794 static struct platform_device bf54x_spi_master0 = {
795         .name = "bfin-spi",
796         .id = 0, /* Bus number */
797         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
798         .resource = bfin_spi0_resource,
799         .dev = {
800                 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
801                 },
802 };
803
804 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
805         .num_chipselect = 3,
806         .enable_dma = 1,  /* master has the ability to do dma transfer */
807         .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
808 };
809
810 static struct platform_device bf54x_spi_master1 = {
811         .name = "bfin-spi",
812         .id = 1, /* Bus number */
813         .num_resources = ARRAY_SIZE(bfin_spi1_resource),
814         .resource = bfin_spi1_resource,
815         .dev = {
816                 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
817                 },
818 };
819 #endif  /* spi master and devices */
820
821 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
822 static struct resource bfin_twi0_resource[] = {
823         [0] = {
824                 .start = TWI0_REGBASE,
825                 .end   = TWI0_REGBASE + 0xFF,
826                 .flags = IORESOURCE_MEM,
827         },
828         [1] = {
829                 .start = IRQ_TWI0,
830                 .end   = IRQ_TWI0,
831                 .flags = IORESOURCE_IRQ,
832         },
833 };
834
835 static struct platform_device i2c_bfin_twi0_device = {
836         .name = "i2c-bfin-twi",
837         .id = 0,
838         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
839         .resource = bfin_twi0_resource,
840 };
841
842 #if !defined(CONFIG_BF542)      /* The BF542 only has 1 TWI */
843 static struct resource bfin_twi1_resource[] = {
844         [0] = {
845                 .start = TWI1_REGBASE,
846                 .end   = TWI1_REGBASE + 0xFF,
847                 .flags = IORESOURCE_MEM,
848         },
849         [1] = {
850                 .start = IRQ_TWI1,
851                 .end   = IRQ_TWI1,
852                 .flags = IORESOURCE_IRQ,
853         },
854 };
855
856 static struct platform_device i2c_bfin_twi1_device = {
857         .name = "i2c-bfin-twi",
858         .id = 1,
859         .num_resources = ARRAY_SIZE(bfin_twi1_resource),
860         .resource = bfin_twi1_resource,
861 };
862 #endif
863 #endif
864
865 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
866 #include <linux/gpio_keys.h>
867
868 static struct gpio_keys_button bfin_gpio_keys_table[] = {
869         {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
870 };
871
872 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
873         .buttons        = bfin_gpio_keys_table,
874         .nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
875 };
876
877 static struct platform_device bfin_device_gpiokeys = {
878         .name      = "gpio-keys",
879         .dev = {
880                 .platform_data = &bfin_gpio_keys_data,
881         },
882 };
883 #endif
884
885 static const unsigned int cclk_vlev_datasheet[] =
886 {
887 /*
888  * Internal VLEV BF54XSBBC1533
889  ****temporarily using these values until data sheet is updated
890  */
891         VRPAIR(VLEV_085, 150000000),
892         VRPAIR(VLEV_090, 250000000),
893         VRPAIR(VLEV_110, 276000000),
894         VRPAIR(VLEV_115, 301000000),
895         VRPAIR(VLEV_120, 525000000),
896         VRPAIR(VLEV_125, 550000000),
897         VRPAIR(VLEV_130, 600000000),
898 };
899
900 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
901         .tuple_tab = cclk_vlev_datasheet,
902         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
903         .vr_settling_time = 25 /* us */,
904 };
905
906 static struct platform_device bfin_dpmc = {
907         .name = "bfin dpmc",
908         .dev = {
909                 .platform_data = &bfin_dmpc_vreg_data,
910         },
911 };
912
913 static struct platform_device *cm_bf548_devices[] __initdata = {
914
915         &bfin_dpmc,
916
917 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
918         &rtc_device,
919 #endif
920
921 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
922 #ifdef CONFIG_SERIAL_BFIN_UART0
923         &bfin_uart0_device,
924 #endif
925 #ifdef CONFIG_SERIAL_BFIN_UART1
926         &bfin_uart1_device,
927 #endif
928 #ifdef CONFIG_SERIAL_BFIN_UART2
929         &bfin_uart2_device,
930 #endif
931 #ifdef CONFIG_SERIAL_BFIN_UART3
932         &bfin_uart3_device,
933 #endif
934 #endif
935
936 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
937 #ifdef CONFIG_BFIN_SIR0
938         &bfin_sir0_device,
939 #endif
940 #ifdef CONFIG_BFIN_SIR1
941         &bfin_sir1_device,
942 #endif
943 #ifdef CONFIG_BFIN_SIR2
944         &bfin_sir2_device,
945 #endif
946 #ifdef CONFIG_BFIN_SIR3
947         &bfin_sir3_device,
948 #endif
949 #endif
950
951 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
952         &bf54x_lq043_device,
953 #endif
954
955 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
956         &smsc911x_device,
957 #endif
958
959 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
960         &musb_device,
961 #endif
962
963 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
964         &bfin_atapi_device,
965 #endif
966
967 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
968         &bf5xx_nand_device,
969 #endif
970
971 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
972         &bf54x_sdh_device,
973 #endif
974
975 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
976         &bf54x_spi_master0,
977         &bf54x_spi_master1,
978 #endif
979
980 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
981         &bf54x_kpad_device,
982 #endif
983
984 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
985         &i2c_bfin_twi0_device,
986 #if !defined(CONFIG_BF542)
987         &i2c_bfin_twi1_device,
988 #endif
989 #endif
990
991 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
992         &bfin_device_gpiokeys,
993 #endif
994
995 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
996         &para_flash_device,
997 #endif
998 };
999
1000 static int __init cm_bf548_init(void)
1001 {
1002         printk(KERN_INFO "%s(): registering device resources\n", __func__);
1003         platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
1004
1005 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1006         spi_register_board_info(bf54x_spi_board_info,
1007                         ARRAY_SIZE(bf54x_spi_board_info));
1008 #endif
1009
1010         return 0;
1011 }
1012
1013 arch_initcall(cm_bf548_init);