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 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39 #include <linux/usb/isp1362.h>
41 #include <linux/ata_platform.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>
50 * Name the Board for the /proc/cpuinfo
52 const char bfin_board_name[] = "ADDS-BF533-STAMP";
54 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
55 static struct platform_device rtc_device = {
62 * Driver needs to know address, irq and flag pin.
64 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
65 static struct resource smc91x_resources[] = {
67 .name = "smc91x-regs",
69 .end = 0x20300300 + 16,
70 .flags = IORESOURCE_MEM,
74 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
78 static struct platform_device smc91x_device = {
81 .num_resources = ARRAY_SIZE(smc91x_resources),
82 .resource = smc91x_resources,
86 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
87 static struct platform_device bfin_fb_adv7393_device = {
88 .name = "bfin-adv7393",
92 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
93 static struct resource net2272_bfin_resources[] = {
96 .end = 0x20300000 + 0x100,
97 .flags = IORESOURCE_MEM,
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
105 static struct platform_device net2272_bfin_device = {
108 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
109 .resource = net2272_bfin_resources,
113 #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
114 static struct mtd_partition stamp_partitions[] = {
116 .name = "Bootloader",
122 .offset = MTDPART_OFS_APPEND,
125 .size = MTDPART_SIZ_FULL,
126 .offset = MTDPART_OFS_APPEND,
130 static struct physmap_flash_data stamp_flash_data = {
132 .parts = stamp_partitions,
133 .nr_parts = ARRAY_SIZE(stamp_partitions),
136 static struct resource stamp_flash_resource[] = {
141 .flags = IORESOURCE_MEM,
143 .start = CONFIG_ENET_FLASH_PIN,
144 .flags = IORESOURCE_IRQ,
148 static struct platform_device stamp_flash_device = {
149 .name = "BF5xx-Flash",
152 .platform_data = &stamp_flash_data,
154 .num_resources = ARRAY_SIZE(stamp_flash_resource),
155 .resource = stamp_flash_resource,
159 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
160 /* all SPI peripherals info goes here */
162 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
163 static struct mtd_partition bfin_spi_flash_partitions[] = {
165 .name = "bootloader",
168 .mask_flags = MTD_CAP_ROM
172 .offset = MTDPART_OFS_APPEND,
174 .name = "file system",
175 .size = MTDPART_SIZ_FULL,
176 .offset = MTDPART_OFS_APPEND,
180 static struct flash_platform_data bfin_spi_flash_data = {
182 .parts = bfin_spi_flash_partitions,
183 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
187 /* SPI flash chip (m25p64) */
188 static struct bfin5xx_spi_chip spi_flash_chip_info = {
189 .enable_dma = 0, /* use dma transfer with this chip*/
194 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
196 static struct bfin5xx_spi_chip spi_adc_chip_info = {
197 .enable_dma = 1, /* use dma transfer with this chip*/
202 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
203 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
209 #if defined(CONFIG_PBX)
210 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
211 .ctl_reg = 0x4, /* send zero */
214 .cs_change_per_word = 1,
218 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
219 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
225 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
226 static struct bfin5xx_spi_chip spidev_chip_info = {
232 static struct spi_board_info bfin_spi_board_info[] __initdata = {
233 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
235 /* the modalias must be the same as spi device driver name */
236 .modalias = "m25p80", /* Name of spi_driver for this device */
237 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
238 .bus_num = 0, /* Framework bus number */
239 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
240 .platform_data = &bfin_spi_flash_data,
241 .controller_data = &spi_flash_chip_info,
246 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
248 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
249 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
250 .bus_num = 0, /* Framework bus number */
251 .chip_select = 1, /* Framework chip select. */
252 .platform_data = NULL, /* No spi_driver specific config */
253 .controller_data = &spi_adc_chip_info,
257 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
259 .modalias = "ad1836-spi",
260 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
262 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
263 .controller_data = &ad1836_spi_chip_info,
267 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
269 .modalias = "spi_mmc_dummy",
270 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
273 .platform_data = NULL,
274 .controller_data = &spi_mmc_chip_info,
278 .modalias = "spi_mmc",
279 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
281 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
282 .platform_data = NULL,
283 .controller_data = &spi_mmc_chip_info,
288 #if defined(CONFIG_PBX)
290 .modalias = "fxs-spi",
291 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
293 .chip_select = 8 - CONFIG_J11_JUMPER,
294 .controller_data = &spi_si3xxx_chip_info,
298 .modalias = "fxo-spi",
299 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
301 .chip_select = 8 - CONFIG_J19_JUMPER,
302 .controller_data = &spi_si3xxx_chip_info,
307 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
309 .modalias = "spidev",
310 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
313 .controller_data = &spidev_chip_info,
319 static struct resource bfin_spi0_resource[] = {
321 .start = SPI0_REGBASE,
322 .end = SPI0_REGBASE + 0xFF,
323 .flags = IORESOURCE_MEM,
328 .flags = IORESOURCE_IRQ,
332 /* SPI controller data */
333 static struct bfin5xx_spi_master bfin_spi0_info = {
335 .enable_dma = 1, /* master has the ability to do dma transfer */
336 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
339 static struct platform_device bfin_spi0_device = {
341 .id = 0, /* Bus number */
342 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
343 .resource = bfin_spi0_resource,
345 .platform_data = &bfin_spi0_info, /* Passed to driver */
348 #endif /* spi master and devices */
350 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
351 static struct platform_device bfin_fb_device = {
356 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
357 static struct resource bfin_uart_resources[] = {
361 .flags = IORESOURCE_MEM,
365 static struct platform_device bfin_uart_device = {
368 .num_resources = ARRAY_SIZE(bfin_uart_resources),
369 .resource = bfin_uart_resources,
373 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
374 static struct resource bfin_sir_resources[] = {
375 #ifdef CONFIG_BFIN_SIR0
379 .flags = IORESOURCE_MEM,
384 static struct platform_device bfin_sir_device = {
387 .num_resources = ARRAY_SIZE(bfin_sir_resources),
388 .resource = bfin_sir_resources,
392 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
393 static struct platform_device bfin_sport0_uart_device = {
394 .name = "bfin-sport-uart",
398 static struct platform_device bfin_sport1_uart_device = {
399 .name = "bfin-sport-uart",
404 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
407 static struct pata_platform_info bfin_pata_platform_data = {
409 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
412 static struct resource bfin_pata_resources[] = {
416 .flags = IORESOURCE_MEM,
421 .flags = IORESOURCE_MEM,
426 .flags = IORESOURCE_IRQ,
430 static struct platform_device bfin_pata_device = {
431 .name = "pata_platform",
433 .num_resources = ARRAY_SIZE(bfin_pata_resources),
434 .resource = bfin_pata_resources,
436 .platform_data = &bfin_pata_platform_data,
441 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
442 #include <linux/input.h>
443 #include <linux/gpio_keys.h>
445 static struct gpio_keys_button bfin_gpio_keys_table[] = {
446 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
447 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
448 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
451 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
452 .buttons = bfin_gpio_keys_table,
453 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
456 static struct platform_device bfin_device_gpiokeys = {
459 .platform_data = &bfin_gpio_keys_data,
464 static struct resource bfin_gpios_resources = {
466 .end = MAX_BLACKFIN_GPIOS - 1,
467 .flags = IORESOURCE_IRQ,
470 static struct platform_device bfin_gpios_device = {
471 .name = "simple-gpio",
474 .resource = &bfin_gpios_resources,
477 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
478 #include <linux/i2c-gpio.h>
480 static struct i2c_gpio_platform_data i2c_gpio_data = {
483 .sda_is_open_drain = 0,
484 .scl_is_open_drain = 0,
488 static struct platform_device i2c_gpio_device = {
492 .platform_data = &i2c_gpio_data,
497 #ifdef CONFIG_I2C_BOARDINFO
498 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
499 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
501 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
502 .type = "ad7142_joystick",
506 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
508 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
509 .type = "pcf8574_lcd",
512 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
514 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
515 .type = "pcf8574_keypad",
522 static struct platform_device *stamp_devices[] __initdata = {
523 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
527 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
531 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
532 &bfin_fb_adv7393_device,
535 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
536 &net2272_bfin_device,
539 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
543 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
547 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
551 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
552 &bfin_sport0_uart_device,
553 &bfin_sport1_uart_device,
556 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
560 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
561 &bfin_device_gpiokeys,
564 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
570 #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
575 static int __init stamp_init(void)
579 printk(KERN_INFO "%s(): registering device resources\n", __func__);
581 #ifdef CONFIG_I2C_BOARDINFO
582 i2c_register_board_info(0, bfin_i2c_board_info,
583 ARRAY_SIZE(bfin_i2c_board_info));
586 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
590 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
591 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
592 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
593 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
597 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
598 spi_register_board_info(bfin_spi_board_info,
599 ARRAY_SIZE(bfin_spi_board_info));
601 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
602 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
607 arch_initcall(stamp_init);
609 void native_machine_restart(char *cmd)
611 #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
612 bfin_write_FIO_INEN(~BIT_TO_SET);
613 bfin_write_FIO_DIR(BIT_TO_SET);
614 bfin_write_FIO_FLAG_C(BIT_TO_SET);