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 #include <linux/irq.h>
17 #include <linux/i2c.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/musb.h>
20 #include <asm/bfin5xx_spi.h>
25 #include <asm/portmux.h>
26 #include <asm/bfin_sdh.h>
27 #include <mach/bf54x_keys.h>
28 #include <linux/input.h>
29 #include <linux/spi/ad7877.h>
32 * Name the Board for the /proc/cpuinfo
34 const char bfin_board_name
[] = "ADI BF548-EZKIT";
37 * Driver needs to know address, irq and flag pin.
40 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
41 #include <linux/usb/isp1760.h>
42 static struct resource bfin_isp1760_resources
[] = {
45 .end
= 0x2C0C0000 + 0xfffff,
46 .flags
= IORESOURCE_MEM
,
51 .flags
= IORESOURCE_IRQ
,
55 static struct isp1760_platform_data isp1760_priv
= {
60 .dack_polarity_high
= 0,
61 .dreq_polarity_high
= 0,
64 static struct platform_device bfin_isp1760_device
= {
68 .platform_data
= &isp1760_priv
,
70 .num_resources
= ARRAY_SIZE(bfin_isp1760_resources
),
71 .resource
= bfin_isp1760_resources
,
75 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
77 #include <mach/bf54x-lq043.h>
79 static struct bfin_bf54xfb_mach_info bf54x_lq043_data
= {
82 .xres
= {480, 480, 480},
83 .yres
= {272, 272, 272},
88 static struct resource bf54x_lq043_resources
[] = {
90 .start
= IRQ_EPPI0_ERR
,
92 .flags
= IORESOURCE_IRQ
,
96 static struct platform_device bf54x_lq043_device
= {
97 .name
= "bf54x-lq043",
99 .num_resources
= ARRAY_SIZE(bf54x_lq043_resources
),
100 .resource
= bf54x_lq043_resources
,
102 .platform_data
= &bf54x_lq043_data
,
107 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
108 static const unsigned int bf548_keymap
[] = {
109 KEYVAL(0, 0, KEY_ENTER
),
110 KEYVAL(0, 1, KEY_HELP
),
112 KEYVAL(0, 3, KEY_BACKSPACE
),
113 KEYVAL(1, 0, KEY_TAB
),
117 KEYVAL(2, 0, KEY_DOWN
),
121 KEYVAL(3, 0, KEY_UP
),
127 static struct bfin_kpad_platform_data bf54x_kpad_data
= {
130 .keymap
= bf548_keymap
,
131 .keymapsize
= ARRAY_SIZE(bf548_keymap
),
133 .debounce_time
= 5000, /* ns (5ms) */
134 .coldrive_time
= 1000, /* ns (1ms) */
135 .keyup_test_interval
= 50, /* ms (50ms) */
138 static struct resource bf54x_kpad_resources
[] = {
142 .flags
= IORESOURCE_IRQ
,
146 static struct platform_device bf54x_kpad_device
= {
147 .name
= "bf54x-keys",
149 .num_resources
= ARRAY_SIZE(bf54x_kpad_resources
),
150 .resource
= bf54x_kpad_resources
,
152 .platform_data
= &bf54x_kpad_data
,
157 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
158 #include <asm/bfin_rotary.h>
160 static struct bfin_rotary_platform_data bfin_rotary_data
= {
161 /*.rotary_up_key = KEY_UP,*/
162 /*.rotary_down_key = KEY_DOWN,*/
163 .rotary_rel_code
= REL_WHEEL
,
164 .rotary_button_key
= KEY_ENTER
,
165 .debounce
= 10, /* 0..17 */
166 .mode
= ROT_QUAD_ENC
| ROT_DEBE
,
169 static struct resource bfin_rotary_resources
[] = {
173 .flags
= IORESOURCE_IRQ
,
177 static struct platform_device bfin_rotary_device
= {
178 .name
= "bfin-rotary",
180 .num_resources
= ARRAY_SIZE(bfin_rotary_resources
),
181 .resource
= bfin_rotary_resources
,
183 .platform_data
= &bfin_rotary_data
,
188 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
189 #include <linux/input/adxl34x.h>
190 static const struct adxl34x_platform_data adxl34x_info
= {
194 .tap_threshold
= 0x31,
195 .tap_duration
= 0x10,
198 .tap_axis_control
= ADXL_TAP_X_EN
| ADXL_TAP_Y_EN
| ADXL_TAP_Z_EN
,
199 .act_axis_control
= 0xFF,
200 .activity_threshold
= 5,
201 .inactivity_threshold
= 3,
202 .inactivity_time
= 4,
203 .free_fall_threshold
= 0x7,
204 .free_fall_time
= 0x20,
206 .data_range
= ADXL_FULL_RES
,
209 .ev_code_x
= ABS_X
, /* EV_REL */
210 .ev_code_y
= ABS_Y
, /* EV_REL */
211 .ev_code_z
= ABS_Z
, /* EV_REL */
213 .ev_code_tap
= {BTN_TOUCH
, BTN_TOUCH
, BTN_TOUCH
}, /* EV_KEY x,y,z */
215 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
216 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
217 .power_mode
= ADXL_AUTO_SLEEP
| ADXL_LINK
,
218 .fifo_mode
= ADXL_FIFO_STREAM
,
219 .orientation_enable
= ADXL_EN_ORIENTATION_3D
,
220 .deadzone_angle
= ADXL_DEADZONE_ANGLE_10p8
,
221 .divisor_length
= ADXL_LP_FILTER_DIVISOR_16
,
222 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
223 .ev_codes_orient_3d
= {BTN_Z
, BTN_Y
, BTN_X
, BTN_A
, BTN_B
, BTN_C
},
227 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
228 static struct platform_device rtc_device
= {
234 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
235 #ifdef CONFIG_SERIAL_BFIN_UART0
236 static struct resource bfin_uart0_resources
[] = {
240 .flags
= IORESOURCE_MEM
,
243 .start
= IRQ_UART0_RX
,
244 .end
= IRQ_UART0_RX
+1,
245 .flags
= IORESOURCE_IRQ
,
248 .start
= IRQ_UART0_ERROR
,
249 .end
= IRQ_UART0_ERROR
,
250 .flags
= IORESOURCE_IRQ
,
253 .start
= CH_UART0_TX
,
255 .flags
= IORESOURCE_DMA
,
258 .start
= CH_UART0_RX
,
260 .flags
= IORESOURCE_DMA
,
264 unsigned short bfin_uart0_peripherals
[] = {
265 P_UART0_TX
, P_UART0_RX
, 0
268 static struct platform_device bfin_uart0_device
= {
271 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
272 .resource
= bfin_uart0_resources
,
274 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
278 #ifdef CONFIG_SERIAL_BFIN_UART1
279 static struct resource bfin_uart1_resources
[] = {
283 .flags
= IORESOURCE_MEM
,
286 .start
= IRQ_UART1_RX
,
287 .end
= IRQ_UART1_RX
+1,
288 .flags
= IORESOURCE_IRQ
,
291 .start
= IRQ_UART1_ERROR
,
292 .end
= IRQ_UART1_ERROR
,
293 .flags
= IORESOURCE_IRQ
,
296 .start
= CH_UART1_TX
,
298 .flags
= IORESOURCE_DMA
,
301 .start
= CH_UART1_RX
,
303 .flags
= IORESOURCE_DMA
,
305 #ifdef CONFIG_BFIN_UART1_CTSRTS
306 { /* CTS pin -- 0 means not supported */
309 .flags
= IORESOURCE_IO
,
311 { /* RTS pin -- 0 means not supported */
314 .flags
= IORESOURCE_IO
,
319 unsigned short bfin_uart1_peripherals
[] = {
320 P_UART1_TX
, P_UART1_RX
,
321 #ifdef CONFIG_BFIN_UART1_CTSRTS
322 P_UART1_RTS
, P_UART1_CTS
,
327 static struct platform_device bfin_uart1_device
= {
330 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
331 .resource
= bfin_uart1_resources
,
333 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
337 #ifdef CONFIG_SERIAL_BFIN_UART2
338 static struct resource bfin_uart2_resources
[] = {
342 .flags
= IORESOURCE_MEM
,
345 .start
= IRQ_UART2_RX
,
346 .end
= IRQ_UART2_RX
+1,
347 .flags
= IORESOURCE_IRQ
,
350 .start
= IRQ_UART2_ERROR
,
351 .end
= IRQ_UART2_ERROR
,
352 .flags
= IORESOURCE_IRQ
,
355 .start
= CH_UART2_TX
,
357 .flags
= IORESOURCE_DMA
,
360 .start
= CH_UART2_RX
,
362 .flags
= IORESOURCE_DMA
,
366 unsigned short bfin_uart2_peripherals
[] = {
367 P_UART2_TX
, P_UART2_RX
, 0
370 static struct platform_device bfin_uart2_device
= {
373 .num_resources
= ARRAY_SIZE(bfin_uart2_resources
),
374 .resource
= bfin_uart2_resources
,
376 .platform_data
= &bfin_uart2_peripherals
, /* Passed to driver */
380 #ifdef CONFIG_SERIAL_BFIN_UART3
381 static struct resource bfin_uart3_resources
[] = {
385 .flags
= IORESOURCE_MEM
,
388 .start
= IRQ_UART3_RX
,
389 .end
= IRQ_UART3_RX
+1,
390 .flags
= IORESOURCE_IRQ
,
393 .start
= IRQ_UART3_ERROR
,
394 .end
= IRQ_UART3_ERROR
,
395 .flags
= IORESOURCE_IRQ
,
398 .start
= CH_UART3_TX
,
400 .flags
= IORESOURCE_DMA
,
403 .start
= CH_UART3_RX
,
405 .flags
= IORESOURCE_DMA
,
407 #ifdef CONFIG_BFIN_UART3_CTSRTS
408 { /* CTS pin -- 0 means not supported */
411 .flags
= IORESOURCE_IO
,
413 { /* RTS pin -- 0 means not supported */
416 .flags
= IORESOURCE_IO
,
421 unsigned short bfin_uart3_peripherals
[] = {
422 P_UART3_TX
, P_UART3_RX
,
423 #ifdef CONFIG_BFIN_UART3_CTSRTS
424 P_UART3_RTS
, P_UART3_CTS
,
429 static struct platform_device bfin_uart3_device
= {
432 .num_resources
= ARRAY_SIZE(bfin_uart3_resources
),
433 .resource
= bfin_uart3_resources
,
435 .platform_data
= &bfin_uart3_peripherals
, /* Passed to driver */
441 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
442 #ifdef CONFIG_BFIN_SIR0
443 static struct resource bfin_sir0_resources
[] = {
447 .flags
= IORESOURCE_MEM
,
450 .start
= IRQ_UART0_RX
,
451 .end
= IRQ_UART0_RX
+1,
452 .flags
= IORESOURCE_IRQ
,
455 .start
= CH_UART0_RX
,
456 .end
= CH_UART0_RX
+1,
457 .flags
= IORESOURCE_DMA
,
460 static struct platform_device bfin_sir0_device
= {
463 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
464 .resource
= bfin_sir0_resources
,
467 #ifdef CONFIG_BFIN_SIR1
468 static struct resource bfin_sir1_resources
[] = {
472 .flags
= IORESOURCE_MEM
,
475 .start
= IRQ_UART1_RX
,
476 .end
= IRQ_UART1_RX
+1,
477 .flags
= IORESOURCE_IRQ
,
480 .start
= CH_UART1_RX
,
481 .end
= CH_UART1_RX
+1,
482 .flags
= IORESOURCE_DMA
,
485 static struct platform_device bfin_sir1_device
= {
488 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
489 .resource
= bfin_sir1_resources
,
492 #ifdef CONFIG_BFIN_SIR2
493 static struct resource bfin_sir2_resources
[] = {
497 .flags
= IORESOURCE_MEM
,
500 .start
= IRQ_UART2_RX
,
501 .end
= IRQ_UART2_RX
+1,
502 .flags
= IORESOURCE_IRQ
,
505 .start
= CH_UART2_RX
,
506 .end
= CH_UART2_RX
+1,
507 .flags
= IORESOURCE_DMA
,
510 static struct platform_device bfin_sir2_device
= {
513 .num_resources
= ARRAY_SIZE(bfin_sir2_resources
),
514 .resource
= bfin_sir2_resources
,
517 #ifdef CONFIG_BFIN_SIR3
518 static struct resource bfin_sir3_resources
[] = {
522 .flags
= IORESOURCE_MEM
,
525 .start
= IRQ_UART3_RX
,
526 .end
= IRQ_UART3_RX
+1,
527 .flags
= IORESOURCE_IRQ
,
530 .start
= CH_UART3_RX
,
531 .end
= CH_UART3_RX
+1,
532 .flags
= IORESOURCE_DMA
,
535 static struct platform_device bfin_sir3_device
= {
538 .num_resources
= ARRAY_SIZE(bfin_sir3_resources
),
539 .resource
= bfin_sir3_resources
,
544 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
545 #include <linux/smsc911x.h>
547 static struct resource smsc911x_resources
[] = {
549 .name
= "smsc911x-memory",
551 .end
= 0x24000000 + 0xFF,
552 .flags
= IORESOURCE_MEM
,
557 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
561 static struct smsc911x_platform_config smsc911x_config
= {
562 .flags
= SMSC911X_USE_32BIT
,
563 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
564 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
565 .phy_interface
= PHY_INTERFACE_MODE_MII
,
568 static struct platform_device smsc911x_device
= {
571 .num_resources
= ARRAY_SIZE(smsc911x_resources
),
572 .resource
= smsc911x_resources
,
574 .platform_data
= &smsc911x_config
,
579 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
580 static struct resource musb_resources
[] = {
584 .flags
= IORESOURCE_MEM
,
586 [1] = { /* general IRQ */
587 .start
= IRQ_USB_INT0
,
589 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
591 [2] = { /* DMA IRQ */
592 .start
= IRQ_USB_DMA
,
594 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
598 static struct musb_hdrc_config musb_config
= {
605 .gpio_vrsel
= GPIO_PE7
,
606 /* Some custom boards need to be active low, just set it to "0"
609 .gpio_vrsel_active
= 1,
612 static struct musb_hdrc_platform_data musb_plat
= {
613 #if defined(CONFIG_USB_MUSB_OTG)
615 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
617 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
618 .mode
= MUSB_PERIPHERAL
,
620 .config
= &musb_config
,
623 static u64 musb_dmamask
= ~(u32
)0;
625 static struct platform_device musb_device
= {
629 .dma_mask
= &musb_dmamask
,
630 .coherent_dma_mask
= 0xffffffff,
631 .platform_data
= &musb_plat
,
633 .num_resources
= ARRAY_SIZE(musb_resources
),
634 .resource
= musb_resources
,
638 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
639 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
640 static struct resource bfin_sport0_uart_resources
[] = {
642 .start
= SPORT0_TCR1
,
643 .end
= SPORT0_MRCS3
+4,
644 .flags
= IORESOURCE_MEM
,
647 .start
= IRQ_SPORT0_RX
,
648 .end
= IRQ_SPORT0_RX
+1,
649 .flags
= IORESOURCE_IRQ
,
652 .start
= IRQ_SPORT0_ERROR
,
653 .end
= IRQ_SPORT0_ERROR
,
654 .flags
= IORESOURCE_IRQ
,
658 unsigned short bfin_sport0_peripherals
[] = {
659 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
660 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, P_SPORT0_DRSEC
, P_SPORT0_DTSEC
, 0
663 static struct platform_device bfin_sport0_uart_device
= {
664 .name
= "bfin-sport-uart",
666 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
667 .resource
= bfin_sport0_uart_resources
,
669 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
673 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
674 static struct resource bfin_sport1_uart_resources
[] = {
676 .start
= SPORT1_TCR1
,
677 .end
= SPORT1_MRCS3
+4,
678 .flags
= IORESOURCE_MEM
,
681 .start
= IRQ_SPORT1_RX
,
682 .end
= IRQ_SPORT1_RX
+1,
683 .flags
= IORESOURCE_IRQ
,
686 .start
= IRQ_SPORT1_ERROR
,
687 .end
= IRQ_SPORT1_ERROR
,
688 .flags
= IORESOURCE_IRQ
,
692 unsigned short bfin_sport1_peripherals
[] = {
693 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
694 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, P_SPORT1_DRSEC
, P_SPORT1_DTSEC
, 0
697 static struct platform_device bfin_sport1_uart_device
= {
698 .name
= "bfin-sport-uart",
700 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
701 .resource
= bfin_sport1_uart_resources
,
703 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
707 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
708 static struct resource bfin_sport2_uart_resources
[] = {
710 .start
= SPORT2_TCR1
,
711 .end
= SPORT2_MRCS3
+4,
712 .flags
= IORESOURCE_MEM
,
715 .start
= IRQ_SPORT2_RX
,
716 .end
= IRQ_SPORT2_RX
+1,
717 .flags
= IORESOURCE_IRQ
,
720 .start
= IRQ_SPORT2_ERROR
,
721 .end
= IRQ_SPORT2_ERROR
,
722 .flags
= IORESOURCE_IRQ
,
726 unsigned short bfin_sport2_peripherals
[] = {
727 P_SPORT2_TFS
, P_SPORT2_DTPRI
, P_SPORT2_TSCLK
, P_SPORT2_RFS
,
728 P_SPORT2_DRPRI
, P_SPORT2_RSCLK
, P_SPORT2_DRSEC
, P_SPORT2_DTSEC
, 0
731 static struct platform_device bfin_sport2_uart_device
= {
732 .name
= "bfin-sport-uart",
734 .num_resources
= ARRAY_SIZE(bfin_sport2_uart_resources
),
735 .resource
= bfin_sport2_uart_resources
,
737 .platform_data
= &bfin_sport2_peripherals
, /* Passed to driver */
741 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
742 static struct resource bfin_sport3_uart_resources
[] = {
744 .start
= SPORT3_TCR1
,
745 .end
= SPORT3_MRCS3
+4,
746 .flags
= IORESOURCE_MEM
,
749 .start
= IRQ_SPORT3_RX
,
750 .end
= IRQ_SPORT3_RX
+1,
751 .flags
= IORESOURCE_IRQ
,
754 .start
= IRQ_SPORT3_ERROR
,
755 .end
= IRQ_SPORT3_ERROR
,
756 .flags
= IORESOURCE_IRQ
,
760 unsigned short bfin_sport3_peripherals
[] = {
761 P_SPORT3_TFS
, P_SPORT3_DTPRI
, P_SPORT3_TSCLK
, P_SPORT3_RFS
,
762 P_SPORT3_DRPRI
, P_SPORT3_RSCLK
, P_SPORT3_DRSEC
, P_SPORT3_DTSEC
, 0
765 static struct platform_device bfin_sport3_uart_device
= {
766 .name
= "bfin-sport-uart",
768 .num_resources
= ARRAY_SIZE(bfin_sport3_uart_resources
),
769 .resource
= bfin_sport3_uart_resources
,
771 .platform_data
= &bfin_sport3_peripherals
, /* Passed to driver */
777 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
778 unsigned short bfin_can_peripherals
[] = {
779 P_CAN0_RX
, P_CAN0_TX
, 0
782 static struct resource bfin_can_resources
[] = {
786 .flags
= IORESOURCE_MEM
,
789 .start
= IRQ_CAN0_RX
,
791 .flags
= IORESOURCE_IRQ
,
794 .start
= IRQ_CAN0_TX
,
796 .flags
= IORESOURCE_IRQ
,
799 .start
= IRQ_CAN0_ERROR
,
800 .end
= IRQ_CAN0_ERROR
,
801 .flags
= IORESOURCE_IRQ
,
805 static struct platform_device bfin_can_device
= {
807 .num_resources
= ARRAY_SIZE(bfin_can_resources
),
808 .resource
= bfin_can_resources
,
810 .platform_data
= &bfin_can_peripherals
, /* Passed to driver */
815 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
816 static struct resource bfin_atapi_resources
[] = {
820 .flags
= IORESOURCE_MEM
,
823 .start
= IRQ_ATAPI_ERR
,
824 .end
= IRQ_ATAPI_ERR
,
825 .flags
= IORESOURCE_IRQ
,
829 static struct platform_device bfin_atapi_device
= {
830 .name
= "pata-bf54x",
832 .num_resources
= ARRAY_SIZE(bfin_atapi_resources
),
833 .resource
= bfin_atapi_resources
,
837 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
838 static struct mtd_partition partition_info
[] = {
840 .name
= "linux kernel(nand)",
842 .size
= 4 * 1024 * 1024,
845 .name
= "file system(nand)",
846 .offset
= MTDPART_OFS_APPEND
,
847 .size
= MTDPART_SIZ_FULL
,
851 static struct bf5xx_nand_platform bf5xx_nand_platform
= {
852 .data_width
= NFC_NWIDTH_8
,
853 .partitions
= partition_info
,
854 .nr_partitions
= ARRAY_SIZE(partition_info
),
859 static struct resource bf5xx_nand_resources
[] = {
863 .flags
= IORESOURCE_MEM
,
868 .flags
= IORESOURCE_IRQ
,
872 static struct platform_device bf5xx_nand_device
= {
873 .name
= "bf5xx-nand",
875 .num_resources
= ARRAY_SIZE(bf5xx_nand_resources
),
876 .resource
= bf5xx_nand_resources
,
878 .platform_data
= &bf5xx_nand_platform
,
883 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
885 static struct bfin_sd_host bfin_sdh_data
= {
887 .irq_int0
= IRQ_SDH_MASK0
,
888 .pin_req
= {P_SD_D0
, P_SD_D1
, P_SD_D2
, P_SD_D3
, P_SD_CLK
, P_SD_CMD
, 0},
891 static struct platform_device bf54x_sdh_device
= {
895 .platform_data
= &bfin_sdh_data
,
900 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
901 static struct mtd_partition ezkit_partitions
[] = {
903 .name
= "bootloader(nor)",
907 .name
= "linux kernel(nor)",
909 .offset
= MTDPART_OFS_APPEND
,
911 .name
= "file system(nor)",
912 .size
= MTDPART_SIZ_FULL
,
913 .offset
= MTDPART_OFS_APPEND
,
917 static struct physmap_flash_data ezkit_flash_data
= {
919 .parts
= ezkit_partitions
,
920 .nr_parts
= ARRAY_SIZE(ezkit_partitions
),
923 static struct resource ezkit_flash_resource
= {
926 .flags
= IORESOURCE_MEM
,
929 static struct platform_device ezkit_flash_device
= {
930 .name
= "physmap-flash",
933 .platform_data
= &ezkit_flash_data
,
936 .resource
= &ezkit_flash_resource
,
940 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
941 /* SPI flash chip (m25p16) */
942 static struct mtd_partition bfin_spi_flash_partitions
[] = {
944 .name
= "bootloader(spi)",
947 .mask_flags
= MTD_CAP_ROM
949 .name
= "linux kernel(spi)",
950 .size
= MTDPART_SIZ_FULL
,
951 .offset
= MTDPART_OFS_APPEND
,
955 static struct flash_platform_data bfin_spi_flash_data
= {
957 .parts
= bfin_spi_flash_partitions
,
958 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
962 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
963 .enable_dma
= 0, /* use dma transfer with this chip*/
968 #if defined(CONFIG_SND_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
969 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
975 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
976 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
981 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
983 .vref_delay_usecs
= 50, /* internal, no capacitor */
986 .pressure_max
= 1000,
988 .stopacq_polarity
= 1,
989 .first_conversion_delay
= 3,
990 .acquisition_time
= 1,
992 .pen_down_acc_interval
= 1,
996 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
997 static struct bfin5xx_spi_chip spidev_chip_info
= {
1003 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1004 static struct bfin5xx_spi_chip spi_adxl34x_chip_info
= {
1005 .enable_dma
= 0, /* use dma transfer with this chip*/
1010 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
1011 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
1013 /* the modalias must be the same as spi device driver name */
1014 .modalias
= "m25p80", /* Name of spi_driver for this device */
1015 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
1016 .bus_num
= 0, /* Framework bus number */
1017 .chip_select
= 1, /* SPI_SSEL1*/
1018 .platform_data
= &bfin_spi_flash_data
,
1019 .controller_data
= &spi_flash_chip_info
,
1023 #if defined(CONFIG_SND_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
1025 .modalias
= "ad1836",
1026 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
1028 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
1029 .controller_data
= &ad1836_spi_chip_info
,
1032 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1034 .modalias
= "ad7877",
1035 .platform_data
= &bfin_ad7877_ts_info
,
1036 .irq
= IRQ_PB4
, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
1037 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
1040 .controller_data
= &spi_ad7877_chip_info
,
1043 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1045 .modalias
= "spidev",
1046 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
1049 .controller_data
= &spidev_chip_info
,
1052 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1054 .modalias
= "adxl34x",
1055 .platform_data
= &adxl34x_info
,
1057 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
1060 .controller_data
= &spi_adxl34x_chip_info
,
1065 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1067 static struct resource bfin_spi0_resource
[] = {
1069 .start
= SPI0_REGBASE
,
1070 .end
= SPI0_REGBASE
+ 0xFF,
1071 .flags
= IORESOURCE_MEM
,
1076 .flags
= IORESOURCE_DMA
,
1081 .flags
= IORESOURCE_IRQ
,
1086 static struct resource bfin_spi1_resource
[] = {
1088 .start
= SPI1_REGBASE
,
1089 .end
= SPI1_REGBASE
+ 0xFF,
1090 .flags
= IORESOURCE_MEM
,
1095 .flags
= IORESOURCE_DMA
,
1100 .flags
= IORESOURCE_IRQ
,
1104 /* SPI controller data */
1105 static struct bfin5xx_spi_master bf54x_spi_master_info0
= {
1106 .num_chipselect
= 3,
1107 .enable_dma
= 1, /* master has the ability to do dma transfer */
1108 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
1111 static struct platform_device bf54x_spi_master0
= {
1113 .id
= 0, /* Bus number */
1114 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
1115 .resource
= bfin_spi0_resource
,
1117 .platform_data
= &bf54x_spi_master_info0
, /* Passed to driver */
1121 static struct bfin5xx_spi_master bf54x_spi_master_info1
= {
1122 .num_chipselect
= 3,
1123 .enable_dma
= 1, /* master has the ability to do dma transfer */
1124 .pin_req
= {P_SPI1_SCK
, P_SPI1_MISO
, P_SPI1_MOSI
, 0},
1127 static struct platform_device bf54x_spi_master1
= {
1129 .id
= 1, /* Bus number */
1130 .num_resources
= ARRAY_SIZE(bfin_spi1_resource
),
1131 .resource
= bfin_spi1_resource
,
1133 .platform_data
= &bf54x_spi_master_info1
, /* Passed to driver */
1136 #endif /* spi master and devices */
1138 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1139 static struct resource bfin_twi0_resource
[] = {
1141 .start
= TWI0_REGBASE
,
1142 .end
= TWI0_REGBASE
+ 0xFF,
1143 .flags
= IORESOURCE_MEM
,
1148 .flags
= IORESOURCE_IRQ
,
1152 static struct platform_device i2c_bfin_twi0_device
= {
1153 .name
= "i2c-bfin-twi",
1155 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
1156 .resource
= bfin_twi0_resource
,
1159 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1160 static struct resource bfin_twi1_resource
[] = {
1162 .start
= TWI1_REGBASE
,
1163 .end
= TWI1_REGBASE
+ 0xFF,
1164 .flags
= IORESOURCE_MEM
,
1169 .flags
= IORESOURCE_IRQ
,
1173 static struct platform_device i2c_bfin_twi1_device
= {
1174 .name
= "i2c-bfin-twi",
1176 .num_resources
= ARRAY_SIZE(bfin_twi1_resource
),
1177 .resource
= bfin_twi1_resource
,
1182 static struct i2c_board_info __initdata bfin_i2c_board_info0
[] = {
1185 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1186 static struct i2c_board_info __initdata bfin_i2c_board_info1
[] = {
1187 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1189 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1192 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1194 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1198 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1200 I2C_BOARD_INFO("adxl34x", 0x53),
1202 .platform_data
= (void *)&adxl34x_info
,
1208 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1209 #include <linux/gpio_keys.h>
1211 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
1212 {BTN_0
, GPIO_PB8
, 1, "gpio-keys: BTN0"},
1213 {BTN_1
, GPIO_PB9
, 1, "gpio-keys: BTN1"},
1214 {BTN_2
, GPIO_PB10
, 1, "gpio-keys: BTN2"},
1215 {BTN_3
, GPIO_PB11
, 1, "gpio-keys: BTN3"},
1218 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
1219 .buttons
= bfin_gpio_keys_table
,
1220 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
1223 static struct platform_device bfin_device_gpiokeys
= {
1224 .name
= "gpio-keys",
1226 .platform_data
= &bfin_gpio_keys_data
,
1231 static const unsigned int cclk_vlev_datasheet
[] =
1234 * Internal VLEV BF54XSBBC1533
1235 ****temporarily using these values until data sheet is updated
1237 VRPAIR(VLEV_085
, 150000000),
1238 VRPAIR(VLEV_090
, 250000000),
1239 VRPAIR(VLEV_110
, 276000000),
1240 VRPAIR(VLEV_115
, 301000000),
1241 VRPAIR(VLEV_120
, 525000000),
1242 VRPAIR(VLEV_125
, 550000000),
1243 VRPAIR(VLEV_130
, 600000000),
1246 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
1247 .tuple_tab
= cclk_vlev_datasheet
,
1248 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
1249 .vr_settling_time
= 25 /* us */,
1252 static struct platform_device bfin_dpmc
= {
1253 .name
= "bfin dpmc",
1255 .platform_data
= &bfin_dmpc_vreg_data
,
1259 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1260 static struct platform_device bfin_i2s
= {
1262 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
1263 /* TODO: add platform data here */
1267 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1268 static struct platform_device bfin_tdm
= {
1270 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
1271 /* TODO: add platform data here */
1275 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1276 static struct platform_device bfin_ac97
= {
1277 .name
= "bfin-ac97",
1278 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
1279 /* TODO: add platform data here */
1283 static struct platform_device
*ezkit_devices
[] __initdata
= {
1287 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1291 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1292 #ifdef CONFIG_SERIAL_BFIN_UART0
1295 #ifdef CONFIG_SERIAL_BFIN_UART1
1298 #ifdef CONFIG_SERIAL_BFIN_UART2
1301 #ifdef CONFIG_SERIAL_BFIN_UART3
1306 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1307 #ifdef CONFIG_BFIN_SIR0
1310 #ifdef CONFIG_BFIN_SIR1
1313 #ifdef CONFIG_BFIN_SIR2
1316 #ifdef CONFIG_BFIN_SIR3
1321 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
1322 &bf54x_lq043_device
,
1325 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
1329 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1333 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1334 &bfin_isp1760_device
,
1337 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1338 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1339 &bfin_sport0_uart_device
,
1341 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1342 &bfin_sport1_uart_device
,
1344 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1345 &bfin_sport2_uart_device
,
1347 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1348 &bfin_sport3_uart_device
,
1352 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1356 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
1360 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1364 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1368 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1373 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
1377 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1378 &bfin_rotary_device
,
1381 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1382 &i2c_bfin_twi0_device
,
1383 #if !defined(CONFIG_BF542)
1384 &i2c_bfin_twi1_device
,
1388 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1389 &bfin_device_gpiokeys
,
1392 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1393 &ezkit_flash_device
,
1396 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1400 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1404 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1409 static int __init
ezkit_init(void)
1411 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
1413 i2c_register_board_info(0, bfin_i2c_board_info0
,
1414 ARRAY_SIZE(bfin_i2c_board_info0
));
1415 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1416 i2c_register_board_info(1, bfin_i2c_board_info1
,
1417 ARRAY_SIZE(bfin_i2c_board_info1
));
1420 platform_add_devices(ezkit_devices
, ARRAY_SIZE(ezkit_devices
));
1422 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
1427 arch_initcall(ezkit_init
);
1429 static struct platform_device
*ezkit_early_devices
[] __initdata
= {
1430 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1431 #ifdef CONFIG_SERIAL_BFIN_UART0
1434 #ifdef CONFIG_SERIAL_BFIN_UART1
1437 #ifdef CONFIG_SERIAL_BFIN_UART2
1440 #ifdef CONFIG_SERIAL_BFIN_UART3
1445 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1446 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1447 &bfin_sport0_uart_device
,
1449 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1450 &bfin_sport1_uart_device
,
1452 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1453 &bfin_sport2_uart_device
,
1455 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1456 &bfin_sport3_uart_device
,
1461 void __init
native_machine_early_platform_add_devices(void)
1463 printk(KERN_INFO
"register early platform devices\n");
1464 early_platform_add_devices(ezkit_early_devices
,
1465 ARRAY_SIZE(ezkit_early_devices
));