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/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>
44 #include <asm/portmux.h>
45 #include <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[] = "Bluetechnix CM-BF548";
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 <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 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_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
188 static struct resource bfin_sir_resources[] = {
189 #ifdef CONFIG_BFIN_SIR0
193 .flags = IORESOURCE_MEM,
196 #ifdef CONFIG_BFIN_SIR1
200 .flags = IORESOURCE_MEM,
203 #ifdef CONFIG_BFIN_SIR2
207 .flags = IORESOURCE_MEM,
210 #ifdef CONFIG_BFIN_SIR3
214 .flags = IORESOURCE_MEM,
219 static struct platform_device bfin_sir_device = {
222 .num_resources = ARRAY_SIZE(bfin_sir_resources),
223 .resource = bfin_sir_resources,
227 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
228 static struct resource smsc911x_resources[] = {
230 .name = "smsc911x-memory",
232 .end = 0x24000000 + 0xFF,
233 .flags = IORESOURCE_MEM,
238 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
241 static struct platform_device smsc911x_device = {
244 .num_resources = ARRAY_SIZE(smsc911x_resources),
245 .resource = smsc911x_resources,
249 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
250 static struct resource musb_resources[] = {
254 .flags = IORESOURCE_MEM,
256 [1] = { /* general IRQ */
257 .start = IRQ_USB_INT0,
259 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
261 [2] = { /* DMA IRQ */
262 .start = IRQ_USB_DMA,
264 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
268 static struct musb_hdrc_config musb_config = {
275 .gpio_vrsel = GPIO_PH6,
278 static struct musb_hdrc_platform_data musb_plat = {
279 #if defined(CONFIG_USB_MUSB_OTG)
281 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
283 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
284 .mode = MUSB_PERIPHERAL,
286 .config = &musb_config,
289 static u64 musb_dmamask = ~(u32)0;
291 static struct platform_device musb_device = {
295 .dma_mask = &musb_dmamask,
296 .coherent_dma_mask = 0xffffffff,
297 .platform_data = &musb_plat,
299 .num_resources = ARRAY_SIZE(musb_resources),
300 .resource = musb_resources,
304 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
305 static struct resource bfin_atapi_resources[] = {
309 .flags = IORESOURCE_MEM,
312 .start = IRQ_ATAPI_ERR,
313 .end = IRQ_ATAPI_ERR,
314 .flags = IORESOURCE_IRQ,
318 static struct platform_device bfin_atapi_device = {
319 .name = "pata-bf54x",
321 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
322 .resource = bfin_atapi_resources,
326 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
327 static struct mtd_partition partition_info[] = {
329 .name = "linux kernel(nand)",
331 .size = 4 * 1024 * 1024,
334 .name = "file system(nand)",
335 .offset = 4 * 1024 * 1024,
336 .size = (256 - 4) * 1024 * 1024,
340 static struct bf5xx_nand_platform bf5xx_nand_platform = {
341 .page_size = NFC_PG_SIZE_256,
342 .data_width = NFC_NWIDTH_8,
343 .partitions = partition_info,
344 .nr_partitions = ARRAY_SIZE(partition_info),
349 static struct resource bf5xx_nand_resources[] = {
353 .flags = IORESOURCE_MEM,
358 .flags = IORESOURCE_IRQ,
362 static struct platform_device bf5xx_nand_device = {
363 .name = "bf5xx-nand",
365 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
366 .resource = bf5xx_nand_resources,
368 .platform_data = &bf5xx_nand_platform,
373 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
374 static struct platform_device bf54x_sdh_device = {
380 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
381 /* all SPI peripherals info goes here */
382 #if defined(CONFIG_MTD_M25P80) \
383 || defined(CONFIG_MTD_M25P80_MODULE)
384 /* SPI flash chip (m25p16) */
385 static struct mtd_partition bfin_spi_flash_partitions[] = {
387 .name = "bootloader(spi)",
390 .mask_flags = MTD_CAP_ROM
392 .name = "linux kernel(spi)",
398 static struct flash_platform_data bfin_spi_flash_data = {
400 .parts = bfin_spi_flash_partitions,
401 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
405 static struct bfin5xx_spi_chip spi_flash_chip_info = {
406 .enable_dma = 0, /* use dma transfer with this chip*/
408 .cs_change_per_word = 0,
412 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
413 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
414 .cs_change_per_word = 0,
419 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
421 .vref_delay_usecs = 50, /* internal, no capacitor */
424 .pressure_max = 1000,
426 .stopacq_polarity = 1,
427 .first_conversion_delay = 3,
428 .acquisition_time = 1,
430 .pen_down_acc_interval = 1,
434 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
435 static struct bfin5xx_spi_chip spidev_chip_info = {
441 static struct spi_board_info bf54x_spi_board_info[] __initdata = {
442 #if defined(CONFIG_MTD_M25P80) \
443 || defined(CONFIG_MTD_M25P80_MODULE)
445 /* the modalias must be the same as spi device driver name */
446 .modalias = "m25p80", /* Name of spi_driver for this device */
447 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
448 .bus_num = 0, /* Framework bus number */
449 .chip_select = 1, /* SPI_SSEL1*/
450 .platform_data = &bfin_spi_flash_data,
451 .controller_data = &spi_flash_chip_info,
455 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
457 .modalias = "ad7877",
458 .platform_data = &bfin_ad7877_ts_info,
460 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
463 .controller_data = &spi_ad7877_chip_info,
466 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
468 .modalias = "spidev",
469 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
472 .controller_data = &spidev_chip_info,
478 static struct resource bfin_spi0_resource[] = {
480 .start = SPI0_REGBASE,
481 .end = SPI0_REGBASE + 0xFF,
482 .flags = IORESOURCE_MEM,
487 .flags = IORESOURCE_IRQ,
492 static struct resource bfin_spi1_resource[] = {
494 .start = SPI1_REGBASE,
495 .end = SPI1_REGBASE + 0xFF,
496 .flags = IORESOURCE_MEM,
501 .flags = IORESOURCE_IRQ,
505 /* SPI controller data */
506 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
508 .enable_dma = 1, /* master has the ability to do dma transfer */
509 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
512 static struct platform_device bf54x_spi_master0 = {
514 .id = 0, /* Bus number */
515 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
516 .resource = bfin_spi0_resource,
518 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
522 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
524 .enable_dma = 1, /* master has the ability to do dma transfer */
525 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
528 static struct platform_device bf54x_spi_master1 = {
530 .id = 1, /* Bus number */
531 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
532 .resource = bfin_spi1_resource,
534 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
537 #endif /* spi master and devices */
539 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
540 static struct resource bfin_twi0_resource[] = {
542 .start = TWI0_REGBASE,
543 .end = TWI0_REGBASE + 0xFF,
544 .flags = IORESOURCE_MEM,
549 .flags = IORESOURCE_IRQ,
553 static struct platform_device i2c_bfin_twi0_device = {
554 .name = "i2c-bfin-twi",
556 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
557 .resource = bfin_twi0_resource,
560 #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
561 static struct resource bfin_twi1_resource[] = {
563 .start = TWI1_REGBASE,
564 .end = TWI1_REGBASE + 0xFF,
565 .flags = IORESOURCE_MEM,
570 .flags = IORESOURCE_IRQ,
574 static struct platform_device i2c_bfin_twi1_device = {
575 .name = "i2c-bfin-twi",
577 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
578 .resource = bfin_twi1_resource,
583 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
584 #include <linux/gpio_keys.h>
586 static struct gpio_keys_button bfin_gpio_keys_table[] = {
587 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
590 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
591 .buttons = bfin_gpio_keys_table,
592 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
595 static struct platform_device bfin_device_gpiokeys = {
598 .platform_data = &bfin_gpio_keys_data,
603 static const unsigned int cclk_vlev_datasheet[] =
606 * Internal VLEV BF54XSBBC1533
607 ****temporarily using these values until data sheet is updated
609 VRPAIR(VLEV_085, 150000000),
610 VRPAIR(VLEV_090, 250000000),
611 VRPAIR(VLEV_110, 276000000),
612 VRPAIR(VLEV_115, 301000000),
613 VRPAIR(VLEV_120, 525000000),
614 VRPAIR(VLEV_125, 550000000),
615 VRPAIR(VLEV_130, 600000000),
618 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
619 .tuple_tab = cclk_vlev_datasheet,
620 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
621 .vr_settling_time = 25 /* us */,
624 static struct platform_device bfin_dpmc = {
627 .platform_data = &bfin_dmpc_vreg_data,
631 static struct platform_device *cm_bf548_devices[] __initdata = {
635 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
639 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
643 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
647 #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
651 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
655 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
659 #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
663 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
667 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
671 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
676 #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
680 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
681 /* &i2c_bfin_twi0_device, */
682 #if !defined(CONFIG_BF542)
683 &i2c_bfin_twi1_device,
687 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
688 &bfin_device_gpiokeys,
692 static int __init cm_bf548_init(void)
694 printk(KERN_INFO "%s(): registering device resources\n", __func__);
695 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
697 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
698 spi_register_board_info(bf54x_spi_board_info,
699 ARRAY_SIZE(bf54x_spi_board_info));
705 arch_initcall(cm_bf548_init);