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/interrupt.h>
40 #include <linux/usb/musb.h>
41 #include <asm/bfin5xx_spi.h>
46 #include <asm/portmux.h>
47 #include <asm/mach/bf54x_keys.h>
48 #include <linux/input.h>
49 #include <linux/spi/ad7877.h>
52 * Name the Board for the /proc/cpuinfo
54 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
57 * Driver needs to know address, irq and flag pin.
60 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
62 #include <asm/mach/bf54x-lq043.h>
64 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
67 .xres = {480, 480, 480},
68 .yres = {272, 272, 272},
73 static struct resource bf54x_lq043_resources[] = {
75 .start = IRQ_EPPI0_ERR,
77 .flags = IORESOURCE_IRQ,
81 static struct platform_device bf54x_lq043_device = {
82 .name = "bf54x-lq043",
84 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
85 .resource = bf54x_lq043_resources,
87 .platform_data = &bf54x_lq043_data,
92 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
93 static const unsigned int bf548_keymap[] = {
94 KEYVAL(0, 0, KEY_ENTER),
95 KEYVAL(0, 1, KEY_HELP),
97 KEYVAL(0, 3, KEY_BACKSPACE),
98 KEYVAL(1, 0, KEY_TAB),
102 KEYVAL(2, 0, KEY_DOWN),
106 KEYVAL(3, 0, KEY_UP),
112 static struct bfin_kpad_platform_data bf54x_kpad_data = {
115 .keymap = bf548_keymap,
116 .keymapsize = ARRAY_SIZE(bf548_keymap),
118 .debounce_time = 5000, /* ns (5ms) */
119 .coldrive_time = 1000, /* ns (1ms) */
120 .keyup_test_interval = 50, /* ms (50ms) */
123 static struct resource bf54x_kpad_resources[] = {
127 .flags = IORESOURCE_IRQ,
131 static struct platform_device bf54x_kpad_device = {
132 .name = "bf54x-keys",
134 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
135 .resource = bf54x_kpad_resources,
137 .platform_data = &bf54x_kpad_data,
142 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
143 static struct platform_device rtc_device = {
149 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
150 static struct resource bfin_uart_resources[] = {
151 #ifdef CONFIG_SERIAL_BFIN_UART0
155 .flags = IORESOURCE_MEM,
158 #ifdef CONFIG_SERIAL_BFIN_UART1
162 .flags = IORESOURCE_MEM,
165 #ifdef CONFIG_SERIAL_BFIN_UART2
169 .flags = IORESOURCE_MEM,
172 #ifdef CONFIG_SERIAL_BFIN_UART3
180 static struct platform_device bfin_uart_device = {
183 .num_resources = ARRAY_SIZE(bfin_uart_resources),
184 .resource = bfin_uart_resources,
188 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
189 static struct resource smsc911x_resources[] = {
191 .name = "smsc911x-memory",
193 .end = 0x24000000 + 0xFF,
194 .flags = IORESOURCE_MEM,
199 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
202 static struct platform_device smsc911x_device = {
205 .num_resources = ARRAY_SIZE(smsc911x_resources),
206 .resource = smsc911x_resources,
210 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
211 static struct resource musb_resources[] = {
215 .flags = IORESOURCE_MEM,
217 [1] = { /* general IRQ */
218 .start = IRQ_USB_INT0,
220 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
222 [2] = { /* DMA IRQ */
223 .start = IRQ_USB_DMA,
225 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
229 static struct musb_hdrc_platform_data musb_plat = {
230 #if defined(CONFIG_USB_MUSB_OTG)
232 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
234 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
235 .mode = MUSB_PERIPHERAL,
240 static u64 musb_dmamask = ~(u32)0;
242 static struct platform_device musb_device = {
246 .dma_mask = &musb_dmamask,
247 .coherent_dma_mask = 0xffffffff,
248 .platform_data = &musb_plat,
250 .num_resources = ARRAY_SIZE(musb_resources),
251 .resource = musb_resources,
255 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
256 static struct resource bfin_atapi_resources[] = {
260 .flags = IORESOURCE_MEM,
263 .start = IRQ_ATAPI_ERR,
264 .end = IRQ_ATAPI_ERR,
265 .flags = IORESOURCE_IRQ,
269 static struct platform_device bfin_atapi_device = {
270 .name = "pata-bf54x",
272 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
273 .resource = bfin_atapi_resources,
277 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
278 static struct mtd_partition partition_info[] = {
280 .name = "Linux Kernel",
285 .name = "File System",
286 .offset = 4 * SIZE_1M,
287 .size = (256 - 4) * SIZE_1M,
291 static struct bf5xx_nand_platform bf5xx_nand_platform = {
292 .page_size = NFC_PG_SIZE_256,
293 .data_width = NFC_NWIDTH_8,
294 .partitions = partition_info,
295 .nr_partitions = ARRAY_SIZE(partition_info),
300 static struct resource bf5xx_nand_resources[] = {
304 .flags = IORESOURCE_MEM,
309 .flags = IORESOURCE_IRQ,
313 static struct platform_device bf5xx_nand_device = {
314 .name = "bf5xx-nand",
316 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
317 .resource = bf5xx_nand_resources,
319 .platform_data = &bf5xx_nand_platform,
324 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
325 static struct platform_device bf54x_sdh_device = {
331 static struct mtd_partition ezkit_partitions[] = {
333 .name = "Bootloader",
339 .offset = MTDPART_OFS_APPEND,
342 .size = MTDPART_SIZ_FULL,
343 .offset = MTDPART_OFS_APPEND,
347 static struct physmap_flash_data ezkit_flash_data = {
349 .parts = ezkit_partitions,
350 .nr_parts = ARRAY_SIZE(ezkit_partitions),
353 static struct resource ezkit_flash_resource = {
356 .flags = IORESOURCE_MEM,
359 static struct platform_device ezkit_flash_device = {
360 .name = "physmap-flash",
363 .platform_data = &ezkit_flash_data,
366 .resource = &ezkit_flash_resource,
369 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
370 /* all SPI peripherals info goes here */
371 #if defined(CONFIG_MTD_M25P80) \
372 || defined(CONFIG_MTD_M25P80_MODULE)
373 /* SPI flash chip (m25p16) */
374 static struct mtd_partition bfin_spi_flash_partitions[] = {
376 .name = "bootloader",
379 .mask_flags = MTD_CAP_ROM
381 .name = "linux kernel",
387 static struct flash_platform_data bfin_spi_flash_data = {
389 .parts = bfin_spi_flash_partitions,
390 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
394 static struct bfin5xx_spi_chip spi_flash_chip_info = {
395 .enable_dma = 0, /* use dma transfer with this chip*/
397 .cs_change_per_word = 0,
401 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
402 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
403 .cs_change_per_word = 0,
408 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
410 .vref_delay_usecs = 50, /* internal, no capacitor */
413 .pressure_max = 1000,
415 .stopacq_polarity = 1,
416 .first_conversion_delay = 3,
417 .acquisition_time = 1,
419 .pen_down_acc_interval = 1,
423 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
424 static struct bfin5xx_spi_chip spidev_chip_info = {
430 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
431 #if defined(CONFIG_MTD_M25P80) \
432 || defined(CONFIG_MTD_M25P80_MODULE)
434 /* the modalias must be the same as spi device driver name */
435 .modalias = "m25p80", /* Name of spi_driver for this device */
436 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
437 .bus_num = 0, /* Framework bus number */
438 .chip_select = 1, /* SPI_SSEL1*/
439 .platform_data = &bfin_spi_flash_data,
440 .controller_data = &spi_flash_chip_info,
444 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
446 .modalias = "ad7877",
447 .platform_data = &bfin_ad7877_ts_info,
449 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
452 .controller_data = &spi_ad7877_chip_info,
455 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
457 .modalias = "spidev",
458 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
461 .controller_data = &spidev_chip_info,
467 static struct resource bfin_spi0_resource[] = {
469 .start = SPI0_REGBASE,
470 .end = SPI0_REGBASE + 0xFF,
471 .flags = IORESOURCE_MEM,
476 .flags = IORESOURCE_IRQ,
481 static struct resource bfin_spi1_resource[] = {
483 .start = SPI1_REGBASE,
484 .end = SPI1_REGBASE + 0xFF,
485 .flags = IORESOURCE_MEM,
490 .flags = IORESOURCE_IRQ,
494 /* SPI controller data */
495 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
497 .enable_dma = 1, /* master has the ability to do dma transfer */
498 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
501 static struct platform_device bf54x_spi_master0 = {
503 .id = 0, /* Bus number */
504 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
505 .resource = bfin_spi0_resource,
507 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
511 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
513 .enable_dma = 1, /* master has the ability to do dma transfer */
514 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
517 static struct platform_device bf54x_spi_master1 = {
519 .id = 1, /* Bus number */
520 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
521 .resource = bfin_spi1_resource,
523 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
526 #endif /* spi master and devices */
528 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
529 static struct resource bfin_twi0_resource[] = {
531 .start = TWI0_REGBASE,
532 .end = TWI0_REGBASE + 0xFF,
533 .flags = IORESOURCE_MEM,
538 .flags = IORESOURCE_IRQ,
542 static struct platform_device i2c_bfin_twi0_device = {
543 .name = "i2c-bfin-twi",
545 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
546 .resource = bfin_twi0_resource,
549 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
550 static struct resource bfin_twi1_resource[] = {
552 .start = TWI1_REGBASE,
553 .end = TWI1_REGBASE + 0xFF,
554 .flags = IORESOURCE_MEM,
559 .flags = IORESOURCE_IRQ,
563 static struct platform_device i2c_bfin_twi1_device = {
564 .name = "i2c-bfin-twi",
566 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
567 .resource = bfin_twi1_resource,
572 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
573 #include <linux/gpio_keys.h>
575 static struct gpio_keys_button bfin_gpio_keys_table[] = {
576 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
577 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
578 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
579 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
582 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
583 .buttons = bfin_gpio_keys_table,
584 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
587 static struct platform_device bfin_device_gpiokeys = {
590 .platform_data = &bfin_gpio_keys_data,
595 static struct platform_device *ezkit_devices[] __initdata = {
596 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
600 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
604 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
608 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
612 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
616 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
620 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
624 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
628 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
633 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
637 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
638 &i2c_bfin_twi0_device,
639 #if !defined(CONFIG_BF542)
640 &i2c_bfin_twi1_device,
644 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
645 &bfin_device_gpiokeys,
650 static int __init ezkit_init(void)
652 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
653 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
655 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
656 spi_register_board_info(bf54x_spi_board_info,
657 ARRAY_SIZE(bf54x_spi_board_info));
663 arch_initcall(ezkit_init);