Blackfin: mass clean up of copyright/licensing info
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / blackfin / mach-bf527 / boards / cm_bf527.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/etherdevice.h>
18 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19 #include <linux/usb/isp1362.h>
20 #endif
21 #include <linux/i2c.h>
22 #include <linux/irq.h>
23 #include <linux/interrupt.h>
24 #include <linux/usb/sl811.h>
25 #include <linux/usb/musb.h>
26 #include <asm/dma.h>
27 #include <asm/bfin5xx_spi.h>
28 #include <asm/reboot.h>
29 #include <asm/nand.h>
30 #include <asm/portmux.h>
31 #include <asm/dpmc.h>
32 #include <linux/spi/ad7877.h>
33
34 /*
35 * Name the Board for the /proc/cpuinfo
36 */
37 const char bfin_board_name[] = "Bluetechnix CM-BF527";
38
39 /*
40 * Driver needs to know address, irq and flag pin.
41 */
42
43 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
44 #include <linux/usb/isp1760.h>
45 static struct resource bfin_isp1760_resources[] = {
46 [0] = {
47 .start = 0x203C0000,
48 .end = 0x203C0000 + 0x000fffff,
49 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
52 .start = IRQ_PF7,
53 .end = IRQ_PF7,
54 .flags = IORESOURCE_IRQ,
55 },
56 };
57
58 static struct isp1760_platform_data isp1760_priv = {
59 .is_isp1761 = 0,
60 .bus_width_16 = 1,
61 .port1_otg = 0,
62 .analog_oc = 0,
63 .dack_polarity_high = 0,
64 .dreq_polarity_high = 0,
65 };
66
67 static struct platform_device bfin_isp1760_device = {
68 .name = "isp1760-hcd",
69 .id = 0,
70 .dev = {
71 .platform_data = &isp1760_priv,
72 },
73 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
74 .resource = bfin_isp1760_resources,
75 };
76 #endif
77
78 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
79 static struct resource musb_resources[] = {
80 [0] = {
81 .start = 0xffc03800,
82 .end = 0xffc03cff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = { /* general IRQ */
86 .start = IRQ_USB_INT0,
87 .end = IRQ_USB_INT0,
88 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
89 },
90 [2] = { /* DMA IRQ */
91 .start = IRQ_USB_DMA,
92 .end = IRQ_USB_DMA,
93 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
94 },
95 };
96
97 static struct musb_hdrc_config musb_config = {
98 .multipoint = 0,
99 .dyn_fifo = 0,
100 .soft_con = 1,
101 .dma = 1,
102 .num_eps = 8,
103 .dma_channels = 8,
104 .gpio_vrsel = GPIO_PF11,
105 };
106
107 static struct musb_hdrc_platform_data musb_plat = {
108 #if defined(CONFIG_USB_MUSB_OTG)
109 .mode = MUSB_OTG,
110 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
111 .mode = MUSB_HOST,
112 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
113 .mode = MUSB_PERIPHERAL,
114 #endif
115 .config = &musb_config,
116 };
117
118 static u64 musb_dmamask = ~(u32)0;
119
120 static struct platform_device musb_device = {
121 .name = "musb_hdrc",
122 .id = 0,
123 .dev = {
124 .dma_mask = &musb_dmamask,
125 .coherent_dma_mask = 0xffffffff,
126 .platform_data = &musb_plat,
127 },
128 .num_resources = ARRAY_SIZE(musb_resources),
129 .resource = musb_resources,
130 };
131 #endif
132
133 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
134 static struct mtd_partition partition_info[] = {
135 {
136 .name = "linux kernel(nand)",
137 .offset = 0,
138 .size = 4 * 1024 * 1024,
139 },
140 {
141 .name = "file system(nand)",
142 .offset = MTDPART_OFS_APPEND,
143 .size = MTDPART_SIZ_FULL,
144 },
145 };
146
147 static struct bf5xx_nand_platform bf5xx_nand_platform = {
148 .page_size = NFC_PG_SIZE_256,
149 .data_width = NFC_NWIDTH_8,
150 .partitions = partition_info,
151 .nr_partitions = ARRAY_SIZE(partition_info),
152 .rd_dly = 3,
153 .wr_dly = 3,
154 };
155
156 static struct resource bf5xx_nand_resources[] = {
157 {
158 .start = NFC_CTL,
159 .end = NFC_DATA_RD + 2,
160 .flags = IORESOURCE_MEM,
161 },
162 {
163 .start = CH_NFC,
164 .end = CH_NFC,
165 .flags = IORESOURCE_IRQ,
166 },
167 };
168
169 static struct platform_device bf5xx_nand_device = {
170 .name = "bf5xx-nand",
171 .id = 0,
172 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
173 .resource = bf5xx_nand_resources,
174 .dev = {
175 .platform_data = &bf5xx_nand_platform,
176 },
177 };
178 #endif
179
180 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
181 static struct resource bfin_pcmcia_cf_resources[] = {
182 {
183 .start = 0x20310000, /* IO PORT */
184 .end = 0x20312000,
185 .flags = IORESOURCE_MEM,
186 }, {
187 .start = 0x20311000, /* Attribute Memory */
188 .end = 0x20311FFF,
189 .flags = IORESOURCE_MEM,
190 }, {
191 .start = IRQ_PF4,
192 .end = IRQ_PF4,
193 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
194 }, {
195 .start = 6, /* Card Detect PF6 */
196 .end = 6,
197 .flags = IORESOURCE_IRQ,
198 },
199 };
200
201 static struct platform_device bfin_pcmcia_cf_device = {
202 .name = "bfin_cf_pcmcia",
203 .id = -1,
204 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
205 .resource = bfin_pcmcia_cf_resources,
206 };
207 #endif
208
209 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
210 static struct platform_device rtc_device = {
211 .name = "rtc-bfin",
212 .id = -1,
213 };
214 #endif
215
216 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
217 #include <linux/smc91x.h>
218
219 static struct smc91x_platdata smc91x_info = {
220 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
221 .leda = RPC_LED_100_10,
222 .ledb = RPC_LED_TX_RX,
223 };
224
225 static struct resource smc91x_resources[] = {
226 {
227 .name = "smc91x-regs",
228 .start = 0x20300300,
229 .end = 0x20300300 + 16,
230 .flags = IORESOURCE_MEM,
231 }, {
232
233 .start = IRQ_PF7,
234 .end = IRQ_PF7,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
236 },
237 };
238 static struct platform_device smc91x_device = {
239 .name = "smc91x",
240 .id = 0,
241 .num_resources = ARRAY_SIZE(smc91x_resources),
242 .resource = smc91x_resources,
243 .dev = {
244 .platform_data = &smc91x_info,
245 },
246 };
247 #endif
248
249 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
250 static struct resource dm9000_resources[] = {
251 [0] = {
252 .start = 0x203FB800,
253 .end = 0x203FB800 + 1,
254 .flags = IORESOURCE_MEM,
255 },
256 [1] = {
257 .start = 0x203FB804,
258 .end = 0x203FB804 + 1,
259 .flags = IORESOURCE_MEM,
260 },
261 [2] = {
262 .start = IRQ_PF9,
263 .end = IRQ_PF9,
264 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
265 },
266 };
267
268 static struct platform_device dm9000_device = {
269 .name = "dm9000",
270 .id = -1,
271 .num_resources = ARRAY_SIZE(dm9000_resources),
272 .resource = dm9000_resources,
273 };
274 #endif
275
276 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
277 static struct resource sl811_hcd_resources[] = {
278 {
279 .start = 0x20340000,
280 .end = 0x20340000,
281 .flags = IORESOURCE_MEM,
282 }, {
283 .start = 0x20340004,
284 .end = 0x20340004,
285 .flags = IORESOURCE_MEM,
286 }, {
287 .start = CONFIG_USB_SL811_BFIN_IRQ,
288 .end = CONFIG_USB_SL811_BFIN_IRQ,
289 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
290 },
291 };
292
293 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
294 void sl811_port_power(struct device *dev, int is_on)
295 {
296 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
297 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
298 }
299 #endif
300
301 static struct sl811_platform_data sl811_priv = {
302 .potpg = 10,
303 .power = 250, /* == 500mA */
304 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
305 .port_power = &sl811_port_power,
306 #endif
307 };
308
309 static struct platform_device sl811_hcd_device = {
310 .name = "sl811-hcd",
311 .id = 0,
312 .dev = {
313 .platform_data = &sl811_priv,
314 },
315 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
316 .resource = sl811_hcd_resources,
317 };
318 #endif
319
320 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
321 static struct resource isp1362_hcd_resources[] = {
322 {
323 .start = 0x20360000,
324 .end = 0x20360000,
325 .flags = IORESOURCE_MEM,
326 }, {
327 .start = 0x20360004,
328 .end = 0x20360004,
329 .flags = IORESOURCE_MEM,
330 }, {
331 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
332 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
333 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
334 },
335 };
336
337 static struct isp1362_platform_data isp1362_priv = {
338 .sel15Kres = 1,
339 .clknotstop = 0,
340 .oc_enable = 0,
341 .int_act_high = 0,
342 .int_edge_triggered = 0,
343 .remote_wakeup_connected = 0,
344 .no_power_switching = 1,
345 .power_switching_mode = 0,
346 };
347
348 static struct platform_device isp1362_hcd_device = {
349 .name = "isp1362-hcd",
350 .id = 0,
351 .dev = {
352 .platform_data = &isp1362_priv,
353 },
354 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
355 .resource = isp1362_hcd_resources,
356 };
357 #endif
358
359 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
360 static struct platform_device bfin_mii_bus = {
361 .name = "bfin_mii_bus",
362 };
363
364 static struct platform_device bfin_mac_device = {
365 .name = "bfin_mac",
366 .dev.platform_data = &bfin_mii_bus,
367 };
368 #endif
369
370 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
371 static struct resource net2272_bfin_resources[] = {
372 {
373 .start = 0x20300000,
374 .end = 0x20300000 + 0x100,
375 .flags = IORESOURCE_MEM,
376 }, {
377 .start = IRQ_PF7,
378 .end = IRQ_PF7,
379 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
380 },
381 };
382
383 static struct platform_device net2272_bfin_device = {
384 .name = "net2272",
385 .id = -1,
386 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
387 .resource = net2272_bfin_resources,
388 };
389 #endif
390
391 #if defined(CONFIG_MTD_M25P80) \
392 || defined(CONFIG_MTD_M25P80_MODULE)
393 static struct mtd_partition bfin_spi_flash_partitions[] = {
394 {
395 .name = "bootloader(spi)",
396 .size = 0x00040000,
397 .offset = 0,
398 .mask_flags = MTD_CAP_ROM
399 }, {
400 .name = "linux kernel(spi)",
401 .size = MTDPART_SIZ_FULL,
402 .offset = MTDPART_OFS_APPEND,
403 }
404 };
405
406 static struct flash_platform_data bfin_spi_flash_data = {
407 .name = "m25p80",
408 .parts = bfin_spi_flash_partitions,
409 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
410 .type = "m25p16",
411 };
412
413 /* SPI flash chip (m25p64) */
414 static struct bfin5xx_spi_chip spi_flash_chip_info = {
415 .enable_dma = 0, /* use dma transfer with this chip*/
416 .bits_per_word = 8,
417 };
418 #endif
419
420 #if defined(CONFIG_BFIN_SPI_ADC) \
421 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
422 /* SPI ADC chip */
423 static struct bfin5xx_spi_chip spi_adc_chip_info = {
424 .enable_dma = 1, /* use dma transfer with this chip*/
425 .bits_per_word = 16,
426 };
427 #endif
428
429 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
430 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
431 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
432 .enable_dma = 0,
433 .bits_per_word = 16,
434 };
435 #endif
436
437 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
438 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
439 .enable_dma = 0,
440 .bits_per_word = 8,
441 };
442 #endif
443
444 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
445 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
446 .enable_dma = 0,
447 .bits_per_word = 16,
448 };
449
450 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
451 .model = 7877,
452 .vref_delay_usecs = 50, /* internal, no capacitor */
453 .x_plate_ohms = 419,
454 .y_plate_ohms = 486,
455 .pressure_max = 1000,
456 .pressure_min = 0,
457 .stopacq_polarity = 1,
458 .first_conversion_delay = 3,
459 .acquisition_time = 1,
460 .averaging = 1,
461 .pen_down_acc_interval = 1,
462 };
463 #endif
464
465 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
466 && defined(CONFIG_SND_SOC_WM8731_SPI)
467 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
468 .enable_dma = 0,
469 .bits_per_word = 16,
470 };
471 #endif
472
473 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
474 static struct bfin5xx_spi_chip spidev_chip_info = {
475 .enable_dma = 0,
476 .bits_per_word = 8,
477 };
478 #endif
479
480 static struct spi_board_info bfin_spi_board_info[] __initdata = {
481 #if defined(CONFIG_MTD_M25P80) \
482 || defined(CONFIG_MTD_M25P80_MODULE)
483 {
484 /* the modalias must be the same as spi device driver name */
485 .modalias = "m25p80", /* Name of spi_driver for this device */
486 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
487 .bus_num = 0, /* Framework bus number */
488 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
489 .platform_data = &bfin_spi_flash_data,
490 .controller_data = &spi_flash_chip_info,
491 .mode = SPI_MODE_3,
492 },
493 #endif
494
495 #if defined(CONFIG_BFIN_SPI_ADC) \
496 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
497 {
498 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
499 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
500 .bus_num = 0, /* Framework bus number */
501 .chip_select = 1, /* Framework chip select. */
502 .platform_data = NULL, /* No spi_driver specific config */
503 .controller_data = &spi_adc_chip_info,
504 },
505 #endif
506
507 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
508 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
509 {
510 .modalias = "ad1836",
511 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
512 .bus_num = 0,
513 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
514 .controller_data = &ad1836_spi_chip_info,
515 },
516 #endif
517 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
518 {
519 .modalias = "mmc_spi",
520 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
521 .bus_num = 0,
522 .chip_select = 5,
523 .controller_data = &mmc_spi_chip_info,
524 .mode = SPI_MODE_3,
525 },
526 #endif
527 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
528 {
529 .modalias = "ad7877",
530 .platform_data = &bfin_ad7877_ts_info,
531 .irq = IRQ_PF8,
532 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
533 .bus_num = 0,
534 .chip_select = 2,
535 .controller_data = &spi_ad7877_chip_info,
536 },
537 #endif
538 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
539 && defined(CONFIG_SND_SOC_WM8731_SPI)
540 {
541 .modalias = "wm8731",
542 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
543 .bus_num = 0,
544 .chip_select = 5,
545 .controller_data = &spi_wm8731_chip_info,
546 .mode = SPI_MODE_0,
547 },
548 #endif
549 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
550 {
551 .modalias = "spidev",
552 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
553 .bus_num = 0,
554 .chip_select = 1,
555 .controller_data = &spidev_chip_info,
556 },
557 #endif
558 };
559
560 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
561 /* SPI controller data */
562 static struct bfin5xx_spi_master bfin_spi0_info = {
563 .num_chipselect = 8,
564 .enable_dma = 1, /* master has the ability to do dma transfer */
565 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
566 };
567
568 /* SPI (0) */
569 static struct resource bfin_spi0_resource[] = {
570 [0] = {
571 .start = SPI0_REGBASE,
572 .end = SPI0_REGBASE + 0xFF,
573 .flags = IORESOURCE_MEM,
574 },
575 [1] = {
576 .start = CH_SPI,
577 .end = CH_SPI,
578 .flags = IORESOURCE_DMA,
579 },
580 [2] = {
581 .start = IRQ_SPI,
582 .end = IRQ_SPI,
583 .flags = IORESOURCE_IRQ,
584 },
585 };
586
587 static struct platform_device bfin_spi0_device = {
588 .name = "bfin-spi",
589 .id = 0, /* Bus number */
590 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
591 .resource = bfin_spi0_resource,
592 .dev = {
593 .platform_data = &bfin_spi0_info, /* Passed to driver */
594 },
595 };
596 #endif /* spi master and devices */
597
598 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
599 static struct platform_device bfin_fb_adv7393_device = {
600 .name = "bfin-adv7393",
601 };
602 #endif
603
604 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
605 static struct mtd_partition cm_partitions[] = {
606 {
607 .name = "bootloader(nor)",
608 .size = 0x40000,
609 .offset = 0,
610 }, {
611 .name = "linux kernel(nor)",
612 .size = 0x100000,
613 .offset = MTDPART_OFS_APPEND,
614 }, {
615 .name = "file system(nor)",
616 .size = MTDPART_SIZ_FULL,
617 .offset = MTDPART_OFS_APPEND,
618 }
619 };
620
621 static struct physmap_flash_data cm_flash_data = {
622 .width = 2,
623 .parts = cm_partitions,
624 .nr_parts = ARRAY_SIZE(cm_partitions),
625 };
626
627 static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };
628
629 static struct resource cm_flash_resource[] = {
630 {
631 .name = "cfi_probe",
632 .start = 0x20000000,
633 .end = 0x201fffff,
634 .flags = IORESOURCE_MEM,
635 }, {
636 .start = (unsigned long)cm_flash_gpios,
637 .end = ARRAY_SIZE(cm_flash_gpios),
638 .flags = IORESOURCE_IRQ,
639 }
640 };
641
642 static struct platform_device cm_flash_device = {
643 .name = "gpio-addr-flash",
644 .id = 0,
645 .dev = {
646 .platform_data = &cm_flash_data,
647 },
648 .num_resources = ARRAY_SIZE(cm_flash_resource),
649 .resource = cm_flash_resource,
650 };
651 #endif
652
653 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
654 static struct resource bfin_uart_resources[] = {
655 #ifdef CONFIG_SERIAL_BFIN_UART0
656 {
657 .start = 0xFFC00400,
658 .end = 0xFFC004FF,
659 .flags = IORESOURCE_MEM,
660 },
661 #endif
662 #ifdef CONFIG_SERIAL_BFIN_UART1
663 {
664 .start = 0xFFC02000,
665 .end = 0xFFC020FF,
666 .flags = IORESOURCE_MEM,
667 },
668 #endif
669 };
670
671 static struct platform_device bfin_uart_device = {
672 .name = "bfin-uart",
673 .id = 1,
674 .num_resources = ARRAY_SIZE(bfin_uart_resources),
675 .resource = bfin_uart_resources,
676 };
677 #endif
678
679 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
680 #ifdef CONFIG_BFIN_SIR0
681 static struct resource bfin_sir0_resources[] = {
682 {
683 .start = 0xFFC00400,
684 .end = 0xFFC004FF,
685 .flags = IORESOURCE_MEM,
686 },
687 {
688 .start = IRQ_UART0_RX,
689 .end = IRQ_UART0_RX+1,
690 .flags = IORESOURCE_IRQ,
691 },
692 {
693 .start = CH_UART0_RX,
694 .end = CH_UART0_RX+1,
695 .flags = IORESOURCE_DMA,
696 },
697 };
698
699 static struct platform_device bfin_sir0_device = {
700 .name = "bfin_sir",
701 .id = 0,
702 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
703 .resource = bfin_sir0_resources,
704 };
705 #endif
706 #ifdef CONFIG_BFIN_SIR1
707 static struct resource bfin_sir1_resources[] = {
708 {
709 .start = 0xFFC02000,
710 .end = 0xFFC020FF,
711 .flags = IORESOURCE_MEM,
712 },
713 {
714 .start = IRQ_UART1_RX,
715 .end = IRQ_UART1_RX+1,
716 .flags = IORESOURCE_IRQ,
717 },
718 {
719 .start = CH_UART1_RX,
720 .end = CH_UART1_RX+1,
721 .flags = IORESOURCE_DMA,
722 },
723 };
724
725 static struct platform_device bfin_sir1_device = {
726 .name = "bfin_sir",
727 .id = 1,
728 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
729 .resource = bfin_sir1_resources,
730 };
731 #endif
732 #endif
733
734 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
735 static struct resource bfin_twi0_resource[] = {
736 [0] = {
737 .start = TWI0_REGBASE,
738 .end = TWI0_REGBASE,
739 .flags = IORESOURCE_MEM,
740 },
741 [1] = {
742 .start = IRQ_TWI,
743 .end = IRQ_TWI,
744 .flags = IORESOURCE_IRQ,
745 },
746 };
747
748 static struct platform_device i2c_bfin_twi_device = {
749 .name = "i2c-bfin-twi",
750 .id = 0,
751 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
752 .resource = bfin_twi0_resource,
753 };
754 #endif
755
756 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
757 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
758 {
759 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
760 },
761 #endif
762 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
763 {
764 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
765 .irq = IRQ_PF8,
766 },
767 #endif
768 };
769
770 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
771 static struct platform_device bfin_sport0_uart_device = {
772 .name = "bfin-sport-uart",
773 .id = 0,
774 };
775
776 static struct platform_device bfin_sport1_uart_device = {
777 .name = "bfin-sport-uart",
778 .id = 1,
779 };
780 #endif
781
782 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
783 #include <linux/input.h>
784 #include <linux/gpio_keys.h>
785
786 static struct gpio_keys_button bfin_gpio_keys_table[] = {
787 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
788 };
789
790 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
791 .buttons = bfin_gpio_keys_table,
792 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
793 };
794
795 static struct platform_device bfin_device_gpiokeys = {
796 .name = "gpio-keys",
797 .dev = {
798 .platform_data = &bfin_gpio_keys_data,
799 },
800 };
801 #endif
802
803 static struct resource bfin_gpios_resources = {
804 .start = 0,
805 .end = MAX_BLACKFIN_GPIOS - 1,
806 .flags = IORESOURCE_IRQ,
807 };
808
809 static struct platform_device bfin_gpios_device = {
810 .name = "simple-gpio",
811 .id = -1,
812 .num_resources = 1,
813 .resource = &bfin_gpios_resources,
814 };
815
816 static const unsigned int cclk_vlev_datasheet[] =
817 {
818 VRPAIR(VLEV_100, 400000000),
819 VRPAIR(VLEV_105, 426000000),
820 VRPAIR(VLEV_110, 500000000),
821 VRPAIR(VLEV_115, 533000000),
822 VRPAIR(VLEV_120, 600000000),
823 };
824
825 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
826 .tuple_tab = cclk_vlev_datasheet,
827 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
828 .vr_settling_time = 25 /* us */,
829 };
830
831 static struct platform_device bfin_dpmc = {
832 .name = "bfin dpmc",
833 .dev = {
834 .platform_data = &bfin_dmpc_vreg_data,
835 },
836 };
837
838 static struct platform_device *cmbf527_devices[] __initdata = {
839
840 &bfin_dpmc,
841
842 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
843 &bf5xx_nand_device,
844 #endif
845
846 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
847 &bfin_pcmcia_cf_device,
848 #endif
849
850 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
851 &rtc_device,
852 #endif
853
854 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
855 &sl811_hcd_device,
856 #endif
857
858 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
859 &isp1362_hcd_device,
860 #endif
861
862 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
863 &bfin_isp1760_device,
864 #endif
865
866 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
867 &musb_device,
868 #endif
869
870 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
871 &smc91x_device,
872 #endif
873
874 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
875 &dm9000_device,
876 #endif
877
878 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
879 &bfin_mii_bus,
880 &bfin_mac_device,
881 #endif
882
883 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
884 &net2272_bfin_device,
885 #endif
886
887 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
888 &bfin_spi0_device,
889 #endif
890
891 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
892 &bfin_fb_adv7393_device,
893 #endif
894
895 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
896 &bfin_uart_device,
897 #endif
898
899 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
900 #ifdef CONFIG_BFIN_SIR0
901 &bfin_sir0_device,
902 #endif
903 #ifdef CONFIG_BFIN_SIR1
904 &bfin_sir1_device,
905 #endif
906 #endif
907
908 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
909 &i2c_bfin_twi_device,
910 #endif
911
912 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
913 &bfin_sport0_uart_device,
914 &bfin_sport1_uart_device,
915 #endif
916
917 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
918 &bfin_device_gpiokeys,
919 #endif
920
921 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
922 &cm_flash_device,
923 #endif
924
925 &bfin_gpios_device,
926 };
927
928 static int __init cm_init(void)
929 {
930 printk(KERN_INFO "%s(): registering device resources\n", __func__);
931 i2c_register_board_info(0, bfin_i2c_board_info,
932 ARRAY_SIZE(bfin_i2c_board_info));
933 platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));
934 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
935 return 0;
936 }
937
938 arch_initcall(cm_init);
939
940 void native_machine_restart(char *cmd)
941 {
942 /* workaround reboot hang when booting from SPI */
943 if ((bfin_read_SYSCR() & 0x7) == 0x3)
944 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
945 }
946
947 void bfin_get_ether_addr(char *addr)
948 {
949 random_ether_addr(addr);
950 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
951 }
952 EXPORT_SYMBOL(bfin_get_ether_addr);