2 * File: arch/blackfin/mach-bf548/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2007 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/mtd/physmap.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #include <linux/irq.h>
39 #include <linux/i2c.h>
40 #include <linux/interrupt.h>
41 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
42 #include <linux/usb/musb.h>
44 #include <asm/bfin5xx_spi.h>
50 #include <asm/portmux.h>
51 #include <asm/mach/bf54x_keys.h>
52 #include <linux/input.h>
53 #include <linux/spi/ad7877.h>
56 * Name the Board for the /proc/cpuinfo
58 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
61 * Driver needs to know address, irq and flag pin.
64 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65 static struct resource bfin_isp1761_resources[] = {
67 .name = "isp1761-regs",
69 .end = 0x2C0C0000 + 0xfffff,
70 .flags = IORESOURCE_MEM,
75 .flags = IORESOURCE_IRQ,
79 static struct platform_device bfin_isp1761_device = {
82 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
83 .resource = bfin_isp1761_resources,
86 static struct platform_device *bfin_isp1761_devices[] = {
90 int __init bfin_isp1761_init(void)
92 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
94 printk(KERN_INFO "%s(): registering device resources\n", __func__);
95 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
97 return platform_add_devices(bfin_isp1761_devices, num_devices);
100 void __exit bfin_isp1761_exit(void)
102 platform_device_unregister(&bfin_isp1761_device);
104 arch_initcall(bfin_isp1761_init);
107 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
109 #include <asm/mach/bf54x-lq043.h>
111 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
114 .xres = {480, 480, 480},
115 .yres = {272, 272, 272},
120 static struct resource bf54x_lq043_resources[] = {
122 .start = IRQ_EPPI0_ERR,
123 .end = IRQ_EPPI0_ERR,
124 .flags = IORESOURCE_IRQ,
128 static struct platform_device bf54x_lq043_device = {
129 .name = "bf54x-lq043",
131 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
132 .resource = bf54x_lq043_resources,
134 .platform_data = &bf54x_lq043_data,
139 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
140 static const unsigned int bf548_keymap[] = {
141 KEYVAL(0, 0, KEY_ENTER),
142 KEYVAL(0, 1, KEY_HELP),
144 KEYVAL(0, 3, KEY_BACKSPACE),
145 KEYVAL(1, 0, KEY_TAB),
149 KEYVAL(2, 0, KEY_DOWN),
153 KEYVAL(3, 0, KEY_UP),
159 static struct bfin_kpad_platform_data bf54x_kpad_data = {
162 .keymap = bf548_keymap,
163 .keymapsize = ARRAY_SIZE(bf548_keymap),
165 .debounce_time = 5000, /* ns (5ms) */
166 .coldrive_time = 1000, /* ns (1ms) */
167 .keyup_test_interval = 50, /* ms (50ms) */
170 static struct resource bf54x_kpad_resources[] = {
174 .flags = IORESOURCE_IRQ,
178 static struct platform_device bf54x_kpad_device = {
179 .name = "bf54x-keys",
181 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
182 .resource = bf54x_kpad_resources,
184 .platform_data = &bf54x_kpad_data,
189 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
190 static struct platform_device rtc_device = {
196 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
197 static struct resource bfin_uart_resources[] = {
198 #ifdef CONFIG_SERIAL_BFIN_UART0
202 .flags = IORESOURCE_MEM,
205 #ifdef CONFIG_SERIAL_BFIN_UART1
209 .flags = IORESOURCE_MEM,
212 #ifdef CONFIG_SERIAL_BFIN_UART2
216 .flags = IORESOURCE_MEM,
219 #ifdef CONFIG_SERIAL_BFIN_UART3
223 .flags = IORESOURCE_MEM,
228 static struct platform_device bfin_uart_device = {
231 .num_resources = ARRAY_SIZE(bfin_uart_resources),
232 .resource = bfin_uart_resources,
236 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
237 static struct resource bfin_sir_resources[] = {
238 #ifdef CONFIG_BFIN_SIR0
242 .flags = IORESOURCE_MEM,
245 #ifdef CONFIG_BFIN_SIR1
249 .flags = IORESOURCE_MEM,
252 #ifdef CONFIG_BFIN_SIR2
256 .flags = IORESOURCE_MEM,
259 #ifdef CONFIG_BFIN_SIR3
263 .flags = IORESOURCE_MEM,
268 static struct platform_device bfin_sir_device = {
271 .num_resources = ARRAY_SIZE(bfin_sir_resources),
272 .resource = bfin_sir_resources,
276 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
277 static struct resource smsc911x_resources[] = {
279 .name = "smsc911x-memory",
281 .end = 0x24000000 + 0xFF,
282 .flags = IORESOURCE_MEM,
287 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
290 static struct platform_device smsc911x_device = {
293 .num_resources = ARRAY_SIZE(smsc911x_resources),
294 .resource = smsc911x_resources,
298 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
299 static struct resource musb_resources[] = {
303 .flags = IORESOURCE_MEM,
305 [1] = { /* general IRQ */
306 .start = IRQ_USB_INT0,
308 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
310 [2] = { /* DMA IRQ */
311 .start = IRQ_USB_DMA,
313 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
317 static struct musb_hdrc_platform_data musb_plat = {
318 #if defined(CONFIG_USB_MUSB_OTG)
320 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
322 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
323 .mode = MUSB_PERIPHERAL,
328 static u64 musb_dmamask = ~(u32)0;
330 static struct platform_device musb_device = {
334 .dma_mask = &musb_dmamask,
335 .coherent_dma_mask = 0xffffffff,
336 .platform_data = &musb_plat,
338 .num_resources = ARRAY_SIZE(musb_resources),
339 .resource = musb_resources,
343 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
344 static struct resource bfin_atapi_resources[] = {
348 .flags = IORESOURCE_MEM,
351 .start = IRQ_ATAPI_ERR,
352 .end = IRQ_ATAPI_ERR,
353 .flags = IORESOURCE_IRQ,
357 static struct platform_device bfin_atapi_device = {
358 .name = "pata-bf54x",
360 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
361 .resource = bfin_atapi_resources,
365 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
366 static struct mtd_partition partition_info[] = {
368 .name = "Linux Kernel",
373 .name = "File System",
374 .offset = MTDPART_OFS_APPEND,
375 .size = MTDPART_SIZ_FULL,
379 static struct bf5xx_nand_platform bf5xx_nand_platform = {
380 .page_size = NFC_PG_SIZE_256,
381 .data_width = NFC_NWIDTH_8,
382 .partitions = partition_info,
383 .nr_partitions = ARRAY_SIZE(partition_info),
388 static struct resource bf5xx_nand_resources[] = {
392 .flags = IORESOURCE_MEM,
397 .flags = IORESOURCE_IRQ,
401 static struct platform_device bf5xx_nand_device = {
402 .name = "bf5xx-nand",
404 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
405 .resource = bf5xx_nand_resources,
407 .platform_data = &bf5xx_nand_platform,
412 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
413 static struct platform_device bf54x_sdh_device = {
419 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
420 static struct mtd_partition ezkit_partitions[] = {
422 .name = "Bootloader",
428 .offset = MTDPART_OFS_APPEND,
431 .size = MTDPART_SIZ_FULL,
432 .offset = MTDPART_OFS_APPEND,
436 static struct physmap_flash_data ezkit_flash_data = {
438 .parts = ezkit_partitions,
439 .nr_parts = ARRAY_SIZE(ezkit_partitions),
442 static struct resource ezkit_flash_resource = {
445 .flags = IORESOURCE_MEM,
448 static struct platform_device ezkit_flash_device = {
449 .name = "physmap-flash",
452 .platform_data = &ezkit_flash_data,
455 .resource = &ezkit_flash_resource,
459 #if defined(CONFIG_MTD_M25P80) \
460 || defined(CONFIG_MTD_M25P80_MODULE)
461 /* SPI flash chip (m25p16) */
462 static struct mtd_partition bfin_spi_flash_partitions[] = {
464 .name = "bootloader",
467 .mask_flags = MTD_CAP_ROM
469 .name = "linux kernel",
470 .size = MTDPART_SIZ_FULL,
471 .offset = MTDPART_OFS_APPEND,
475 static struct flash_platform_data bfin_spi_flash_data = {
477 .parts = bfin_spi_flash_partitions,
478 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
482 static struct bfin5xx_spi_chip spi_flash_chip_info = {
483 .enable_dma = 0, /* use dma transfer with this chip*/
485 .cs_change_per_word = 0,
489 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
490 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
491 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
497 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
498 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
499 .cs_change_per_word = 0,
504 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
506 .vref_delay_usecs = 50, /* internal, no capacitor */
509 .pressure_max = 1000,
511 .stopacq_polarity = 1,
512 .first_conversion_delay = 3,
513 .acquisition_time = 1,
515 .pen_down_acc_interval = 1,
519 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
520 static struct bfin5xx_spi_chip spidev_chip_info = {
526 static struct spi_board_info bfin_spi_board_info[] __initdata = {
527 #if defined(CONFIG_MTD_M25P80) \
528 || defined(CONFIG_MTD_M25P80_MODULE)
530 /* the modalias must be the same as spi device driver name */
531 .modalias = "m25p80", /* Name of spi_driver for this device */
532 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
533 .bus_num = 0, /* Framework bus number */
534 .chip_select = 1, /* SPI_SSEL1*/
535 .platform_data = &bfin_spi_flash_data,
536 .controller_data = &spi_flash_chip_info,
540 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
541 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
543 .modalias = "ad1836-spi",
544 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
546 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
547 .controller_data = &ad1836_spi_chip_info,
550 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
552 .modalias = "ad7877",
553 .platform_data = &bfin_ad7877_ts_info,
555 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
558 .controller_data = &spi_ad7877_chip_info,
561 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
563 .modalias = "spidev",
564 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
567 .controller_data = &spidev_chip_info,
572 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
574 static struct resource bfin_spi0_resource[] = {
576 .start = SPI0_REGBASE,
577 .end = SPI0_REGBASE + 0xFF,
578 .flags = IORESOURCE_MEM,
583 .flags = IORESOURCE_IRQ,
588 static struct resource bfin_spi1_resource[] = {
590 .start = SPI1_REGBASE,
591 .end = SPI1_REGBASE + 0xFF,
592 .flags = IORESOURCE_MEM,
597 .flags = IORESOURCE_IRQ,
601 /* SPI controller data */
602 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
604 .enable_dma = 1, /* master has the ability to do dma transfer */
605 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
608 static struct platform_device bf54x_spi_master0 = {
610 .id = 0, /* Bus number */
611 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
612 .resource = bfin_spi0_resource,
614 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
618 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
620 .enable_dma = 1, /* master has the ability to do dma transfer */
621 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
624 static struct platform_device bf54x_spi_master1 = {
626 .id = 1, /* Bus number */
627 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
628 .resource = bfin_spi1_resource,
630 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
633 #endif /* spi master and devices */
635 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
636 static struct resource bfin_twi0_resource[] = {
638 .start = TWI0_REGBASE,
639 .end = TWI0_REGBASE + 0xFF,
640 .flags = IORESOURCE_MEM,
645 .flags = IORESOURCE_IRQ,
649 static struct platform_device i2c_bfin_twi0_device = {
650 .name = "i2c-bfin-twi",
652 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
653 .resource = bfin_twi0_resource,
656 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
657 static struct resource bfin_twi1_resource[] = {
659 .start = TWI1_REGBASE,
660 .end = TWI1_REGBASE + 0xFF,
661 .flags = IORESOURCE_MEM,
666 .flags = IORESOURCE_IRQ,
670 static struct platform_device i2c_bfin_twi1_device = {
671 .name = "i2c-bfin-twi",
673 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
674 .resource = bfin_twi1_resource,
679 #ifdef CONFIG_I2C_BOARDINFO
680 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
683 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
684 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
685 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
687 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
690 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
692 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
700 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
701 #include <linux/gpio_keys.h>
703 static struct gpio_keys_button bfin_gpio_keys_table[] = {
704 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
705 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
706 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
707 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
710 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
711 .buttons = bfin_gpio_keys_table,
712 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
715 static struct platform_device bfin_device_gpiokeys = {
718 .platform_data = &bfin_gpio_keys_data,
723 static struct resource bfin_gpios_resources = {
725 .end = MAX_BLACKFIN_GPIOS - 1,
726 .flags = IORESOURCE_IRQ,
729 static struct platform_device bfin_gpios_device = {
730 .name = "simple-gpio",
733 .resource = &bfin_gpios_resources,
736 static const unsigned int cclk_vlev_datasheet[] =
739 * Internal VLEV BF54XSBBC1533
740 ****temporarily using these values until data sheet is updated
742 VRPAIR(VLEV_085, 150000000),
743 VRPAIR(VLEV_090, 250000000),
744 VRPAIR(VLEV_110, 276000000),
745 VRPAIR(VLEV_115, 301000000),
746 VRPAIR(VLEV_120, 525000000),
747 VRPAIR(VLEV_125, 550000000),
748 VRPAIR(VLEV_130, 600000000),
751 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
752 .tuple_tab = cclk_vlev_datasheet,
753 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
754 .vr_settling_time = 25 /* us */,
757 static struct platform_device bfin_dpmc = {
760 .platform_data = &bfin_dmpc_vreg_data,
764 static struct platform_device *ezkit_devices[] __initdata = {
768 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
772 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
776 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
780 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
784 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
788 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
792 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
796 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
800 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
804 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
809 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
813 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
814 &i2c_bfin_twi0_device,
815 #if !defined(CONFIG_BF542)
816 &i2c_bfin_twi1_device,
820 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
821 &bfin_device_gpiokeys,
826 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
831 static int __init ezkit_init(void)
833 printk(KERN_INFO "%s(): registering device resources\n", __func__);
835 #ifdef CONFIG_I2C_BOARDINFO
836 i2c_register_board_info(0, bfin_i2c_board_info0,
837 ARRAY_SIZE(bfin_i2c_board_info0));
838 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
839 i2c_register_board_info(1, bfin_i2c_board_info1,
840 ARRAY_SIZE(bfin_i2c_board_info1));
844 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
846 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
851 arch_initcall(ezkit_init);