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>
49 #include <asm/portmux.h>
50 #include <asm/mach/bf54x_keys.h>
51 #include <linux/input.h>
52 #include <linux/spi/ad7877.h>
55 * Name the Board for the /proc/cpuinfo
57 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
60 * Driver needs to know address, irq and flag pin.
63 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
65 #include <asm/mach/bf54x-lq043.h>
67 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
70 .xres = {480, 480, 480},
71 .yres = {272, 272, 272},
76 static struct resource bf54x_lq043_resources[] = {
78 .start = IRQ_EPPI0_ERR,
80 .flags = IORESOURCE_IRQ,
84 static struct platform_device bf54x_lq043_device = {
85 .name = "bf54x-lq043",
87 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
88 .resource = bf54x_lq043_resources,
90 .platform_data = &bf54x_lq043_data,
95 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
96 static const unsigned int bf548_keymap[] = {
97 KEYVAL(0, 0, KEY_ENTER),
98 KEYVAL(0, 1, KEY_HELP),
100 KEYVAL(0, 3, KEY_BACKSPACE),
101 KEYVAL(1, 0, KEY_TAB),
105 KEYVAL(2, 0, KEY_DOWN),
109 KEYVAL(3, 0, KEY_UP),
115 static struct bfin_kpad_platform_data bf54x_kpad_data = {
118 .keymap = bf548_keymap,
119 .keymapsize = ARRAY_SIZE(bf548_keymap),
121 .debounce_time = 5000, /* ns (5ms) */
122 .coldrive_time = 1000, /* ns (1ms) */
123 .keyup_test_interval = 50, /* ms (50ms) */
126 static struct resource bf54x_kpad_resources[] = {
130 .flags = IORESOURCE_IRQ,
134 static struct platform_device bf54x_kpad_device = {
135 .name = "bf54x-keys",
137 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
138 .resource = bf54x_kpad_resources,
140 .platform_data = &bf54x_kpad_data,
145 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
146 static struct platform_device rtc_device = {
152 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
153 static struct resource bfin_uart_resources[] = {
154 #ifdef CONFIG_SERIAL_BFIN_UART0
158 .flags = IORESOURCE_MEM,
161 #ifdef CONFIG_SERIAL_BFIN_UART1
165 .flags = IORESOURCE_MEM,
168 #ifdef CONFIG_SERIAL_BFIN_UART2
172 .flags = IORESOURCE_MEM,
175 #ifdef CONFIG_SERIAL_BFIN_UART3
183 static struct platform_device bfin_uart_device = {
186 .num_resources = ARRAY_SIZE(bfin_uart_resources),
187 .resource = bfin_uart_resources,
191 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
192 static struct resource smsc911x_resources[] = {
194 .name = "smsc911x-memory",
196 .end = 0x24000000 + 0xFF,
197 .flags = IORESOURCE_MEM,
202 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
205 static struct platform_device smsc911x_device = {
208 .num_resources = ARRAY_SIZE(smsc911x_resources),
209 .resource = smsc911x_resources,
213 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
214 static struct resource musb_resources[] = {
218 .flags = IORESOURCE_MEM,
220 [1] = { /* general IRQ */
221 .start = IRQ_USB_INT0,
223 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
225 [2] = { /* DMA IRQ */
226 .start = IRQ_USB_DMA,
228 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
232 static struct musb_hdrc_platform_data musb_plat = {
233 #if defined(CONFIG_USB_MUSB_OTG)
235 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
237 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
238 .mode = MUSB_PERIPHERAL,
243 static u64 musb_dmamask = ~(u32)0;
245 static struct platform_device musb_device = {
249 .dma_mask = &musb_dmamask,
250 .coherent_dma_mask = 0xffffffff,
251 .platform_data = &musb_plat,
253 .num_resources = ARRAY_SIZE(musb_resources),
254 .resource = musb_resources,
258 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
259 static struct resource bfin_atapi_resources[] = {
263 .flags = IORESOURCE_MEM,
266 .start = IRQ_ATAPI_ERR,
267 .end = IRQ_ATAPI_ERR,
268 .flags = IORESOURCE_IRQ,
272 static struct platform_device bfin_atapi_device = {
273 .name = "pata-bf54x",
275 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
276 .resource = bfin_atapi_resources,
280 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
281 static struct mtd_partition partition_info[] = {
283 .name = "Linux Kernel",
288 .name = "File System",
289 .offset = MTDPART_OFS_APPEND,
290 .size = MTDPART_SIZ_FULL,
294 static struct bf5xx_nand_platform bf5xx_nand_platform = {
295 .page_size = NFC_PG_SIZE_256,
296 .data_width = NFC_NWIDTH_8,
297 .partitions = partition_info,
298 .nr_partitions = ARRAY_SIZE(partition_info),
303 static struct resource bf5xx_nand_resources[] = {
307 .flags = IORESOURCE_MEM,
312 .flags = IORESOURCE_IRQ,
316 static struct platform_device bf5xx_nand_device = {
317 .name = "bf5xx-nand",
319 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
320 .resource = bf5xx_nand_resources,
322 .platform_data = &bf5xx_nand_platform,
327 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
328 static struct platform_device bf54x_sdh_device = {
334 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
335 static struct mtd_partition ezkit_partitions[] = {
337 .name = "Bootloader",
343 .offset = MTDPART_OFS_APPEND,
346 .size = MTDPART_SIZ_FULL,
347 .offset = MTDPART_OFS_APPEND,
351 static struct physmap_flash_data ezkit_flash_data = {
353 .parts = ezkit_partitions,
354 .nr_parts = ARRAY_SIZE(ezkit_partitions),
357 static struct resource ezkit_flash_resource = {
360 .flags = IORESOURCE_MEM,
363 static struct platform_device ezkit_flash_device = {
364 .name = "physmap-flash",
367 .platform_data = &ezkit_flash_data,
370 .resource = &ezkit_flash_resource,
374 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
375 /* all SPI peripherals info goes here */
376 #if defined(CONFIG_MTD_M25P80) \
377 || defined(CONFIG_MTD_M25P80_MODULE)
378 /* SPI flash chip (m25p16) */
379 static struct mtd_partition bfin_spi_flash_partitions[] = {
381 .name = "bootloader",
384 .mask_flags = MTD_CAP_ROM
386 .name = "linux kernel",
387 .size = MTDPART_SIZ_FULL,
388 .offset = MTDPART_OFS_APPEND,
392 static struct flash_platform_data bfin_spi_flash_data = {
394 .parts = bfin_spi_flash_partitions,
395 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
399 static struct bfin5xx_spi_chip spi_flash_chip_info = {
400 .enable_dma = 0, /* use dma transfer with this chip*/
402 .cs_change_per_word = 0,
406 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
407 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
408 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
414 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
415 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
416 .cs_change_per_word = 0,
421 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
423 .vref_delay_usecs = 50, /* internal, no capacitor */
426 .pressure_max = 1000,
428 .stopacq_polarity = 1,
429 .first_conversion_delay = 3,
430 .acquisition_time = 1,
432 .pen_down_acc_interval = 1,
436 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
437 static struct bfin5xx_spi_chip spidev_chip_info = {
443 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
444 #if defined(CONFIG_MTD_M25P80) \
445 || defined(CONFIG_MTD_M25P80_MODULE)
447 /* the modalias must be the same as spi device driver name */
448 .modalias = "m25p80", /* Name of spi_driver for this device */
449 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
450 .bus_num = 0, /* Framework bus number */
451 .chip_select = 1, /* SPI_SSEL1*/
452 .platform_data = &bfin_spi_flash_data,
453 .controller_data = &spi_flash_chip_info,
457 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
458 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
460 .modalias = "ad1836-spi",
461 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
463 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
464 .controller_data = &ad1836_spi_chip_info,
467 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
469 .modalias = "ad7877",
470 .platform_data = &bfin_ad7877_ts_info,
472 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
475 .controller_data = &spi_ad7877_chip_info,
478 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
480 .modalias = "spidev",
481 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
484 .controller_data = &spidev_chip_info,
490 static struct resource bfin_spi0_resource[] = {
492 .start = SPI0_REGBASE,
493 .end = SPI0_REGBASE + 0xFF,
494 .flags = IORESOURCE_MEM,
499 .flags = IORESOURCE_IRQ,
504 static struct resource bfin_spi1_resource[] = {
506 .start = SPI1_REGBASE,
507 .end = SPI1_REGBASE + 0xFF,
508 .flags = IORESOURCE_MEM,
513 .flags = IORESOURCE_IRQ,
517 /* SPI controller data */
518 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
520 .enable_dma = 1, /* master has the ability to do dma transfer */
521 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
524 static struct platform_device bf54x_spi_master0 = {
526 .id = 0, /* Bus number */
527 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
528 .resource = bfin_spi0_resource,
530 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
534 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
536 .enable_dma = 1, /* master has the ability to do dma transfer */
537 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
540 static struct platform_device bf54x_spi_master1 = {
542 .id = 1, /* Bus number */
543 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
544 .resource = bfin_spi1_resource,
546 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
549 #endif /* spi master and devices */
551 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
552 static struct resource bfin_twi0_resource[] = {
554 .start = TWI0_REGBASE,
555 .end = TWI0_REGBASE + 0xFF,
556 .flags = IORESOURCE_MEM,
561 .flags = IORESOURCE_IRQ,
565 static struct platform_device i2c_bfin_twi0_device = {
566 .name = "i2c-bfin-twi",
568 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
569 .resource = bfin_twi0_resource,
572 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
573 static struct resource bfin_twi1_resource[] = {
575 .start = TWI1_REGBASE,
576 .end = TWI1_REGBASE + 0xFF,
577 .flags = IORESOURCE_MEM,
582 .flags = IORESOURCE_IRQ,
586 static struct platform_device i2c_bfin_twi1_device = {
587 .name = "i2c-bfin-twi",
589 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
590 .resource = bfin_twi1_resource,
595 #ifdef CONFIG_I2C_BOARDINFO
596 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
599 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
600 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
601 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
603 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
604 .type = "pcf8574_lcd",
607 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
609 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
610 .type = "pcf8574_keypad",
618 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
619 #include <linux/gpio_keys.h>
621 static struct gpio_keys_button bfin_gpio_keys_table[] = {
622 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
623 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
624 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
625 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
628 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
629 .buttons = bfin_gpio_keys_table,
630 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
633 static struct platform_device bfin_device_gpiokeys = {
636 .platform_data = &bfin_gpio_keys_data,
641 static struct resource bfin_gpios_resources = {
643 .end = MAX_BLACKFIN_GPIOS - 1,
644 .flags = IORESOURCE_IRQ,
647 static struct platform_device bfin_gpios_device = {
648 .name = "simple-gpio",
651 .resource = &bfin_gpios_resources,
654 static struct platform_device *ezkit_devices[] __initdata = {
655 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
659 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
663 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
667 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
671 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
675 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
679 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
683 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
687 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
692 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
696 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
697 &i2c_bfin_twi0_device,
698 #if !defined(CONFIG_BF542)
699 &i2c_bfin_twi1_device,
703 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
704 &bfin_device_gpiokeys,
709 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
714 static int __init ezkit_init(void)
716 printk(KERN_INFO "%s(): registering device resources\n", __func__);
718 #ifdef CONFIG_I2C_BOARDINFO
719 i2c_register_board_info(0, bfin_i2c_board_info0,
720 ARRAY_SIZE(bfin_i2c_board_info0));
721 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
722 i2c_register_board_info(1, bfin_i2c_board_info1,
723 ARRAY_SIZE(bfin_i2c_board_info1));
727 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
729 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
730 spi_register_board_info(bf54x_spi_board_info,
731 ARRAY_SIZE(bf54x_spi_board_info));
737 arch_initcall(ezkit_init);