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",
115 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
119 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
124 .offset
= MTDPART_OFS_APPEND
,
127 .size
= MTDPART_SIZ_FULL
,
128 .offset
= MTDPART_OFS_APPEND
,
132 static struct physmap_flash_data stamp_flash_data
= {
134 .parts
= stamp_partitions
,
135 .nr_parts
= ARRAY_SIZE(stamp_partitions
),
138 static struct resource stamp_flash_resource
[] = {
143 .flags
= IORESOURCE_MEM
,
145 .start
= CONFIG_ENET_FLASH_PIN
,
146 .flags
= IORESOURCE_IRQ
,
150 static struct platform_device stamp_flash_device
= {
151 .name
= "BF5xx-Flash",
154 .platform_data
= &stamp_flash_data
,
156 .num_resources
= ARRAY_SIZE(stamp_flash_resource
),
157 .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",
167 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
171 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
173 .mask_flags
= MTD_CAP_ROM
177 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
180 .offset
= MTDPART_OFS_APPEND
,
181 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
183 .name
= "file system",
184 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
186 .offset
= 0x00100000,
188 .size
= MTDPART_SIZ_FULL
,
189 .offset
= MTDPART_OFS_APPEND
,
190 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
194 static struct flash_platform_data bfin_spi_flash_data
= {
196 .parts
= bfin_spi_flash_partitions
,
197 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
201 /* SPI flash chip (m25p64) */
202 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
203 .enable_dma
= 0, /* use dma transfer with this chip*/
208 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
210 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
211 .enable_dma
= 1, /* use dma transfer with this chip*/
216 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
217 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
223 #if defined(CONFIG_PBX)
224 static struct bfin5xx_spi_chip spi_si3xxx_chip_info
= {
225 .ctl_reg
= 0x4, /* send zero */
228 .cs_change_per_word
= 1,
232 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
233 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
234 static struct bfin5xx_spi_chip ad5304_chip_info
= {
241 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
242 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
243 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
249 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
250 static struct bfin5xx_spi_chip spidev_chip_info
= {
256 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
257 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
259 /* the modalias must be the same as spi device driver name */
260 .modalias
= "m25p80", /* Name of spi_driver for this device */
261 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
262 .bus_num
= 0, /* Framework bus number */
263 .chip_select
= 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
264 .platform_data
= &bfin_spi_flash_data
,
265 .controller_data
= &spi_flash_chip_info
,
270 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
272 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
273 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
274 .bus_num
= 0, /* Framework bus number */
275 .chip_select
= 1, /* Framework chip select. */
276 .platform_data
= NULL
, /* No spi_driver specific config */
277 .controller_data
= &spi_adc_chip_info
,
281 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
283 .modalias
= "ad1836-spi",
284 .max_speed_hz
= 31250000, /* max spi clock (SCK) speed in HZ */
286 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
287 .controller_data
= &ad1836_spi_chip_info
,
291 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
293 .modalias
= "spi_mmc_dummy",
294 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
297 .platform_data
= NULL
,
298 .controller_data
= &spi_mmc_chip_info
,
302 .modalias
= "spi_mmc",
303 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
305 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
306 .platform_data
= NULL
,
307 .controller_data
= &spi_mmc_chip_info
,
312 #if defined(CONFIG_PBX)
314 .modalias
= "fxs-spi",
315 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
317 .chip_select
= 8 - CONFIG_J11_JUMPER
,
318 .controller_data
= &spi_si3xxx_chip_info
,
322 .modalias
= "fxo-spi",
323 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
325 .chip_select
= 8 - CONFIG_J19_JUMPER
,
326 .controller_data
= &spi_si3xxx_chip_info
,
331 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
332 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
334 .modalias
= "ad5304_spi",
335 .max_speed_hz
= 1000000, /* max spi clock (SCK) speed in HZ */
338 .platform_data
= NULL
,
339 .controller_data
= &ad5304_chip_info
,
344 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
345 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
347 .modalias
= "spidev",
348 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
351 .controller_data
= &spidev_chip_info
,
357 static struct resource bfin_spi0_resource
[] = {
359 .start
= SPI0_REGBASE
,
360 .end
= SPI0_REGBASE
+ 0xFF,
361 .flags
= IORESOURCE_MEM
,
366 .flags
= IORESOURCE_IRQ
,
370 /* SPI controller data */
371 static struct bfin5xx_spi_master bfin_spi0_info
= {
373 .enable_dma
= 1, /* master has the ability to do dma transfer */
374 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
377 static struct platform_device bfin_spi0_device
= {
379 .id
= 0, /* Bus number */
380 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
381 .resource
= bfin_spi0_resource
,
383 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
386 #endif /* spi master and devices */
388 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
389 static struct platform_device bfin_fb_device
= {
394 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
395 static struct resource bfin_uart_resources
[] = {
399 .flags
= IORESOURCE_MEM
,
403 static struct platform_device bfin_uart_device
= {
406 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
407 .resource
= bfin_uart_resources
,
411 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
412 static struct platform_device bfin_sport0_uart_device
= {
413 .name
= "bfin-sport-uart",
417 static struct platform_device bfin_sport1_uart_device
= {
418 .name
= "bfin-sport-uart",
423 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
426 static struct pata_platform_info bfin_pata_platform_data
= {
428 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
431 static struct resource bfin_pata_resources
[] = {
435 .flags
= IORESOURCE_MEM
,
440 .flags
= IORESOURCE_MEM
,
445 .flags
= IORESOURCE_IRQ
,
449 static struct platform_device bfin_pata_device
= {
450 .name
= "pata_platform",
452 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
453 .resource
= bfin_pata_resources
,
455 .platform_data
= &bfin_pata_platform_data
,
460 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
461 #include <linux/input.h>
462 #include <linux/gpio_keys.h>
464 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
465 {BTN_0
, GPIO_PF5
, 0, "gpio-keys: BTN0"},
466 {BTN_1
, GPIO_PF6
, 0, "gpio-keys: BTN1"},
467 {BTN_2
, GPIO_PF8
, 0, "gpio-keys: BTN2"},
470 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
471 .buttons
= bfin_gpio_keys_table
,
472 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
475 static struct platform_device bfin_device_gpiokeys
= {
478 .platform_data
= &bfin_gpio_keys_data
,
483 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
485 static struct resource bfin_gpios_resources
= {
487 .end
= MAX_BLACKFIN_GPIOS
- 1,
488 .flags
= IORESOURCE_IRQ
,
491 static struct platform_device bfin_gpios_device
= {
492 .name
= "simple-gpio",
495 .resource
= &bfin_gpios_resources
,
498 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
499 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
500 #include <linux/i2c-gpio.h>
502 static struct i2c_gpio_platform_data i2c_gpio_data
= {
505 .sda_is_open_drain
= 0,
506 .scl_is_open_drain
= 0,
510 static struct platform_device i2c_gpio_device
= {
514 .platform_data
= &i2c_gpio_data
,
519 static struct platform_device
*stamp_devices
[] __initdata
= {
520 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
524 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
528 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
529 &bfin_fb_adv7393_device
,
532 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
533 &net2272_bfin_device
,
536 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
540 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
544 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
545 &bfin_sport0_uart_device
,
546 &bfin_sport1_uart_device
,
549 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
553 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
554 &bfin_device_gpiokeys
,
557 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
560 <<<<<<< HEAD
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
564 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/blackfin
/mach
-bf533
/boards
/stamp
.c
568 static int __init
stamp_init(void)
572 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
573 ret
= platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
577 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
578 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
579 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN
));
580 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN
);
584 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
585 spi_register_board_info(bfin_spi_board_info
,
586 ARRAY_SIZE(bfin_spi_board_info
));
588 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
589 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
594 arch_initcall(stamp_init
);
596 void native_machine_restart(char *cmd
)
598 #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
599 bfin_write_FIO_INEN(~BIT_TO_SET
);
600 bfin_write_FIO_DIR(BIT_TO_SET
);
601 bfin_write_FIO_FLAG_C(BIT_TO_SET
);