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>
48 #include <asm/portmux.h>
49 #include <mach/bf54x_keys.h>
50 #include <linux/input.h>
51 #include <linux/spi/ad7877.h>
54 * Name the Board for the /proc/cpuinfo
56 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
59 * Driver needs to know address, irq and flag pin.
62 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
63 static struct resource bfin_isp1761_resources[] = {
65 .name = "isp1761-regs",
67 .end = 0x2C0C0000 + 0xfffff,
68 .flags = IORESOURCE_MEM,
73 .flags = IORESOURCE_IRQ,
77 static struct platform_device bfin_isp1761_device = {
80 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
81 .resource = bfin_isp1761_resources,
84 static struct platform_device *bfin_isp1761_devices[] = {
88 int __init bfin_isp1761_init(void)
90 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
92 printk(KERN_INFO "%s(): registering device resources\n", __func__);
93 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
95 return platform_add_devices(bfin_isp1761_devices, num_devices);
98 void __exit bfin_isp1761_exit(void)
100 platform_device_unregister(&bfin_isp1761_device);
102 arch_initcall(bfin_isp1761_init);
105 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
107 #include <mach/bf54x-lq043.h>
109 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
112 .xres = {480, 480, 480},
113 .yres = {272, 272, 272},
118 static struct resource bf54x_lq043_resources[] = {
120 .start = IRQ_EPPI0_ERR,
121 .end = IRQ_EPPI0_ERR,
122 .flags = IORESOURCE_IRQ,
126 static struct platform_device bf54x_lq043_device = {
127 .name = "bf54x-lq043",
129 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
130 .resource = bf54x_lq043_resources,
132 .platform_data = &bf54x_lq043_data,
137 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
138 static const unsigned int bf548_keymap[] = {
139 KEYVAL(0, 0, KEY_ENTER),
140 KEYVAL(0, 1, KEY_HELP),
142 KEYVAL(0, 3, KEY_BACKSPACE),
143 KEYVAL(1, 0, KEY_TAB),
147 KEYVAL(2, 0, KEY_DOWN),
151 KEYVAL(3, 0, KEY_UP),
157 static struct bfin_kpad_platform_data bf54x_kpad_data = {
160 .keymap = bf548_keymap,
161 .keymapsize = ARRAY_SIZE(bf548_keymap),
163 .debounce_time = 5000, /* ns (5ms) */
164 .coldrive_time = 1000, /* ns (1ms) */
165 .keyup_test_interval = 50, /* ms (50ms) */
168 static struct resource bf54x_kpad_resources[] = {
172 .flags = IORESOURCE_IRQ,
176 static struct platform_device bf54x_kpad_device = {
177 .name = "bf54x-keys",
179 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
180 .resource = bf54x_kpad_resources,
182 .platform_data = &bf54x_kpad_data,
187 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
188 static struct platform_device rtc_device = {
194 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
195 static struct resource bfin_uart_resources[] = {
196 #ifdef CONFIG_SERIAL_BFIN_UART0
200 .flags = IORESOURCE_MEM,
203 #ifdef CONFIG_SERIAL_BFIN_UART1
207 .flags = IORESOURCE_MEM,
210 #ifdef CONFIG_SERIAL_BFIN_UART2
214 .flags = IORESOURCE_MEM,
217 #ifdef CONFIG_SERIAL_BFIN_UART3
221 .flags = IORESOURCE_MEM,
226 static struct platform_device bfin_uart_device = {
229 .num_resources = ARRAY_SIZE(bfin_uart_resources),
230 .resource = bfin_uart_resources,
234 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
235 static struct resource bfin_sir_resources[] = {
236 #ifdef CONFIG_BFIN_SIR0
240 .flags = IORESOURCE_MEM,
243 #ifdef CONFIG_BFIN_SIR1
247 .flags = IORESOURCE_MEM,
250 #ifdef CONFIG_BFIN_SIR2
254 .flags = IORESOURCE_MEM,
257 #ifdef CONFIG_BFIN_SIR3
261 .flags = IORESOURCE_MEM,
266 static struct platform_device bfin_sir_device = {
269 .num_resources = ARRAY_SIZE(bfin_sir_resources),
270 .resource = bfin_sir_resources,
274 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
275 static struct resource smsc911x_resources[] = {
277 .name = "smsc911x-memory",
279 .end = 0x24000000 + 0xFF,
280 .flags = IORESOURCE_MEM,
285 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
288 static struct platform_device smsc911x_device = {
291 .num_resources = ARRAY_SIZE(smsc911x_resources),
292 .resource = smsc911x_resources,
296 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
297 static struct resource musb_resources[] = {
301 .flags = IORESOURCE_MEM,
303 [1] = { /* general IRQ */
304 .start = IRQ_USB_INT0,
306 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
308 [2] = { /* DMA IRQ */
309 .start = IRQ_USB_DMA,
311 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
315 static struct musb_hdrc_config musb_config = {
322 .gpio_vrsel = GPIO_PE7,
325 static struct musb_hdrc_platform_data musb_plat = {
326 #if defined(CONFIG_USB_MUSB_OTG)
328 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
330 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
331 .mode = MUSB_PERIPHERAL,
333 .config = &musb_config,
336 static u64 musb_dmamask = ~(u32)0;
338 static struct platform_device musb_device = {
342 .dma_mask = &musb_dmamask,
343 .coherent_dma_mask = 0xffffffff,
344 .platform_data = &musb_plat,
346 .num_resources = ARRAY_SIZE(musb_resources),
347 .resource = musb_resources,
351 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
352 static struct resource bfin_atapi_resources[] = {
356 .flags = IORESOURCE_MEM,
359 .start = IRQ_ATAPI_ERR,
360 .end = IRQ_ATAPI_ERR,
361 .flags = IORESOURCE_IRQ,
365 static struct platform_device bfin_atapi_device = {
366 .name = "pata-bf54x",
368 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
369 .resource = bfin_atapi_resources,
373 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
374 static struct mtd_partition partition_info[] = {
376 .name = "linux kernel(nand)",
381 .name = "file system(nand)",
382 .offset = MTDPART_OFS_APPEND,
383 .size = MTDPART_SIZ_FULL,
387 static struct bf5xx_nand_platform bf5xx_nand_platform = {
388 .page_size = NFC_PG_SIZE_256,
389 .data_width = NFC_NWIDTH_8,
390 .partitions = partition_info,
391 .nr_partitions = ARRAY_SIZE(partition_info),
396 static struct resource bf5xx_nand_resources[] = {
400 .flags = IORESOURCE_MEM,
405 .flags = IORESOURCE_IRQ,
409 static struct platform_device bf5xx_nand_device = {
410 .name = "bf5xx-nand",
412 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
413 .resource = bf5xx_nand_resources,
415 .platform_data = &bf5xx_nand_platform,
420 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
421 static struct platform_device bf54x_sdh_device = {
427 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
428 static struct mtd_partition ezkit_partitions[] = {
430 .name = "bootloader(nor)",
434 .name = "linux kernel(nor)",
436 .offset = MTDPART_OFS_APPEND,
438 .name = "file system(nor)",
439 .size = MTDPART_SIZ_FULL,
440 .offset = MTDPART_OFS_APPEND,
444 static struct physmap_flash_data ezkit_flash_data = {
446 .parts = ezkit_partitions,
447 .nr_parts = ARRAY_SIZE(ezkit_partitions),
450 static struct resource ezkit_flash_resource = {
453 .flags = IORESOURCE_MEM,
456 static struct platform_device ezkit_flash_device = {
457 .name = "physmap-flash",
460 .platform_data = &ezkit_flash_data,
463 .resource = &ezkit_flash_resource,
467 #if defined(CONFIG_MTD_M25P80) \
468 || defined(CONFIG_MTD_M25P80_MODULE)
469 /* SPI flash chip (m25p16) */
470 static struct mtd_partition bfin_spi_flash_partitions[] = {
472 .name = "bootloader(spi)",
475 .mask_flags = MTD_CAP_ROM
477 .name = "linux kernel(spi)",
478 .size = MTDPART_SIZ_FULL,
479 .offset = MTDPART_OFS_APPEND,
483 static struct flash_platform_data bfin_spi_flash_data = {
485 .parts = bfin_spi_flash_partitions,
486 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
490 static struct bfin5xx_spi_chip spi_flash_chip_info = {
491 .enable_dma = 0, /* use dma transfer with this chip*/
493 .cs_change_per_word = 0,
497 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
498 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
499 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
505 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
506 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
507 .cs_change_per_word = 0,
512 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
514 .vref_delay_usecs = 50, /* internal, no capacitor */
517 .pressure_max = 1000,
519 .stopacq_polarity = 1,
520 .first_conversion_delay = 3,
521 .acquisition_time = 1,
523 .pen_down_acc_interval = 1,
527 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
528 static struct bfin5xx_spi_chip spidev_chip_info = {
534 static struct spi_board_info bfin_spi_board_info[] __initdata = {
535 #if defined(CONFIG_MTD_M25P80) \
536 || defined(CONFIG_MTD_M25P80_MODULE)
538 /* the modalias must be the same as spi device driver name */
539 .modalias = "m25p80", /* Name of spi_driver for this device */
540 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
541 .bus_num = 0, /* Framework bus number */
542 .chip_select = 1, /* SPI_SSEL1*/
543 .platform_data = &bfin_spi_flash_data,
544 .controller_data = &spi_flash_chip_info,
548 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
549 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
551 .modalias = "ad1836-spi",
552 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
554 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
555 .controller_data = &ad1836_spi_chip_info,
558 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
560 .modalias = "ad7877",
561 .platform_data = &bfin_ad7877_ts_info,
562 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
563 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
566 .controller_data = &spi_ad7877_chip_info,
569 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
571 .modalias = "spidev",
572 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
575 .controller_data = &spidev_chip_info,
580 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
582 static struct resource bfin_spi0_resource[] = {
584 .start = SPI0_REGBASE,
585 .end = SPI0_REGBASE + 0xFF,
586 .flags = IORESOURCE_MEM,
591 .flags = IORESOURCE_IRQ,
596 static struct resource bfin_spi1_resource[] = {
598 .start = SPI1_REGBASE,
599 .end = SPI1_REGBASE + 0xFF,
600 .flags = IORESOURCE_MEM,
605 .flags = IORESOURCE_IRQ,
609 /* SPI controller data */
610 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
612 .enable_dma = 1, /* master has the ability to do dma transfer */
613 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
616 static struct platform_device bf54x_spi_master0 = {
618 .id = 0, /* Bus number */
619 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
620 .resource = bfin_spi0_resource,
622 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
626 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
628 .enable_dma = 1, /* master has the ability to do dma transfer */
629 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
632 static struct platform_device bf54x_spi_master1 = {
634 .id = 1, /* Bus number */
635 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
636 .resource = bfin_spi1_resource,
638 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
641 #endif /* spi master and devices */
643 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
644 static struct resource bfin_twi0_resource[] = {
646 .start = TWI0_REGBASE,
647 .end = TWI0_REGBASE + 0xFF,
648 .flags = IORESOURCE_MEM,
653 .flags = IORESOURCE_IRQ,
657 static struct platform_device i2c_bfin_twi0_device = {
658 .name = "i2c-bfin-twi",
660 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
661 .resource = bfin_twi0_resource,
664 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
665 static struct resource bfin_twi1_resource[] = {
667 .start = TWI1_REGBASE,
668 .end = TWI1_REGBASE + 0xFF,
669 .flags = IORESOURCE_MEM,
674 .flags = IORESOURCE_IRQ,
678 static struct platform_device i2c_bfin_twi1_device = {
679 .name = "i2c-bfin-twi",
681 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
682 .resource = bfin_twi1_resource,
687 #ifdef CONFIG_I2C_BOARDINFO
688 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
691 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
692 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
693 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
695 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
698 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
700 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
708 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
709 #include <linux/gpio_keys.h>
711 static struct gpio_keys_button bfin_gpio_keys_table[] = {
712 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
713 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
714 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
715 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
718 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
719 .buttons = bfin_gpio_keys_table,
720 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
723 static struct platform_device bfin_device_gpiokeys = {
726 .platform_data = &bfin_gpio_keys_data,
731 static struct resource bfin_gpios_resources = {
733 .end = MAX_BLACKFIN_GPIOS - 1,
734 .flags = IORESOURCE_IRQ,
737 static struct platform_device bfin_gpios_device = {
738 .name = "simple-gpio",
741 .resource = &bfin_gpios_resources,
744 static const unsigned int cclk_vlev_datasheet[] =
747 * Internal VLEV BF54XSBBC1533
748 ****temporarily using these values until data sheet is updated
750 VRPAIR(VLEV_085, 150000000),
751 VRPAIR(VLEV_090, 250000000),
752 VRPAIR(VLEV_110, 276000000),
753 VRPAIR(VLEV_115, 301000000),
754 VRPAIR(VLEV_120, 525000000),
755 VRPAIR(VLEV_125, 550000000),
756 VRPAIR(VLEV_130, 600000000),
759 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
760 .tuple_tab = cclk_vlev_datasheet,
761 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
762 .vr_settling_time = 25 /* us */,
765 static struct platform_device bfin_dpmc = {
768 .platform_data = &bfin_dmpc_vreg_data,
772 static struct platform_device *ezkit_devices[] __initdata = {
776 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
780 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
784 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
788 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
792 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
796 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
800 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
804 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
808 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
812 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
817 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
821 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
822 &i2c_bfin_twi0_device,
823 #if !defined(CONFIG_BF542)
824 &i2c_bfin_twi1_device,
828 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
829 &bfin_device_gpiokeys,
834 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
839 static int __init ezkit_init(void)
841 printk(KERN_INFO "%s(): registering device resources\n", __func__);
843 #ifdef CONFIG_I2C_BOARDINFO
844 i2c_register_board_info(0, bfin_i2c_board_info0,
845 ARRAY_SIZE(bfin_i2c_board_info0));
846 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
847 i2c_register_board_info(1, bfin_i2c_board_info1,
848 ARRAY_SIZE(bfin_i2c_board_info1));
852 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
854 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
859 arch_initcall(ezkit_init);