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_TX,
246 .flags = IORESOURCE_IRQ,
249 .start = IRQ_UART0_RX,
251 .flags = IORESOURCE_IRQ,
254 .start = IRQ_UART0_ERROR,
255 .end = IRQ_UART0_ERROR,
256 .flags = IORESOURCE_IRQ,
259 .start = CH_UART0_TX,
261 .flags = IORESOURCE_DMA,
264 .start = CH_UART0_RX,
266 .flags = IORESOURCE_DMA,
270 static unsigned short bfin_uart0_peripherals[] = {
271 P_UART0_TX, P_UART0_RX, 0
274 static struct platform_device bfin_uart0_device = {
277 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
278 .resource = bfin_uart0_resources,
280 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
284 #ifdef CONFIG_SERIAL_BFIN_UART1
285 static struct resource bfin_uart1_resources[] = {
289 .flags = IORESOURCE_MEM,
292 .start = IRQ_UART1_TX,
294 .flags = IORESOURCE_IRQ,
297 .start = IRQ_UART1_RX,
299 .flags = IORESOURCE_IRQ,
302 .start = IRQ_UART1_ERROR,
303 .end = IRQ_UART1_ERROR,
304 .flags = IORESOURCE_IRQ,
307 .start = CH_UART1_TX,
309 .flags = IORESOURCE_DMA,
312 .start = CH_UART1_RX,
314 .flags = IORESOURCE_DMA,
316 #ifdef CONFIG_BFIN_UART1_CTSRTS
317 { /* CTS pin -- 0 means not supported */
320 .flags = IORESOURCE_IO,
322 { /* RTS pin -- 0 means not supported */
325 .flags = IORESOURCE_IO,
330 static unsigned short bfin_uart1_peripherals[] = {
331 P_UART1_TX, P_UART1_RX,
332 #ifdef CONFIG_BFIN_UART1_CTSRTS
333 P_UART1_RTS, P_UART1_CTS,
338 static struct platform_device bfin_uart1_device = {
341 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
342 .resource = bfin_uart1_resources,
344 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
348 #ifdef CONFIG_SERIAL_BFIN_UART2
349 static struct resource bfin_uart2_resources[] = {
353 .flags = IORESOURCE_MEM,
356 .start = IRQ_UART2_TX,
358 .flags = IORESOURCE_IRQ,
361 .start = IRQ_UART2_RX,
363 .flags = IORESOURCE_IRQ,
366 .start = IRQ_UART2_ERROR,
367 .end = IRQ_UART2_ERROR,
368 .flags = IORESOURCE_IRQ,
371 .start = CH_UART2_TX,
373 .flags = IORESOURCE_DMA,
376 .start = CH_UART2_RX,
378 .flags = IORESOURCE_DMA,
382 static unsigned short bfin_uart2_peripherals[] = {
383 P_UART2_TX, P_UART2_RX, 0
386 static struct platform_device bfin_uart2_device = {
389 .num_resources = ARRAY_SIZE(bfin_uart2_resources),
390 .resource = bfin_uart2_resources,
392 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
396 #ifdef CONFIG_SERIAL_BFIN_UART3
397 static struct resource bfin_uart3_resources[] = {
401 .flags = IORESOURCE_MEM,
404 .start = IRQ_UART3_TX,
406 .flags = IORESOURCE_IRQ,
409 .start = IRQ_UART3_RX,
411 .flags = IORESOURCE_IRQ,
414 .start = IRQ_UART3_ERROR,
415 .end = IRQ_UART3_ERROR,
416 .flags = IORESOURCE_IRQ,
419 .start = CH_UART3_TX,
421 .flags = IORESOURCE_DMA,
424 .start = CH_UART3_RX,
426 .flags = IORESOURCE_DMA,
428 #ifdef CONFIG_BFIN_UART3_CTSRTS
429 { /* CTS pin -- 0 means not supported */
432 .flags = IORESOURCE_IO,
434 { /* RTS pin -- 0 means not supported */
437 .flags = IORESOURCE_IO,
442 static unsigned short bfin_uart3_peripherals[] = {
443 P_UART3_TX, P_UART3_RX,
444 #ifdef CONFIG_BFIN_UART3_CTSRTS
445 P_UART3_RTS, P_UART3_CTS,
450 static struct platform_device bfin_uart3_device = {
453 .num_resources = ARRAY_SIZE(bfin_uart3_resources),
454 .resource = bfin_uart3_resources,
456 .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
462 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
463 #ifdef CONFIG_BFIN_SIR0
464 static struct resource bfin_sir0_resources[] = {
468 .flags = IORESOURCE_MEM,
471 .start = IRQ_UART0_RX,
472 .end = IRQ_UART0_RX+1,
473 .flags = IORESOURCE_IRQ,
476 .start = CH_UART0_RX,
477 .end = CH_UART0_RX+1,
478 .flags = IORESOURCE_DMA,
481 static struct platform_device bfin_sir0_device = {
484 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
485 .resource = bfin_sir0_resources,
488 #ifdef CONFIG_BFIN_SIR1
489 static struct resource bfin_sir1_resources[] = {
493 .flags = IORESOURCE_MEM,
496 .start = IRQ_UART1_RX,
497 .end = IRQ_UART1_RX+1,
498 .flags = IORESOURCE_IRQ,
501 .start = CH_UART1_RX,
502 .end = CH_UART1_RX+1,
503 .flags = IORESOURCE_DMA,
506 static struct platform_device bfin_sir1_device = {
509 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
510 .resource = bfin_sir1_resources,
513 #ifdef CONFIG_BFIN_SIR2
514 static struct resource bfin_sir2_resources[] = {
518 .flags = IORESOURCE_MEM,
521 .start = IRQ_UART2_RX,
522 .end = IRQ_UART2_RX+1,
523 .flags = IORESOURCE_IRQ,
526 .start = CH_UART2_RX,
527 .end = CH_UART2_RX+1,
528 .flags = IORESOURCE_DMA,
531 static struct platform_device bfin_sir2_device = {
534 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
535 .resource = bfin_sir2_resources,
538 #ifdef CONFIG_BFIN_SIR3
539 static struct resource bfin_sir3_resources[] = {
543 .flags = IORESOURCE_MEM,
546 .start = IRQ_UART3_RX,
547 .end = IRQ_UART3_RX+1,
548 .flags = IORESOURCE_IRQ,
551 .start = CH_UART3_RX,
552 .end = CH_UART3_RX+1,
553 .flags = IORESOURCE_DMA,
556 static struct platform_device bfin_sir3_device = {
559 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
560 .resource = bfin_sir3_resources,
565 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
566 #include <linux/smsc911x.h>
568 static struct resource smsc911x_resources[] = {
570 .name = "smsc911x-memory",
572 .end = 0x24000000 + 0xFF,
573 .flags = IORESOURCE_MEM,
578 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
582 static struct smsc911x_platform_config smsc911x_config = {
583 .flags = SMSC911X_USE_32BIT,
584 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
585 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
586 .phy_interface = PHY_INTERFACE_MODE_MII,
589 static struct platform_device smsc911x_device = {
592 .num_resources = ARRAY_SIZE(smsc911x_resources),
593 .resource = smsc911x_resources,
595 .platform_data = &smsc911x_config,
600 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
601 static struct resource musb_resources[] = {
605 .flags = IORESOURCE_MEM,
607 [1] = { /* general IRQ */
608 .start = IRQ_USB_INT0,
610 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
613 [2] = { /* DMA IRQ */
614 .start = IRQ_USB_DMA,
616 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
621 static struct musb_hdrc_config musb_config = {
628 .gpio_vrsel = GPIO_PE7,
629 /* Some custom boards need to be active low, just set it to "0"
632 .gpio_vrsel_active = 1,
633 .clkin = 24, /* musb CLKIN in MHZ */
636 static struct musb_hdrc_platform_data musb_plat = {
637 #if defined(CONFIG_USB_MUSB_OTG)
639 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
641 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
642 .mode = MUSB_PERIPHERAL,
644 .config = &musb_config,
647 static u64 musb_dmamask = ~(u32)0;
649 static struct platform_device musb_device = {
650 .name = "musb-blackfin",
653 .dma_mask = &musb_dmamask,
654 .coherent_dma_mask = 0xffffffff,
655 .platform_data = &musb_plat,
657 .num_resources = ARRAY_SIZE(musb_resources),
658 .resource = musb_resources,
662 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
663 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
664 static struct resource bfin_sport0_uart_resources[] = {
666 .start = SPORT0_TCR1,
667 .end = SPORT0_MRCS3+4,
668 .flags = IORESOURCE_MEM,
671 .start = IRQ_SPORT0_RX,
672 .end = IRQ_SPORT0_RX+1,
673 .flags = IORESOURCE_IRQ,
676 .start = IRQ_SPORT0_ERROR,
677 .end = IRQ_SPORT0_ERROR,
678 .flags = IORESOURCE_IRQ,
682 static unsigned short bfin_sport0_peripherals[] = {
683 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
684 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
687 static struct platform_device bfin_sport0_uart_device = {
688 .name = "bfin-sport-uart",
690 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
691 .resource = bfin_sport0_uart_resources,
693 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
697 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
698 static struct resource bfin_sport1_uart_resources[] = {
700 .start = SPORT1_TCR1,
701 .end = SPORT1_MRCS3+4,
702 .flags = IORESOURCE_MEM,
705 .start = IRQ_SPORT1_RX,
706 .end = IRQ_SPORT1_RX+1,
707 .flags = IORESOURCE_IRQ,
710 .start = IRQ_SPORT1_ERROR,
711 .end = IRQ_SPORT1_ERROR,
712 .flags = IORESOURCE_IRQ,
716 static unsigned short bfin_sport1_peripherals[] = {
717 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
718 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
721 static struct platform_device bfin_sport1_uart_device = {
722 .name = "bfin-sport-uart",
724 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
725 .resource = bfin_sport1_uart_resources,
727 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
731 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
732 static struct resource bfin_sport2_uart_resources[] = {
734 .start = SPORT2_TCR1,
735 .end = SPORT2_MRCS3+4,
736 .flags = IORESOURCE_MEM,
739 .start = IRQ_SPORT2_RX,
740 .end = IRQ_SPORT2_RX+1,
741 .flags = IORESOURCE_IRQ,
744 .start = IRQ_SPORT2_ERROR,
745 .end = IRQ_SPORT2_ERROR,
746 .flags = IORESOURCE_IRQ,
750 static unsigned short bfin_sport2_peripherals[] = {
751 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
752 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
755 static struct platform_device bfin_sport2_uart_device = {
756 .name = "bfin-sport-uart",
758 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
759 .resource = bfin_sport2_uart_resources,
761 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
765 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
766 static struct resource bfin_sport3_uart_resources[] = {
768 .start = SPORT3_TCR1,
769 .end = SPORT3_MRCS3+4,
770 .flags = IORESOURCE_MEM,
773 .start = IRQ_SPORT3_RX,
774 .end = IRQ_SPORT3_RX+1,
775 .flags = IORESOURCE_IRQ,
778 .start = IRQ_SPORT3_ERROR,
779 .end = IRQ_SPORT3_ERROR,
780 .flags = IORESOURCE_IRQ,
784 static unsigned short bfin_sport3_peripherals[] = {
785 P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
786 P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
789 static struct platform_device bfin_sport3_uart_device = {
790 .name = "bfin-sport-uart",
792 .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
793 .resource = bfin_sport3_uart_resources,
795 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
801 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
803 static unsigned short bfin_can0_peripherals[] = {
804 P_CAN0_RX, P_CAN0_TX, 0
807 static struct resource bfin_can0_resources[] = {
811 .flags = IORESOURCE_MEM,
814 .start = IRQ_CAN0_RX,
816 .flags = IORESOURCE_IRQ,
819 .start = IRQ_CAN0_TX,
821 .flags = IORESOURCE_IRQ,
824 .start = IRQ_CAN0_ERROR,
825 .end = IRQ_CAN0_ERROR,
826 .flags = IORESOURCE_IRQ,
830 static struct platform_device bfin_can0_device = {
833 .num_resources = ARRAY_SIZE(bfin_can0_resources),
834 .resource = bfin_can0_resources,
836 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
840 static unsigned short bfin_can1_peripherals[] = {
841 P_CAN1_RX, P_CAN1_TX, 0
844 static struct resource bfin_can1_resources[] = {
848 .flags = IORESOURCE_MEM,
851 .start = IRQ_CAN1_RX,
853 .flags = IORESOURCE_IRQ,
856 .start = IRQ_CAN1_TX,
858 .flags = IORESOURCE_IRQ,
861 .start = IRQ_CAN1_ERROR,
862 .end = IRQ_CAN1_ERROR,
863 .flags = IORESOURCE_IRQ,
867 static struct platform_device bfin_can1_device = {
870 .num_resources = ARRAY_SIZE(bfin_can1_resources),
871 .resource = bfin_can1_resources,
873 .platform_data = &bfin_can1_peripherals, /* Passed to driver */
879 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
880 static struct resource bfin_atapi_resources[] = {
884 .flags = IORESOURCE_MEM,
887 .start = IRQ_ATAPI_ERR,
888 .end = IRQ_ATAPI_ERR,
889 .flags = IORESOURCE_IRQ,
893 static struct platform_device bfin_atapi_device = {
894 .name = "pata-bf54x",
896 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
897 .resource = bfin_atapi_resources,
901 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
902 static struct mtd_partition partition_info[] = {
904 .name = "bootloader(nand)",
908 .name = "linux kernel(nand)",
909 .offset = MTDPART_OFS_APPEND,
910 .size = 4 * 1024 * 1024,
913 .name = "file system(nand)",
914 .offset = MTDPART_OFS_APPEND,
915 .size = MTDPART_SIZ_FULL,
919 static struct bf5xx_nand_platform bf5xx_nand_platform = {
920 .data_width = NFC_NWIDTH_8,
921 .partitions = partition_info,
922 .nr_partitions = ARRAY_SIZE(partition_info),
927 static struct resource bf5xx_nand_resources[] = {
931 .flags = IORESOURCE_MEM,
936 .flags = IORESOURCE_IRQ,
940 static struct platform_device bf5xx_nand_device = {
941 .name = "bf5xx-nand",
943 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
944 .resource = bf5xx_nand_resources,
946 .platform_data = &bf5xx_nand_platform,
951 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
953 static struct bfin_sd_host bfin_sdh_data = {
955 .irq_int0 = IRQ_SDH_MASK0,
956 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
959 static struct platform_device bf54x_sdh_device = {
963 .platform_data = &bfin_sdh_data,
968 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
969 static struct mtd_partition ezkit_partitions[] = {
971 .name = "bootloader(nor)",
975 .name = "linux kernel(nor)",
977 .offset = MTDPART_OFS_APPEND,
979 .name = "file system(nor)",
980 .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
981 .offset = MTDPART_OFS_APPEND,
983 .name = "config(nor)",
985 .offset = MTDPART_OFS_APPEND,
987 .name = "u-boot env(nor)",
989 .offset = MTDPART_OFS_APPEND,
993 static struct physmap_flash_data ezkit_flash_data = {
995 .parts = ezkit_partitions,
996 .nr_parts = ARRAY_SIZE(ezkit_partitions),
999 static struct resource ezkit_flash_resource = {
1000 .start = 0x20000000,
1002 .flags = IORESOURCE_MEM,
1005 static struct platform_device ezkit_flash_device = {
1006 .name = "physmap-flash",
1009 .platform_data = &ezkit_flash_data,
1012 .resource = &ezkit_flash_resource,
1016 #if defined(CONFIG_MTD_M25P80) \
1017 || defined(CONFIG_MTD_M25P80_MODULE)
1018 /* SPI flash chip (m25p16) */
1019 static struct mtd_partition bfin_spi_flash_partitions[] = {
1021 .name = "bootloader(spi)",
1024 .mask_flags = MTD_CAP_ROM
1026 .name = "linux kernel(spi)",
1027 .size = MTDPART_SIZ_FULL,
1028 .offset = MTDPART_OFS_APPEND,
1032 static struct flash_platform_data bfin_spi_flash_data = {
1034 .parts = bfin_spi_flash_partitions,
1035 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
1039 static struct bfin5xx_spi_chip spi_flash_chip_info = {
1040 .enable_dma = 0, /* use dma transfer with this chip*/
1044 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1045 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
1047 .vref_delay_usecs = 50, /* internal, no capacitor */
1048 .x_plate_ohms = 419,
1049 .y_plate_ohms = 486,
1050 .pressure_max = 1000,
1052 .stopacq_polarity = 1,
1053 .first_conversion_delay = 3,
1054 .acquisition_time = 1,
1056 .pen_down_acc_interval = 1,
1060 static struct spi_board_info bfin_spi_board_info[] __initdata = {
1061 #if defined(CONFIG_MTD_M25P80) \
1062 || defined(CONFIG_MTD_M25P80_MODULE)
1064 /* the modalias must be the same as spi device driver name */
1065 .modalias = "m25p80", /* Name of spi_driver for this device */
1066 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
1067 .bus_num = 0, /* Framework bus number */
1068 .chip_select = 1, /* SPI_SSEL1*/
1069 .platform_data = &bfin_spi_flash_data,
1070 .controller_data = &spi_flash_chip_info,
1074 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
1075 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
1077 .modalias = "ad183x",
1078 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1083 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1085 .modalias = "ad7877",
1086 .platform_data = &bfin_ad7877_ts_info,
1087 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
1088 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
1093 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1095 .modalias = "spidev",
1096 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1101 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1103 .modalias = "adxl34x",
1104 .platform_data = &adxl34x_info,
1106 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1113 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1115 static struct resource bfin_spi0_resource[] = {
1117 .start = SPI0_REGBASE,
1118 .end = SPI0_REGBASE + 0xFF,
1119 .flags = IORESOURCE_MEM,
1124 .flags = IORESOURCE_DMA,
1129 .flags = IORESOURCE_IRQ,
1134 static struct resource bfin_spi1_resource[] = {
1136 .start = SPI1_REGBASE,
1137 .end = SPI1_REGBASE + 0xFF,
1138 .flags = IORESOURCE_MEM,
1143 .flags = IORESOURCE_DMA,
1148 .flags = IORESOURCE_IRQ,
1152 /* SPI controller data */
1153 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
1154 .num_chipselect = 4,
1155 .enable_dma = 1, /* master has the ability to do dma transfer */
1156 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1159 static struct platform_device bf54x_spi_master0 = {
1161 .id = 0, /* Bus number */
1162 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1163 .resource = bfin_spi0_resource,
1165 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
1169 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
1170 .num_chipselect = 4,
1171 .enable_dma = 1, /* master has the ability to do dma transfer */
1172 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1175 static struct platform_device bf54x_spi_master1 = {
1177 .id = 1, /* Bus number */
1178 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1179 .resource = bfin_spi1_resource,
1181 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
1184 #endif /* spi master and devices */
1186 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1187 static struct resource bfin_twi0_resource[] = {
1189 .start = TWI0_REGBASE,
1190 .end = TWI0_REGBASE + 0xFF,
1191 .flags = IORESOURCE_MEM,
1196 .flags = IORESOURCE_IRQ,
1200 static struct platform_device i2c_bfin_twi0_device = {
1201 .name = "i2c-bfin-twi",
1203 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1204 .resource = bfin_twi0_resource,
1207 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1208 static struct resource bfin_twi1_resource[] = {
1210 .start = TWI1_REGBASE,
1211 .end = TWI1_REGBASE + 0xFF,
1212 .flags = IORESOURCE_MEM,
1217 .flags = IORESOURCE_IRQ,
1221 static struct platform_device i2c_bfin_twi1_device = {
1222 .name = "i2c-bfin-twi",
1224 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1225 .resource = bfin_twi1_resource,
1230 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1233 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1234 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1235 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1237 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1240 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1242 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1246 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1248 I2C_BOARD_INFO("adxl34x", 0x53),
1250 .platform_data = (void *)&adxl34x_info,
1253 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1255 I2C_BOARD_INFO("ad5252", 0x2f),
1261 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1262 #include <linux/gpio_keys.h>
1264 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1265 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
1266 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
1267 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
1268 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
1271 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1272 .buttons = bfin_gpio_keys_table,
1273 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1276 static struct platform_device bfin_device_gpiokeys = {
1277 .name = "gpio-keys",
1279 .platform_data = &bfin_gpio_keys_data,
1284 static const unsigned int cclk_vlev_datasheet[] =
1287 * Internal VLEV BF54XSBBC1533
1288 ****temporarily using these values until data sheet is updated
1290 VRPAIR(VLEV_085, 150000000),
1291 VRPAIR(VLEV_090, 250000000),
1292 VRPAIR(VLEV_110, 276000000),
1293 VRPAIR(VLEV_115, 301000000),
1294 VRPAIR(VLEV_120, 525000000),
1295 VRPAIR(VLEV_125, 550000000),
1296 VRPAIR(VLEV_130, 600000000),
1299 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1300 .tuple_tab = cclk_vlev_datasheet,
1301 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1302 .vr_settling_time = 25 /* us */,
1305 static struct platform_device bfin_dpmc = {
1306 .name = "bfin dpmc",
1308 .platform_data = &bfin_dmpc_vreg_data,
1312 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1313 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1314 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1316 #define SPORT_REQ(x) \
1317 [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
1318 P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
1320 static const u16 bfin_snd_pin[][7] = {
1325 static struct bfin_snd_platform_data bfin_snd_data[] = {
1327 .pin_req = &bfin_snd_pin[0][0],
1330 .pin_req = &bfin_snd_pin[1][0],
1334 #define BFIN_SND_RES(x) \
1337 .start = SPORT##x##_TCR1, \
1338 .end = SPORT##x##_TCR1, \
1339 .flags = IORESOURCE_MEM \
1342 .start = CH_SPORT##x##_RX, \
1343 .end = CH_SPORT##x##_RX, \
1344 .flags = IORESOURCE_DMA, \
1347 .start = CH_SPORT##x##_TX, \
1348 .end = CH_SPORT##x##_TX, \
1349 .flags = IORESOURCE_DMA, \
1352 .start = IRQ_SPORT##x##_ERROR, \
1353 .end = IRQ_SPORT##x##_ERROR, \
1354 .flags = IORESOURCE_IRQ, \
1358 static struct resource bfin_snd_resources[][4] = {
1363 static struct platform_device bfin_pcm = {
1364 .name = "bfin-pcm-audio",
1369 #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
1370 static struct platform_device bfin_ad73311_codec_device = {
1376 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1377 static struct platform_device bfin_ad1980_codec_device = {
1383 #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
1384 static struct platform_device bfin_i2s = {
1386 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1387 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1388 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1390 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1395 #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
1396 static struct platform_device bfin_tdm = {
1398 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1399 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1400 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1402 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1407 #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
1408 static struct platform_device bfin_ac97 = {
1409 .name = "bfin-ac97",
1410 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1411 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1412 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1414 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1419 static struct platform_device *ezkit_devices[] __initdata = {
1423 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1427 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1428 #ifdef CONFIG_SERIAL_BFIN_UART0
1431 #ifdef CONFIG_SERIAL_BFIN_UART1
1434 #ifdef CONFIG_SERIAL_BFIN_UART2
1437 #ifdef CONFIG_SERIAL_BFIN_UART3
1442 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1443 #ifdef CONFIG_BFIN_SIR0
1446 #ifdef CONFIG_BFIN_SIR1
1449 #ifdef CONFIG_BFIN_SIR2
1452 #ifdef CONFIG_BFIN_SIR3
1457 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
1458 &bf54x_lq043_device,
1461 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
1465 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1469 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1470 &bfin_isp1760_device,
1473 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1474 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1475 &bfin_sport0_uart_device,
1477 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1478 &bfin_sport1_uart_device,
1480 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1481 &bfin_sport2_uart_device,
1483 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1484 &bfin_sport3_uart_device,
1488 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1493 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
1497 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1501 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1505 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1510 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
1514 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1515 &bfin_rotary_device,
1518 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1519 &i2c_bfin_twi0_device,
1520 #if !defined(CONFIG_BF542)
1521 &i2c_bfin_twi1_device,
1525 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1526 &bfin_device_gpiokeys,
1529 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1530 &ezkit_flash_device,
1533 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1534 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1535 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1539 #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
1540 &bfin_ad1980_codec_device,
1543 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1547 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1551 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1556 static int __init ezkit_init(void)
1558 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1560 i2c_register_board_info(0, bfin_i2c_board_info0,
1561 ARRAY_SIZE(bfin_i2c_board_info0));
1562 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1563 i2c_register_board_info(1, bfin_i2c_board_info1,
1564 ARRAY_SIZE(bfin_i2c_board_info1));
1567 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1569 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1574 arch_initcall(ezkit_init);
1576 static struct platform_device *ezkit_early_devices[] __initdata = {
1577 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1578 #ifdef CONFIG_SERIAL_BFIN_UART0
1581 #ifdef CONFIG_SERIAL_BFIN_UART1
1584 #ifdef CONFIG_SERIAL_BFIN_UART2
1587 #ifdef CONFIG_SERIAL_BFIN_UART3
1592 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1593 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1594 &bfin_sport0_uart_device,
1596 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1597 &bfin_sport1_uart_device,
1599 #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1600 &bfin_sport2_uart_device,
1602 #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
1603 &bfin_sport3_uart_device,
1608 void __init native_machine_early_platform_add_devices(void)
1610 printk(KERN_INFO "register early platform devices\n");
1611 early_platform_add_devices(ezkit_early_devices,
1612 ARRAY_SIZE(ezkit_early_devices));