Blackfin arch: be consistant with parition names, and ensure the bus is identified
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / blackfin / mach-bf533 / boards / stamp.c
blobd10b2dc59024285af672b164ec40ad271fdefbb4
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 <linux/i2c.h>
44 #include <asm/dma.h>
45 #include <asm/bfin5xx_spi.h>
46 #include <asm/reboot.h>
47 #include <asm/portmux.h>
48 #include <asm/dpmc.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 = {
57 .name = "rtc-bfin",
58 .id = -1,
60 #endif
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",
69 .start = 0x20300300,
70 .end = 0x20300300 + 16,
71 .flags = IORESOURCE_MEM,
72 }, {
73 .start = IRQ_PF7,
74 .end = IRQ_PF7,
75 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
79 static struct platform_device smc91x_device = {
80 .name = "smc91x",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(smc91x_resources),
83 .resource = smc91x_resources,
85 #endif
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",
91 #endif
93 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
94 static struct resource net2272_bfin_resources[] = {
96 .start = 0x20300000,
97 .end = 0x20300000 + 0x100,
98 .flags = IORESOURCE_MEM,
99 }, {
100 .start = IRQ_PF10,
101 .end = IRQ_PF10,
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
106 static struct platform_device net2272_bfin_device = {
107 .name = "net2272",
108 .id = -1,
109 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
110 .resource = net2272_bfin_resources,
112 #endif
114 #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
115 static struct mtd_partition stamp_partitions[] = {
117 .name = "bootloader(nor)",
118 .size = 0x40000,
119 .offset = 0,
120 }, {
121 .name = "linux kernel(nor)",
122 .size = 0xE0000,
123 .offset = MTDPART_OFS_APPEND,
124 }, {
125 .name = "file system(nor)",
126 .size = MTDPART_SIZ_FULL,
127 .offset = MTDPART_OFS_APPEND,
131 static struct physmap_flash_data stamp_flash_data = {
132 .width = 2,
133 .parts = stamp_partitions,
134 .nr_parts = ARRAY_SIZE(stamp_partitions),
137 static struct resource stamp_flash_resource[] = {
139 .name = "cfi_probe",
140 .start = 0x20000000,
141 .end = 0x203fffff,
142 .flags = IORESOURCE_MEM,
143 }, {
144 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
145 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
146 .flags = IORESOURCE_MEM,
147 }, {
148 .start = GPIO_PF0,
149 .flags = IORESOURCE_IRQ,
153 static struct platform_device stamp_flash_device = {
154 .name = "bfin-async-flash",
155 .id = 0,
156 .dev = {
157 .platform_data = &stamp_flash_data,
159 .num_resources = ARRAY_SIZE(stamp_flash_resource),
160 .resource = stamp_flash_resource,
162 #endif
164 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
165 static struct mtd_partition bfin_spi_flash_partitions[] = {
167 .name = "bootloader(spi)",
168 .size = 0x00040000,
169 .offset = 0,
170 .mask_flags = MTD_CAP_ROM
171 }, {
172 .name = "linux kernel(spi)",
173 .size = 0xe0000,
174 .offset = MTDPART_OFS_APPEND,
175 }, {
176 .name = "file system(spi)",
177 .size = MTDPART_SIZ_FULL,
178 .offset = MTDPART_OFS_APPEND,
182 static struct flash_platform_data bfin_spi_flash_data = {
183 .name = "m25p80",
184 .parts = bfin_spi_flash_partitions,
185 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
186 .type = "m25p64",
189 /* SPI flash chip (m25p64) */
190 static struct bfin5xx_spi_chip spi_flash_chip_info = {
191 .enable_dma = 0, /* use dma transfer with this chip*/
192 .bits_per_word = 8,
194 #endif
196 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
197 /* SPI ADC chip */
198 static struct bfin5xx_spi_chip spi_adc_chip_info = {
199 .enable_dma = 1, /* use dma transfer with this chip*/
200 .bits_per_word = 16,
202 #endif
204 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
205 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
206 .enable_dma = 0,
207 .bits_per_word = 16,
209 #endif
211 #if defined(CONFIG_PBX)
212 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
213 .ctl_reg = 0x4, /* send zero */
214 .enable_dma = 0,
215 .bits_per_word = 8,
216 .cs_change_per_word = 1,
218 #endif
220 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
221 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
222 .enable_dma = 1,
223 .bits_per_word = 8,
225 #endif
227 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
228 static struct bfin5xx_spi_chip spidev_chip_info = {
229 .enable_dma = 0,
230 .bits_per_word = 8,
232 #endif
234 static struct spi_board_info bfin_spi_board_info[] __initdata = {
235 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
237 /* the modalias must be the same as spi device driver name */
238 .modalias = "m25p80", /* Name of spi_driver for this device */
239 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
240 .bus_num = 0, /* Framework bus number */
241 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
242 .platform_data = &bfin_spi_flash_data,
243 .controller_data = &spi_flash_chip_info,
244 .mode = SPI_MODE_3,
246 #endif
248 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
250 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
251 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
252 .bus_num = 0, /* Framework bus number */
253 .chip_select = 1, /* Framework chip select. */
254 .platform_data = NULL, /* No spi_driver specific config */
255 .controller_data = &spi_adc_chip_info,
257 #endif
259 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
261 .modalias = "ad1836-spi",
262 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
263 .bus_num = 0,
264 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
265 .controller_data = &ad1836_spi_chip_info,
267 #endif
269 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
271 .modalias = "spi_mmc_dummy",
272 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
273 .bus_num = 0,
274 .chip_select = 0,
275 .platform_data = NULL,
276 .controller_data = &spi_mmc_chip_info,
277 .mode = SPI_MODE_3,
280 .modalias = "spi_mmc",
281 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
282 .bus_num = 0,
283 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
284 .platform_data = NULL,
285 .controller_data = &spi_mmc_chip_info,
286 .mode = SPI_MODE_3,
288 #endif
290 #if defined(CONFIG_PBX)
292 .modalias = "fxs-spi",
293 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
294 .bus_num = 0,
295 .chip_select = 8 - CONFIG_J11_JUMPER,
296 .controller_data = &spi_si3xxx_chip_info,
297 .mode = SPI_MODE_3,
300 .modalias = "fxo-spi",
301 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
302 .bus_num = 0,
303 .chip_select = 8 - CONFIG_J19_JUMPER,
304 .controller_data = &spi_si3xxx_chip_info,
305 .mode = SPI_MODE_3,
307 #endif
309 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
311 .modalias = "spidev",
312 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
313 .bus_num = 0,
314 .chip_select = 1,
315 .controller_data = &spidev_chip_info,
317 #endif
320 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
321 /* SPI (0) */
322 static struct resource bfin_spi0_resource[] = {
323 [0] = {
324 .start = SPI0_REGBASE,
325 .end = SPI0_REGBASE + 0xFF,
326 .flags = IORESOURCE_MEM,
328 [1] = {
329 .start = CH_SPI,
330 .end = CH_SPI,
331 .flags = IORESOURCE_IRQ,
335 /* SPI controller data */
336 static struct bfin5xx_spi_master bfin_spi0_info = {
337 .num_chipselect = 8,
338 .enable_dma = 1, /* master has the ability to do dma transfer */
339 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
342 static struct platform_device bfin_spi0_device = {
343 .name = "bfin-spi",
344 .id = 0, /* Bus number */
345 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
346 .resource = bfin_spi0_resource,
347 .dev = {
348 .platform_data = &bfin_spi0_info, /* Passed to driver */
351 #endif /* spi master and devices */
353 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
354 static struct platform_device bfin_fb_device = {
355 .name = "bf537-fb",
357 #endif
359 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
360 static struct resource bfin_uart_resources[] = {
362 .start = 0xFFC00400,
363 .end = 0xFFC004FF,
364 .flags = IORESOURCE_MEM,
368 static struct platform_device bfin_uart_device = {
369 .name = "bfin-uart",
370 .id = 1,
371 .num_resources = ARRAY_SIZE(bfin_uart_resources),
372 .resource = bfin_uart_resources,
374 #endif
376 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
377 static struct resource bfin_sir_resources[] = {
378 #ifdef CONFIG_BFIN_SIR0
380 .start = 0xFFC00400,
381 .end = 0xFFC004FF,
382 .flags = IORESOURCE_MEM,
384 #endif
387 static struct platform_device bfin_sir_device = {
388 .name = "bfin_sir",
389 .id = 0,
390 .num_resources = ARRAY_SIZE(bfin_sir_resources),
391 .resource = bfin_sir_resources,
393 #endif
395 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
396 static struct platform_device bfin_sport0_uart_device = {
397 .name = "bfin-sport-uart",
398 .id = 0,
401 static struct platform_device bfin_sport1_uart_device = {
402 .name = "bfin-sport-uart",
403 .id = 1,
405 #endif
407 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
408 #define PATA_INT 55
410 static struct pata_platform_info bfin_pata_platform_data = {
411 .ioport_shift = 1,
412 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
415 static struct resource bfin_pata_resources[] = {
417 .start = 0x20314020,
418 .end = 0x2031403F,
419 .flags = IORESOURCE_MEM,
422 .start = 0x2031401C,
423 .end = 0x2031401F,
424 .flags = IORESOURCE_MEM,
427 .start = PATA_INT,
428 .end = PATA_INT,
429 .flags = IORESOURCE_IRQ,
433 static struct platform_device bfin_pata_device = {
434 .name = "pata_platform",
435 .id = -1,
436 .num_resources = ARRAY_SIZE(bfin_pata_resources),
437 .resource = bfin_pata_resources,
438 .dev = {
439 .platform_data = &bfin_pata_platform_data,
442 #endif
444 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
445 #include <linux/input.h>
446 #include <linux/gpio_keys.h>
448 static struct gpio_keys_button bfin_gpio_keys_table[] = {
449 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
450 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
451 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
454 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
455 .buttons = bfin_gpio_keys_table,
456 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
459 static struct platform_device bfin_device_gpiokeys = {
460 .name = "gpio-keys",
461 .dev = {
462 .platform_data = &bfin_gpio_keys_data,
465 #endif
467 static struct resource bfin_gpios_resources = {
468 .start = 0,
469 .end = MAX_BLACKFIN_GPIOS - 1,
470 .flags = IORESOURCE_IRQ,
473 static struct platform_device bfin_gpios_device = {
474 .name = "simple-gpio",
475 .id = -1,
476 .num_resources = 1,
477 .resource = &bfin_gpios_resources,
480 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
481 #include <linux/i2c-gpio.h>
483 static struct i2c_gpio_platform_data i2c_gpio_data = {
484 .sda_pin = 2,
485 .scl_pin = 3,
486 .sda_is_open_drain = 0,
487 .scl_is_open_drain = 0,
488 .udelay = 40,
491 static struct platform_device i2c_gpio_device = {
492 .name = "i2c-gpio",
493 .id = 0,
494 .dev = {
495 .platform_data = &i2c_gpio_data,
498 #endif
500 #ifdef CONFIG_I2C_BOARDINFO
501 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
502 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
504 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
505 .irq = 39,
507 #endif
508 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
510 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
512 #endif
513 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
515 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
516 .irq = 39,
518 #endif
520 #endif
522 static const unsigned int cclk_vlev_datasheet[] =
524 VRPAIR(VLEV_085, 250000000),
525 VRPAIR(VLEV_090, 376000000),
526 VRPAIR(VLEV_095, 426000000),
527 VRPAIR(VLEV_100, 426000000),
528 VRPAIR(VLEV_105, 476000000),
529 VRPAIR(VLEV_110, 476000000),
530 VRPAIR(VLEV_115, 476000000),
531 VRPAIR(VLEV_120, 600000000),
532 VRPAIR(VLEV_125, 600000000),
533 VRPAIR(VLEV_130, 600000000),
536 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
537 .tuple_tab = cclk_vlev_datasheet,
538 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
539 .vr_settling_time = 25 /* us */,
542 static struct platform_device bfin_dpmc = {
543 .name = "bfin dpmc",
544 .dev = {
545 .platform_data = &bfin_dmpc_vreg_data,
549 static struct platform_device *stamp_devices[] __initdata = {
551 &bfin_dpmc,
553 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
554 &rtc_device,
555 #endif
557 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
558 &smc91x_device,
559 #endif
561 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
562 &bfin_fb_adv7393_device,
563 #endif
565 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
566 &net2272_bfin_device,
567 #endif
569 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
570 &bfin_spi0_device,
571 #endif
573 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
574 &bfin_uart_device,
575 #endif
577 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
578 &bfin_sir_device,
579 #endif
581 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
582 &bfin_sport0_uart_device,
583 &bfin_sport1_uart_device,
584 #endif
586 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
587 &bfin_pata_device,
588 #endif
590 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
591 &bfin_device_gpiokeys,
592 #endif
594 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
595 &i2c_gpio_device,
596 #endif
598 &bfin_gpios_device,
600 #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
601 &stamp_flash_device,
602 #endif
605 static int __init stamp_init(void)
607 int ret;
609 printk(KERN_INFO "%s(): registering device resources\n", __func__);
611 #ifdef CONFIG_I2C_BOARDINFO
612 i2c_register_board_info(0, bfin_i2c_board_info,
613 ARRAY_SIZE(bfin_i2c_board_info));
614 #endif
616 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
617 if (ret < 0)
618 return ret;
620 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
621 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
622 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
623 bfin_write_FIO_FLAG_S(PF0);
624 SSYNC();
625 #endif
627 spi_register_board_info(bfin_spi_board_info, 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;
631 #endif
632 return 0;
635 arch_initcall(stamp_init);
637 void native_machine_restart(char *cmd)
639 /* workaround pull up on cpld / flash pin not being strong enough */
640 bfin_write_FIO_INEN(~PF0);
641 bfin_write_FIO_DIR(PF0);
642 bfin_write_FIO_FLAG_C(PF0);