Blackfin: convert boards to use platform data with smc91x
[linux-2.6/linux-2.6-openrd.git] / arch / blackfin / mach-bf527 / boards / cm_bf527.c
blobcb360e99f1dcbb17ff85922d08e8cf830bc18754
1 /*
2 * File: arch/blackfin/mach-bf527/boards/cm-bf527.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
6 * Created:
7 * Description:
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/mtd/physmap.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #include <linux/etherdevice.h>
39 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40 #include <linux/usb/isp1362.h>
41 #endif
42 #include <linux/i2c.h>
43 #include <linux/irq.h>
44 #include <linux/interrupt.h>
45 #include <linux/usb/sl811.h>
46 #include <linux/usb/musb.h>
47 #include <asm/dma.h>
48 #include <asm/bfin5xx_spi.h>
49 #include <asm/reboot.h>
50 #include <asm/nand.h>
51 #include <asm/portmux.h>
52 #include <asm/dpmc.h>
53 #include <linux/spi/ad7877.h>
56 * Name the Board for the /proc/cpuinfo
58 const char bfin_board_name[] = "Bluetechnix CM-BF527";
61 * Driver needs to know address, irq and flag pin.
64 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 #include <linux/usb/isp1760.h>
66 static struct resource bfin_isp1760_resources[] = {
67 [0] = {
68 .start = 0x203C0000,
69 .end = 0x203C0000 + 0x000fffff,
70 .flags = IORESOURCE_MEM,
72 [1] = {
73 .start = IRQ_PF7,
74 .end = IRQ_PF7,
75 .flags = IORESOURCE_IRQ,
79 static struct isp1760_platform_data isp1760_priv = {
80 .is_isp1761 = 0,
81 .bus_width_16 = 1,
82 .port1_otg = 0,
83 .analog_oc = 0,
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
88 static struct platform_device bfin_isp1760_device = {
89 .name = "isp1760-hcd",
90 .id = 0,
91 .dev = {
92 .platform_data = &isp1760_priv,
94 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
95 .resource = bfin_isp1760_resources,
97 #endif
99 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
100 static struct resource musb_resources[] = {
101 [0] = {
102 .start = 0xffc03800,
103 .end = 0xffc03cff,
104 .flags = IORESOURCE_MEM,
106 [1] = { /* general IRQ */
107 .start = IRQ_USB_INT0,
108 .end = IRQ_USB_INT0,
109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
111 [2] = { /* DMA IRQ */
112 .start = IRQ_USB_DMA,
113 .end = IRQ_USB_DMA,
114 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
118 static struct musb_hdrc_config musb_config = {
119 .multipoint = 0,
120 .dyn_fifo = 0,
121 .soft_con = 1,
122 .dma = 1,
123 .num_eps = 8,
124 .dma_channels = 8,
125 .gpio_vrsel = GPIO_PF11,
128 static struct musb_hdrc_platform_data musb_plat = {
129 #if defined(CONFIG_USB_MUSB_OTG)
130 .mode = MUSB_OTG,
131 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
132 .mode = MUSB_HOST,
133 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
134 .mode = MUSB_PERIPHERAL,
135 #endif
136 .config = &musb_config,
139 static u64 musb_dmamask = ~(u32)0;
141 static struct platform_device musb_device = {
142 .name = "musb_hdrc",
143 .id = 0,
144 .dev = {
145 .dma_mask = &musb_dmamask,
146 .coherent_dma_mask = 0xffffffff,
147 .platform_data = &musb_plat,
149 .num_resources = ARRAY_SIZE(musb_resources),
150 .resource = musb_resources,
152 #endif
154 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
155 static struct mtd_partition ezkit_partitions[] = {
157 .name = "bootloader(nor)",
158 .size = 0x40000,
159 .offset = 0,
160 }, {
161 .name = "linux kernel(nor)",
162 .size = 0x1C0000,
163 .offset = MTDPART_OFS_APPEND,
164 }, {
165 .name = "file system(nor)",
166 .size = MTDPART_SIZ_FULL,
167 .offset = MTDPART_OFS_APPEND,
171 static struct physmap_flash_data ezkit_flash_data = {
172 .width = 2,
173 .parts = ezkit_partitions,
174 .nr_parts = ARRAY_SIZE(ezkit_partitions),
177 static struct resource ezkit_flash_resource = {
178 .start = 0x20000000,
179 .end = 0x201fffff,
180 .flags = IORESOURCE_MEM,
183 static struct platform_device ezkit_flash_device = {
184 .name = "physmap-flash",
185 .id = 0,
186 .dev = {
187 .platform_data = &ezkit_flash_data,
189 .num_resources = 1,
190 .resource = &ezkit_flash_resource,
192 #endif
194 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
195 static struct mtd_partition partition_info[] = {
197 .name = "linux kernel(nand)",
198 .offset = 0,
199 .size = 4 * 1024 * 1024,
202 .name = "file system(nand)",
203 .offset = MTDPART_OFS_APPEND,
204 .size = MTDPART_SIZ_FULL,
208 static struct bf5xx_nand_platform bf5xx_nand_platform = {
209 .page_size = NFC_PG_SIZE_256,
210 .data_width = NFC_NWIDTH_8,
211 .partitions = partition_info,
212 .nr_partitions = ARRAY_SIZE(partition_info),
213 .rd_dly = 3,
214 .wr_dly = 3,
217 static struct resource bf5xx_nand_resources[] = {
219 .start = NFC_CTL,
220 .end = NFC_DATA_RD + 2,
221 .flags = IORESOURCE_MEM,
224 .start = CH_NFC,
225 .end = CH_NFC,
226 .flags = IORESOURCE_IRQ,
230 static struct platform_device bf5xx_nand_device = {
231 .name = "bf5xx-nand",
232 .id = 0,
233 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
234 .resource = bf5xx_nand_resources,
235 .dev = {
236 .platform_data = &bf5xx_nand_platform,
239 #endif
241 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
242 static struct resource bfin_pcmcia_cf_resources[] = {
244 .start = 0x20310000, /* IO PORT */
245 .end = 0x20312000,
246 .flags = IORESOURCE_MEM,
247 }, {
248 .start = 0x20311000, /* Attribute Memory */
249 .end = 0x20311FFF,
250 .flags = IORESOURCE_MEM,
251 }, {
252 .start = IRQ_PF4,
253 .end = IRQ_PF4,
254 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
255 }, {
256 .start = 6, /* Card Detect PF6 */
257 .end = 6,
258 .flags = IORESOURCE_IRQ,
262 static struct platform_device bfin_pcmcia_cf_device = {
263 .name = "bfin_cf_pcmcia",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
266 .resource = bfin_pcmcia_cf_resources,
268 #endif
270 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
271 static struct platform_device rtc_device = {
272 .name = "rtc-bfin",
273 .id = -1,
275 #endif
277 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
278 #include <linux/smc91x.h>
280 static struct smc91x_platdata smc91x_info = {
281 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
282 .leda = RPC_LED_100_10,
283 .ledb = RPC_LED_TX_RX,
286 static struct resource smc91x_resources[] = {
288 .name = "smc91x-regs",
289 .start = 0x20300300,
290 .end = 0x20300300 + 16,
291 .flags = IORESOURCE_MEM,
292 }, {
294 .start = IRQ_PF7,
295 .end = IRQ_PF7,
296 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
299 static struct platform_device smc91x_device = {
300 .name = "smc91x",
301 .id = 0,
302 .num_resources = ARRAY_SIZE(smc91x_resources),
303 .resource = smc91x_resources,
304 .dev = {
305 .platform_data = &smc91x_info,
308 #endif
310 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
311 static struct resource dm9000_resources[] = {
312 [0] = {
313 .start = 0x203FB800,
314 .end = 0x203FB800 + 8,
315 .flags = IORESOURCE_MEM,
317 [1] = {
318 .start = IRQ_PF9,
319 .end = IRQ_PF9,
320 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
324 static struct platform_device dm9000_device = {
325 .name = "dm9000",
326 .id = -1,
327 .num_resources = ARRAY_SIZE(dm9000_resources),
328 .resource = dm9000_resources,
330 #endif
332 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
333 static struct resource sl811_hcd_resources[] = {
335 .start = 0x20340000,
336 .end = 0x20340000,
337 .flags = IORESOURCE_MEM,
338 }, {
339 .start = 0x20340004,
340 .end = 0x20340004,
341 .flags = IORESOURCE_MEM,
342 }, {
343 .start = CONFIG_USB_SL811_BFIN_IRQ,
344 .end = CONFIG_USB_SL811_BFIN_IRQ,
345 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
349 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
350 void sl811_port_power(struct device *dev, int is_on)
352 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
353 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
355 #endif
357 static struct sl811_platform_data sl811_priv = {
358 .potpg = 10,
359 .power = 250, /* == 500mA */
360 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
361 .port_power = &sl811_port_power,
362 #endif
365 static struct platform_device sl811_hcd_device = {
366 .name = "sl811-hcd",
367 .id = 0,
368 .dev = {
369 .platform_data = &sl811_priv,
371 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
372 .resource = sl811_hcd_resources,
374 #endif
376 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
377 static struct resource isp1362_hcd_resources[] = {
379 .start = 0x20360000,
380 .end = 0x20360000,
381 .flags = IORESOURCE_MEM,
382 }, {
383 .start = 0x20360004,
384 .end = 0x20360004,
385 .flags = IORESOURCE_MEM,
386 }, {
387 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
388 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
389 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
393 static struct isp1362_platform_data isp1362_priv = {
394 .sel15Kres = 1,
395 .clknotstop = 0,
396 .oc_enable = 0,
397 .int_act_high = 0,
398 .int_edge_triggered = 0,
399 .remote_wakeup_connected = 0,
400 .no_power_switching = 1,
401 .power_switching_mode = 0,
404 static struct platform_device isp1362_hcd_device = {
405 .name = "isp1362-hcd",
406 .id = 0,
407 .dev = {
408 .platform_data = &isp1362_priv,
410 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
411 .resource = isp1362_hcd_resources,
413 #endif
415 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
416 static struct platform_device bfin_mii_bus = {
417 .name = "bfin_mii_bus",
420 static struct platform_device bfin_mac_device = {
421 .name = "bfin_mac",
422 .dev.platform_data = &bfin_mii_bus,
424 #endif
426 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
427 static struct resource net2272_bfin_resources[] = {
429 .start = 0x20300000,
430 .end = 0x20300000 + 0x100,
431 .flags = IORESOURCE_MEM,
432 }, {
433 .start = IRQ_PF7,
434 .end = IRQ_PF7,
435 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
439 static struct platform_device net2272_bfin_device = {
440 .name = "net2272",
441 .id = -1,
442 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
443 .resource = net2272_bfin_resources,
445 #endif
447 #if defined(CONFIG_MTD_M25P80) \
448 || defined(CONFIG_MTD_M25P80_MODULE)
449 static struct mtd_partition bfin_spi_flash_partitions[] = {
451 .name = "bootloader(spi)",
452 .size = 0x00040000,
453 .offset = 0,
454 .mask_flags = MTD_CAP_ROM
455 }, {
456 .name = "linux kernel(spi)",
457 .size = MTDPART_SIZ_FULL,
458 .offset = MTDPART_OFS_APPEND,
462 static struct flash_platform_data bfin_spi_flash_data = {
463 .name = "m25p80",
464 .parts = bfin_spi_flash_partitions,
465 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
466 .type = "m25p16",
469 /* SPI flash chip (m25p64) */
470 static struct bfin5xx_spi_chip spi_flash_chip_info = {
471 .enable_dma = 0, /* use dma transfer with this chip*/
472 .bits_per_word = 8,
474 #endif
476 #if defined(CONFIG_BFIN_SPI_ADC) \
477 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
478 /* SPI ADC chip */
479 static struct bfin5xx_spi_chip spi_adc_chip_info = {
480 .enable_dma = 1, /* use dma transfer with this chip*/
481 .bits_per_word = 16,
483 #endif
485 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
486 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
487 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
488 .enable_dma = 0,
489 .bits_per_word = 16,
491 #endif
493 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
494 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
495 .enable_dma = 0,
496 .bits_per_word = 16,
498 #endif
500 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
501 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
502 .enable_dma = 0,
503 .bits_per_word = 8,
505 #endif
507 #if defined(CONFIG_PBX)
508 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
509 .ctl_reg = 0x4, /* send zero */
510 .enable_dma = 0,
511 .bits_per_word = 8,
512 .cs_change_per_word = 1,
514 #endif
516 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
517 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
518 .enable_dma = 0,
519 .bits_per_word = 16,
522 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
523 .model = 7877,
524 .vref_delay_usecs = 50, /* internal, no capacitor */
525 .x_plate_ohms = 419,
526 .y_plate_ohms = 486,
527 .pressure_max = 1000,
528 .pressure_min = 0,
529 .stopacq_polarity = 1,
530 .first_conversion_delay = 3,
531 .acquisition_time = 1,
532 .averaging = 1,
533 .pen_down_acc_interval = 1,
535 #endif
537 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
538 && defined(CONFIG_SND_SOC_WM8731_SPI)
539 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
540 .enable_dma = 0,
541 .bits_per_word = 16,
543 #endif
545 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
546 static struct bfin5xx_spi_chip spidev_chip_info = {
547 .enable_dma = 0,
548 .bits_per_word = 8,
550 #endif
552 static struct spi_board_info bfin_spi_board_info[] __initdata = {
553 #if defined(CONFIG_MTD_M25P80) \
554 || defined(CONFIG_MTD_M25P80_MODULE)
556 /* the modalias must be the same as spi device driver name */
557 .modalias = "m25p80", /* Name of spi_driver for this device */
558 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
559 .bus_num = 0, /* Framework bus number */
560 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
561 .platform_data = &bfin_spi_flash_data,
562 .controller_data = &spi_flash_chip_info,
563 .mode = SPI_MODE_3,
565 #endif
567 #if defined(CONFIG_BFIN_SPI_ADC) \
568 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
570 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
571 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
572 .bus_num = 0, /* Framework bus number */
573 .chip_select = 1, /* Framework chip select. */
574 .platform_data = NULL, /* No spi_driver specific config */
575 .controller_data = &spi_adc_chip_info,
577 #endif
579 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
580 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
582 .modalias = "ad1836-spi",
583 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
584 .bus_num = 0,
585 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
586 .controller_data = &ad1836_spi_chip_info,
588 #endif
589 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
591 .modalias = "ad9960-spi",
592 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
593 .bus_num = 0,
594 .chip_select = 1,
595 .controller_data = &ad9960_spi_chip_info,
597 #endif
598 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
600 .modalias = "mmc_spi",
601 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
602 .bus_num = 0,
603 .chip_select = 5,
604 .controller_data = &mmc_spi_chip_info,
605 .mode = SPI_MODE_3,
607 #endif
608 #if defined(CONFIG_PBX)
610 .modalias = "fxs-spi",
611 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
612 .bus_num = 0,
613 .chip_select = 8 - CONFIG_J11_JUMPER,
614 .controller_data = &spi_si3xxx_chip_info,
615 .mode = SPI_MODE_3,
618 .modalias = "fxo-spi",
619 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
620 .bus_num = 0,
621 .chip_select = 8 - CONFIG_J19_JUMPER,
622 .controller_data = &spi_si3xxx_chip_info,
623 .mode = SPI_MODE_3,
625 #endif
626 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
628 .modalias = "ad7877",
629 .platform_data = &bfin_ad7877_ts_info,
630 .irq = IRQ_PF8,
631 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
632 .bus_num = 0,
633 .chip_select = 2,
634 .controller_data = &spi_ad7877_chip_info,
636 #endif
637 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
638 && defined(CONFIG_SND_SOC_WM8731_SPI)
640 .modalias = "wm8731",
641 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
642 .bus_num = 0,
643 .chip_select = 5,
644 .controller_data = &spi_wm8731_chip_info,
645 .mode = SPI_MODE_0,
647 #endif
648 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
650 .modalias = "spidev",
651 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
652 .bus_num = 0,
653 .chip_select = 1,
654 .controller_data = &spidev_chip_info,
656 #endif
659 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
660 /* SPI controller data */
661 static struct bfin5xx_spi_master bfin_spi0_info = {
662 .num_chipselect = 8,
663 .enable_dma = 1, /* master has the ability to do dma transfer */
664 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
667 /* SPI (0) */
668 static struct resource bfin_spi0_resource[] = {
669 [0] = {
670 .start = SPI0_REGBASE,
671 .end = SPI0_REGBASE + 0xFF,
672 .flags = IORESOURCE_MEM,
674 [1] = {
675 .start = CH_SPI,
676 .end = CH_SPI,
677 .flags = IORESOURCE_DMA,
679 [2] = {
680 .start = IRQ_SPI,
681 .end = IRQ_SPI,
682 .flags = IORESOURCE_IRQ,
686 static struct platform_device bfin_spi0_device = {
687 .name = "bfin-spi",
688 .id = 0, /* Bus number */
689 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
690 .resource = bfin_spi0_resource,
691 .dev = {
692 .platform_data = &bfin_spi0_info, /* Passed to driver */
695 #endif /* spi master and devices */
697 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
698 static struct platform_device bfin_fb_adv7393_device = {
699 .name = "bfin-adv7393",
701 #endif
703 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
704 static struct resource bfin_uart_resources[] = {
705 #ifdef CONFIG_SERIAL_BFIN_UART0
707 .start = 0xFFC00400,
708 .end = 0xFFC004FF,
709 .flags = IORESOURCE_MEM,
711 #endif
712 #ifdef CONFIG_SERIAL_BFIN_UART1
714 .start = 0xFFC02000,
715 .end = 0xFFC020FF,
716 .flags = IORESOURCE_MEM,
718 #endif
721 static struct platform_device bfin_uart_device = {
722 .name = "bfin-uart",
723 .id = 1,
724 .num_resources = ARRAY_SIZE(bfin_uart_resources),
725 .resource = bfin_uart_resources,
727 #endif
729 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
730 #ifdef CONFIG_BFIN_SIR0
731 static struct resource bfin_sir0_resources[] = {
733 .start = 0xFFC00400,
734 .end = 0xFFC004FF,
735 .flags = IORESOURCE_MEM,
738 .start = IRQ_UART0_RX,
739 .end = IRQ_UART0_RX+1,
740 .flags = IORESOURCE_IRQ,
743 .start = CH_UART0_RX,
744 .end = CH_UART0_RX+1,
745 .flags = IORESOURCE_DMA,
749 static struct platform_device bfin_sir0_device = {
750 .name = "bfin_sir",
751 .id = 0,
752 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
753 .resource = bfin_sir0_resources,
755 #endif
756 #ifdef CONFIG_BFIN_SIR1
757 static struct resource bfin_sir1_resources[] = {
759 .start = 0xFFC02000,
760 .end = 0xFFC020FF,
761 .flags = IORESOURCE_MEM,
764 .start = IRQ_UART1_RX,
765 .end = IRQ_UART1_RX+1,
766 .flags = IORESOURCE_IRQ,
769 .start = CH_UART1_RX,
770 .end = CH_UART1_RX+1,
771 .flags = IORESOURCE_DMA,
775 static struct platform_device bfin_sir1_device = {
776 .name = "bfin_sir",
777 .id = 1,
778 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
779 .resource = bfin_sir1_resources,
781 #endif
782 #endif
784 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
785 static struct resource bfin_twi0_resource[] = {
786 [0] = {
787 .start = TWI0_REGBASE,
788 .end = TWI0_REGBASE,
789 .flags = IORESOURCE_MEM,
791 [1] = {
792 .start = IRQ_TWI,
793 .end = IRQ_TWI,
794 .flags = IORESOURCE_IRQ,
798 static struct platform_device i2c_bfin_twi_device = {
799 .name = "i2c-bfin-twi",
800 .id = 0,
801 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
802 .resource = bfin_twi0_resource,
804 #endif
806 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
807 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
809 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
811 #endif
812 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
814 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
815 .irq = IRQ_PF8,
817 #endif
820 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
821 static struct platform_device bfin_sport0_uart_device = {
822 .name = "bfin-sport-uart",
823 .id = 0,
826 static struct platform_device bfin_sport1_uart_device = {
827 .name = "bfin-sport-uart",
828 .id = 1,
830 #endif
832 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
833 #include <linux/input.h>
834 #include <linux/gpio_keys.h>
836 static struct gpio_keys_button bfin_gpio_keys_table[] = {
837 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
840 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
841 .buttons = bfin_gpio_keys_table,
842 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
845 static struct platform_device bfin_device_gpiokeys = {
846 .name = "gpio-keys",
847 .dev = {
848 .platform_data = &bfin_gpio_keys_data,
851 #endif
853 static struct resource bfin_gpios_resources = {
854 .start = 0,
855 .end = MAX_BLACKFIN_GPIOS - 1,
856 .flags = IORESOURCE_IRQ,
859 static struct platform_device bfin_gpios_device = {
860 .name = "simple-gpio",
861 .id = -1,
862 .num_resources = 1,
863 .resource = &bfin_gpios_resources,
866 static const unsigned int cclk_vlev_datasheet[] =
868 VRPAIR(VLEV_100, 400000000),
869 VRPAIR(VLEV_105, 426000000),
870 VRPAIR(VLEV_110, 500000000),
871 VRPAIR(VLEV_115, 533000000),
872 VRPAIR(VLEV_120, 600000000),
875 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
876 .tuple_tab = cclk_vlev_datasheet,
877 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
878 .vr_settling_time = 25 /* us */,
881 static struct platform_device bfin_dpmc = {
882 .name = "bfin dpmc",
883 .dev = {
884 .platform_data = &bfin_dmpc_vreg_data,
888 static struct platform_device *stamp_devices[] __initdata = {
890 &bfin_dpmc,
892 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
893 &bf5xx_nand_device,
894 #endif
896 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
897 &bfin_pcmcia_cf_device,
898 #endif
900 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
901 &rtc_device,
902 #endif
904 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
905 &sl811_hcd_device,
906 #endif
908 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
909 &isp1362_hcd_device,
910 #endif
912 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
913 &bfin_isp1760_device,
914 #endif
916 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
917 &musb_device,
918 #endif
920 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
921 &smc91x_device,
922 #endif
924 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
925 &dm9000_device,
926 #endif
928 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
929 &bfin_mii_bus,
930 &bfin_mac_device,
931 #endif
933 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
934 &net2272_bfin_device,
935 #endif
937 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
938 &bfin_spi0_device,
939 #endif
941 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
942 &bfin_fb_adv7393_device,
943 #endif
945 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
946 &bfin_uart_device,
947 #endif
949 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
950 #ifdef CONFIG_BFIN_SIR0
951 &bfin_sir0_device,
952 #endif
953 #ifdef CONFIG_BFIN_SIR1
954 &bfin_sir1_device,
955 #endif
956 #endif
958 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
959 &i2c_bfin_twi_device,
960 #endif
962 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
963 &bfin_sport0_uart_device,
964 &bfin_sport1_uart_device,
965 #endif
967 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
968 &bfin_device_gpiokeys,
969 #endif
971 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
972 &ezkit_flash_device,
973 #endif
975 &bfin_gpios_device,
978 static int __init cm_init(void)
980 printk(KERN_INFO "%s(): registering device resources\n", __func__);
981 i2c_register_board_info(0, bfin_i2c_board_info,
982 ARRAY_SIZE(bfin_i2c_board_info));
983 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
984 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
985 return 0;
988 arch_initcall(cm_init);
990 void native_machine_restart(char *cmd)
992 /* workaround reboot hang when booting from SPI */
993 if ((bfin_read_SYSCR() & 0x7) == 0x3)
994 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
997 void bfin_get_ether_addr(char *addr)
999 random_ether_addr(addr);
1000 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
1002 EXPORT_SYMBOL(bfin_get_ether_addr);