RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / blackfin / mach-bf527 / boards / cm_bf527.c
blob4e17d8b8b263f501277d8267790aa41148283671
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 #include <linux/i2c.h>
19 #include <linux/irq.h>
20 #include <linux/interrupt.h>
21 #include <linux/usb/musb.h>
22 #include <asm/dma.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/reboot.h>
25 #include <asm/nand.h>
26 #include <asm/portmux.h>
27 #include <asm/dpmc.h>
28 #include <linux/spi/ad7877.h>
31 * Name the Board for the /proc/cpuinfo
33 const char bfin_board_name[] = "Bluetechnix CM-BF527";
36 * Driver needs to know address, irq and flag pin.
39 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
40 #include <linux/usb/isp1760.h>
41 static struct resource bfin_isp1760_resources[] = {
42 [0] = {
43 .start = 0x203C0000,
44 .end = 0x203C0000 + 0x000fffff,
45 .flags = IORESOURCE_MEM,
47 [1] = {
48 .start = IRQ_PF7,
49 .end = IRQ_PF7,
50 .flags = IORESOURCE_IRQ,
54 static struct isp1760_platform_data isp1760_priv = {
55 .is_isp1761 = 0,
56 .bus_width_16 = 1,
57 .port1_otg = 0,
58 .analog_oc = 0,
59 .dack_polarity_high = 0,
60 .dreq_polarity_high = 0,
63 static struct platform_device bfin_isp1760_device = {
64 .name = "isp1760",
65 .id = 0,
66 .dev = {
67 .platform_data = &isp1760_priv,
69 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
70 .resource = bfin_isp1760_resources,
72 #endif
74 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
75 static struct resource musb_resources[] = {
76 [0] = {
77 .start = 0xffc03800,
78 .end = 0xffc03cff,
79 .flags = IORESOURCE_MEM,
81 [1] = { /* general IRQ */
82 .start = IRQ_USB_INT0,
83 .end = IRQ_USB_INT0,
84 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
86 [2] = { /* DMA IRQ */
87 .start = IRQ_USB_DMA,
88 .end = IRQ_USB_DMA,
89 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
93 static struct musb_hdrc_config musb_config = {
94 .multipoint = 0,
95 .dyn_fifo = 0,
96 .soft_con = 1,
97 .dma = 1,
98 .num_eps = 8,
99 .dma_channels = 8,
100 .gpio_vrsel = GPIO_PF11,
101 /* Some custom boards need to be active low, just set it to "0"
102 * if it is the case.
104 .gpio_vrsel_active = 1,
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 .data_width = NFC_NWIDTH_8,
149 .partitions = partition_info,
150 .nr_partitions = ARRAY_SIZE(partition_info),
151 .rd_dly = 3,
152 .wr_dly = 3,
155 static struct resource bf5xx_nand_resources[] = {
157 .start = NFC_CTL,
158 .end = NFC_DATA_RD + 2,
159 .flags = IORESOURCE_MEM,
162 .start = CH_NFC,
163 .end = CH_NFC,
164 .flags = IORESOURCE_IRQ,
168 static struct platform_device bf5xx_nand_device = {
169 .name = "bf5xx-nand",
170 .id = 0,
171 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
172 .resource = bf5xx_nand_resources,
173 .dev = {
174 .platform_data = &bf5xx_nand_platform,
177 #endif
179 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
180 static struct resource bfin_pcmcia_cf_resources[] = {
182 .start = 0x20310000, /* IO PORT */
183 .end = 0x20312000,
184 .flags = IORESOURCE_MEM,
185 }, {
186 .start = 0x20311000, /* Attribute Memory */
187 .end = 0x20311FFF,
188 .flags = IORESOURCE_MEM,
189 }, {
190 .start = IRQ_PF4,
191 .end = IRQ_PF4,
192 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
193 }, {
194 .start = 6, /* Card Detect PF6 */
195 .end = 6,
196 .flags = IORESOURCE_IRQ,
200 static struct platform_device bfin_pcmcia_cf_device = {
201 .name = "bfin_cf_pcmcia",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
204 .resource = bfin_pcmcia_cf_resources,
206 #endif
208 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
209 static struct platform_device rtc_device = {
210 .name = "rtc-bfin",
211 .id = -1,
213 #endif
215 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
216 #include <linux/smc91x.h>
218 static struct smc91x_platdata smc91x_info = {
219 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
220 .leda = RPC_LED_100_10,
221 .ledb = RPC_LED_TX_RX,
224 static struct resource smc91x_resources[] = {
226 .name = "smc91x-regs",
227 .start = 0x20300300,
228 .end = 0x20300300 + 16,
229 .flags = IORESOURCE_MEM,
230 }, {
232 .start = IRQ_PF7,
233 .end = IRQ_PF7,
234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
237 static struct platform_device smc91x_device = {
238 .name = "smc91x",
239 .id = 0,
240 .num_resources = ARRAY_SIZE(smc91x_resources),
241 .resource = smc91x_resources,
242 .dev = {
243 .platform_data = &smc91x_info,
246 #endif
248 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
249 static struct resource dm9000_resources[] = {
250 [0] = {
251 .start = 0x203FB800,
252 .end = 0x203FB800 + 1,
253 .flags = IORESOURCE_MEM,
255 [1] = {
256 .start = 0x203FB804,
257 .end = 0x203FB804 + 1,
258 .flags = IORESOURCE_MEM,
260 [2] = {
261 .start = IRQ_PF9,
262 .end = IRQ_PF9,
263 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
267 static struct platform_device dm9000_device = {
268 .name = "dm9000",
269 .id = -1,
270 .num_resources = ARRAY_SIZE(dm9000_resources),
271 .resource = dm9000_resources,
273 #endif
275 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
276 static struct platform_device bfin_mii_bus = {
277 .name = "bfin_mii_bus",
280 static struct platform_device bfin_mac_device = {
281 .name = "bfin_mac",
282 .dev.platform_data = &bfin_mii_bus,
284 #endif
286 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
287 static struct resource net2272_bfin_resources[] = {
289 .start = 0x20300000,
290 .end = 0x20300000 + 0x100,
291 .flags = IORESOURCE_MEM,
292 }, {
293 .start = IRQ_PF7,
294 .end = IRQ_PF7,
295 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
299 static struct platform_device net2272_bfin_device = {
300 .name = "net2272",
301 .id = -1,
302 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
303 .resource = net2272_bfin_resources,
305 #endif
307 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
308 static struct mtd_partition bfin_spi_flash_partitions[] = {
310 .name = "bootloader(spi)",
311 .size = 0x00040000,
312 .offset = 0,
313 .mask_flags = MTD_CAP_ROM
314 }, {
315 .name = "linux kernel(spi)",
316 .size = MTDPART_SIZ_FULL,
317 .offset = MTDPART_OFS_APPEND,
321 static struct flash_platform_data bfin_spi_flash_data = {
322 .name = "m25p80",
323 .parts = bfin_spi_flash_partitions,
324 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
325 .type = "m25p16",
328 /* SPI flash chip (m25p64) */
329 static struct bfin5xx_spi_chip spi_flash_chip_info = {
330 .enable_dma = 0, /* use dma transfer with this chip*/
331 .bits_per_word = 8,
333 #endif
335 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
336 /* SPI ADC chip */
337 static struct bfin5xx_spi_chip spi_adc_chip_info = {
338 .enable_dma = 1, /* use dma transfer with this chip*/
339 .bits_per_word = 16,
341 #endif
343 #if defined(CONFIG_SND_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
344 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
345 .enable_dma = 0,
346 .bits_per_word = 16,
348 #endif
350 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
351 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
352 .enable_dma = 0,
353 .bits_per_word = 8,
355 #endif
357 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
358 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
359 .enable_dma = 0,
360 .bits_per_word = 16,
363 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
364 .model = 7877,
365 .vref_delay_usecs = 50, /* internal, no capacitor */
366 .x_plate_ohms = 419,
367 .y_plate_ohms = 486,
368 .pressure_max = 1000,
369 .pressure_min = 0,
370 .stopacq_polarity = 1,
371 .first_conversion_delay = 3,
372 .acquisition_time = 1,
373 .averaging = 1,
374 .pen_down_acc_interval = 1,
376 #endif
378 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) && \
379 defined(CONFIG_SND_SOC_WM8731_SPI)
380 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
381 .enable_dma = 0,
382 .bits_per_word = 16,
384 #endif
386 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
387 static struct bfin5xx_spi_chip spidev_chip_info = {
388 .enable_dma = 0,
389 .bits_per_word = 8,
391 #endif
393 static struct spi_board_info bfin_spi_board_info[] __initdata = {
394 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
396 /* the modalias must be the same as spi device driver name */
397 .modalias = "m25p80", /* Name of spi_driver for this device */
398 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
399 .bus_num = 0, /* Framework bus number */
400 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
401 .platform_data = &bfin_spi_flash_data,
402 .controller_data = &spi_flash_chip_info,
403 .mode = SPI_MODE_3,
405 #endif
407 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
409 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
410 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
411 .bus_num = 0, /* Framework bus number */
412 .chip_select = 1, /* Framework chip select. */
413 .platform_data = NULL, /* No spi_driver specific config */
414 .controller_data = &spi_adc_chip_info,
416 #endif
418 #if defined(CONFIG_SND_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
420 .modalias = "ad1836",
421 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
422 .bus_num = 0,
423 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
424 .controller_data = &ad1836_spi_chip_info,
426 #endif
427 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
429 .modalias = "mmc_spi",
430 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
431 .bus_num = 0,
432 .chip_select = 5,
433 .controller_data = &mmc_spi_chip_info,
434 .mode = SPI_MODE_3,
436 #endif
437 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
439 .modalias = "ad7877",
440 .platform_data = &bfin_ad7877_ts_info,
441 .irq = IRQ_PF8,
442 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
443 .bus_num = 0,
444 .chip_select = 2,
445 .controller_data = &spi_ad7877_chip_info,
447 #endif
448 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) && \
449 defined(CONFIG_SND_SOC_WM8731_SPI)
451 .modalias = "wm8731",
452 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
453 .bus_num = 0,
454 .chip_select = 5,
455 .controller_data = &spi_wm8731_chip_info,
456 .mode = SPI_MODE_0,
458 #endif
459 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
461 .modalias = "spidev",
462 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
463 .bus_num = 0,
464 .chip_select = 1,
465 .controller_data = &spidev_chip_info,
467 #endif
470 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
471 /* SPI controller data */
472 static struct bfin5xx_spi_master bfin_spi0_info = {
473 .num_chipselect = 8,
474 .enable_dma = 1, /* master has the ability to do dma transfer */
475 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
478 /* SPI (0) */
479 static struct resource bfin_spi0_resource[] = {
480 [0] = {
481 .start = SPI0_REGBASE,
482 .end = SPI0_REGBASE + 0xFF,
483 .flags = IORESOURCE_MEM,
485 [1] = {
486 .start = CH_SPI,
487 .end = CH_SPI,
488 .flags = IORESOURCE_DMA,
490 [2] = {
491 .start = IRQ_SPI,
492 .end = IRQ_SPI,
493 .flags = IORESOURCE_IRQ,
497 static struct platform_device bfin_spi0_device = {
498 .name = "bfin-spi",
499 .id = 0, /* Bus number */
500 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
501 .resource = bfin_spi0_resource,
502 .dev = {
503 .platform_data = &bfin_spi0_info, /* Passed to driver */
506 #endif /* spi master and devices */
508 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
509 static struct mtd_partition cm_partitions[] = {
511 .name = "bootloader(nor)",
512 .size = 0x40000,
513 .offset = 0,
514 }, {
515 .name = "linux kernel(nor)",
516 .size = 0x100000,
517 .offset = MTDPART_OFS_APPEND,
518 }, {
519 .name = "file system(nor)",
520 .size = MTDPART_SIZ_FULL,
521 .offset = MTDPART_OFS_APPEND,
525 static struct physmap_flash_data cm_flash_data = {
526 .width = 2,
527 .parts = cm_partitions,
528 .nr_parts = ARRAY_SIZE(cm_partitions),
531 static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };
533 static struct resource cm_flash_resource[] = {
535 .name = "cfi_probe",
536 .start = 0x20000000,
537 .end = 0x201fffff,
538 .flags = IORESOURCE_MEM,
539 }, {
540 .start = (unsigned long)cm_flash_gpios,
541 .end = ARRAY_SIZE(cm_flash_gpios),
542 .flags = IORESOURCE_IRQ,
546 static struct platform_device cm_flash_device = {
547 .name = "gpio-addr-flash",
548 .id = 0,
549 .dev = {
550 .platform_data = &cm_flash_data,
552 .num_resources = ARRAY_SIZE(cm_flash_resource),
553 .resource = cm_flash_resource,
555 #endif
557 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
558 #ifdef CONFIG_SERIAL_BFIN_UART0
559 static struct resource bfin_uart0_resources[] = {
561 .start = UART0_THR,
562 .end = UART0_GCTL+2,
563 .flags = IORESOURCE_MEM,
566 .start = IRQ_UART0_RX,
567 .end = IRQ_UART0_RX+1,
568 .flags = IORESOURCE_IRQ,
571 .start = IRQ_UART0_ERROR,
572 .end = IRQ_UART0_ERROR,
573 .flags = IORESOURCE_IRQ,
576 .start = CH_UART0_TX,
577 .end = CH_UART0_TX,
578 .flags = IORESOURCE_DMA,
581 .start = CH_UART0_RX,
582 .end = CH_UART0_RX,
583 .flags = IORESOURCE_DMA,
587 unsigned short bfin_uart0_peripherals[] = {
588 P_UART0_TX, P_UART0_RX, 0
591 static struct platform_device bfin_uart0_device = {
592 .name = "bfin-uart",
593 .id = 0,
594 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
595 .resource = bfin_uart0_resources,
596 .dev = {
597 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
600 #endif
601 #ifdef CONFIG_SERIAL_BFIN_UART1
602 static struct resource bfin_uart1_resources[] = {
604 .start = UART1_THR,
605 .end = UART1_GCTL+2,
606 .flags = IORESOURCE_MEM,
609 .start = IRQ_UART1_RX,
610 .end = IRQ_UART1_RX+1,
611 .flags = IORESOURCE_IRQ,
614 .start = IRQ_UART1_ERROR,
615 .end = IRQ_UART1_ERROR,
616 .flags = IORESOURCE_IRQ,
619 .start = CH_UART1_TX,
620 .end = CH_UART1_TX,
621 .flags = IORESOURCE_DMA,
624 .start = CH_UART1_RX,
625 .end = CH_UART1_RX,
626 .flags = IORESOURCE_DMA,
628 #ifdef CONFIG_BFIN_UART1_CTSRTS
629 { /* CTS pin */
630 .start = GPIO_PF9,
631 .end = GPIO_PF9,
632 .flags = IORESOURCE_IO,
634 { /* RTS pin */
635 .start = GPIO_PF10,
636 .end = GPIO_PF10,
637 .flags = IORESOURCE_IO,
639 #endif
642 unsigned short bfin_uart1_peripherals[] = {
643 P_UART1_TX, P_UART1_RX, 0
646 static struct platform_device bfin_uart1_device = {
647 .name = "bfin-uart",
648 .id = 1,
649 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
650 .resource = bfin_uart1_resources,
651 .dev = {
652 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
655 #endif
656 #endif
658 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
659 #ifdef CONFIG_BFIN_SIR0
660 static struct resource bfin_sir0_resources[] = {
662 .start = 0xFFC00400,
663 .end = 0xFFC004FF,
664 .flags = IORESOURCE_MEM,
667 .start = IRQ_UART0_RX,
668 .end = IRQ_UART0_RX+1,
669 .flags = IORESOURCE_IRQ,
672 .start = CH_UART0_RX,
673 .end = CH_UART0_RX+1,
674 .flags = IORESOURCE_DMA,
678 static struct platform_device bfin_sir0_device = {
679 .name = "bfin_sir",
680 .id = 0,
681 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
682 .resource = bfin_sir0_resources,
684 #endif
685 #ifdef CONFIG_BFIN_SIR1
686 static struct resource bfin_sir1_resources[] = {
688 .start = 0xFFC02000,
689 .end = 0xFFC020FF,
690 .flags = IORESOURCE_MEM,
693 .start = IRQ_UART1_RX,
694 .end = IRQ_UART1_RX+1,
695 .flags = IORESOURCE_IRQ,
698 .start = CH_UART1_RX,
699 .end = CH_UART1_RX+1,
700 .flags = IORESOURCE_DMA,
704 static struct platform_device bfin_sir1_device = {
705 .name = "bfin_sir",
706 .id = 1,
707 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
708 .resource = bfin_sir1_resources,
710 #endif
711 #endif
713 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
714 static struct resource bfin_twi0_resource[] = {
715 [0] = {
716 .start = TWI0_REGBASE,
717 .end = TWI0_REGBASE,
718 .flags = IORESOURCE_MEM,
720 [1] = {
721 .start = IRQ_TWI,
722 .end = IRQ_TWI,
723 .flags = IORESOURCE_IRQ,
727 static struct platform_device i2c_bfin_twi_device = {
728 .name = "i2c-bfin-twi",
729 .id = 0,
730 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
731 .resource = bfin_twi0_resource,
733 #endif
735 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
736 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
738 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
740 #endif
741 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
743 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
744 .irq = IRQ_PF8,
746 #endif
747 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
749 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
751 #endif
754 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
755 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
756 static struct resource bfin_sport0_uart_resources[] = {
758 .start = SPORT0_TCR1,
759 .end = SPORT0_MRCS3+4,
760 .flags = IORESOURCE_MEM,
763 .start = IRQ_SPORT0_RX,
764 .end = IRQ_SPORT0_RX+1,
765 .flags = IORESOURCE_IRQ,
768 .start = IRQ_SPORT0_ERROR,
769 .end = IRQ_SPORT0_ERROR,
770 .flags = IORESOURCE_IRQ,
774 unsigned short bfin_sport0_peripherals[] = {
775 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
776 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
779 static struct platform_device bfin_sport0_uart_device = {
780 .name = "bfin-sport-uart",
781 .id = 0,
782 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
783 .resource = bfin_sport0_uart_resources,
784 .dev = {
785 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
788 #endif
789 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
790 static struct resource bfin_sport1_uart_resources[] = {
792 .start = SPORT1_TCR1,
793 .end = SPORT1_MRCS3+4,
794 .flags = IORESOURCE_MEM,
797 .start = IRQ_SPORT1_RX,
798 .end = IRQ_SPORT1_RX+1,
799 .flags = IORESOURCE_IRQ,
802 .start = IRQ_SPORT1_ERROR,
803 .end = IRQ_SPORT1_ERROR,
804 .flags = IORESOURCE_IRQ,
808 unsigned short bfin_sport1_peripherals[] = {
809 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
810 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
813 static struct platform_device bfin_sport1_uart_device = {
814 .name = "bfin-sport-uart",
815 .id = 1,
816 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
817 .resource = bfin_sport1_uart_resources,
818 .dev = {
819 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
822 #endif
823 #endif
825 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
826 #include <linux/input.h>
827 #include <linux/gpio_keys.h>
829 static struct gpio_keys_button bfin_gpio_keys_table[] = {
830 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
833 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
834 .buttons = bfin_gpio_keys_table,
835 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
838 static struct platform_device bfin_device_gpiokeys = {
839 .name = "gpio-keys",
840 .dev = {
841 .platform_data = &bfin_gpio_keys_data,
844 #endif
846 static const unsigned int cclk_vlev_datasheet[] =
848 VRPAIR(VLEV_100, 400000000),
849 VRPAIR(VLEV_105, 426000000),
850 VRPAIR(VLEV_110, 500000000),
851 VRPAIR(VLEV_115, 533000000),
852 VRPAIR(VLEV_120, 600000000),
855 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
856 .tuple_tab = cclk_vlev_datasheet,
857 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
858 .vr_settling_time = 25 /* us */,
861 static struct platform_device bfin_dpmc = {
862 .name = "bfin dpmc",
863 .dev = {
864 .platform_data = &bfin_dmpc_vreg_data,
868 static struct platform_device *cmbf527_devices[] __initdata = {
870 &bfin_dpmc,
872 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
873 &bf5xx_nand_device,
874 #endif
876 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
877 &bfin_pcmcia_cf_device,
878 #endif
880 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
881 &rtc_device,
882 #endif
884 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
885 &bfin_isp1760_device,
886 #endif
888 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
889 &musb_device,
890 #endif
892 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
893 &smc91x_device,
894 #endif
896 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
897 &dm9000_device,
898 #endif
900 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
901 &bfin_mii_bus,
902 &bfin_mac_device,
903 #endif
905 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
906 &net2272_bfin_device,
907 #endif
909 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
910 &bfin_spi0_device,
911 #endif
913 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
914 #ifdef CONFIG_SERIAL_BFIN_UART0
915 &bfin_uart0_device,
916 #endif
917 #ifdef CONFIG_SERIAL_BFIN_UART1
918 &bfin_uart1_device,
919 #endif
920 #endif
922 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
923 #ifdef CONFIG_BFIN_SIR0
924 &bfin_sir0_device,
925 #endif
926 #ifdef CONFIG_BFIN_SIR1
927 &bfin_sir1_device,
928 #endif
929 #endif
931 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
932 &i2c_bfin_twi_device,
933 #endif
935 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
936 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
937 &bfin_sport0_uart_device,
938 #endif
939 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
940 &bfin_sport1_uart_device,
941 #endif
942 #endif
944 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
945 &bfin_device_gpiokeys,
946 #endif
948 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
949 &cm_flash_device,
950 #endif
953 static int __init cm_init(void)
955 printk(KERN_INFO "%s(): registering device resources\n", __func__);
956 i2c_register_board_info(0, bfin_i2c_board_info,
957 ARRAY_SIZE(bfin_i2c_board_info));
958 platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));
959 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
960 return 0;
963 arch_initcall(cm_init);
965 static struct platform_device *cmbf527_early_devices[] __initdata = {
966 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
967 #ifdef CONFIG_SERIAL_BFIN_UART0
968 &bfin_uart0_device,
969 #endif
970 #ifdef CONFIG_SERIAL_BFIN_UART1
971 &bfin_uart1_device,
972 #endif
973 #endif
975 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
976 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
977 &bfin_sport0_uart_device,
978 #endif
979 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
980 &bfin_sport1_uart_device,
981 #endif
982 #endif
985 void __init native_machine_early_platform_add_devices(void)
987 printk(KERN_INFO "register early platform devices\n");
988 early_platform_add_devices(cmbf527_early_devices,
989 ARRAY_SIZE(cmbf527_early_devices));
992 void native_machine_restart(char *cmd)
994 if ((bfin_read_SYSCR() & 0x7) == 0x3)
995 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
998 void bfin_get_ether_addr(char *addr)
1000 random_ether_addr(addr);
1001 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
1003 EXPORT_SYMBOL(bfin_get_ether_addr);