mm-only debug patch...
[mmotm.git] / arch / blackfin / mach-bf527 / boards / cm_bf527.c
blobf1996b13a3daf1844b598a6b45cb8b7c3c1e8c10
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>
7 * Licensed under the GPL-2 or later.
8 */
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>
35 * Name the Board for the /proc/cpuinfo
37 const char bfin_board_name[] = "Bluetechnix CM-BF527";
40 * Driver needs to know address, irq and flag pin.
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,
51 [1] = {
52 .start = IRQ_PF7,
53 .end = IRQ_PF7,
54 .flags = IORESOURCE_IRQ,
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,
67 static struct platform_device bfin_isp1760_device = {
68 .name = "isp1760-hcd",
69 .id = 0,
70 .dev = {
71 .platform_data = &isp1760_priv,
73 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
74 .resource = bfin_isp1760_resources,
76 #endif
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,
85 [1] = { /* general IRQ */
86 .start = IRQ_USB_INT0,
87 .end = IRQ_USB_INT0,
88 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
90 [2] = { /* DMA IRQ */
91 .start = IRQ_USB_DMA,
92 .end = IRQ_USB_DMA,
93 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
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,
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,
118 static u64 musb_dmamask = ~(u32)0;
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,
128 .num_resources = ARRAY_SIZE(musb_resources),
129 .resource = musb_resources,
131 #endif
133 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
134 static struct mtd_partition partition_info[] = {
136 .name = "linux kernel(nand)",
137 .offset = 0,
138 .size = 4 * 1024 * 1024,
141 .name = "file system(nand)",
142 .offset = MTDPART_OFS_APPEND,
143 .size = MTDPART_SIZ_FULL,
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,
156 static struct resource bf5xx_nand_resources[] = {
158 .start = NFC_CTL,
159 .end = NFC_DATA_RD + 2,
160 .flags = IORESOURCE_MEM,
163 .start = CH_NFC,
164 .end = CH_NFC,
165 .flags = IORESOURCE_IRQ,
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,
178 #endif
180 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
181 static struct resource bfin_pcmcia_cf_resources[] = {
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,
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,
207 #endif
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,
214 #endif
216 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
217 #include <linux/smc91x.h>
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,
225 static struct resource smc91x_resources[] = {
227 .name = "smc91x-regs",
228 .start = 0x20300300,
229 .end = 0x20300300 + 16,
230 .flags = IORESOURCE_MEM,
231 }, {
233 .start = IRQ_PF7,
234 .end = IRQ_PF7,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
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,
247 #endif
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,
256 [1] = {
257 .start = 0x203FB804,
258 .end = 0x203FB804 + 1,
259 .flags = IORESOURCE_MEM,
261 [2] = {
262 .start = IRQ_PF9,
263 .end = IRQ_PF9,
264 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
268 static struct platform_device dm9000_device = {
269 .name = "dm9000",
270 .id = -1,
271 .num_resources = ARRAY_SIZE(dm9000_resources),
272 .resource = dm9000_resources,
274 #endif
276 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
277 static struct resource sl811_hcd_resources[] = {
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,
293 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
294 void sl811_port_power(struct device *dev, int is_on)
296 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
297 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
299 #endif
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
309 static struct platform_device sl811_hcd_device = {
310 .name = "sl811-hcd",
311 .id = 0,
312 .dev = {
313 .platform_data = &sl811_priv,
315 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
316 .resource = sl811_hcd_resources,
318 #endif
320 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
321 static struct resource isp1362_hcd_resources[] = {
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,
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,
348 static struct platform_device isp1362_hcd_device = {
349 .name = "isp1362-hcd",
350 .id = 0,
351 .dev = {
352 .platform_data = &isp1362_priv,
354 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
355 .resource = isp1362_hcd_resources,
357 #endif
359 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
360 static struct platform_device bfin_mii_bus = {
361 .name = "bfin_mii_bus",
364 static struct platform_device bfin_mac_device = {
365 .name = "bfin_mac",
366 .dev.platform_data = &bfin_mii_bus,
368 #endif
370 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
371 static struct resource net2272_bfin_resources[] = {
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,
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,
389 #endif
391 #if defined(CONFIG_MTD_M25P80) \
392 || defined(CONFIG_MTD_M25P80_MODULE)
393 static struct mtd_partition bfin_spi_flash_partitions[] = {
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,
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",
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,
418 #endif
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,
427 #endif
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,
435 #endif
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,
442 #endif
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,
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,
463 #endif
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,
471 #endif
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,
478 #endif
480 static struct spi_board_info bfin_spi_board_info[] __initdata = {
481 #if defined(CONFIG_MTD_M25P80) \
482 || defined(CONFIG_MTD_M25P80_MODULE)
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,
493 #endif
495 #if defined(CONFIG_BFIN_SPI_ADC) \
496 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
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,
505 #endif
507 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
508 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
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,
516 #endif
517 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
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,
526 #endif
527 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
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,
537 #endif
538 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
539 && defined(CONFIG_SND_SOC_WM8731_SPI)
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,
548 #endif
549 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
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,
557 #endif
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},
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,
575 [1] = {
576 .start = CH_SPI,
577 .end = CH_SPI,
578 .flags = IORESOURCE_DMA,
580 [2] = {
581 .start = IRQ_SPI,
582 .end = IRQ_SPI,
583 .flags = IORESOURCE_IRQ,
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 */
596 #endif /* spi master and devices */
598 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
599 static struct mtd_partition cm_partitions[] = {
601 .name = "bootloader(nor)",
602 .size = 0x40000,
603 .offset = 0,
604 }, {
605 .name = "linux kernel(nor)",
606 .size = 0x100000,
607 .offset = MTDPART_OFS_APPEND,
608 }, {
609 .name = "file system(nor)",
610 .size = MTDPART_SIZ_FULL,
611 .offset = MTDPART_OFS_APPEND,
615 static struct physmap_flash_data cm_flash_data = {
616 .width = 2,
617 .parts = cm_partitions,
618 .nr_parts = ARRAY_SIZE(cm_partitions),
621 static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };
623 static struct resource cm_flash_resource[] = {
625 .name = "cfi_probe",
626 .start = 0x20000000,
627 .end = 0x201fffff,
628 .flags = IORESOURCE_MEM,
629 }, {
630 .start = (unsigned long)cm_flash_gpios,
631 .end = ARRAY_SIZE(cm_flash_gpios),
632 .flags = IORESOURCE_IRQ,
636 static struct platform_device cm_flash_device = {
637 .name = "gpio-addr-flash",
638 .id = 0,
639 .dev = {
640 .platform_data = &cm_flash_data,
642 .num_resources = ARRAY_SIZE(cm_flash_resource),
643 .resource = cm_flash_resource,
645 #endif
647 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
648 static struct resource bfin_uart_resources[] = {
649 #ifdef CONFIG_SERIAL_BFIN_UART0
651 .start = 0xFFC00400,
652 .end = 0xFFC004FF,
653 .flags = IORESOURCE_MEM,
655 #endif
656 #ifdef CONFIG_SERIAL_BFIN_UART1
658 .start = 0xFFC02000,
659 .end = 0xFFC020FF,
660 .flags = IORESOURCE_MEM,
662 #endif
665 static struct platform_device bfin_uart_device = {
666 .name = "bfin-uart",
667 .id = 1,
668 .num_resources = ARRAY_SIZE(bfin_uart_resources),
669 .resource = bfin_uart_resources,
671 #endif
673 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
674 #ifdef CONFIG_BFIN_SIR0
675 static struct resource bfin_sir0_resources[] = {
677 .start = 0xFFC00400,
678 .end = 0xFFC004FF,
679 .flags = IORESOURCE_MEM,
682 .start = IRQ_UART0_RX,
683 .end = IRQ_UART0_RX+1,
684 .flags = IORESOURCE_IRQ,
687 .start = CH_UART0_RX,
688 .end = CH_UART0_RX+1,
689 .flags = IORESOURCE_DMA,
693 static struct platform_device bfin_sir0_device = {
694 .name = "bfin_sir",
695 .id = 0,
696 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
697 .resource = bfin_sir0_resources,
699 #endif
700 #ifdef CONFIG_BFIN_SIR1
701 static struct resource bfin_sir1_resources[] = {
703 .start = 0xFFC02000,
704 .end = 0xFFC020FF,
705 .flags = IORESOURCE_MEM,
708 .start = IRQ_UART1_RX,
709 .end = IRQ_UART1_RX+1,
710 .flags = IORESOURCE_IRQ,
713 .start = CH_UART1_RX,
714 .end = CH_UART1_RX+1,
715 .flags = IORESOURCE_DMA,
719 static struct platform_device bfin_sir1_device = {
720 .name = "bfin_sir",
721 .id = 1,
722 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
723 .resource = bfin_sir1_resources,
725 #endif
726 #endif
728 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
729 static struct resource bfin_twi0_resource[] = {
730 [0] = {
731 .start = TWI0_REGBASE,
732 .end = TWI0_REGBASE,
733 .flags = IORESOURCE_MEM,
735 [1] = {
736 .start = IRQ_TWI,
737 .end = IRQ_TWI,
738 .flags = IORESOURCE_IRQ,
742 static struct platform_device i2c_bfin_twi_device = {
743 .name = "i2c-bfin-twi",
744 .id = 0,
745 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
746 .resource = bfin_twi0_resource,
748 #endif
750 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
751 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
753 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
755 #endif
756 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
758 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
759 .irq = IRQ_PF8,
761 #endif
762 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
764 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
766 #endif
769 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
770 static struct platform_device bfin_sport0_uart_device = {
771 .name = "bfin-sport-uart",
772 .id = 0,
775 static struct platform_device bfin_sport1_uart_device = {
776 .name = "bfin-sport-uart",
777 .id = 1,
779 #endif
781 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
782 #include <linux/input.h>
783 #include <linux/gpio_keys.h>
785 static struct gpio_keys_button bfin_gpio_keys_table[] = {
786 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
789 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
790 .buttons = bfin_gpio_keys_table,
791 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
794 static struct platform_device bfin_device_gpiokeys = {
795 .name = "gpio-keys",
796 .dev = {
797 .platform_data = &bfin_gpio_keys_data,
800 #endif
802 static const unsigned int cclk_vlev_datasheet[] =
804 VRPAIR(VLEV_100, 400000000),
805 VRPAIR(VLEV_105, 426000000),
806 VRPAIR(VLEV_110, 500000000),
807 VRPAIR(VLEV_115, 533000000),
808 VRPAIR(VLEV_120, 600000000),
811 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
812 .tuple_tab = cclk_vlev_datasheet,
813 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
814 .vr_settling_time = 25 /* us */,
817 static struct platform_device bfin_dpmc = {
818 .name = "bfin dpmc",
819 .dev = {
820 .platform_data = &bfin_dmpc_vreg_data,
824 static struct platform_device *cmbf527_devices[] __initdata = {
826 &bfin_dpmc,
828 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
829 &bf5xx_nand_device,
830 #endif
832 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
833 &bfin_pcmcia_cf_device,
834 #endif
836 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
837 &rtc_device,
838 #endif
840 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
841 &sl811_hcd_device,
842 #endif
844 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
845 &isp1362_hcd_device,
846 #endif
848 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
849 &bfin_isp1760_device,
850 #endif
852 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
853 &musb_device,
854 #endif
856 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
857 &smc91x_device,
858 #endif
860 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
861 &dm9000_device,
862 #endif
864 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
865 &bfin_mii_bus,
866 &bfin_mac_device,
867 #endif
869 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
870 &net2272_bfin_device,
871 #endif
873 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
874 &bfin_spi0_device,
875 #endif
877 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
878 &bfin_uart_device,
879 #endif
881 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
882 #ifdef CONFIG_BFIN_SIR0
883 &bfin_sir0_device,
884 #endif
885 #ifdef CONFIG_BFIN_SIR1
886 &bfin_sir1_device,
887 #endif
888 #endif
890 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
891 &i2c_bfin_twi_device,
892 #endif
894 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
895 &bfin_sport0_uart_device,
896 &bfin_sport1_uart_device,
897 #endif
899 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
900 &bfin_device_gpiokeys,
901 #endif
903 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
904 &cm_flash_device,
905 #endif
908 static int __init cm_init(void)
910 printk(KERN_INFO "%s(): registering device resources\n", __func__);
911 i2c_register_board_info(0, bfin_i2c_board_info,
912 ARRAY_SIZE(bfin_i2c_board_info));
913 platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));
914 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
915 return 0;
918 arch_initcall(cm_init);
920 void native_machine_restart(char *cmd)
922 /* workaround reboot hang when booting from SPI */
923 if ((bfin_read_SYSCR() & 0x7) == 0x3)
924 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
927 void bfin_get_ether_addr(char *addr)
929 random_ether_addr(addr);
930 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
932 EXPORT_SYMBOL(bfin_get_ether_addr);