2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
17 #include <linux/usb/isp1362.h>
19 #include <linux/i2c.h>
20 #include <linux/irq.h>
21 #include <linux/interrupt.h>
22 #include <linux/usb/sl811.h>
23 #include <linux/usb/musb.h>
25 #include <asm/bfin5xx_spi.h>
26 #include <asm/reboot.h>
28 #include <asm/portmux.h>
30 #include <linux/spi/ad7877.h>
33 * Name the Board for the /proc/cpuinfo
35 const char bfin_board_name[] = "ADI BF527-EZKIT";
38 * Driver needs to know address, irq and flag pin.
41 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
42 #include <linux/usb/isp1760.h>
43 static struct resource bfin_isp1760_resources[] = {
46 .end = 0x203C0000 + 0x000fffff,
47 .flags = IORESOURCE_MEM,
52 .flags = IORESOURCE_IRQ,
56 static struct isp1760_platform_data isp1760_priv = {
61 .dack_polarity_high = 0,
62 .dreq_polarity_high = 0,
65 static struct platform_device bfin_isp1760_device = {
66 .name = "isp1760-hcd",
69 .platform_data = &isp1760_priv,
71 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
72 .resource = bfin_isp1760_resources,
76 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
77 static struct resource musb_resources[] = {
81 .flags = IORESOURCE_MEM,
83 [1] = { /* general IRQ */
84 .start = IRQ_USB_INT0,
86 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
91 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 static struct musb_hdrc_config musb_config = {
102 .gpio_vrsel = GPIO_PG13,
105 static struct musb_hdrc_platform_data musb_plat = {
106 #if defined(CONFIG_USB_MUSB_OTG)
108 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
110 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
111 .mode = MUSB_PERIPHERAL,
113 .config = &musb_config,
116 static u64 musb_dmamask = ~(u32)0;
118 static struct platform_device musb_device = {
122 .dma_mask = &musb_dmamask,
123 .coherent_dma_mask = 0xffffffff,
124 .platform_data = &musb_plat,
126 .num_resources = ARRAY_SIZE(musb_resources),
127 .resource = musb_resources,
131 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
133 static struct resource bf52x_t350mcqb_resources[] = {
135 .start = IRQ_PPI_ERROR,
136 .end = IRQ_PPI_ERROR,
137 .flags = IORESOURCE_IRQ,
141 static struct platform_device bf52x_t350mcqb_device = {
142 .name = "bfin-t350mcqb",
144 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
145 .resource = bf52x_t350mcqb_resources,
149 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
150 static struct mtd_partition ezkit_partitions[] = {
152 .name = "bootloader(nor)",
156 .name = "linux kernel(nor)",
158 .offset = MTDPART_OFS_APPEND,
160 .name = "file system(nor)",
161 .size = MTDPART_SIZ_FULL,
162 .offset = MTDPART_OFS_APPEND,
166 static struct physmap_flash_data ezkit_flash_data = {
168 .parts = ezkit_partitions,
169 .nr_parts = ARRAY_SIZE(ezkit_partitions),
172 static struct resource ezkit_flash_resource = {
175 .flags = IORESOURCE_MEM,
178 static struct platform_device ezkit_flash_device = {
179 .name = "physmap-flash",
182 .platform_data = &ezkit_flash_data,
185 .resource = &ezkit_flash_resource,
189 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
190 static struct mtd_partition partition_info[] = {
192 .name = "linux kernel(nand)",
194 .size = 4 * 1024 * 1024,
197 .name = "file system(nand)",
198 .offset = MTDPART_OFS_APPEND,
199 .size = MTDPART_SIZ_FULL,
203 static struct bf5xx_nand_platform bf5xx_nand_platform = {
204 .page_size = NFC_PG_SIZE_256,
205 .data_width = NFC_NWIDTH_8,
206 .partitions = partition_info,
207 .nr_partitions = ARRAY_SIZE(partition_info),
212 static struct resource bf5xx_nand_resources[] = {
215 .end = NFC_DATA_RD + 2,
216 .flags = IORESOURCE_MEM,
221 .flags = IORESOURCE_IRQ,
225 static struct platform_device bf5xx_nand_device = {
226 .name = "bf5xx-nand",
228 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
229 .resource = bf5xx_nand_resources,
231 .platform_data = &bf5xx_nand_platform,
236 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
237 static struct resource bfin_pcmcia_cf_resources[] = {
239 .start = 0x20310000, /* IO PORT */
241 .flags = IORESOURCE_MEM,
243 .start = 0x20311000, /* Attribute Memory */
245 .flags = IORESOURCE_MEM,
249 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
251 .start = 6, /* Card Detect PF6 */
253 .flags = IORESOURCE_IRQ,
257 static struct platform_device bfin_pcmcia_cf_device = {
258 .name = "bfin_cf_pcmcia",
260 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
261 .resource = bfin_pcmcia_cf_resources,
265 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
266 static struct platform_device rtc_device = {
272 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
273 #include <linux/smc91x.h>
275 static struct smc91x_platdata smc91x_info = {
276 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
277 .leda = RPC_LED_100_10,
278 .ledb = RPC_LED_TX_RX,
281 static struct resource smc91x_resources[] = {
283 .name = "smc91x-regs",
285 .end = 0x20300300 + 16,
286 .flags = IORESOURCE_MEM,
291 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
294 static struct platform_device smc91x_device = {
297 .num_resources = ARRAY_SIZE(smc91x_resources),
298 .resource = smc91x_resources,
300 .platform_data = &smc91x_info,
305 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
306 static struct resource dm9000_resources[] = {
309 .end = 0x203FB800 + 1,
310 .flags = IORESOURCE_MEM,
313 .start = 0x203FB800 + 4,
314 .end = 0x203FB800 + 5,
315 .flags = IORESOURCE_MEM,
320 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
324 static struct platform_device dm9000_device = {
327 .num_resources = ARRAY_SIZE(dm9000_resources),
328 .resource = dm9000_resources,
332 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
333 static struct resource sl811_hcd_resources[] = {
337 .flags = IORESOURCE_MEM,
341 .flags = IORESOURCE_MEM,
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);
357 static struct sl811_platform_data sl811_priv = {
359 .power = 250, /* == 500mA */
360 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
361 .port_power = &sl811_port_power,
365 static struct platform_device sl811_hcd_device = {
369 .platform_data = &sl811_priv,
371 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
372 .resource = sl811_hcd_resources,
376 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
377 static struct resource isp1362_hcd_resources[] = {
381 .flags = IORESOURCE_MEM,
385 .flags = IORESOURCE_MEM,
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 = {
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",
408 .platform_data = &isp1362_priv,
410 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
411 .resource = isp1362_hcd_resources,
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 = {
422 .dev.platform_data = &bfin_mii_bus,
426 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
427 static struct resource net2272_bfin_resources[] = {
430 .end = 0x20300000 + 0x100,
431 .flags = IORESOURCE_MEM,
435 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
439 static struct platform_device net2272_bfin_device = {
442 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
443 .resource = net2272_bfin_resources,
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)",
454 .mask_flags = MTD_CAP_ROM
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 = {
464 .parts = bfin_spi_flash_partitions,
465 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
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*/
476 #if defined(CONFIG_BFIN_SPI_ADC) \
477 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
479 static struct bfin5xx_spi_chip spi_adc_chip_info = {
480 .enable_dma = 1, /* use dma transfer with this chip*/
485 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
486 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
487 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
493 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
494 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
500 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
501 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
506 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
508 .vref_delay_usecs = 50, /* internal, no capacitor */
511 .pressure_max = 1000,
513 .stopacq_polarity = 1,
514 .first_conversion_delay = 3,
515 .acquisition_time = 1,
517 .pen_down_acc_interval = 1,
521 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
522 #include <linux/spi/ad7879.h>
523 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
524 .model = 7879, /* Model = AD7879 */
525 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
526 .pressure_max = 10000,
528 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
529 .acquisition_time = 1, /* 4us acquisition time per sample */
530 .median = 2, /* do 8 measurements */
531 .averaging = 1, /* take the average of 4 middle samples */
532 .pen_down_acc_interval = 255, /* 9.4 ms */
533 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
534 .gpio_default = 1, /* During initialization set GPIO = HIGH */
538 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
539 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
545 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
546 && defined(CONFIG_SND_SOC_WM8731_SPI)
547 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
553 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
554 static struct bfin5xx_spi_chip spidev_chip_info = {
560 static struct spi_board_info bfin_spi_board_info[] __initdata = {
561 #if defined(CONFIG_MTD_M25P80) \
562 || defined(CONFIG_MTD_M25P80_MODULE)
564 /* the modalias must be the same as spi device driver name */
565 .modalias = "m25p80", /* Name of spi_driver for this device */
566 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
567 .bus_num = 0, /* Framework bus number */
568 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
569 .platform_data = &bfin_spi_flash_data,
570 .controller_data = &spi_flash_chip_info,
575 #if defined(CONFIG_BFIN_SPI_ADC) \
576 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
578 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
579 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
580 .bus_num = 0, /* Framework bus number */
581 .chip_select = 1, /* Framework chip select. */
582 .platform_data = NULL, /* No spi_driver specific config */
583 .controller_data = &spi_adc_chip_info,
587 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
588 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
590 .modalias = "ad1836",
591 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
593 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
594 .controller_data = &ad1836_spi_chip_info,
597 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
599 .modalias = "mmc_spi",
600 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
603 .controller_data = &mmc_spi_chip_info,
608 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
610 .modalias = "ad7877",
611 .platform_data = &bfin_ad7877_ts_info,
613 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
616 .controller_data = &spi_ad7877_chip_info,
619 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
621 .modalias = "ad7879",
622 .platform_data = &bfin_ad7879_ts_info,
624 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
627 .controller_data = &spi_ad7879_chip_info,
628 .mode = SPI_CPHA | SPI_CPOL,
631 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
632 && defined(CONFIG_SND_SOC_WM8731_SPI)
634 .modalias = "wm8731",
635 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
638 .controller_data = &spi_wm8731_chip_info,
642 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
644 .modalias = "spidev",
645 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
648 .controller_data = &spidev_chip_info,
653 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
654 /* SPI controller data */
655 static struct bfin5xx_spi_master bfin_spi0_info = {
657 .enable_dma = 1, /* master has the ability to do dma transfer */
658 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
662 static struct resource bfin_spi0_resource[] = {
664 .start = SPI0_REGBASE,
665 .end = SPI0_REGBASE + 0xFF,
666 .flags = IORESOURCE_MEM,
671 .flags = IORESOURCE_DMA,
676 .flags = IORESOURCE_IRQ,
680 static struct platform_device bfin_spi0_device = {
682 .id = 0, /* Bus number */
683 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
684 .resource = bfin_spi0_resource,
686 .platform_data = &bfin_spi0_info, /* Passed to driver */
689 #endif /* spi master and devices */
691 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
692 static struct platform_device bfin_fb_device = {
693 .name = "bf537-lq035",
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",
703 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
704 static struct resource bfin_uart_resources[] = {
705 #ifdef CONFIG_SERIAL_BFIN_UART0
709 .flags = IORESOURCE_MEM,
712 #ifdef CONFIG_SERIAL_BFIN_UART1
716 .flags = IORESOURCE_MEM,
721 static struct platform_device bfin_uart_device = {
724 .num_resources = ARRAY_SIZE(bfin_uart_resources),
725 .resource = bfin_uart_resources,
729 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
730 #ifdef CONFIG_BFIN_SIR0
731 static struct resource bfin_sir0_resources[] = {
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 = {
752 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
753 .resource = bfin_sir0_resources,
756 #ifdef CONFIG_BFIN_SIR1
757 static struct resource bfin_sir1_resources[] = {
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 = {
778 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
779 .resource = bfin_sir1_resources,
784 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
785 static struct resource bfin_twi0_resource[] = {
787 .start = TWI0_REGBASE,
789 .flags = IORESOURCE_MEM,
794 .flags = IORESOURCE_IRQ,
798 static struct platform_device i2c_bfin_twi_device = {
799 .name = "i2c-bfin-twi",
801 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
802 .resource = bfin_twi0_resource,
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),
812 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
814 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
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",
826 static struct platform_device bfin_sport1_uart_device = {
827 .name = "bfin-sport-uart",
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_PG0, 1, "gpio-keys: BTN0"},
838 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
841 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
842 .buttons = bfin_gpio_keys_table,
843 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
846 static struct platform_device bfin_device_gpiokeys = {
849 .platform_data = &bfin_gpio_keys_data,
854 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
855 #include <linux/input.h>
856 #include <asm/bfin_rotary.h>
858 static struct bfin_rotary_platform_data bfin_rotary_data = {
859 /*.rotary_up_key = KEY_UP,*/
860 /*.rotary_down_key = KEY_DOWN,*/
861 .rotary_rel_code = REL_WHEEL,
862 .rotary_button_key = KEY_ENTER,
863 .debounce = 10, /* 0..17 */
864 .mode = ROT_QUAD_ENC | ROT_DEBE,
867 static struct resource bfin_rotary_resources[] = {
871 .flags = IORESOURCE_IRQ,
875 static struct platform_device bfin_rotary_device = {
876 .name = "bfin-rotary",
878 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
879 .resource = bfin_rotary_resources,
881 .platform_data = &bfin_rotary_data,
886 static struct resource bfin_gpios_resources = {
888 .end = MAX_BLACKFIN_GPIOS - 1,
889 .flags = IORESOURCE_IRQ,
892 static struct platform_device bfin_gpios_device = {
893 .name = "simple-gpio",
896 .resource = &bfin_gpios_resources,
899 static const unsigned int cclk_vlev_datasheet[] =
901 VRPAIR(VLEV_100, 400000000),
902 VRPAIR(VLEV_105, 426000000),
903 VRPAIR(VLEV_110, 500000000),
904 VRPAIR(VLEV_115, 533000000),
905 VRPAIR(VLEV_120, 600000000),
908 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
909 .tuple_tab = cclk_vlev_datasheet,
910 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
911 .vr_settling_time = 25 /* us */,
914 static struct platform_device bfin_dpmc = {
917 .platform_data = &bfin_dmpc_vreg_data,
921 static struct platform_device *stamp_devices[] __initdata = {
925 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
929 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
930 &bfin_pcmcia_cf_device,
933 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
937 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
941 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
945 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
946 &bfin_isp1760_device,
949 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
953 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
957 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
961 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
966 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
967 &net2272_bfin_device,
970 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
974 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
978 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
979 &bf52x_t350mcqb_device,
982 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
983 &bfin_fb_adv7393_device,
986 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
990 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
991 #ifdef CONFIG_BFIN_SIR0
994 #ifdef CONFIG_BFIN_SIR1
999 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1000 &i2c_bfin_twi_device,
1003 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1004 &bfin_sport0_uart_device,
1005 &bfin_sport1_uart_device,
1008 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1009 &bfin_device_gpiokeys,
1012 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
1013 &bfin_rotary_device,
1016 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1017 &ezkit_flash_device,
1023 static int __init ezkit_init(void)
1025 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1026 i2c_register_board_info(0, bfin_i2c_board_info,
1027 ARRAY_SIZE(bfin_i2c_board_info));
1028 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1029 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1033 arch_initcall(ezkit_init);
1035 void native_machine_restart(char *cmd)
1037 /* workaround reboot hang when booting from SPI */
1038 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1039 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1042 void bfin_get_ether_addr(char *addr)
1044 /* the MAC is stored in OTP memory page 0xDF */
1047 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1049 ret = otp_read(0xDF, 0x00, &otp_mac);
1051 char *otp_mac_p = (char *)&otp_mac;
1052 for (ret = 0; ret < 6; ++ret)
1053 addr[ret] = otp_mac_p[5 - ret];
1056 EXPORT_SYMBOL(bfin_get_ether_addr);