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>
44 #include <asm/bfin5xx_spi.h>
45 #include <asm/reboot.h>
46 #include <asm/portmux.h>
49 * Name the Board for the /proc/cpuinfo
51 const char bfin_board_name[] = "ADDS-BF533-STAMP";
53 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
54 static struct platform_device rtc_device = {
61 * Driver needs to know address, irq and flag pin.
63 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
64 static struct resource smc91x_resources[] = {
66 .name = "smc91x-regs",
68 .end = 0x20300300 + 16,
69 .flags = IORESOURCE_MEM,
73 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
77 static struct platform_device smc91x_device = {
80 .num_resources = ARRAY_SIZE(smc91x_resources),
81 .resource = smc91x_resources,
85 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
86 static struct platform_device bfin_fb_adv7393_device = {
87 .name = "bfin-adv7393",
91 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
92 static struct resource net2272_bfin_resources[] = {
95 .end = 0x20300000 + 0x100,
96 .flags = IORESOURCE_MEM,
100 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
104 static struct platform_device net2272_bfin_device = {
107 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
108 .resource = net2272_bfin_resources,
112 static struct mtd_partition stamp_partitions[] = {
114 .name = "Bootloader",
120 .offset = MTDPART_OFS_APPEND,
123 .size = MTDPART_SIZ_FULL,
124 .offset = MTDPART_OFS_APPEND,
128 static struct physmap_flash_data stamp_flash_data = {
130 .parts = stamp_partitions,
131 .nr_parts = ARRAY_SIZE(stamp_partitions),
134 static struct resource stamp_flash_resource[] = {
139 .flags = IORESOURCE_MEM,
141 .start = CONFIG_ENET_FLASH_PIN,
142 .flags = IORESOURCE_IRQ,
146 static struct platform_device stamp_flash_device = {
147 .name = "BF5xx-Flash",
150 .platform_data = &stamp_flash_data,
152 .num_resources = ARRAY_SIZE(stamp_flash_resource),
153 .resource = stamp_flash_resource,
156 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
157 /* all SPI peripherals info goes here */
159 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
160 static struct mtd_partition bfin_spi_flash_partitions[] = {
162 .name = "bootloader",
165 .mask_flags = MTD_CAP_ROM
169 .offset = MTDPART_OFS_APPEND,
171 .name = "file system",
172 .size = MTDPART_SIZ_FULL,
173 .offset = MTDPART_OFS_APPEND,
177 static struct flash_platform_data bfin_spi_flash_data = {
179 .parts = bfin_spi_flash_partitions,
180 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
184 /* SPI flash chip (m25p64) */
185 static struct bfin5xx_spi_chip spi_flash_chip_info = {
186 .enable_dma = 0, /* use dma transfer with this chip*/
191 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
193 static struct bfin5xx_spi_chip spi_adc_chip_info = {
194 .enable_dma = 1, /* use dma transfer with this chip*/
199 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
200 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
206 #if defined(CONFIG_PBX)
207 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
208 .ctl_reg = 0x4, /* send zero */
211 .cs_change_per_word = 1,
215 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
216 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
222 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
223 static struct bfin5xx_spi_chip spidev_chip_info = {
229 static struct spi_board_info bfin_spi_board_info[] __initdata = {
230 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
232 /* the modalias must be the same as spi device driver name */
233 .modalias = "m25p80", /* Name of spi_driver for this device */
234 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
235 .bus_num = 0, /* Framework bus number */
236 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
237 .platform_data = &bfin_spi_flash_data,
238 .controller_data = &spi_flash_chip_info,
243 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
245 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
246 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
247 .bus_num = 0, /* Framework bus number */
248 .chip_select = 1, /* Framework chip select. */
249 .platform_data = NULL, /* No spi_driver specific config */
250 .controller_data = &spi_adc_chip_info,
254 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
256 .modalias = "ad1836-spi",
257 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
259 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
260 .controller_data = &ad1836_spi_chip_info,
264 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
266 .modalias = "spi_mmc_dummy",
267 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
270 .platform_data = NULL,
271 .controller_data = &spi_mmc_chip_info,
275 .modalias = "spi_mmc",
276 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
278 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
279 .platform_data = NULL,
280 .controller_data = &spi_mmc_chip_info,
285 #if defined(CONFIG_PBX)
287 .modalias = "fxs-spi",
288 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
290 .chip_select = 8 - CONFIG_J11_JUMPER,
291 .controller_data = &spi_si3xxx_chip_info,
295 .modalias = "fxo-spi",
296 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
298 .chip_select = 8 - CONFIG_J19_JUMPER,
299 .controller_data = &spi_si3xxx_chip_info,
304 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
306 .modalias = "spidev",
307 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
310 .controller_data = &spidev_chip_info,
316 static struct resource bfin_spi0_resource[] = {
318 .start = SPI0_REGBASE,
319 .end = SPI0_REGBASE + 0xFF,
320 .flags = IORESOURCE_MEM,
325 .flags = IORESOURCE_IRQ,
329 /* SPI controller data */
330 static struct bfin5xx_spi_master bfin_spi0_info = {
332 .enable_dma = 1, /* master has the ability to do dma transfer */
333 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
336 static struct platform_device bfin_spi0_device = {
338 .id = 0, /* Bus number */
339 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
340 .resource = bfin_spi0_resource,
342 .platform_data = &bfin_spi0_info, /* Passed to driver */
345 #endif /* spi master and devices */
347 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
348 static struct platform_device bfin_fb_device = {
353 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
354 static struct resource bfin_uart_resources[] = {
358 .flags = IORESOURCE_MEM,
362 static struct platform_device bfin_uart_device = {
365 .num_resources = ARRAY_SIZE(bfin_uart_resources),
366 .resource = bfin_uart_resources,
370 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
371 static struct platform_device bfin_sport0_uart_device = {
372 .name = "bfin-sport-uart",
376 static struct platform_device bfin_sport1_uart_device = {
377 .name = "bfin-sport-uart",
382 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
385 static struct pata_platform_info bfin_pata_platform_data = {
387 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
390 static struct resource bfin_pata_resources[] = {
394 .flags = IORESOURCE_MEM,
399 .flags = IORESOURCE_MEM,
404 .flags = IORESOURCE_IRQ,
408 static struct platform_device bfin_pata_device = {
409 .name = "pata_platform",
411 .num_resources = ARRAY_SIZE(bfin_pata_resources),
412 .resource = bfin_pata_resources,
414 .platform_data = &bfin_pata_platform_data,
419 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
420 #include <linux/input.h>
421 #include <linux/gpio_keys.h>
423 static struct gpio_keys_button bfin_gpio_keys_table[] = {
424 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
425 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
426 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
429 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
430 .buttons = bfin_gpio_keys_table,
431 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
434 static struct platform_device bfin_device_gpiokeys = {
437 .platform_data = &bfin_gpio_keys_data,
442 static struct resource bfin_gpios_resources = {
444 .end = MAX_BLACKFIN_GPIOS - 1,
445 .flags = IORESOURCE_IRQ,
448 static struct platform_device bfin_gpios_device = {
449 .name = "simple-gpio",
452 .resource = &bfin_gpios_resources,
455 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
456 #include <linux/i2c-gpio.h>
458 static struct i2c_gpio_platform_data i2c_gpio_data = {
461 .sda_is_open_drain = 0,
462 .scl_is_open_drain = 0,
466 static struct platform_device i2c_gpio_device = {
470 .platform_data = &i2c_gpio_data,
475 static struct platform_device *stamp_devices[] __initdata = {
476 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
480 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
484 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
485 &bfin_fb_adv7393_device,
488 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
489 &net2272_bfin_device,
492 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
496 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
500 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
501 &bfin_sport0_uart_device,
502 &bfin_sport1_uart_device,
505 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
509 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
510 &bfin_device_gpiokeys,
513 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
521 static int __init stamp_init(void)
525 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
526 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
530 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
531 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
532 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
533 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
537 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
538 spi_register_board_info(bfin_spi_board_info,
539 ARRAY_SIZE(bfin_spi_board_info));
541 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
542 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
547 arch_initcall(stamp_init);
549 void native_machine_restart(char *cmd)
551 #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
552 bfin_write_FIO_INEN(~BIT_TO_SET);
553 bfin_write_FIO_DIR(BIT_TO_SET);
554 bfin_write_FIO_FLAG_C(BIT_TO_SET);