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/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #include <linux/irq.h>
38 #include <linux/interrupt.h>
39 #include <linux/usb/musb.h>
40 #include <asm/bfin5xx_spi.h>
45 #include <asm/mach/bf54x_keys.h>
46 #include <linux/input.h>
47 #include <linux/spi/ad7877.h>
50 * Name the Board for the /proc/cpuinfo
52 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
55 * Driver needs to know address, irq and flag pin.
58 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
60 #include <asm/mach/bf54x-lq043.h>
62 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
65 .xres = {480, 480, 480},
66 .yres = {272, 272, 272},
71 static struct resource bf54x_lq043_resources[] = {
73 .start = IRQ_EPPI0_ERR,
75 .flags = IORESOURCE_IRQ,
79 static struct platform_device bf54x_lq043_device = {
80 .name = "bf54x-lq043",
82 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
83 .resource = bf54x_lq043_resources,
85 .platform_data = &bf54x_lq043_data,
90 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
91 static const unsigned int bf548_keymap[] = {
92 KEYVAL(0, 0, KEY_ENTER),
93 KEYVAL(0, 1, KEY_HELP),
95 KEYVAL(0, 3, KEY_BACKSPACE),
96 KEYVAL(1, 0, KEY_TAB),
100 KEYVAL(2, 0, KEY_DOWN),
104 KEYVAL(3, 0, KEY_UP),
110 static struct bfin_kpad_platform_data bf54x_kpad_data = {
113 .keymap = bf548_keymap,
114 .keymapsize = ARRAY_SIZE(bf548_keymap),
116 .debounce_time = 5000, /* ns (5ms) */
117 .coldrive_time = 1000, /* ns (1ms) */
118 .keyup_test_interval = 50, /* ms (50ms) */
121 static struct resource bf54x_kpad_resources[] = {
125 .flags = IORESOURCE_IRQ,
129 static struct platform_device bf54x_kpad_device = {
130 .name = "bf54x-keys",
132 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
133 .resource = bf54x_kpad_resources,
135 .platform_data = &bf54x_kpad_data,
140 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
141 static struct platform_device rtc_device = {
147 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
148 static struct resource bfin_uart_resources[] = {
149 #ifdef CONFIG_SERIAL_BFIN_UART0
153 .flags = IORESOURCE_MEM,
156 #ifdef CONFIG_SERIAL_BFIN_UART1
160 .flags = IORESOURCE_MEM,
163 #ifdef CONFIG_SERIAL_BFIN_UART2
167 .flags = IORESOURCE_MEM,
170 #ifdef CONFIG_SERIAL_BFIN_UART3
178 static struct platform_device bfin_uart_device = {
181 .num_resources = ARRAY_SIZE(bfin_uart_resources),
182 .resource = bfin_uart_resources,
186 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
187 static struct resource smsc911x_resources[] = {
189 .name = "smsc911x-memory",
191 .end = 0x24000000 + 0xFF,
192 .flags = IORESOURCE_MEM,
197 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
200 static struct platform_device smsc911x_device = {
203 .num_resources = ARRAY_SIZE(smsc911x_resources),
204 .resource = smsc911x_resources,
208 #if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
209 static struct resource bf54x_hcd_resources[] = {
213 .flags = IORESOURCE_MEM,
217 static struct platform_device bf54x_hcd = {
220 .num_resources = ARRAY_SIZE(bf54x_hcd_resources),
221 .resource = bf54x_hcd_resources,
225 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
226 static struct resource musb_resources[] = {
230 .flags = IORESOURCE_MEM,
232 [1] = { /* general IRQ */
233 .start = IRQ_USB_INT0,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
237 [2] = { /* DMA IRQ */
238 .start = IRQ_USB_DMA,
240 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
244 static struct musb_hdrc_platform_data musb_plat = {
245 #ifdef CONFIG_USB_MUSB_OTG
247 #elif CONFIG_USB_MUSB_HDRC_HCD
249 #elif CONFIG_USB_GADGET_MUSB_HDRC
250 .mode = MUSB_PERIPHERAL,
255 static u64 musb_dmamask = ~(u32)0;
257 static struct platform_device musb_device = {
261 .dma_mask = &musb_dmamask,
262 .coherent_dma_mask = 0xffffffff,
263 .platform_data = &musb_plat,
265 .num_resources = ARRAY_SIZE(musb_resources),
266 .resource = musb_resources,
270 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
271 static struct resource bfin_atapi_resources[] = {
275 .flags = IORESOURCE_MEM,
278 .start = IRQ_ATAPI_ERR,
279 .end = IRQ_ATAPI_ERR,
280 .flags = IORESOURCE_IRQ,
284 static struct platform_device bfin_atapi_device = {
285 .name = "pata-bf54x",
287 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
288 .resource = bfin_atapi_resources,
292 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
293 static struct mtd_partition partition_info[] = {
295 .name = "Linux Kernel",
300 .name = "File System",
301 .offset = 4 * SIZE_1M,
302 .size = (256 - 4) * SIZE_1M,
306 static struct bf5xx_nand_platform bf5xx_nand_platform = {
307 .page_size = NFC_PG_SIZE_256,
308 .data_width = NFC_NWIDTH_8,
309 .partitions = partition_info,
310 .nr_partitions = ARRAY_SIZE(partition_info),
315 static struct resource bf5xx_nand_resources[] = {
319 .flags = IORESOURCE_MEM,
324 .flags = IORESOURCE_IRQ,
328 static struct platform_device bf5xx_nand_device = {
329 .name = "bf5xx-nand",
331 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
332 .resource = bf5xx_nand_resources,
334 .platform_data = &bf5xx_nand_platform,
339 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
340 static struct platform_device bf54x_sdh_device = {
346 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
347 /* all SPI peripherals info goes here */
348 #if defined(CONFIG_MTD_M25P80) \
349 || defined(CONFIG_MTD_M25P80_MODULE)
350 /* SPI flash chip (m25p16) */
351 static struct mtd_partition bfin_spi_flash_partitions[] = {
353 .name = "bootloader",
356 .mask_flags = MTD_CAP_ROM
358 .name = "linux kernel",
364 static struct flash_platform_data bfin_spi_flash_data = {
366 .parts = bfin_spi_flash_partitions,
367 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
371 static struct bfin5xx_spi_chip spi_flash_chip_info = {
372 .enable_dma = 0, /* use dma transfer with this chip*/
374 .cs_change_per_word = 0,
378 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
379 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
380 .cs_change_per_word = 1,
385 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
387 .vref_delay_usecs = 50, /* internal, no capacitor */
390 .pressure_max = 1000,
392 .stopacq_polarity = 1,
393 .first_conversion_delay = 3,
394 .acquisition_time = 1,
396 .pen_down_acc_interval = 1,
400 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
401 #if defined(CONFIG_MTD_M25P80) \
402 || defined(CONFIG_MTD_M25P80_MODULE)
404 /* the modalias must be the same as spi device driver name */
405 .modalias = "m25p80", /* Name of spi_driver for this device */
406 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
407 .bus_num = 0, /* Framework bus number */
408 .chip_select = 1, /* SPI_SSEL1*/
409 .platform_data = &bfin_spi_flash_data,
410 .controller_data = &spi_flash_chip_info,
414 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
416 .modalias = "ad7877",
417 .platform_data = &bfin_ad7877_ts_info,
419 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
422 .controller_data = &spi_ad7877_chip_info,
428 static struct resource bfin_spi0_resource[] = {
430 .start = SPI0_REGBASE,
431 .end = SPI0_REGBASE + 0xFF,
432 .flags = IORESOURCE_MEM,
437 .flags = IORESOURCE_IRQ,
442 static struct resource bfin_spi1_resource[] = {
444 .start = SPI1_REGBASE,
445 .end = SPI1_REGBASE + 0xFF,
446 .flags = IORESOURCE_MEM,
451 .flags = IORESOURCE_IRQ,
455 /* SPI controller data */
456 static struct bfin5xx_spi_master bf54x_spi_master_info = {
458 .enable_dma = 1, /* master has the ability to do dma transfer */
461 static struct platform_device bf54x_spi_master0 = {
463 .id = 0, /* Bus number */
464 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
465 .resource = bfin_spi0_resource,
467 .platform_data = &bf54x_spi_master_info, /* Passed to driver */
471 static struct platform_device bf54x_spi_master1 = {
473 .id = 1, /* Bus number */
474 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
475 .resource = bfin_spi1_resource,
477 .platform_data = &bf54x_spi_master_info, /* Passed to driver */
480 #endif /* spi master and devices */
482 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
483 static struct resource bfin_twi0_resource[] = {
485 .start = TWI0_REGBASE,
486 .end = TWI0_REGBASE + 0xFF,
487 .flags = IORESOURCE_MEM,
492 .flags = IORESOURCE_IRQ,
496 static struct platform_device i2c_bfin_twi0_device = {
497 .name = "i2c-bfin-twi",
499 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
500 .resource = bfin_twi0_resource,
503 static struct resource bfin_twi1_resource[] = {
505 .start = TWI1_REGBASE,
506 .end = TWI1_REGBASE + 0xFF,
507 .flags = IORESOURCE_MEM,
512 .flags = IORESOURCE_IRQ,
516 static struct platform_device i2c_bfin_twi1_device = {
517 .name = "i2c-bfin-twi",
519 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
520 .resource = bfin_twi1_resource,
524 static struct platform_device *ezkit_devices[] __initdata = {
525 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
529 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
533 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
537 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
541 #if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
545 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
549 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
553 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
557 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
561 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
566 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
570 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
571 &i2c_bfin_twi0_device,
572 &i2c_bfin_twi1_device,
576 static int __init stamp_init(void)
578 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
579 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
581 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
582 spi_register_board_info(bf54x_spi_board_info,
583 ARRAY_SIZE(bf54x_spi_board_info));
589 arch_initcall(stamp_init);