Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / blackfin / mach-bf533 / boards / stamp.c
blob778374927bf6a92262fa0ca76f99bd41d11832e6
1 /*
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>
6 * Created: 2005
7 * Description: Board Info File for the BF533-STAMP
9 * Modified:
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>
40 #endif
41 #include <linux/ata_platform.h>
42 #include <linux/irq.h>
43 #include <asm/dma.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 = {
55 .name = "rtc-bfin",
56 .id = -1,
58 #endif
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",
67 .start = 0x20300300,
68 .end = 0x20300300 + 16,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = IRQ_PF7,
72 .end = IRQ_PF7,
73 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
77 static struct platform_device smc91x_device = {
78 .name = "smc91x",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(smc91x_resources),
81 .resource = smc91x_resources,
83 #endif
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",
89 #endif
91 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
92 static struct resource net2272_bfin_resources[] = {
94 .start = 0x20300000,
95 .end = 0x20300000 + 0x100,
96 .flags = IORESOURCE_MEM,
97 }, {
98 .start = IRQ_PF10,
99 .end = IRQ_PF10,
100 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
104 static struct platform_device net2272_bfin_device = {
105 .name = "net2272",
106 .id = -1,
107 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
108 .resource = net2272_bfin_resources,
110 #endif
112 static struct mtd_partition stamp_partitions[] = {
114 .name = "Bootloader",
115 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/stamp.c
116 .size = 0x20000,
117 =======
118 .size = 0x40000,
119 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/stamp.c
120 .offset = 0,
121 }, {
122 .name = "Kernel",
123 .size = 0xE0000,
124 .offset = MTDPART_OFS_APPEND,
125 }, {
126 .name = "RootFS",
127 .size = MTDPART_SIZ_FULL,
128 .offset = MTDPART_OFS_APPEND,
132 static struct physmap_flash_data stamp_flash_data = {
133 .width = 2,
134 .parts = stamp_partitions,
135 .nr_parts = ARRAY_SIZE(stamp_partitions),
138 static struct resource stamp_flash_resource[] = {
140 .name = "cfi_probe",
141 .start = 0x20000000,
142 .end = 0x203fffff,
143 .flags = IORESOURCE_MEM,
144 }, {
145 .start = CONFIG_ENET_FLASH_PIN,
146 .flags = IORESOURCE_IRQ,
150 static struct platform_device stamp_flash_device = {
151 .name = "BF5xx-Flash",
152 .id = 0,
153 .dev = {
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
168 .size = 0x00020000,
169 =======
170 .size = 0x00040000,
171 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/stamp.c
172 .offset = 0,
173 .mask_flags = MTD_CAP_ROM
174 }, {
175 .name = "kernel",
176 .size = 0xe0000,
177 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/stamp.c
178 .offset = 0x20000
179 =======
180 .offset = MTDPART_OFS_APPEND,
181 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/stamp.c
182 }, {
183 .name = "file system",
184 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/stamp.c
185 .size = 0x700000,
186 .offset = 0x00100000,
187 =======
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 = {
195 .name = "m25p80",
196 .parts = bfin_spi_flash_partitions,
197 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
198 .type = "m25p64",
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*/
204 .bits_per_word = 8,
206 #endif
208 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
209 /* SPI ADC chip */
210 static struct bfin5xx_spi_chip spi_adc_chip_info = {
211 .enable_dma = 1, /* use dma transfer with this chip*/
212 .bits_per_word = 16,
214 #endif
216 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
217 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
218 .enable_dma = 0,
219 .bits_per_word = 16,
221 #endif
223 #if defined(CONFIG_PBX)
224 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
225 .ctl_reg = 0x4, /* send zero */
226 .enable_dma = 0,
227 .bits_per_word = 8,
228 .cs_change_per_word = 1,
230 #endif
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 = {
235 .enable_dma = 0,
236 .bits_per_word = 16,
238 #endif
240 =======
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 = {
244 .enable_dma = 1,
245 .bits_per_word = 8,
247 #endif
249 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
250 static struct bfin5xx_spi_chip spidev_chip_info = {
251 .enable_dma = 0,
252 .bits_per_word = 8,
254 #endif
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,
266 .mode = SPI_MODE_3,
268 #endif
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,
279 #endif
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 */
285 .bus_num = 0,
286 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
287 .controller_data = &ad1836_spi_chip_info,
289 #endif
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 */
295 .bus_num = 0,
296 .chip_select = 0,
297 .platform_data = NULL,
298 .controller_data = &spi_mmc_chip_info,
299 .mode = SPI_MODE_3,
302 .modalias = "spi_mmc",
303 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
304 .bus_num = 0,
305 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
306 .platform_data = NULL,
307 .controller_data = &spi_mmc_chip_info,
308 .mode = SPI_MODE_3,
310 #endif
312 #if defined(CONFIG_PBX)
314 .modalias = "fxs-spi",
315 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
316 .bus_num = 0,
317 .chip_select = 8 - CONFIG_J11_JUMPER,
318 .controller_data = &spi_si3xxx_chip_info,
319 .mode = SPI_MODE_3,
322 .modalias = "fxo-spi",
323 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
324 .bus_num = 0,
325 .chip_select = 8 - CONFIG_J19_JUMPER,
326 .controller_data = &spi_si3xxx_chip_info,
327 .mode = SPI_MODE_3,
329 #endif
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 */
336 .bus_num = 0,
337 .chip_select = 2,
338 .platform_data = NULL,
339 .controller_data = &ad5304_chip_info,
340 .mode = SPI_MODE_2,
342 #endif
343 =======
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 */
349 .bus_num = 0,
350 .chip_select = 1,
351 .controller_data = &spidev_chip_info,
353 #endif
356 /* SPI (0) */
357 static struct resource bfin_spi0_resource[] = {
358 [0] = {
359 .start = SPI0_REGBASE,
360 .end = SPI0_REGBASE + 0xFF,
361 .flags = IORESOURCE_MEM,
363 [1] = {
364 .start = CH_SPI,
365 .end = CH_SPI,
366 .flags = IORESOURCE_IRQ,
370 /* SPI controller data */
371 static struct bfin5xx_spi_master bfin_spi0_info = {
372 .num_chipselect = 8,
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 = {
378 .name = "bfin-spi",
379 .id = 0, /* Bus number */
380 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
381 .resource = bfin_spi0_resource,
382 .dev = {
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 = {
390 .name = "bf537-fb",
392 #endif
394 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
395 static struct resource bfin_uart_resources[] = {
397 .start = 0xFFC00400,
398 .end = 0xFFC004FF,
399 .flags = IORESOURCE_MEM,
403 static struct platform_device bfin_uart_device = {
404 .name = "bfin-uart",
405 .id = 1,
406 .num_resources = ARRAY_SIZE(bfin_uart_resources),
407 .resource = bfin_uart_resources,
409 #endif
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",
414 .id = 0,
417 static struct platform_device bfin_sport1_uart_device = {
418 .name = "bfin-sport-uart",
419 .id = 1,
421 #endif
423 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
424 #define PATA_INT 55
426 static struct pata_platform_info bfin_pata_platform_data = {
427 .ioport_shift = 1,
428 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
431 static struct resource bfin_pata_resources[] = {
433 .start = 0x20314020,
434 .end = 0x2031403F,
435 .flags = IORESOURCE_MEM,
438 .start = 0x2031401C,
439 .end = 0x2031401F,
440 .flags = IORESOURCE_MEM,
443 .start = PATA_INT,
444 .end = PATA_INT,
445 .flags = IORESOURCE_IRQ,
449 static struct platform_device bfin_pata_device = {
450 .name = "pata_platform",
451 .id = -1,
452 .num_resources = ARRAY_SIZE(bfin_pata_resources),
453 .resource = bfin_pata_resources,
454 .dev = {
455 .platform_data = &bfin_pata_platform_data,
458 #endif
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 = {
476 .name = "gpio-keys",
477 .dev = {
478 .platform_data = &bfin_gpio_keys_data,
481 #endif
483 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/stamp.c
484 =======
485 static struct resource bfin_gpios_resources = {
486 .start = 0,
487 .end = MAX_BLACKFIN_GPIOS - 1,
488 .flags = IORESOURCE_IRQ,
491 static struct platform_device bfin_gpios_device = {
492 .name = "simple-gpio",
493 .id = -1,
494 .num_resources = 1,
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 = {
503 .sda_pin = 2,
504 .scl_pin = 3,
505 .sda_is_open_drain = 0,
506 .scl_is_open_drain = 0,
507 .udelay = 40,
510 static struct platform_device i2c_gpio_device = {
511 .name = "i2c-gpio",
512 .id = 0,
513 .dev = {
514 .platform_data = &i2c_gpio_data,
517 #endif
519 static struct platform_device *stamp_devices[] __initdata = {
520 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
521 &rtc_device,
522 #endif
524 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
525 &smc91x_device,
526 #endif
528 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
529 &bfin_fb_adv7393_device,
530 #endif
532 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
533 &net2272_bfin_device,
534 #endif
536 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
537 &bfin_spi0_device,
538 #endif
540 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
541 &bfin_uart_device,
542 #endif
544 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
545 &bfin_sport0_uart_device,
546 &bfin_sport1_uart_device,
547 #endif
549 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
550 &bfin_pata_device,
551 #endif
553 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
554 &bfin_device_gpiokeys,
555 #endif
557 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
558 &i2c_gpio_device,
559 #endif
560 <<<<<<< HEAD:arch/blackfin/mach-bf533/boards/stamp.c
561 =======
563 &bfin_gpios_device,
564 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-bf533/boards/stamp.c
565 &stamp_flash_device,
568 static int __init stamp_init(void)
570 int ret;
572 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
573 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
574 if (ret < 0)
575 return ret;
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);
581 SSYNC();
582 #endif
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));
587 #endif
588 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
589 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
590 #endif
591 return 0;
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);