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 #include <linux/usb/musb.h>
42 #include <asm/bfin5xx_spi.h>
47 #include <asm/portmux.h>
48 #include <mach/bf54x_keys.h>
49 #include <linux/input.h>
50 #include <linux/spi/ad7877.h>
53 * Name the Board for the /proc/cpuinfo
55 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
58 * Driver needs to know address, irq and flag pin.
61 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
62 static struct resource bfin_isp1761_resources[] = {
64 .name = "isp1761-regs",
66 .end = 0x2C0C0000 + 0xfffff,
67 .flags = IORESOURCE_MEM,
72 .flags = IORESOURCE_IRQ,
76 static struct platform_device bfin_isp1761_device = {
79 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
80 .resource = bfin_isp1761_resources,
83 static struct platform_device *bfin_isp1761_devices[] = {
87 int __init bfin_isp1761_init(void)
89 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
91 printk(KERN_INFO "%s(): registering device resources\n", __func__);
92 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
94 return platform_add_devices(bfin_isp1761_devices, num_devices);
97 void __exit bfin_isp1761_exit(void)
99 platform_device_unregister(&bfin_isp1761_device);
101 arch_initcall(bfin_isp1761_init);
104 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
106 #include <mach/bf54x-lq043.h>
108 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
111 .xres = {480, 480, 480},
112 .yres = {272, 272, 272},
117 static struct resource bf54x_lq043_resources[] = {
119 .start = IRQ_EPPI0_ERR,
120 .end = IRQ_EPPI0_ERR,
121 .flags = IORESOURCE_IRQ,
125 static struct platform_device bf54x_lq043_device = {
126 .name = "bf54x-lq043",
128 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
129 .resource = bf54x_lq043_resources,
131 .platform_data = &bf54x_lq043_data,
136 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
137 static const unsigned int bf548_keymap[] = {
138 KEYVAL(0, 0, KEY_ENTER),
139 KEYVAL(0, 1, KEY_HELP),
141 KEYVAL(0, 3, KEY_BACKSPACE),
142 KEYVAL(1, 0, KEY_TAB),
146 KEYVAL(2, 0, KEY_DOWN),
150 KEYVAL(3, 0, KEY_UP),
156 static struct bfin_kpad_platform_data bf54x_kpad_data = {
159 .keymap = bf548_keymap,
160 .keymapsize = ARRAY_SIZE(bf548_keymap),
162 .debounce_time = 5000, /* ns (5ms) */
163 .coldrive_time = 1000, /* ns (1ms) */
164 .keyup_test_interval = 50, /* ms (50ms) */
167 static struct resource bf54x_kpad_resources[] = {
171 .flags = IORESOURCE_IRQ,
175 static struct platform_device bf54x_kpad_device = {
176 .name = "bf54x-keys",
178 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
179 .resource = bf54x_kpad_resources,
181 .platform_data = &bf54x_kpad_data,
186 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
187 static struct platform_device rtc_device = {
193 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
194 static struct resource bfin_uart_resources[] = {
195 #ifdef CONFIG_SERIAL_BFIN_UART0
199 .flags = IORESOURCE_MEM,
202 #ifdef CONFIG_SERIAL_BFIN_UART1
206 .flags = IORESOURCE_MEM,
209 #ifdef CONFIG_SERIAL_BFIN_UART2
213 .flags = IORESOURCE_MEM,
216 #ifdef CONFIG_SERIAL_BFIN_UART3
220 .flags = IORESOURCE_MEM,
225 static struct platform_device bfin_uart_device = {
228 .num_resources = ARRAY_SIZE(bfin_uart_resources),
229 .resource = bfin_uart_resources,
233 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
234 static struct resource bfin_sir_resources[] = {
235 #ifdef CONFIG_BFIN_SIR0
239 .flags = IORESOURCE_MEM,
242 #ifdef CONFIG_BFIN_SIR1
246 .flags = IORESOURCE_MEM,
249 #ifdef CONFIG_BFIN_SIR2
253 .flags = IORESOURCE_MEM,
256 #ifdef CONFIG_BFIN_SIR3
260 .flags = IORESOURCE_MEM,
265 static struct platform_device bfin_sir_device = {
268 .num_resources = ARRAY_SIZE(bfin_sir_resources),
269 .resource = bfin_sir_resources,
273 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
274 static struct resource smsc911x_resources[] = {
276 .name = "smsc911x-memory",
278 .end = 0x24000000 + 0xFF,
279 .flags = IORESOURCE_MEM,
284 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
287 static struct platform_device smsc911x_device = {
290 .num_resources = ARRAY_SIZE(smsc911x_resources),
291 .resource = smsc911x_resources,
295 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
296 static struct resource musb_resources[] = {
300 .flags = IORESOURCE_MEM,
302 [1] = { /* general IRQ */
303 .start = IRQ_USB_INT0,
305 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
307 [2] = { /* DMA IRQ */
308 .start = IRQ_USB_DMA,
310 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
314 static struct musb_hdrc_config musb_config = {
321 .gpio_vrsel = GPIO_PE7,
324 static struct musb_hdrc_platform_data musb_plat = {
325 #if defined(CONFIG_USB_MUSB_OTG)
327 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
329 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
330 .mode = MUSB_PERIPHERAL,
332 .config = &musb_config,
335 static u64 musb_dmamask = ~(u32)0;
337 static struct platform_device musb_device = {
341 .dma_mask = &musb_dmamask,
342 .coherent_dma_mask = 0xffffffff,
343 .platform_data = &musb_plat,
345 .num_resources = ARRAY_SIZE(musb_resources),
346 .resource = musb_resources,
350 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
351 static struct resource bfin_atapi_resources[] = {
355 .flags = IORESOURCE_MEM,
358 .start = IRQ_ATAPI_ERR,
359 .end = IRQ_ATAPI_ERR,
360 .flags = IORESOURCE_IRQ,
364 static struct platform_device bfin_atapi_device = {
365 .name = "pata-bf54x",
367 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
368 .resource = bfin_atapi_resources,
372 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
373 static struct mtd_partition partition_info[] = {
375 .name = "linux kernel(nand)",
377 .size = 4 * 1024 * 1024,
380 .name = "file system(nand)",
381 .offset = MTDPART_OFS_APPEND,
382 .size = MTDPART_SIZ_FULL,
386 static struct bf5xx_nand_platform bf5xx_nand_platform = {
387 .page_size = NFC_PG_SIZE_256,
388 .data_width = NFC_NWIDTH_8,
389 .partitions = partition_info,
390 .nr_partitions = ARRAY_SIZE(partition_info),
395 static struct resource bf5xx_nand_resources[] = {
399 .flags = IORESOURCE_MEM,
404 .flags = IORESOURCE_IRQ,
408 static struct platform_device bf5xx_nand_device = {
409 .name = "bf5xx-nand",
411 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
412 .resource = bf5xx_nand_resources,
414 .platform_data = &bf5xx_nand_platform,
419 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
420 static struct platform_device bf54x_sdh_device = {
426 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
427 static struct mtd_partition ezkit_partitions[] = {
429 .name = "bootloader(nor)",
433 .name = "linux kernel(nor)",
435 .offset = MTDPART_OFS_APPEND,
437 .name = "file system(nor)",
438 .size = MTDPART_SIZ_FULL,
439 .offset = MTDPART_OFS_APPEND,
443 static struct physmap_flash_data ezkit_flash_data = {
445 .parts = ezkit_partitions,
446 .nr_parts = ARRAY_SIZE(ezkit_partitions),
449 static struct resource ezkit_flash_resource = {
452 .flags = IORESOURCE_MEM,
455 static struct platform_device ezkit_flash_device = {
456 .name = "physmap-flash",
459 .platform_data = &ezkit_flash_data,
462 .resource = &ezkit_flash_resource,
466 #if defined(CONFIG_MTD_M25P80) \
467 || defined(CONFIG_MTD_M25P80_MODULE)
468 /* SPI flash chip (m25p16) */
469 static struct mtd_partition bfin_spi_flash_partitions[] = {
471 .name = "bootloader(spi)",
474 .mask_flags = MTD_CAP_ROM
476 .name = "linux kernel(spi)",
477 .size = MTDPART_SIZ_FULL,
478 .offset = MTDPART_OFS_APPEND,
482 static struct flash_platform_data bfin_spi_flash_data = {
484 .parts = bfin_spi_flash_partitions,
485 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
489 static struct bfin5xx_spi_chip spi_flash_chip_info = {
490 .enable_dma = 0, /* use dma transfer with this chip*/
492 .cs_change_per_word = 0,
496 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
497 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
498 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
504 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
505 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
506 .cs_change_per_word = 0,
511 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
513 .vref_delay_usecs = 50, /* internal, no capacitor */
516 .pressure_max = 1000,
518 .stopacq_polarity = 1,
519 .first_conversion_delay = 3,
520 .acquisition_time = 1,
522 .pen_down_acc_interval = 1,
526 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
527 static struct bfin5xx_spi_chip spidev_chip_info = {
533 static struct spi_board_info bfin_spi_board_info[] __initdata = {
534 #if defined(CONFIG_MTD_M25P80) \
535 || defined(CONFIG_MTD_M25P80_MODULE)
537 /* the modalias must be the same as spi device driver name */
538 .modalias = "m25p80", /* Name of spi_driver for this device */
539 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
540 .bus_num = 0, /* Framework bus number */
541 .chip_select = 1, /* SPI_SSEL1*/
542 .platform_data = &bfin_spi_flash_data,
543 .controller_data = &spi_flash_chip_info,
547 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
548 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
550 .modalias = "ad1836-spi",
551 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
553 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
554 .controller_data = &ad1836_spi_chip_info,
557 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
559 .modalias = "ad7877",
560 .platform_data = &bfin_ad7877_ts_info,
561 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
562 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
565 .controller_data = &spi_ad7877_chip_info,
568 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
570 .modalias = "spidev",
571 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
574 .controller_data = &spidev_chip_info,
579 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
581 static struct resource bfin_spi0_resource[] = {
583 .start = SPI0_REGBASE,
584 .end = SPI0_REGBASE + 0xFF,
585 .flags = IORESOURCE_MEM,
590 .flags = IORESOURCE_IRQ,
595 static struct resource bfin_spi1_resource[] = {
597 .start = SPI1_REGBASE,
598 .end = SPI1_REGBASE + 0xFF,
599 .flags = IORESOURCE_MEM,
604 .flags = IORESOURCE_IRQ,
608 /* SPI controller data */
609 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
611 .enable_dma = 1, /* master has the ability to do dma transfer */
612 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
615 static struct platform_device bf54x_spi_master0 = {
617 .id = 0, /* Bus number */
618 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
619 .resource = bfin_spi0_resource,
621 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
625 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
627 .enable_dma = 1, /* master has the ability to do dma transfer */
628 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
631 static struct platform_device bf54x_spi_master1 = {
633 .id = 1, /* Bus number */
634 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
635 .resource = bfin_spi1_resource,
637 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
640 #endif /* spi master and devices */
642 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
643 static struct resource bfin_twi0_resource[] = {
645 .start = TWI0_REGBASE,
646 .end = TWI0_REGBASE + 0xFF,
647 .flags = IORESOURCE_MEM,
652 .flags = IORESOURCE_IRQ,
656 static struct platform_device i2c_bfin_twi0_device = {
657 .name = "i2c-bfin-twi",
659 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
660 .resource = bfin_twi0_resource,
663 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
664 static struct resource bfin_twi1_resource[] = {
666 .start = TWI1_REGBASE,
667 .end = TWI1_REGBASE + 0xFF,
668 .flags = IORESOURCE_MEM,
673 .flags = IORESOURCE_IRQ,
677 static struct platform_device i2c_bfin_twi1_device = {
678 .name = "i2c-bfin-twi",
680 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
681 .resource = bfin_twi1_resource,
686 #ifdef CONFIG_I2C_BOARDINFO
687 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
690 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
691 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
692 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
694 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
697 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
699 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
707 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
708 #include <linux/gpio_keys.h>
710 static struct gpio_keys_button bfin_gpio_keys_table[] = {
711 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
712 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
713 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
714 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
717 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
718 .buttons = bfin_gpio_keys_table,
719 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
722 static struct platform_device bfin_device_gpiokeys = {
725 .platform_data = &bfin_gpio_keys_data,
730 static struct resource bfin_gpios_resources = {
732 .end = MAX_BLACKFIN_GPIOS - 1,
733 .flags = IORESOURCE_IRQ,
736 static struct platform_device bfin_gpios_device = {
737 .name = "simple-gpio",
740 .resource = &bfin_gpios_resources,
743 static const unsigned int cclk_vlev_datasheet[] =
746 * Internal VLEV BF54XSBBC1533
747 ****temporarily using these values until data sheet is updated
749 VRPAIR(VLEV_085, 150000000),
750 VRPAIR(VLEV_090, 250000000),
751 VRPAIR(VLEV_110, 276000000),
752 VRPAIR(VLEV_115, 301000000),
753 VRPAIR(VLEV_120, 525000000),
754 VRPAIR(VLEV_125, 550000000),
755 VRPAIR(VLEV_130, 600000000),
758 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
759 .tuple_tab = cclk_vlev_datasheet,
760 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
761 .vr_settling_time = 25 /* us */,
764 static struct platform_device bfin_dpmc = {
767 .platform_data = &bfin_dmpc_vreg_data,
771 static struct platform_device *ezkit_devices[] __initdata = {
775 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
779 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
783 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
787 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
791 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
795 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
799 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
803 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
807 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
811 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
816 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
820 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
821 &i2c_bfin_twi0_device,
822 #if !defined(CONFIG_BF542)
823 &i2c_bfin_twi1_device,
827 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
828 &bfin_device_gpiokeys,
833 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
838 static int __init ezkit_init(void)
840 printk(KERN_INFO "%s(): registering device resources\n", __func__);
842 #ifdef CONFIG_I2C_BOARDINFO
843 i2c_register_board_info(0, bfin_i2c_board_info0,
844 ARRAY_SIZE(bfin_i2c_board_info0));
845 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
846 i2c_register_board_info(1, bfin_i2c_board_info1,
847 ARRAY_SIZE(bfin_i2c_board_info1));
851 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
853 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
858 arch_initcall(ezkit_init);