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/bfin_sport.h>
26 #include <asm/portmux.h>
27 #include <asm/bfin_sdh.h>
28 #include <mach/bf54x_keys.h>
29 #include <linux/input.h>
30 #include <linux/spi/ad7877.h>
33 * Name the Board for the /proc/cpuinfo
35 const char bfin_board_name[] = "ADI BF548-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 = 0x2C0C0000 + 0xfffff,
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 = {
69 .platform_data = &isp1760_priv,
71 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
72 .resource = bfin_isp1760_resources,
76 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
78 #include <mach/bf54x-lq043.h>
80 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
83 .xres = {480, 480, 480},
84 .yres = {272, 272, 272},
89 static struct resource bf54x_lq043_resources[] = {
91 .start = IRQ_EPPI0_ERR,
93 .flags = IORESOURCE_IRQ,
97 static struct platform_device bf54x_lq043_device = {
98 .name = "bf54x-lq043",
100 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
101 .resource = bf54x_lq043_resources,
103 .platform_data = &bf54x_lq043_data,
108 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
109 static const unsigned int bf548_keymap[] = {
110 KEYVAL(0, 0, KEY_ENTER),
111 KEYVAL(0, 1, KEY_HELP),
113 KEYVAL(0, 3, KEY_BACKSPACE),
114 KEYVAL(1, 0, KEY_TAB),
118 KEYVAL(2, 0, KEY_DOWN),
122 KEYVAL(3, 0, KEY_UP),
128 static struct bfin_kpad_platform_data bf54x_kpad_data = {
131 .keymap = bf548_keymap,
132 .keymapsize = ARRAY_SIZE(bf548_keymap),
134 .debounce_time = 5000, /* ns (5ms) */
135 .coldrive_time = 1000, /* ns (1ms) */
136 .keyup_test_interval = 50, /* ms (50ms) */
139 static struct resource bf54x_kpad_resources[] = {
143 .flags = IORESOURCE_IRQ,
147 static struct platform_device bf54x_kpad_device = {
148 .name = "bf54x-keys",
150 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
151 .resource = bf54x_kpad_resources,
153 .platform_data = &bf54x_kpad_data,
158 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
159 #include <asm/bfin_rotary.h>
161 static struct bfin_rotary_platform_data bfin_rotary_data = {
162 /*.rotary_up_key = KEY_UP,*/
163 /*.rotary_down_key = KEY_DOWN,*/
164 .rotary_rel_code = REL_WHEEL,
165 .rotary_button_key = KEY_ENTER,
166 .debounce = 10, /* 0..17 */
167 .mode = ROT_QUAD_ENC | ROT_DEBE,
170 static struct resource bfin_rotary_resources[] = {
174 .flags = IORESOURCE_IRQ,
178 static struct platform_device bfin_rotary_device = {
179 .name = "bfin-rotary",
181 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
182 .resource = bfin_rotary_resources,
184 .platform_data = &bfin_rotary_data,
189 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
190 #include <linux/input/adxl34x.h>
191 static const struct adxl34x_platform_data adxl34x_info = {
195 .tap_threshold = 0x31,
196 .tap_duration = 0x10,
199 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
200 .act_axis_control = 0xFF,
201 .activity_threshold = 5,
202 .inactivity_threshold = 3,
203 .inactivity_time = 4,
204 .free_fall_threshold = 0x7,
205 .free_fall_time = 0x20,
207 .data_range = ADXL_FULL_RES,
210 .ev_code_x = ABS_X, /* EV_REL */
211 .ev_code_y = ABS_Y, /* EV_REL */
212 .ev_code_z = ABS_Z, /* EV_REL */
214 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
216 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
217 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
218 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
219 .fifo_mode = ADXL_FIFO_STREAM,
220 .orientation_enable = ADXL_EN_ORIENTATION_3D,
221 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
222 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
223 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
224 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
228 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
229 static struct platform_device rtc_device = {
235 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
236 #ifdef CONFIG_SERIAL_BFIN_UART0
237 static struct resource bfin_uart0_resources[] = {
241 .flags = IORESOURCE_MEM,
244 .start = IRQ_UART0_RX,
245 .end = IRQ_UART0_RX+1,
246 .flags = IORESOURCE_IRQ,
249 .start = IRQ_UART0_ERROR,
250 .end = IRQ_UART0_ERROR,
251 .flags = IORESOURCE_IRQ,
254 .start = CH_UART0_TX,
256 .flags = IORESOURCE_DMA,
259 .start = CH_UART0_RX,
261 .flags = IORESOURCE_DMA,
265 static unsigned short bfin_uart0_peripherals[] = {
266 P_UART0_TX, P_UART0_RX, 0
269 static struct platform_device bfin_uart0_device = {
272 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
273 .resource = bfin_uart0_resources,
275 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
279 #ifdef CONFIG_SERIAL_BFIN_UART1
280 static struct resource bfin_uart1_resources[] = {
284 .flags = IORESOURCE_MEM,
287 .start = IRQ_UART1_RX,
288 .end = IRQ_UART1_RX+1,
289 .flags = IORESOURCE_IRQ,
292 .start = IRQ_UART1_ERROR,
293 .end = IRQ_UART1_ERROR,
294 .flags = IORESOURCE_IRQ,
297 .start = CH_UART1_TX,
299 .flags = IORESOURCE_DMA,
302 .start = CH_UART1_RX,
304 .flags = IORESOURCE_DMA,
306 #ifdef CONFIG_BFIN_UART1_CTSRTS
307 { /* CTS pin -- 0 means not supported */
310 .flags = IORESOURCE_IO,
312 { /* RTS pin -- 0 means not supported */
315 .flags = IORESOURCE_IO,
320 static unsigned short bfin_uart1_peripherals[] = {
321 P_UART1_TX, P_UART1_RX,
322 #ifdef CONFIG_BFIN_UART1_CTSRTS
323 P_UART1_RTS, P_UART1_CTS,
328 static struct platform_device bfin_uart1_device = {
331 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
332 .resource = bfin_uart1_resources,
334 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
338 #ifdef CONFIG_SERIAL_BFIN_UART2
339 static struct resource bfin_uart2_resources[] = {
343 .flags = IORESOURCE_MEM,
346 .start = IRQ_UART2_RX,
347 .end = IRQ_UART2_RX+1,
348 .flags = IORESOURCE_IRQ,
351 .start = IRQ_UART2_ERROR,
352 .end = IRQ_UART2_ERROR,
353 .flags = IORESOURCE_IRQ,
356 .start = CH_UART2_TX,
358 .flags = IORESOURCE_DMA,
361 .start = CH_UART2_RX,
363 .flags = IORESOURCE_DMA,
367 static unsigned short bfin_uart2_peripherals[] = {
368 P_UART2_TX, P_UART2_RX, 0
371 static struct platform_device bfin_uart2_device = {
374 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
375 .resource = bfin_uart2_resources,
377 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
381 #ifdef CONFIG_SERIAL_BFIN_UART3
382 static struct resource bfin_uart3_resources[] = {
386 .flags = IORESOURCE_MEM,
389 .start = IRQ_UART3_RX,
390 .end = IRQ_UART3_RX+1,
391 .flags = IORESOURCE_IRQ,
394 .start = IRQ_UART3_ERROR,
395 .end = IRQ_UART3_ERROR,
396 .flags = IORESOURCE_IRQ,
399 .start = CH_UART3_TX,
401 .flags = IORESOURCE_DMA,
404 .start = CH_UART3_RX,
406 .flags = IORESOURCE_DMA,
408 #ifdef CONFIG_BFIN_UART3_CTSRTS
409 { /* CTS pin -- 0 means not supported */
412 .flags = IORESOURCE_IO,
414 { /* RTS pin -- 0 means not supported */
417 .flags = IORESOURCE_IO,
422 static unsigned short bfin_uart3_peripherals[] = {
423 P_UART3_TX, P_UART3_RX,
424 #ifdef CONFIG_BFIN_UART3_CTSRTS
425 P_UART3_RTS, P_UART3_CTS,
430 static struct platform_device bfin_uart3_device = {
433 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
434 .resource = bfin_uart3_resources,
436 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
442 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
443 #ifdef CONFIG_BFIN_SIR0
444 static struct resource bfin_sir0_resources[] = {
448 .flags = IORESOURCE_MEM,
451 .start = IRQ_UART0_RX,
452 .end = IRQ_UART0_RX+1,
453 .flags = IORESOURCE_IRQ,
456 .start = CH_UART0_RX,
457 .end = CH_UART0_RX+1,
458 .flags = IORESOURCE_DMA,
461 static struct platform_device bfin_sir0_device = {
464 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
465 .resource = bfin_sir0_resources,
468 #ifdef CONFIG_BFIN_SIR1
469 static struct resource bfin_sir1_resources[] = {
473 .flags = IORESOURCE_MEM,
476 .start = IRQ_UART1_RX,
477 .end = IRQ_UART1_RX+1,
478 .flags = IORESOURCE_IRQ,
481 .start = CH_UART1_RX,
482 .end = CH_UART1_RX+1,
483 .flags = IORESOURCE_DMA,
486 static struct platform_device bfin_sir1_device = {
489 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
490 .resource = bfin_sir1_resources,
493 #ifdef CONFIG_BFIN_SIR2
494 static struct resource bfin_sir2_resources[] = {
498 .flags = IORESOURCE_MEM,
501 .start = IRQ_UART2_RX,
502 .end = IRQ_UART2_RX+1,
503 .flags = IORESOURCE_IRQ,
506 .start = CH_UART2_RX,
507 .end = CH_UART2_RX+1,
508 .flags = IORESOURCE_DMA,
511 static struct platform_device bfin_sir2_device = {
514 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
515 .resource = bfin_sir2_resources,
518 #ifdef CONFIG_BFIN_SIR3
519 static struct resource bfin_sir3_resources[] = {
523 .flags = IORESOURCE_MEM,
526 .start = IRQ_UART3_RX,
527 .end = IRQ_UART3_RX+1,
528 .flags = IORESOURCE_IRQ,
531 .start = CH_UART3_RX,
532 .end = CH_UART3_RX+1,
533 .flags = IORESOURCE_DMA,
536 static struct platform_device bfin_sir3_device = {
539 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
540 .resource = bfin_sir3_resources,
545 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
546 #include <linux/smsc911x.h>
548 static struct resource smsc911x_resources[] = {
550 .name = "smsc911x-memory",
552 .end = 0x24000000 + 0xFF,
553 .flags = IORESOURCE_MEM,
558 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
562 static struct smsc911x_platform_config smsc911x_config = {
563 .flags = SMSC911X_USE_32BIT,
564 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
565 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
566 .phy_interface = PHY_INTERFACE_MODE_MII,
569 static struct platform_device smsc911x_device = {
572 .num_resources = ARRAY_SIZE(smsc911x_resources),
573 .resource = smsc911x_resources,
575 .platform_data = &smsc911x_config,
580 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
581 static struct resource musb_resources[] = {
585 .flags = IORESOURCE_MEM,
587 [1] = { /* general IRQ */
588 .start = IRQ_USB_INT0,
590 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
593 [2] = { /* DMA IRQ */
594 .start = IRQ_USB_DMA,
596 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
601 static struct musb_hdrc_config musb_config = {
608 .gpio_vrsel = GPIO_PE7,
609 /* Some custom boards need to be active low, just set it to "0"
612 .gpio_vrsel_active = 1,
613 .clkin = 24, /* musb CLKIN in MHZ */
616 static struct musb_hdrc_platform_data musb_plat = {
617 #if defined(CONFIG_USB_MUSB_OTG)
619 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
621 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
622 .mode = MUSB_PERIPHERAL,
624 .config = &musb_config,
627 static u64 musb_dmamask = ~(u32)0;
629 static struct platform_device musb_device = {
630 .name = "musb-blackfin",
633 .dma_mask = &musb_dmamask,
634 .coherent_dma_mask = 0xffffffff,
635 .platform_data = &musb_plat,
637 .num_resources = ARRAY_SIZE(musb_resources),
638 .resource = musb_resources,
642 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
643 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
644 static struct resource bfin_sport0_uart_resources[] = {
646 .start = SPORT0_TCR1,
647 .end = SPORT0_MRCS3+4,
648 .flags = IORESOURCE_MEM,
651 .start = IRQ_SPORT0_RX,
652 .end = IRQ_SPORT0_RX+1,
653 .flags = IORESOURCE_IRQ,
656 .start = IRQ_SPORT0_ERROR,
657 .end = IRQ_SPORT0_ERROR,
658 .flags = IORESOURCE_IRQ,
662 static unsigned short bfin_sport0_peripherals[] = {
663 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
664 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
667 static struct platform_device bfin_sport0_uart_device = {
668 .name = "bfin-sport-uart",
670 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
671 .resource = bfin_sport0_uart_resources,
673 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
677 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
678 static struct resource bfin_sport1_uart_resources[] = {
680 .start = SPORT1_TCR1,
681 .end = SPORT1_MRCS3+4,
682 .flags = IORESOURCE_MEM,
685 .start = IRQ_SPORT1_RX,
686 .end = IRQ_SPORT1_RX+1,
687 .flags = IORESOURCE_IRQ,
690 .start = IRQ_SPORT1_ERROR,
691 .end = IRQ_SPORT1_ERROR,
692 .flags = IORESOURCE_IRQ,
696 static unsigned short bfin_sport1_peripherals[] = {
697 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
698 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
701 static struct platform_device bfin_sport1_uart_device = {
702 .name = "bfin-sport-uart",
704 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
705 .resource = bfin_sport1_uart_resources,
707 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
711 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
712 static struct resource bfin_sport2_uart_resources[] = {
714 .start = SPORT2_TCR1,
715 .end = SPORT2_MRCS3+4,
716 .flags = IORESOURCE_MEM,
719 .start = IRQ_SPORT2_RX,
720 .end = IRQ_SPORT2_RX+1,
721 .flags = IORESOURCE_IRQ,
724 .start = IRQ_SPORT2_ERROR,
725 .end = IRQ_SPORT2_ERROR,
726 .flags = IORESOURCE_IRQ,
730 static unsigned short bfin_sport2_peripherals[] = {
731 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
732 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
735 static struct platform_device bfin_sport2_uart_device = {
736 .name = "bfin-sport-uart",
738 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
739 .resource = bfin_sport2_uart_resources,
741 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
745 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
746 static struct resource bfin_sport3_uart_resources[] = {
748 .start = SPORT3_TCR1,
749 .end = SPORT3_MRCS3+4,
750 .flags = IORESOURCE_MEM,
753 .start = IRQ_SPORT3_RX,
754 .end = IRQ_SPORT3_RX+1,
755 .flags = IORESOURCE_IRQ,
758 .start = IRQ_SPORT3_ERROR,
759 .end = IRQ_SPORT3_ERROR,
760 .flags = IORESOURCE_IRQ,
764 static unsigned short bfin_sport3_peripherals[] = {
765 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
766 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
769 static struct platform_device bfin_sport3_uart_device = {
770 .name = "bfin-sport-uart",
772 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
773 .resource = bfin_sport3_uart_resources,
775 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
781 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
783 static unsigned short bfin_can0_peripherals[] = {
784 P_CAN0_RX, P_CAN0_TX, 0
787 static struct resource bfin_can0_resources[] = {
791 .flags = IORESOURCE_MEM,
794 .start = IRQ_CAN0_RX,
796 .flags = IORESOURCE_IRQ,
799 .start = IRQ_CAN0_TX,
801 .flags = IORESOURCE_IRQ,
804 .start = IRQ_CAN0_ERROR,
805 .end = IRQ_CAN0_ERROR,
806 .flags = IORESOURCE_IRQ,
810 static struct platform_device bfin_can0_device = {
813 .num_resources = ARRAY_SIZE(bfin_can0_resources),
814 .resource = bfin_can0_resources,
816 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
820 static unsigned short bfin_can1_peripherals[] = {
821 P_CAN1_RX, P_CAN1_TX, 0
824 static struct resource bfin_can1_resources[] = {
828 .flags = IORESOURCE_MEM,
831 .start = IRQ_CAN1_RX,
833 .flags = IORESOURCE_IRQ,
836 .start = IRQ_CAN1_TX,
838 .flags = IORESOURCE_IRQ,
841 .start = IRQ_CAN1_ERROR,
842 .end = IRQ_CAN1_ERROR,
843 .flags = IORESOURCE_IRQ,
847 static struct platform_device bfin_can1_device = {
850 .num_resources = ARRAY_SIZE(bfin_can1_resources),
851 .resource = bfin_can1_resources,
853 .platform_data = &bfin_can1_peripherals, /* Passed to driver */
859 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
860 static struct resource bfin_atapi_resources[] = {
864 .flags = IORESOURCE_MEM,
867 .start = IRQ_ATAPI_ERR,
868 .end = IRQ_ATAPI_ERR,
869 .flags = IORESOURCE_IRQ,
873 static struct platform_device bfin_atapi_device = {
874 .name = "pata-bf54x",
876 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
877 .resource = bfin_atapi_resources,
881 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
882 static struct mtd_partition partition_info[] = {
884 .name = "bootloader(nand)",
888 .name = "linux kernel(nand)",
889 .offset = MTDPART_OFS_APPEND,
890 .size = 4 * 1024 * 1024,
893 .name = "file system(nand)",
894 .offset = MTDPART_OFS_APPEND,
895 .size = MTDPART_SIZ_FULL,
899 static struct bf5xx_nand_platform bf5xx_nand_platform = {
900 .data_width = NFC_NWIDTH_8,
901 .partitions = partition_info,
902 .nr_partitions = ARRAY_SIZE(partition_info),
907 static struct resource bf5xx_nand_resources[] = {
911 .flags = IORESOURCE_MEM,
916 .flags = IORESOURCE_IRQ,
920 static struct platform_device bf5xx_nand_device = {
921 .name = "bf5xx-nand",
923 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
924 .resource = bf5xx_nand_resources,
926 .platform_data = &bf5xx_nand_platform,
931 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
933 static struct bfin_sd_host bfin_sdh_data = {
935 .irq_int0 = IRQ_SDH_MASK0,
936 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
939 static struct platform_device bf54x_sdh_device = {
943 .platform_data = &bfin_sdh_data,
948 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
949 static struct mtd_partition ezkit_partitions[] = {
951 .name = "bootloader(nor)",
955 .name = "linux kernel(nor)",
957 .offset = MTDPART_OFS_APPEND,
959 .name = "file system(nor)",
960 .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
961 .offset = MTDPART_OFS_APPEND,
963 .name = "config(nor)",
965 .offset = MTDPART_OFS_APPEND,
967 .name = "u-boot env(nor)",
969 .offset = MTDPART_OFS_APPEND,
973 static struct physmap_flash_data ezkit_flash_data = {
975 .parts = ezkit_partitions,
976 .nr_parts = ARRAY_SIZE(ezkit_partitions),
979 static struct resource ezkit_flash_resource = {
982 .flags = IORESOURCE_MEM,
985 static struct platform_device ezkit_flash_device = {
986 .name = "physmap-flash",
989 .platform_data = &ezkit_flash_data,
992 .resource = &ezkit_flash_resource,
996 #if defined(CONFIG_MTD_M25P80) \
997 || defined(CONFIG_MTD_M25P80_MODULE)
998 /* SPI flash chip (m25p16) */
999 static struct mtd_partition bfin_spi_flash_partitions[] = {
1001 .name = "bootloader(spi)",
1004 .mask_flags = MTD_CAP_ROM
1006 .name = "linux kernel(spi)",
1007 .size = MTDPART_SIZ_FULL,
1008 .offset = MTDPART_OFS_APPEND,
1012 static struct flash_platform_data bfin_spi_flash_data = {
1014 .parts = bfin_spi_flash_partitions,
1015 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
1019 static struct bfin5xx_spi_chip spi_flash_chip_info = {
1020 .enable_dma = 0, /* use dma transfer with this chip*/
1024 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1025 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1027 .vref_delay_usecs = 50, /* internal, no capacitor */
1028 .x_plate_ohms = 419,
1029 .y_plate_ohms = 486,
1030 .pressure_max = 1000,
1032 .stopacq_polarity = 1,
1033 .first_conversion_delay = 3,
1034 .acquisition_time = 1,
1036 .pen_down_acc_interval = 1,
1040 static struct spi_board_info bfin_spi_board_info[] __initdata = {
1041 #if defined(CONFIG_MTD_M25P80) \
1042 || defined(CONFIG_MTD_M25P80_MODULE)
1044 /* the modalias must be the same as spi device driver name */
1045 .modalias = "m25p80", /* Name of spi_driver for this device */
1046 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1047 .bus_num = 0, /* Framework bus number */
1048 .chip_select = 1, /* SPI_SSEL1*/
1049 .platform_data = &bfin_spi_flash_data,
1050 .controller_data = &spi_flash_chip_info,
1054 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
1055 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
1057 .modalias = "ad183x",
1058 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1063 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1065 .modalias = "ad7877",
1066 .platform_data = &bfin_ad7877_ts_info,
1067 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
1068 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1073 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1075 .modalias = "spidev",
1076 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1081 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1083 .modalias = "adxl34x",
1084 .platform_data = &adxl34x_info,
1086 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1093 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1095 static struct resource bfin_spi0_resource[] = {
1097 .start = SPI0_REGBASE,
1098 .end = SPI0_REGBASE + 0xFF,
1099 .flags = IORESOURCE_MEM,
1104 .flags = IORESOURCE_DMA,
1109 .flags = IORESOURCE_IRQ,
1114 static struct resource bfin_spi1_resource[] = {
1116 .start = SPI1_REGBASE,
1117 .end = SPI1_REGBASE + 0xFF,
1118 .flags = IORESOURCE_MEM,
1123 .flags = IORESOURCE_DMA,
1128 .flags = IORESOURCE_IRQ,
1132 /* SPI controller data */
1133 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
1134 .num_chipselect = 4,
1135 .enable_dma = 1, /* master has the ability to do dma transfer */
1136 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1139 static struct platform_device bf54x_spi_master0 = {
1141 .id = 0, /* Bus number */
1142 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1143 .resource = bfin_spi0_resource,
1145 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
1149 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
1150 .num_chipselect = 4,
1151 .enable_dma = 1, /* master has the ability to do dma transfer */
1152 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1155 static struct platform_device bf54x_spi_master1 = {
1157 .id = 1, /* Bus number */
1158 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1159 .resource = bfin_spi1_resource,
1161 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1164 #endif /* spi master and devices */
1166 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1167 static struct resource bfin_twi0_resource[] = {
1169 .start = TWI0_REGBASE,
1170 .end = TWI0_REGBASE + 0xFF,
1171 .flags = IORESOURCE_MEM,
1176 .flags = IORESOURCE_IRQ,
1180 static struct platform_device i2c_bfin_twi0_device = {
1181 .name = "i2c-bfin-twi",
1183 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1184 .resource = bfin_twi0_resource,
1187 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1188 static struct resource bfin_twi1_resource[] = {
1190 .start = TWI1_REGBASE,
1191 .end = TWI1_REGBASE + 0xFF,
1192 .flags = IORESOURCE_MEM,
1197 .flags = IORESOURCE_IRQ,
1201 static struct platform_device i2c_bfin_twi1_device = {
1202 .name = "i2c-bfin-twi",
1204 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1205 .resource = bfin_twi1_resource,
1210 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1213 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1214 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1215 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1217 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1220 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1222 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1226 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1228 I2C_BOARD_INFO("adxl34x", 0x53),
1230 .platform_data = (void *)&adxl34x_info,
1233 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1235 I2C_BOARD_INFO("ad5252", 0x2f),
1241 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1242 #include <linux/gpio_keys.h>
1244 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1245 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
1246 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
1247 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
1248 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
1251 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1252 .buttons = bfin_gpio_keys_table,
1253 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1256 static struct platform_device bfin_device_gpiokeys = {
1257 .name = "gpio-keys",
1259 .platform_data = &bfin_gpio_keys_data,
1264 static const unsigned int cclk_vlev_datasheet[] =
1267 * Internal VLEV BF54XSBBC1533
1268 ****temporarily using these values until data sheet is updated
1270 VRPAIR(VLEV_085, 150000000),
1271 VRPAIR(VLEV_090, 250000000),
1272 VRPAIR(VLEV_110, 276000000),
1273 VRPAIR(VLEV_115, 301000000),
1274 VRPAIR(VLEV_120, 525000000),
1275 VRPAIR(VLEV_125, 550000000),
1276 VRPAIR(VLEV_130, 600000000),
1279 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1280 .tuple_tab = cclk_vlev_datasheet,
1281 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1282 .vr_settling_time = 25 /* us */,
1285 static struct platform_device bfin_dpmc = {
1286 .name = "bfin dpmc",
1288 .platform_data = &bfin_dmpc_vreg_data,
1292 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1293 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1294 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1296 #define SPORT_REQ(x) \
1297 [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
1298 P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
1300 static const u16 bfin_snd_pin[][7] = {
1305 static struct bfin_snd_platform_data bfin_snd_data[] = {
1307 .pin_req = &bfin_snd_pin[0][0],
1310 .pin_req = &bfin_snd_pin[1][0],
1314 #define BFIN_SND_RES(x) \
1317 .start = SPORT##x##_TCR1, \
1318 .end = SPORT##x##_TCR1, \
1319 .flags = IORESOURCE_MEM \
1322 .start = CH_SPORT##x##_RX, \
1323 .end = CH_SPORT##x##_RX, \
1324 .flags = IORESOURCE_DMA, \
1327 .start = CH_SPORT##x##_TX, \
1328 .end = CH_SPORT##x##_TX, \
1329 .flags = IORESOURCE_DMA, \
1332 .start = IRQ_SPORT##x##_ERROR, \
1333 .end = IRQ_SPORT##x##_ERROR, \
1334 .flags = IORESOURCE_IRQ, \
1338 static struct resource bfin_snd_resources[][4] = {
1343 static struct platform_device bfin_pcm = {
1344 .name = "bfin-pcm-audio",
1349 #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
1350 static struct platform_device bfin_ad73311_codec_device = {
1356 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1357 static struct platform_device bfin_ad1980_codec_device = {
1363 #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
1364 static struct platform_device bfin_i2s = {
1366 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1367 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1368 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1370 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1375 #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
1376 static struct platform_device bfin_tdm = {
1378 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1379 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1380 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1382 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1387 #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
1388 static struct platform_device bfin_ac97 = {
1389 .name = "bfin-ac97",
1390 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1391 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1392 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1394 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1399 static struct platform_device *ezkit_devices[] __initdata = {
1403 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1407 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1408 #ifdef CONFIG_SERIAL_BFIN_UART0
1411 #ifdef CONFIG_SERIAL_BFIN_UART1
1414 #ifdef CONFIG_SERIAL_BFIN_UART2
1417 #ifdef CONFIG_SERIAL_BFIN_UART3
1422 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1423 #ifdef CONFIG_BFIN_SIR0
1426 #ifdef CONFIG_BFIN_SIR1
1429 #ifdef CONFIG_BFIN_SIR2
1432 #ifdef CONFIG_BFIN_SIR3
1437 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
1438 &bf54x_lq043_device,
1441 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
1445 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1449 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1450 &bfin_isp1760_device,
1453 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1454 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1455 &bfin_sport0_uart_device,
1457 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1458 &bfin_sport1_uart_device,
1460 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1461 &bfin_sport2_uart_device,
1463 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1464 &bfin_sport3_uart_device,
1468 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1473 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
1477 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1481 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1485 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1490 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
1494 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1495 &bfin_rotary_device,
1498 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1499 &i2c_bfin_twi0_device,
1500 #if !defined(CONFIG_BF542)
1501 &i2c_bfin_twi1_device,
1505 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1506 &bfin_device_gpiokeys,
1509 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1510 &ezkit_flash_device,
1513 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1514 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1515 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1519 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1520 &bfin_ad1980_codec_device,
1523 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1527 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1531 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1536 static int __init ezkit_init(void)
1538 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1540 i2c_register_board_info(0, bfin_i2c_board_info0,
1541 ARRAY_SIZE(bfin_i2c_board_info0));
1542 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1543 i2c_register_board_info(1, bfin_i2c_board_info1,
1544 ARRAY_SIZE(bfin_i2c_board_info1));
1547 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1549 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1554 arch_initcall(ezkit_init);
1556 static struct platform_device *ezkit_early_devices[] __initdata = {
1557 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1558 #ifdef CONFIG_SERIAL_BFIN_UART0
1561 #ifdef CONFIG_SERIAL_BFIN_UART1
1564 #ifdef CONFIG_SERIAL_BFIN_UART2
1567 #ifdef CONFIG_SERIAL_BFIN_UART3
1572 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1573 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1574 &bfin_sport0_uart_device,
1576 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1577 &bfin_sport1_uart_device,
1579 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1580 &bfin_sport2_uart_device,
1582 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1583 &bfin_sport3_uart_device,
1588 void __init native_machine_early_platform_add_devices(void)
1590 printk(KERN_INFO "register early platform devices\n");
1591 early_platform_add_devices(ezkit_early_devices,
1592 ARRAY_SIZE(ezkit_early_devices));