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/portmux.h>
46 #include <asm/mach/bf54x_keys.h>
47 #include <linux/input.h>
48 #include <linux/spi/ad7877.h>
51 * Name the Board for the /proc/cpuinfo
53 const char bfin_board_name[] = "ADSP-BF548-EZKIT";
56 * Driver needs to know address, irq and flag pin.
59 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
61 #include <asm/mach/bf54x-lq043.h>
63 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
66 .xres = {480, 480, 480},
67 .yres = {272, 272, 272},
72 static struct resource bf54x_lq043_resources[] = {
74 .start = IRQ_EPPI0_ERR,
76 .flags = IORESOURCE_IRQ,
80 static struct platform_device bf54x_lq043_device = {
81 .name = "bf54x-lq043",
83 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
84 .resource = bf54x_lq043_resources,
86 .platform_data = &bf54x_lq043_data,
91 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
92 static const unsigned int bf548_keymap[] = {
93 KEYVAL(0, 0, KEY_ENTER),
94 KEYVAL(0, 1, KEY_HELP),
96 KEYVAL(0, 3, KEY_BACKSPACE),
97 KEYVAL(1, 0, KEY_TAB),
101 KEYVAL(2, 0, KEY_DOWN),
105 KEYVAL(3, 0, KEY_UP),
111 static struct bfin_kpad_platform_data bf54x_kpad_data = {
114 .keymap = bf548_keymap,
115 .keymapsize = ARRAY_SIZE(bf548_keymap),
117 .debounce_time = 5000, /* ns (5ms) */
118 .coldrive_time = 1000, /* ns (1ms) */
119 .keyup_test_interval = 50, /* ms (50ms) */
122 static struct resource bf54x_kpad_resources[] = {
126 .flags = IORESOURCE_IRQ,
130 static struct platform_device bf54x_kpad_device = {
131 .name = "bf54x-keys",
133 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
134 .resource = bf54x_kpad_resources,
136 .platform_data = &bf54x_kpad_data,
141 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
142 static struct platform_device rtc_device = {
148 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
149 static struct resource bfin_uart_resources[] = {
150 #ifdef CONFIG_SERIAL_BFIN_UART0
154 .flags = IORESOURCE_MEM,
157 #ifdef CONFIG_SERIAL_BFIN_UART1
161 .flags = IORESOURCE_MEM,
164 #ifdef CONFIG_SERIAL_BFIN_UART2
168 .flags = IORESOURCE_MEM,
171 #ifdef CONFIG_SERIAL_BFIN_UART3
179 static struct platform_device bfin_uart_device = {
182 .num_resources = ARRAY_SIZE(bfin_uart_resources),
183 .resource = bfin_uart_resources,
187 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
188 static struct resource smsc911x_resources[] = {
190 .name = "smsc911x-memory",
192 .end = 0x24000000 + 0xFF,
193 .flags = IORESOURCE_MEM,
198 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
201 static struct platform_device smsc911x_device = {
204 .num_resources = ARRAY_SIZE(smsc911x_resources),
205 .resource = smsc911x_resources,
209 #if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
210 static struct resource bf54x_hcd_resources[] = {
214 .flags = IORESOURCE_MEM,
218 static struct platform_device bf54x_hcd = {
221 .num_resources = ARRAY_SIZE(bf54x_hcd_resources),
222 .resource = bf54x_hcd_resources,
226 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
227 static struct resource musb_resources[] = {
231 .flags = IORESOURCE_MEM,
233 [1] = { /* general IRQ */
234 .start = IRQ_USB_INT0,
236 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
238 [2] = { /* DMA IRQ */
239 .start = IRQ_USB_DMA,
241 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
245 static struct musb_hdrc_platform_data musb_plat = {
246 #ifdef CONFIG_USB_MUSB_OTG
248 #elif CONFIG_USB_MUSB_HDRC_HCD
250 #elif CONFIG_USB_GADGET_MUSB_HDRC
251 .mode = MUSB_PERIPHERAL,
256 static u64 musb_dmamask = ~(u32)0;
258 static struct platform_device musb_device = {
262 .dma_mask = &musb_dmamask,
263 .coherent_dma_mask = 0xffffffff,
264 .platform_data = &musb_plat,
266 .num_resources = ARRAY_SIZE(musb_resources),
267 .resource = musb_resources,
271 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
272 static struct resource bfin_atapi_resources[] = {
276 .flags = IORESOURCE_MEM,
279 .start = IRQ_ATAPI_ERR,
280 .end = IRQ_ATAPI_ERR,
281 .flags = IORESOURCE_IRQ,
285 static struct platform_device bfin_atapi_device = {
286 .name = "pata-bf54x",
288 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
289 .resource = bfin_atapi_resources,
293 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
294 static struct mtd_partition partition_info[] = {
296 .name = "Linux Kernel",
301 .name = "File System",
302 .offset = 4 * SIZE_1M,
303 .size = (256 - 4) * SIZE_1M,
307 static struct bf5xx_nand_platform bf5xx_nand_platform = {
308 .page_size = NFC_PG_SIZE_256,
309 .data_width = NFC_NWIDTH_8,
310 .partitions = partition_info,
311 .nr_partitions = ARRAY_SIZE(partition_info),
316 static struct resource bf5xx_nand_resources[] = {
320 .flags = IORESOURCE_MEM,
325 .flags = IORESOURCE_IRQ,
329 static struct platform_device bf5xx_nand_device = {
330 .name = "bf5xx-nand",
332 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
333 .resource = bf5xx_nand_resources,
335 .platform_data = &bf5xx_nand_platform,
340 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
341 static struct platform_device bf54x_sdh_device = {
347 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
348 /* all SPI peripherals info goes here */
349 #if defined(CONFIG_MTD_M25P80) \
350 || defined(CONFIG_MTD_M25P80_MODULE)
351 /* SPI flash chip (m25p16) */
352 static struct mtd_partition bfin_spi_flash_partitions[] = {
354 .name = "bootloader",
357 .mask_flags = MTD_CAP_ROM
359 .name = "linux kernel",
365 static struct flash_platform_data bfin_spi_flash_data = {
367 .parts = bfin_spi_flash_partitions,
368 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
372 static struct bfin5xx_spi_chip spi_flash_chip_info = {
373 .enable_dma = 0, /* use dma transfer with this chip*/
375 .cs_change_per_word = 0,
379 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
380 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
381 .cs_change_per_word = 0,
386 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
388 .vref_delay_usecs = 50, /* internal, no capacitor */
391 .pressure_max = 1000,
393 .stopacq_polarity = 1,
394 .first_conversion_delay = 3,
395 .acquisition_time = 1,
397 .pen_down_acc_interval = 1,
401 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
402 #if defined(CONFIG_MTD_M25P80) \
403 || defined(CONFIG_MTD_M25P80_MODULE)
405 /* the modalias must be the same as spi device driver name */
406 .modalias = "m25p80", /* Name of spi_driver for this device */
407 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
408 .bus_num = 0, /* Framework bus number */
409 .chip_select = 1, /* SPI_SSEL1*/
410 .platform_data = &bfin_spi_flash_data,
411 .controller_data = &spi_flash_chip_info,
415 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
417 .modalias = "ad7877",
418 .platform_data = &bfin_ad7877_ts_info,
420 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
423 .controller_data = &spi_ad7877_chip_info,
429 static struct resource bfin_spi0_resource[] = {
431 .start = SPI0_REGBASE,
432 .end = SPI0_REGBASE + 0xFF,
433 .flags = IORESOURCE_MEM,
438 .flags = IORESOURCE_IRQ,
443 static struct resource bfin_spi1_resource[] = {
445 .start = SPI1_REGBASE,
446 .end = SPI1_REGBASE + 0xFF,
447 .flags = IORESOURCE_MEM,
452 .flags = IORESOURCE_IRQ,
456 /* SPI controller data */
457 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
459 .enable_dma = 1, /* master has the ability to do dma transfer */
460 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
463 static struct platform_device bf54x_spi_master0 = {
465 .id = 0, /* Bus number */
466 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
467 .resource = bfin_spi0_resource,
469 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
473 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
475 .enable_dma = 1, /* master has the ability to do dma transfer */
476 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
479 static struct platform_device bf54x_spi_master1 = {
481 .id = 1, /* Bus number */
482 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
483 .resource = bfin_spi1_resource,
485 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
488 #endif /* spi master and devices */
490 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
491 static struct resource bfin_twi0_resource[] = {
493 .start = TWI0_REGBASE,
494 .end = TWI0_REGBASE + 0xFF,
495 .flags = IORESOURCE_MEM,
500 .flags = IORESOURCE_IRQ,
504 static struct platform_device i2c_bfin_twi0_device = {
505 .name = "i2c-bfin-twi",
507 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
508 .resource = bfin_twi0_resource,
511 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
512 static struct resource bfin_twi1_resource[] = {
514 .start = TWI1_REGBASE,
515 .end = TWI1_REGBASE + 0xFF,
516 .flags = IORESOURCE_MEM,
521 .flags = IORESOURCE_IRQ,
525 static struct platform_device i2c_bfin_twi1_device = {
526 .name = "i2c-bfin-twi",
528 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
529 .resource = bfin_twi1_resource,
534 static struct platform_device *ezkit_devices[] __initdata = {
535 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
539 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
543 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
547 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
551 #if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
555 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
559 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
563 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
567 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
571 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
576 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
580 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
581 &i2c_bfin_twi0_device,
582 #if !defined(CONFIG_BF542)
583 &i2c_bfin_twi1_device,
588 static int __init stamp_init(void)
590 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
591 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
593 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
594 spi_register_board_info(bf54x_spi_board_info,
595 ARRAY_SIZE(bf54x_spi_board_info));
601 arch_initcall(stamp_init);