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_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
698 static struct resource bfin_uart_resources
[] = {
699 #ifdef CONFIG_SERIAL_BFIN_UART0
703 .flags
= IORESOURCE_MEM
,
706 #ifdef CONFIG_SERIAL_BFIN_UART1
710 .flags
= IORESOURCE_MEM
,
715 static struct platform_device bfin_uart_device
= {
718 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
719 .resource
= bfin_uart_resources
,
723 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
724 #ifdef CONFIG_BFIN_SIR0
725 static struct resource bfin_sir0_resources
[] = {
729 .flags
= IORESOURCE_MEM
,
732 .start
= IRQ_UART0_RX
,
733 .end
= IRQ_UART0_RX
+1,
734 .flags
= IORESOURCE_IRQ
,
737 .start
= CH_UART0_RX
,
738 .end
= CH_UART0_RX
+1,
739 .flags
= IORESOURCE_DMA
,
743 static struct platform_device bfin_sir0_device
= {
746 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
747 .resource
= bfin_sir0_resources
,
750 #ifdef CONFIG_BFIN_SIR1
751 static struct resource bfin_sir1_resources
[] = {
755 .flags
= IORESOURCE_MEM
,
758 .start
= IRQ_UART1_RX
,
759 .end
= IRQ_UART1_RX
+1,
760 .flags
= IORESOURCE_IRQ
,
763 .start
= CH_UART1_RX
,
764 .end
= CH_UART1_RX
+1,
765 .flags
= IORESOURCE_DMA
,
769 static struct platform_device bfin_sir1_device
= {
772 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
773 .resource
= bfin_sir1_resources
,
778 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
779 static struct resource bfin_twi0_resource
[] = {
781 .start
= TWI0_REGBASE
,
783 .flags
= IORESOURCE_MEM
,
788 .flags
= IORESOURCE_IRQ
,
792 static struct platform_device i2c_bfin_twi_device
= {
793 .name
= "i2c-bfin-twi",
795 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
796 .resource
= bfin_twi0_resource
,
800 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
801 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
803 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
806 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
808 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
812 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
814 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
819 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
820 static struct platform_device bfin_sport0_uart_device
= {
821 .name
= "bfin-sport-uart",
825 static struct platform_device bfin_sport1_uart_device
= {
826 .name
= "bfin-sport-uart",
831 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
832 #include <linux/input.h>
833 #include <linux/gpio_keys.h>
835 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
836 {BTN_0
, GPIO_PG0
, 1, "gpio-keys: BTN0"},
837 {BTN_1
, GPIO_PG13
, 1, "gpio-keys: BTN1"},
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
= {
848 .platform_data
= &bfin_gpio_keys_data
,
853 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
854 #include <linux/input.h>
855 #include <asm/bfin_rotary.h>
857 static struct bfin_rotary_platform_data bfin_rotary_data
= {
858 /*.rotary_up_key = KEY_UP,*/
859 /*.rotary_down_key = KEY_DOWN,*/
860 .rotary_rel_code
= REL_WHEEL
,
861 .rotary_button_key
= KEY_ENTER
,
862 .debounce
= 10, /* 0..17 */
863 .mode
= ROT_QUAD_ENC
| ROT_DEBE
,
866 static struct resource bfin_rotary_resources
[] = {
870 .flags
= IORESOURCE_IRQ
,
874 static struct platform_device bfin_rotary_device
= {
875 .name
= "bfin-rotary",
877 .num_resources
= ARRAY_SIZE(bfin_rotary_resources
),
878 .resource
= bfin_rotary_resources
,
880 .platform_data
= &bfin_rotary_data
,
885 static const unsigned int cclk_vlev_datasheet
[] =
887 VRPAIR(VLEV_100
, 400000000),
888 VRPAIR(VLEV_105
, 426000000),
889 VRPAIR(VLEV_110
, 500000000),
890 VRPAIR(VLEV_115
, 533000000),
891 VRPAIR(VLEV_120
, 600000000),
894 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
895 .tuple_tab
= cclk_vlev_datasheet
,
896 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
897 .vr_settling_time
= 25 /* us */,
900 static struct platform_device bfin_dpmc
= {
903 .platform_data
= &bfin_dmpc_vreg_data
,
907 static struct platform_device
*stamp_devices
[] __initdata
= {
911 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
915 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
916 &bfin_pcmcia_cf_device
,
919 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
923 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
927 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
931 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
932 &bfin_isp1760_device
,
935 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
939 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
943 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
947 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
952 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
953 &net2272_bfin_device
,
956 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
960 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
964 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
965 &bf52x_t350mcqb_device
,
968 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
972 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
973 #ifdef CONFIG_BFIN_SIR0
976 #ifdef CONFIG_BFIN_SIR1
981 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
982 &i2c_bfin_twi_device
,
985 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
986 &bfin_sport0_uart_device
,
987 &bfin_sport1_uart_device
,
990 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
991 &bfin_device_gpiokeys
,
994 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
998 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1003 static int __init
ezkit_init(void)
1005 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
1006 i2c_register_board_info(0, bfin_i2c_board_info
,
1007 ARRAY_SIZE(bfin_i2c_board_info
));
1008 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
1009 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
1013 arch_initcall(ezkit_init
);
1015 void native_machine_restart(char *cmd
)
1017 /* workaround reboot hang when booting from SPI */
1018 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1019 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS
);
1022 void bfin_get_ether_addr(char *addr
)
1024 /* the MAC is stored in OTP memory page 0xDF */
1027 u32 (*otp_read
)(u32 page
, u32 flags
, u64
*page_content
) = (void *)0xEF00001A;
1029 ret
= otp_read(0xDF, 0x00, &otp_mac
);
1031 char *otp_mac_p
= (char *)&otp_mac
;
1032 for (ret
= 0; ret
< 6; ++ret
)
1033 addr
[ret
] = otp_mac_p
[5 - ret
];
1036 EXPORT_SYMBOL(bfin_get_ether_addr
);