2 * File: arch/blackfin/mach-bf533/stamp.c
3 * Based on: arch/blackfin/mach-bf533/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
7 * Description: Board Info File for the BF533-STAMP
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 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/spi/mmc_spi.h>
39 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40 #include <linux/usb/isp1362.h>
42 #include <linux/irq.h>
43 #include <linux/i2c.h>
45 #include <asm/bfin5xx_spi.h>
46 #include <asm/reboot.h>
47 #include <asm/portmux.h>
51 * Name the Board for the /proc/cpuinfo
53 const char bfin_board_name[] = "ADI BF533-STAMP";
55 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
56 static struct platform_device rtc_device = {
63 * Driver needs to know address, irq and flag pin.
65 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
66 #include <linux/smc91x.h>
68 static struct smc91x_platdata smc91x_info = {
69 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
70 .leda = RPC_LED_100_10,
71 .ledb = RPC_LED_TX_RX,
74 static struct resource smc91x_resources[] = {
76 .name = "smc91x-regs",
78 .end = 0x20300300 + 16,
79 .flags = IORESOURCE_MEM,
83 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
87 static struct platform_device smc91x_device = {
90 .num_resources = ARRAY_SIZE(smc91x_resources),
91 .resource = smc91x_resources,
93 .platform_data = &smc91x_info,
98 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
99 static struct platform_device bfin_fb_adv7393_device = {
100 .name = "bfin-adv7393",
104 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
105 static struct resource net2272_bfin_resources[] = {
108 .end = 0x20300000 + 0x100,
109 .flags = IORESOURCE_MEM,
113 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
117 static struct platform_device net2272_bfin_device = {
120 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
121 .resource = net2272_bfin_resources,
125 #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
126 static struct mtd_partition stamp_partitions[] = {
128 .name = "bootloader(nor)",
132 .name = "linux kernel(nor)",
134 .offset = MTDPART_OFS_APPEND,
136 .name = "file system(nor)",
137 .size = MTDPART_SIZ_FULL,
138 .offset = MTDPART_OFS_APPEND,
142 static struct physmap_flash_data stamp_flash_data = {
144 .parts = stamp_partitions,
145 .nr_parts = ARRAY_SIZE(stamp_partitions),
148 static struct resource stamp_flash_resource[] = {
153 .flags = IORESOURCE_MEM,
155 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
156 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
157 .flags = IORESOURCE_MEM,
160 .flags = IORESOURCE_IRQ,
164 static struct platform_device stamp_flash_device = {
165 .name = "bfin-async-flash",
168 .platform_data = &stamp_flash_data,
170 .num_resources = ARRAY_SIZE(stamp_flash_resource),
171 .resource = stamp_flash_resource,
175 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
176 static struct mtd_partition bfin_spi_flash_partitions[] = {
178 .name = "bootloader(spi)",
181 .mask_flags = MTD_CAP_ROM
183 .name = "linux kernel(spi)",
185 .offset = MTDPART_OFS_APPEND,
187 .name = "file system(spi)",
188 .size = MTDPART_SIZ_FULL,
189 .offset = MTDPART_OFS_APPEND,
193 static struct flash_platform_data bfin_spi_flash_data = {
195 .parts = bfin_spi_flash_partitions,
196 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
200 /* SPI flash chip (m25p64) */
201 static struct bfin5xx_spi_chip spi_flash_chip_info = {
202 .enable_dma = 0, /* use dma transfer with this chip*/
207 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
209 static struct bfin5xx_spi_chip spi_adc_chip_info = {
210 .enable_dma = 1, /* use dma transfer with this chip*/
215 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
216 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
222 #if defined(CONFIG_PBX)
223 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
224 .ctl_reg = 0x4, /* send zero */
227 .cs_change_per_word = 1,
231 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
232 static struct bfin5xx_spi_chip spidev_chip_info = {
238 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
239 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
240 static int bfin_mmc_spi_init(struct device *dev,
241 irqreturn_t (*detect_int)(int, void *), void *data)
243 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
244 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
245 "mmc-spi-detect", data);
248 static void bfin_mmc_spi_exit(struct device *dev, void *data)
250 free_irq(MMC_SPI_CARD_DETECT_INT, data);
253 static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
254 .init = bfin_mmc_spi_init,
255 .exit = bfin_mmc_spi_exit,
256 .detect_delay = 100, /* msecs */
259 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
266 static struct spi_board_info bfin_spi_board_info[] __initdata = {
267 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
269 /* the modalias must be the same as spi device driver name */
270 .modalias = "m25p80", /* Name of spi_driver for this device */
271 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
272 .bus_num = 0, /* Framework bus number */
273 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
274 .platform_data = &bfin_spi_flash_data,
275 .controller_data = &spi_flash_chip_info,
280 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
282 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
283 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
284 .bus_num = 0, /* Framework bus number */
285 .chip_select = 1, /* Framework chip select. */
286 .platform_data = NULL, /* No spi_driver specific config */
287 .controller_data = &spi_adc_chip_info,
291 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
293 .modalias = "ad1836-spi",
294 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
296 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
297 .controller_data = &ad1836_spi_chip_info,
301 #if defined(CONFIG_PBX)
303 .modalias = "fxs-spi",
304 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
306 .chip_select = 8 - CONFIG_J11_JUMPER,
307 .controller_data = &spi_si3xxx_chip_info,
311 .modalias = "fxo-spi",
312 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
314 .chip_select = 8 - CONFIG_J19_JUMPER,
315 .controller_data = &spi_si3xxx_chip_info,
320 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
322 .modalias = "spidev",
323 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
326 .controller_data = &spidev_chip_info,
329 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
331 .modalias = "mmc_spi",
332 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
335 .platform_data = &bfin_mmc_spi_pdata,
336 .controller_data = &mmc_spi_chip_info,
342 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
344 static struct resource bfin_spi0_resource[] = {
346 .start = SPI0_REGBASE,
347 .end = SPI0_REGBASE + 0xFF,
348 .flags = IORESOURCE_MEM,
353 .flags = IORESOURCE_DMA,
358 .flags = IORESOURCE_IRQ,
362 /* SPI controller data */
363 static struct bfin5xx_spi_master bfin_spi0_info = {
365 .enable_dma = 1, /* master has the ability to do dma transfer */
366 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
369 static struct platform_device bfin_spi0_device = {
371 .id = 0, /* Bus number */
372 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
373 .resource = bfin_spi0_resource,
375 .platform_data = &bfin_spi0_info, /* Passed to driver */
378 #endif /* spi master and devices */
380 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
381 static struct platform_device bfin_fb_device = {
386 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
387 static struct resource bfin_uart_resources[] = {
391 .flags = IORESOURCE_MEM,
395 static struct platform_device bfin_uart_device = {
398 .num_resources = ARRAY_SIZE(bfin_uart_resources),
399 .resource = bfin_uart_resources,
403 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
404 #ifdef CONFIG_BFIN_SIR0
405 static struct resource bfin_sir0_resources[] = {
409 .flags = IORESOURCE_MEM,
412 .start = IRQ_UART0_RX,
413 .end = IRQ_UART0_RX+1,
414 .flags = IORESOURCE_IRQ,
417 .start = CH_UART0_RX,
418 .end = CH_UART0_RX+1,
419 .flags = IORESOURCE_DMA,
423 static struct platform_device bfin_sir0_device = {
426 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
427 .resource = bfin_sir0_resources,
432 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
433 static struct platform_device bfin_sport0_uart_device = {
434 .name = "bfin-sport-uart",
438 static struct platform_device bfin_sport1_uart_device = {
439 .name = "bfin-sport-uart",
444 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
445 #include <linux/input.h>
446 #include <linux/gpio_keys.h>
448 static struct gpio_keys_button bfin_gpio_keys_table[] = {
449 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
450 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
451 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
454 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
455 .buttons = bfin_gpio_keys_table,
456 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
459 static struct platform_device bfin_device_gpiokeys = {
462 .platform_data = &bfin_gpio_keys_data,
467 static struct resource bfin_gpios_resources = {
469 .end = MAX_BLACKFIN_GPIOS - 1,
470 .flags = IORESOURCE_IRQ,
473 static struct platform_device bfin_gpios_device = {
474 .name = "simple-gpio",
477 .resource = &bfin_gpios_resources,
480 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
481 #include <linux/i2c-gpio.h>
483 static struct i2c_gpio_platform_data i2c_gpio_data = {
486 .sda_is_open_drain = 0,
487 .scl_is_open_drain = 0,
491 static struct platform_device i2c_gpio_device = {
495 .platform_data = &i2c_gpio_data,
500 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
501 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
503 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
507 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
509 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
512 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
514 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
520 static const unsigned int cclk_vlev_datasheet[] =
522 VRPAIR(VLEV_085, 250000000),
523 VRPAIR(VLEV_090, 376000000),
524 VRPAIR(VLEV_095, 426000000),
525 VRPAIR(VLEV_100, 426000000),
526 VRPAIR(VLEV_105, 476000000),
527 VRPAIR(VLEV_110, 476000000),
528 VRPAIR(VLEV_115, 476000000),
529 VRPAIR(VLEV_120, 600000000),
530 VRPAIR(VLEV_125, 600000000),
531 VRPAIR(VLEV_130, 600000000),
534 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
535 .tuple_tab = cclk_vlev_datasheet,
536 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
537 .vr_settling_time = 25 /* us */,
540 static struct platform_device bfin_dpmc = {
543 .platform_data = &bfin_dmpc_vreg_data,
547 static struct platform_device *stamp_devices[] __initdata = {
551 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
555 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
559 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
560 &bfin_fb_adv7393_device,
563 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
564 &net2272_bfin_device,
567 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
571 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
575 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
576 #ifdef CONFIG_BFIN_SIR0
581 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
582 &bfin_sport0_uart_device,
583 &bfin_sport1_uart_device,
586 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
587 &bfin_device_gpiokeys,
590 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
596 #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
601 static int __init stamp_init(void)
605 printk(KERN_INFO "%s(): registering device resources\n", __func__);
607 i2c_register_board_info(0, bfin_i2c_board_info,
608 ARRAY_SIZE(bfin_i2c_board_info));
610 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
614 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
615 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
616 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
617 bfin_write_FIO_FLAG_S(PF0);
621 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
625 arch_initcall(stamp_init);
627 void native_machine_restart(char *cmd)
629 /* workaround pull up on cpld / flash pin not being strong enough */
630 bfin_write_FIO_INEN(~PF0);
631 bfin_write_FIO_DIR(PF0);
632 bfin_write_FIO_FLAG_C(PF0);