2 * File: arch/blackfin/mach-bf548/boards/cm_bf548.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-2008 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>
45 #include <asm/portmux.h>
46 #include <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[] = "Bluetechnix CM-BF548";
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 <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 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
176 .flags = IORESOURCE_MEM,
181 static struct platform_device bfin_uart_device = {
184 .num_resources = ARRAY_SIZE(bfin_uart_resources),
185 .resource = bfin_uart_resources,
189 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
190 static struct resource bfin_sir_resources[] = {
191 #ifdef CONFIG_BFIN_SIR0
195 .flags = IORESOURCE_MEM,
198 #ifdef CONFIG_BFIN_SIR1
202 .flags = IORESOURCE_MEM,
205 #ifdef CONFIG_BFIN_SIR2
209 .flags = IORESOURCE_MEM,
212 #ifdef CONFIG_BFIN_SIR3
216 .flags = IORESOURCE_MEM,
221 static struct platform_device bfin_sir_device = {
224 .num_resources = ARRAY_SIZE(bfin_sir_resources),
225 .resource = bfin_sir_resources,
229 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
230 static struct resource smsc911x_resources[] = {
232 .name = "smsc911x-memory",
234 .end = 0x24000000 + 0xFF,
235 .flags = IORESOURCE_MEM,
240 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
243 static struct platform_device smsc911x_device = {
246 .num_resources = ARRAY_SIZE(smsc911x_resources),
247 .resource = smsc911x_resources,
251 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
252 static struct resource musb_resources[] = {
256 .flags = IORESOURCE_MEM,
258 [1] = { /* general IRQ */
259 .start = IRQ_USB_INT0,
261 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
263 [2] = { /* DMA IRQ */
264 .start = IRQ_USB_DMA,
266 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
270 static struct musb_hdrc_config musb_config = {
277 .gpio_vrsel = GPIO_PH6,
280 static struct musb_hdrc_platform_data musb_plat = {
281 #if defined(CONFIG_USB_MUSB_OTG)
283 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
285 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
286 .mode = MUSB_PERIPHERAL,
288 .config = &musb_config,
291 static u64 musb_dmamask = ~(u32)0;
293 static struct platform_device musb_device = {
297 .dma_mask = &musb_dmamask,
298 .coherent_dma_mask = 0xffffffff,
299 .platform_data = &musb_plat,
301 .num_resources = ARRAY_SIZE(musb_resources),
302 .resource = musb_resources,
306 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
307 static struct resource bfin_atapi_resources[] = {
311 .flags = IORESOURCE_MEM,
314 .start = IRQ_ATAPI_ERR,
315 .end = IRQ_ATAPI_ERR,
316 .flags = IORESOURCE_IRQ,
320 static struct platform_device bfin_atapi_device = {
321 .name = "pata-bf54x",
323 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
324 .resource = bfin_atapi_resources,
328 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
329 static struct mtd_partition partition_info[] = {
331 .name = "linux kernel(nand)",
333 .size = 4 * 1024 * 1024,
336 .name = "file system(nand)",
337 .offset = 4 * 1024 * 1024,
338 .size = (256 - 4) * 1024 * 1024,
342 static struct bf5xx_nand_platform bf5xx_nand_platform = {
343 .page_size = NFC_PG_SIZE_256,
344 .data_width = NFC_NWIDTH_8,
345 .partitions = partition_info,
346 .nr_partitions = ARRAY_SIZE(partition_info),
351 static struct resource bf5xx_nand_resources[] = {
355 .flags = IORESOURCE_MEM,
360 .flags = IORESOURCE_IRQ,
364 static struct platform_device bf5xx_nand_device = {
365 .name = "bf5xx-nand",
367 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
368 .resource = bf5xx_nand_resources,
370 .platform_data = &bf5xx_nand_platform,
375 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
376 static struct platform_device bf54x_sdh_device = {
382 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
383 static struct mtd_partition para_partitions[] = {
385 .name = "bootloader(nor)",
389 .name = "linux kernel(nor)",
391 .offset = MTDPART_OFS_APPEND,
393 .name = "file system(nor)",
394 .size = MTDPART_SIZ_FULL,
395 .offset = MTDPART_OFS_APPEND,
399 static struct physmap_flash_data para_flash_data = {
401 .parts = para_partitions,
402 .nr_parts = ARRAY_SIZE(para_partitions),
405 static struct resource para_flash_resource = {
408 .flags = IORESOURCE_MEM,
411 static struct platform_device para_flash_device = {
412 .name = "physmap-flash",
415 .platform_data = ¶_flash_data,
418 .resource = ¶_flash_resource,
422 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
423 /* all SPI peripherals info goes here */
424 #if defined(CONFIG_MTD_M25P80) \
425 || defined(CONFIG_MTD_M25P80_MODULE)
426 /* SPI flash chip (m25p16) */
427 static struct mtd_partition bfin_spi_flash_partitions[] = {
429 .name = "bootloader(spi)",
432 .mask_flags = MTD_CAP_ROM
434 .name = "linux kernel(spi)",
440 static struct flash_platform_data bfin_spi_flash_data = {
442 .parts = bfin_spi_flash_partitions,
443 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
447 static struct bfin5xx_spi_chip spi_flash_chip_info = {
448 .enable_dma = 0, /* use dma transfer with this chip*/
450 .cs_change_per_word = 0,
454 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
455 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
456 .cs_change_per_word = 0,
461 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
463 .vref_delay_usecs = 50, /* internal, no capacitor */
466 .pressure_max = 1000,
468 .stopacq_polarity = 1,
469 .first_conversion_delay = 3,
470 .acquisition_time = 1,
472 .pen_down_acc_interval = 1,
476 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
477 static struct bfin5xx_spi_chip spidev_chip_info = {
483 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
484 #if defined(CONFIG_MTD_M25P80) \
485 || defined(CONFIG_MTD_M25P80_MODULE)
487 /* the modalias must be the same as spi device driver name */
488 .modalias = "m25p80", /* Name of spi_driver for this device */
489 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
490 .bus_num = 0, /* Framework bus number */
491 .chip_select = 1, /* SPI_SSEL1*/
492 .platform_data = &bfin_spi_flash_data,
493 .controller_data = &spi_flash_chip_info,
497 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
499 .modalias = "ad7877",
500 .platform_data = &bfin_ad7877_ts_info,
502 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .controller_data = &spi_ad7877_chip_info,
508 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
510 .modalias = "spidev",
511 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
514 .controller_data = &spidev_chip_info,
520 static struct resource bfin_spi0_resource[] = {
522 .start = SPI0_REGBASE,
523 .end = SPI0_REGBASE + 0xFF,
524 .flags = IORESOURCE_MEM,
529 .flags = IORESOURCE_IRQ,
534 static struct resource bfin_spi1_resource[] = {
536 .start = SPI1_REGBASE,
537 .end = SPI1_REGBASE + 0xFF,
538 .flags = IORESOURCE_MEM,
543 .flags = IORESOURCE_IRQ,
547 /* SPI controller data */
548 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
550 .enable_dma = 1, /* master has the ability to do dma transfer */
551 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
554 static struct platform_device bf54x_spi_master0 = {
556 .id = 0, /* Bus number */
557 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
558 .resource = bfin_spi0_resource,
560 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
564 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
566 .enable_dma = 1, /* master has the ability to do dma transfer */
567 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
570 static struct platform_device bf54x_spi_master1 = {
572 .id = 1, /* Bus number */
573 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
574 .resource = bfin_spi1_resource,
576 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
579 #endif /* spi master and devices */
581 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
582 static struct resource bfin_twi0_resource[] = {
584 .start = TWI0_REGBASE,
585 .end = TWI0_REGBASE + 0xFF,
586 .flags = IORESOURCE_MEM,
591 .flags = IORESOURCE_IRQ,
595 static struct platform_device i2c_bfin_twi0_device = {
596 .name = "i2c-bfin-twi",
598 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
599 .resource = bfin_twi0_resource,
602 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
603 static struct resource bfin_twi1_resource[] = {
605 .start = TWI1_REGBASE,
606 .end = TWI1_REGBASE + 0xFF,
607 .flags = IORESOURCE_MEM,
612 .flags = IORESOURCE_IRQ,
616 static struct platform_device i2c_bfin_twi1_device = {
617 .name = "i2c-bfin-twi",
619 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
620 .resource = bfin_twi1_resource,
625 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
626 #include <linux/gpio_keys.h>
628 static struct gpio_keys_button bfin_gpio_keys_table[] = {
629 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
632 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
633 .buttons = bfin_gpio_keys_table,
634 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
637 static struct platform_device bfin_device_gpiokeys = {
640 .platform_data = &bfin_gpio_keys_data,
645 static const unsigned int cclk_vlev_datasheet[] =
648 * Internal VLEV BF54XSBBC1533
649 ****temporarily using these values until data sheet is updated
651 VRPAIR(VLEV_085, 150000000),
652 VRPAIR(VLEV_090, 250000000),
653 VRPAIR(VLEV_110, 276000000),
654 VRPAIR(VLEV_115, 301000000),
655 VRPAIR(VLEV_120, 525000000),
656 VRPAIR(VLEV_125, 550000000),
657 VRPAIR(VLEV_130, 600000000),
660 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
661 .tuple_tab = cclk_vlev_datasheet,
662 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
663 .vr_settling_time = 25 /* us */,
666 static struct platform_device bfin_dpmc = {
669 .platform_data = &bfin_dmpc_vreg_data,
673 static struct platform_device *cm_bf548_devices[] __initdata = {
677 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
681 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
685 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
689 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
693 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
697 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
701 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
705 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
709 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
713 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
718 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
722 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
723 &i2c_bfin_twi0_device,
724 #if !defined(CONFIG_BF542)
725 &i2c_bfin_twi1_device,
729 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
730 &bfin_device_gpiokeys,
733 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
738 static int __init cm_bf548_init(void)
740 printk(KERN_INFO "%s(): registering device resources\n", __func__);
741 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
743 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
744 spi_register_board_info(bf54x_spi_board_info,
745 ARRAY_SIZE(bf54x_spi_board_info));
751 arch_initcall(cm_bf548_init);