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>
51 * Name the Board for the /proc/cpuinfo
53 const char bfin_board_name[] = "ADDS-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 static struct resource smc91x_resources[] = {
68 .name = "smc91x-regs",
70 .end = 0x20300300 + 16,
71 .flags = IORESOURCE_MEM,
75 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
79 static struct platform_device smc91x_device = {
82 .num_resources = ARRAY_SIZE(smc91x_resources),
83 .resource = smc91x_resources,
87 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
88 static struct platform_device bfin_fb_adv7393_device = {
89 .name = "bfin-adv7393",
93 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
94 static struct resource net2272_bfin_resources[] = {
97 .end = 0x20300000 + 0x100,
98 .flags = IORESOURCE_MEM,
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
106 static struct platform_device net2272_bfin_device = {
109 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
110 .resource = net2272_bfin_resources,
114 #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
115 static struct mtd_partition stamp_partitions[] = {
117 .name = "Bootloader",
123 .offset = MTDPART_OFS_APPEND,
126 .size = MTDPART_SIZ_FULL,
127 .offset = MTDPART_OFS_APPEND,
131 static struct physmap_flash_data stamp_flash_data = {
133 .parts = stamp_partitions,
134 .nr_parts = ARRAY_SIZE(stamp_partitions),
137 static struct resource stamp_flash_resource[] = {
142 .flags = IORESOURCE_MEM,
144 .start = CONFIG_ENET_FLASH_PIN,
145 .flags = IORESOURCE_IRQ,
149 static struct platform_device stamp_flash_device = {
150 .name = "BF5xx-Flash",
153 .platform_data = &stamp_flash_data,
155 .num_resources = ARRAY_SIZE(stamp_flash_resource),
156 .resource = stamp_flash_resource,
160 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
161 /* all SPI peripherals info goes here */
163 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
164 static struct mtd_partition bfin_spi_flash_partitions[] = {
166 .name = "bootloader",
169 .mask_flags = MTD_CAP_ROM
173 .offset = MTDPART_OFS_APPEND,
175 .name = "file system",
176 .size = MTDPART_SIZ_FULL,
177 .offset = MTDPART_OFS_APPEND,
181 static struct flash_platform_data bfin_spi_flash_data = {
183 .parts = bfin_spi_flash_partitions,
184 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
188 /* SPI flash chip (m25p64) */
189 static struct bfin5xx_spi_chip spi_flash_chip_info = {
190 .enable_dma = 0, /* use dma transfer with this chip*/
195 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
197 static struct bfin5xx_spi_chip spi_adc_chip_info = {
198 .enable_dma = 1, /* use dma transfer with this chip*/
203 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
204 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
210 #if defined(CONFIG_PBX)
211 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
212 .ctl_reg = 0x4, /* send zero */
215 .cs_change_per_word = 1,
219 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
220 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
226 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
227 static struct bfin5xx_spi_chip spidev_chip_info = {
233 static struct spi_board_info bfin_spi_board_info[] __initdata = {
234 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
236 /* the modalias must be the same as spi device driver name */
237 .modalias = "m25p80", /* Name of spi_driver for this device */
238 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
239 .bus_num = 0, /* Framework bus number */
240 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
241 .platform_data = &bfin_spi_flash_data,
242 .controller_data = &spi_flash_chip_info,
247 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
249 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
250 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
251 .bus_num = 0, /* Framework bus number */
252 .chip_select = 1, /* Framework chip select. */
253 .platform_data = NULL, /* No spi_driver specific config */
254 .controller_data = &spi_adc_chip_info,
258 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
260 .modalias = "ad1836-spi",
261 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
263 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
264 .controller_data = &ad1836_spi_chip_info,
268 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
270 .modalias = "spi_mmc_dummy",
271 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
274 .platform_data = NULL,
275 .controller_data = &spi_mmc_chip_info,
279 .modalias = "spi_mmc",
280 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
282 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
283 .platform_data = NULL,
284 .controller_data = &spi_mmc_chip_info,
289 #if defined(CONFIG_PBX)
291 .modalias = "fxs-spi",
292 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
294 .chip_select = 8 - CONFIG_J11_JUMPER,
295 .controller_data = &spi_si3xxx_chip_info,
299 .modalias = "fxo-spi",
300 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
302 .chip_select = 8 - CONFIG_J19_JUMPER,
303 .controller_data = &spi_si3xxx_chip_info,
308 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
310 .modalias = "spidev",
311 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
314 .controller_data = &spidev_chip_info,
320 static struct resource bfin_spi0_resource[] = {
322 .start = SPI0_REGBASE,
323 .end = SPI0_REGBASE + 0xFF,
324 .flags = IORESOURCE_MEM,
329 .flags = IORESOURCE_IRQ,
333 /* SPI controller data */
334 static struct bfin5xx_spi_master bfin_spi0_info = {
336 .enable_dma = 1, /* master has the ability to do dma transfer */
337 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
340 static struct platform_device bfin_spi0_device = {
342 .id = 0, /* Bus number */
343 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
344 .resource = bfin_spi0_resource,
346 .platform_data = &bfin_spi0_info, /* Passed to driver */
349 #endif /* spi master and devices */
351 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
352 static struct platform_device bfin_fb_device = {
357 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
358 static struct resource bfin_uart_resources[] = {
362 .flags = IORESOURCE_MEM,
366 static struct platform_device bfin_uart_device = {
369 .num_resources = ARRAY_SIZE(bfin_uart_resources),
370 .resource = bfin_uart_resources,
374 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
375 static struct resource bfin_sir_resources[] = {
376 #ifdef CONFIG_BFIN_SIR0
380 .flags = IORESOURCE_MEM,
385 static struct platform_device bfin_sir_device = {
388 .num_resources = ARRAY_SIZE(bfin_sir_resources),
389 .resource = bfin_sir_resources,
393 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
394 static struct platform_device bfin_sport0_uart_device = {
395 .name = "bfin-sport-uart",
399 static struct platform_device bfin_sport1_uart_device = {
400 .name = "bfin-sport-uart",
405 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
408 static struct pata_platform_info bfin_pata_platform_data = {
410 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
413 static struct resource bfin_pata_resources[] = {
417 .flags = IORESOURCE_MEM,
422 .flags = IORESOURCE_MEM,
427 .flags = IORESOURCE_IRQ,
431 static struct platform_device bfin_pata_device = {
432 .name = "pata_platform",
434 .num_resources = ARRAY_SIZE(bfin_pata_resources),
435 .resource = bfin_pata_resources,
437 .platform_data = &bfin_pata_platform_data,
442 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
443 #include <linux/input.h>
444 #include <linux/gpio_keys.h>
446 static struct gpio_keys_button bfin_gpio_keys_table[] = {
447 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
448 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
449 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
452 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
453 .buttons = bfin_gpio_keys_table,
454 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
457 static struct platform_device bfin_device_gpiokeys = {
460 .platform_data = &bfin_gpio_keys_data,
465 static struct resource bfin_gpios_resources = {
467 .end = MAX_BLACKFIN_GPIOS - 1,
468 .flags = IORESOURCE_IRQ,
471 static struct platform_device bfin_gpios_device = {
472 .name = "simple-gpio",
475 .resource = &bfin_gpios_resources,
478 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
479 #include <linux/i2c-gpio.h>
481 static struct i2c_gpio_platform_data i2c_gpio_data = {
484 .sda_is_open_drain = 0,
485 .scl_is_open_drain = 0,
489 static struct platform_device i2c_gpio_device = {
493 .platform_data = &i2c_gpio_data,
498 #ifdef CONFIG_I2C_BOARDINFO
499 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
500 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
502 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
506 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
508 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
511 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
513 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)
579 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
580 &bfin_sport0_uart_device,
581 &bfin_sport1_uart_device,
584 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
588 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
589 &bfin_device_gpiokeys,
592 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
598 #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
603 static int __init stamp_init(void)
607 printk(KERN_INFO "%s(): registering device resources\n", __func__);
609 #ifdef CONFIG_I2C_BOARDINFO
610 i2c_register_board_info(0, bfin_i2c_board_info,
611 ARRAY_SIZE(bfin_i2c_board_info));
614 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
618 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
619 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
620 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
621 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
625 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
626 spi_register_board_info(bfin_spi_board_info,
627 ARRAY_SIZE(bfin_spi_board_info));
629 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
630 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
635 arch_initcall(stamp_init);
637 void native_machine_restart(char *cmd)
639 #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
640 bfin_write_FIO_INEN(~BIT_TO_SET);
641 bfin_write_FIO_DIR(BIT_TO_SET);
642 bfin_write_FIO_FLAG_C(BIT_TO_SET);