]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/blackfin/mach-bf537/boards/stamp.c
[Blackfin] arch: add Blackfin on-chip SIR IrDA driver support
[net-next-2.6.git] / arch / blackfin / mach-bf537 / boards / stamp.c
CommitLineData
1394f032
BW
1/*
2 * File: arch/blackfin/mach-bf537/boards/stamp.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
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.
19 *
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.
24 *
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
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
de8c43f2 35#include <linux/mtd/physmap.h>
1394f032
BW
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)
f02bcec5 39#include <linux/usb/isp1362.h>
1394f032 40#endif
0a87e3e9 41#include <linux/ata_platform.h>
1394f032
BW
42#include <linux/irq.h>
43#include <linux/interrupt.h>
81d9c7f2 44#include <linux/i2c.h>
27f5d75a 45#include <linux/usb/sl811.h>
c6c4d7bb 46#include <asm/dma.h>
1f83b8f1 47#include <asm/bfin5xx_spi.h>
c6c4d7bb 48#include <asm/reboot.h>
5d448dd5 49#include <asm/portmux.h>
1394f032
BW
50#include <linux/spi/ad7877.h>
51
52/*
53 * Name the Board for the /proc/cpuinfo
54 */
066954a3 55const char bfin_board_name[] = "ADDS-BF537-STAMP";
1394f032
BW
56
57/*
58 * Driver needs to know address, irq and flag pin.
59 */
60
61#define ISP1761_BASE 0x203C0000
62#define ISP1761_IRQ IRQ_PF7
63
64#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65static struct resource bfin_isp1761_resources[] = {
66 [0] = {
67 .name = "isp1761-regs",
68 .start = ISP1761_BASE + 0x00000000,
69 .end = ISP1761_BASE + 0x000fffff,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = ISP1761_IRQ,
74 .end = ISP1761_IRQ,
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct platform_device bfin_isp1761_device = {
80 .name = "isp1761",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
83 .resource = bfin_isp1761_resources,
84};
85
86static struct platform_device *bfin_isp1761_devices[] = {
87 &bfin_isp1761_device,
88};
89
90int __init bfin_isp1761_init(void)
91{
1f83b8f1 92 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
1394f032 93
b85d858b 94 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1394f032
BW
95 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
96
97 return platform_add_devices(bfin_isp1761_devices, num_devices);
98}
99
100void __exit bfin_isp1761_exit(void)
101{
102 platform_device_unregister(&bfin_isp1761_device);
103}
104
105arch_initcall(bfin_isp1761_init);
106#endif
107
2463ef22
MH
108#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
109#include <linux/input.h>
110#include <linux/gpio_keys.h>
111
112static struct gpio_keys_button bfin_gpio_keys_table[] = {
113 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
114 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
115 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
116 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
117};
118
119static struct gpio_keys_platform_data bfin_gpio_keys_data = {
120 .buttons = bfin_gpio_keys_table,
121 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
122};
123
124static struct platform_device bfin_device_gpiokeys = {
125 .name = "gpio-keys",
126 .dev = {
127 .platform_data = &bfin_gpio_keys_data,
128 },
129};
130#endif
131
cad2ab65
MF
132static struct resource bfin_gpios_resources = {
133 .start = 0,
134 .end = MAX_BLACKFIN_GPIOS - 1,
135 .flags = IORESOURCE_IRQ,
136};
137
138static struct platform_device bfin_gpios_device = {
139 .name = "simple-gpio",
140 .id = -1,
141 .num_resources = 1,
142 .resource = &bfin_gpios_resources,
143};
144
1394f032
BW
145#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
146static struct resource bfin_pcmcia_cf_resources[] = {
147 {
148 .start = 0x20310000, /* IO PORT */
149 .end = 0x20312000,
150 .flags = IORESOURCE_MEM,
1f83b8f1 151 }, {
d2d50aa9 152 .start = 0x20311000, /* Attribute Memory */
1394f032
BW
153 .end = 0x20311FFF,
154 .flags = IORESOURCE_MEM,
1f83b8f1 155 }, {
1394f032
BW
156 .start = IRQ_PF4,
157 .end = IRQ_PF4,
158 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
1f83b8f1 159 }, {
1394f032
BW
160 .start = 6, /* Card Detect PF6 */
161 .end = 6,
162 .flags = IORESOURCE_IRQ,
163 },
164};
165
166static struct platform_device bfin_pcmcia_cf_device = {
167 .name = "bfin_cf_pcmcia",
168 .id = -1,
169 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
170 .resource = bfin_pcmcia_cf_resources,
171};
172#endif
173
174#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
175static struct platform_device rtc_device = {
176 .name = "rtc-bfin",
177 .id = -1,
178};
179#endif
180
181#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
182static struct resource smc91x_resources[] = {
183 {
184 .name = "smc91x-regs",
185 .start = 0x20300300,
186 .end = 0x20300300 + 16,
187 .flags = IORESOURCE_MEM,
1f83b8f1 188 }, {
1394f032
BW
189
190 .start = IRQ_PF7,
191 .end = IRQ_PF7,
192 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
193 },
194};
195static struct platform_device smc91x_device = {
196 .name = "smc91x",
197 .id = 0,
198 .num_resources = ARRAY_SIZE(smc91x_resources),
199 .resource = smc91x_resources,
200};
201#endif
202
f40d24d9
AL
203#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
204static struct resource dm9000_resources[] = {
205 [0] = {
206 .start = 0x203FB800,
207 .end = 0x203FB800 + 8,
208 .flags = IORESOURCE_MEM,
209 },
210 [1] = {
211 .start = IRQ_PF9,
212 .end = IRQ_PF9,
213 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
214 },
215};
216
217static struct platform_device dm9000_device = {
218 .name = "dm9000",
219 .id = -1,
220 .num_resources = ARRAY_SIZE(dm9000_resources),
221 .resource = dm9000_resources,
222};
223#endif
224
561cc18b
MH
225#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
226static struct resource ax88180_resources[] = {
227 [0] = {
228 .start = 0x20300000,
229 .end = 0x20300000 + 0x8000,
230 .flags = IORESOURCE_MEM,
231 },
232 [1] = {
233 .start = IRQ_PF7,
234 .end = IRQ_PF7,
235 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
236 },
237};
238
239static struct platform_device ax88180_device = {
240 .name = "ax88180",
241 .id = -1,
242 .num_resources = ARRAY_SIZE(ax88180_resources),
243 .resource = ax88180_resources,
244};
245#endif
246
1394f032
BW
247#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
248static struct resource sl811_hcd_resources[] = {
249 {
250 .start = 0x20340000,
251 .end = 0x20340000,
252 .flags = IORESOURCE_MEM,
1f83b8f1 253 }, {
1394f032
BW
254 .start = 0x20340004,
255 .end = 0x20340004,
256 .flags = IORESOURCE_MEM,
1f83b8f1 257 }, {
1394f032
BW
258 .start = CONFIG_USB_SL811_BFIN_IRQ,
259 .end = CONFIG_USB_SL811_BFIN_IRQ,
260 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
261 },
262};
263
264#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
265void sl811_port_power(struct device *dev, int is_on)
266{
c6c4d7bb 267 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
acbcd263 268 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
1394f032
BW
269}
270#endif
271
272static struct sl811_platform_data sl811_priv = {
273 .potpg = 10,
274 .power = 250, /* == 500mA */
275#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
276 .port_power = &sl811_port_power,
277#endif
278};
279
280static struct platform_device sl811_hcd_device = {
281 .name = "sl811-hcd",
282 .id = 0,
283 .dev = {
284 .platform_data = &sl811_priv,
285 },
286 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
287 .resource = sl811_hcd_resources,
288};
289#endif
290
291#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
292static struct resource isp1362_hcd_resources[] = {
293 {
294 .start = 0x20360000,
295 .end = 0x20360000,
296 .flags = IORESOURCE_MEM,
1f83b8f1 297 }, {
1394f032
BW
298 .start = 0x20360004,
299 .end = 0x20360004,
300 .flags = IORESOURCE_MEM,
1f83b8f1 301 }, {
1394f032
BW
302 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
303 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
304 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
305 },
306};
307
308static struct isp1362_platform_data isp1362_priv = {
309 .sel15Kres = 1,
310 .clknotstop = 0,
311 .oc_enable = 0,
312 .int_act_high = 0,
313 .int_edge_triggered = 0,
314 .remote_wakeup_connected = 0,
315 .no_power_switching = 1,
316 .power_switching_mode = 0,
317};
318
319static struct platform_device isp1362_hcd_device = {
320 .name = "isp1362-hcd",
321 .id = 0,
322 .dev = {
323 .platform_data = &isp1362_priv,
324 },
325 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
326 .resource = isp1362_hcd_resources,
327};
328#endif
329
330#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
331static struct platform_device bfin_mac_device = {
332 .name = "bfin_mac",
333};
334#endif
335
336#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
337static struct resource net2272_bfin_resources[] = {
338 {
339 .start = 0x20300000,
340 .end = 0x20300000 + 0x100,
341 .flags = IORESOURCE_MEM,
1f83b8f1 342 }, {
1394f032
BW
343 .start = IRQ_PF7,
344 .end = IRQ_PF7,
345 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
346 },
347};
348
349static struct platform_device net2272_bfin_device = {
350 .name = "net2272",
351 .id = -1,
352 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
353 .resource = net2272_bfin_resources,
354};
355#endif
356
793dc27b 357#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2
MF
358static struct mtd_partition stamp_partitions[] = {
359 {
360 .name = "Bootloader",
edf05641 361 .size = 0x40000,
de8c43f2
MF
362 .offset = 0,
363 }, {
364 .name = "Kernel",
365 .size = 0xE0000,
366 .offset = MTDPART_OFS_APPEND,
367 }, {
368 .name = "RootFS",
edf05641 369 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
de8c43f2
MF
370 .offset = MTDPART_OFS_APPEND,
371 }, {
372 .name = "MAC Address",
373 .size = MTDPART_SIZ_FULL,
374 .offset = 0x3F0000,
375 .mask_flags = MTD_WRITEABLE,
376 }
377};
378
379static struct physmap_flash_data stamp_flash_data = {
380 .width = 2,
381 .parts = stamp_partitions,
382 .nr_parts = ARRAY_SIZE(stamp_partitions),
383};
384
385static struct resource stamp_flash_resource = {
386 .start = 0x20000000,
387 .end = 0x203fffff,
388 .flags = IORESOURCE_MEM,
389};
390
391static struct platform_device stamp_flash_device = {
392 .name = "physmap-flash",
393 .id = 0,
394 .dev = {
395 .platform_data = &stamp_flash_data,
396 },
397 .num_resources = 1,
398 .resource = &stamp_flash_resource,
399};
793dc27b 400#endif
de8c43f2 401
1394f032
BW
402#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
403/* all SPI peripherals info goes here */
404
405#if defined(CONFIG_MTD_M25P80) \
406 || defined(CONFIG_MTD_M25P80_MODULE)
407static struct mtd_partition bfin_spi_flash_partitions[] = {
408 {
409 .name = "bootloader",
edf05641 410 .size = 0x00040000,
1394f032
BW
411 .offset = 0,
412 .mask_flags = MTD_CAP_ROM
1f83b8f1 413 }, {
1394f032
BW
414 .name = "kernel",
415 .size = 0xe0000,
edf05641 416 .offset = MTDPART_OFS_APPEND,
1f83b8f1 417 }, {
1394f032 418 .name = "file system",
edf05641
MF
419 .size = MTDPART_SIZ_FULL,
420 .offset = MTDPART_OFS_APPEND,
1394f032
BW
421 }
422};
423
424static struct flash_platform_data bfin_spi_flash_data = {
425 .name = "m25p80",
426 .parts = bfin_spi_flash_partitions,
427 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
428 .type = "m25p64",
429};
430
431/* SPI flash chip (m25p64) */
432static struct bfin5xx_spi_chip spi_flash_chip_info = {
433 .enable_dma = 0, /* use dma transfer with this chip*/
434 .bits_per_word = 8,
435};
436#endif
437
438#if defined(CONFIG_SPI_ADC_BF533) \
439 || defined(CONFIG_SPI_ADC_BF533_MODULE)
440/* SPI ADC chip */
441static struct bfin5xx_spi_chip spi_adc_chip_info = {
442 .enable_dma = 1, /* use dma transfer with this chip*/
443 .bits_per_word = 16,
444};
445#endif
446
447#if defined(CONFIG_SND_BLACKFIN_AD1836) \
448 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
449static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
450 .enable_dma = 0,
451 .bits_per_word = 16,
452};
453#endif
454
455#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
456static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
457 .enable_dma = 0,
458 .bits_per_word = 16,
459};
460#endif
461
462#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
463static struct bfin5xx_spi_chip spi_mmc_chip_info = {
464 .enable_dma = 1,
465 .bits_per_word = 8,
466};
467#endif
468
469#if defined(CONFIG_PBX)
470static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
471 .ctl_reg = 0x4, /* send zero */
472 .enable_dma = 0,
473 .bits_per_word = 8,
474 .cs_change_per_word = 1,
475};
476#endif
477
1394f032
BW
478#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
479static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
1394f032
BW
480 .enable_dma = 0,
481 .bits_per_word = 16,
482};
483
484static const struct ad7877_platform_data bfin_ad7877_ts_info = {
485 .model = 7877,
486 .vref_delay_usecs = 50, /* internal, no capacitor */
487 .x_plate_ohms = 419,
488 .y_plate_ohms = 486,
489 .pressure_max = 1000,
490 .pressure_min = 0,
491 .stopacq_polarity = 1,
492 .first_conversion_delay = 3,
493 .acquisition_time = 1,
494 .averaging = 1,
495 .pen_down_acc_interval = 1,
496};
497#endif
498
6e668936
MH
499#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
500static struct bfin5xx_spi_chip spidev_chip_info = {
501 .enable_dma = 0,
502 .bits_per_word = 8,
503};
504#endif
505
8e9d5c7d
MH
506#if defined(CONFIG_MTD_DATAFLASH) \
507 || defined(CONFIG_MTD_DATAFLASH_MODULE)
508/* DataFlash chip */
509static struct bfin5xx_spi_chip data_flash_chip_info = {
510 .enable_dma = 0, /* use dma transfer with this chip*/
511 .bits_per_word = 8,
512};
513#endif
514
1394f032
BW
515static struct spi_board_info bfin_spi_board_info[] __initdata = {
516#if defined(CONFIG_MTD_M25P80) \
517 || defined(CONFIG_MTD_M25P80_MODULE)
518 {
519 /* the modalias must be the same as spi device driver name */
520 .modalias = "m25p80", /* Name of spi_driver for this device */
521 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 522 .bus_num = 0, /* Framework bus number */
1394f032
BW
523 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
524 .platform_data = &bfin_spi_flash_data,
525 .controller_data = &spi_flash_chip_info,
526 .mode = SPI_MODE_3,
527 },
528#endif
8e9d5c7d
MH
529#if defined(CONFIG_MTD_DATAFLASH) \
530 || defined(CONFIG_MTD_DATAFLASH_MODULE)
531 { /* DataFlash chip */
532 .modalias = "mtd_dataflash",
533 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
534 .bus_num = 0, /* Framework bus number */
535 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
536 .controller_data = &data_flash_chip_info,
537 .mode = SPI_MODE_3,
538 },
539#endif
1394f032
BW
540#if defined(CONFIG_SPI_ADC_BF533) \
541 || defined(CONFIG_SPI_ADC_BF533_MODULE)
542 {
543 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
544 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 545 .bus_num = 0, /* Framework bus number */
1394f032
BW
546 .chip_select = 1, /* Framework chip select. */
547 .platform_data = NULL, /* No spi_driver specific config */
548 .controller_data = &spi_adc_chip_info,
549 },
550#endif
551
552#if defined(CONFIG_SND_BLACKFIN_AD1836) \
553 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
554 {
555 .modalias = "ad1836-spi",
556 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 557 .bus_num = 0,
1394f032
BW
558 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
559 .controller_data = &ad1836_spi_chip_info,
560 },
561#endif
562#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
563 {
564 .modalias = "ad9960-spi",
565 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 566 .bus_num = 0,
1394f032
BW
567 .chip_select = 1,
568 .controller_data = &ad9960_spi_chip_info,
569 },
570#endif
571#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
572 {
573 .modalias = "spi_mmc_dummy",
111cf97d 574 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 575 .bus_num = 0,
1394f032
BW
576 .chip_select = 0,
577 .platform_data = NULL,
578 .controller_data = &spi_mmc_chip_info,
579 .mode = SPI_MODE_3,
580 },
581 {
582 .modalias = "spi_mmc",
111cf97d 583 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 584 .bus_num = 0,
1394f032
BW
585 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
586 .platform_data = NULL,
587 .controller_data = &spi_mmc_chip_info,
588 .mode = SPI_MODE_3,
589 },
590#endif
591#if defined(CONFIG_PBX)
592 {
1f83b8f1
MF
593 .modalias = "fxs-spi",
594 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb
BW
595 .bus_num = 0,
596 .chip_select = 8 - CONFIG_J11_JUMPER,
1f83b8f1 597 .controller_data = &spi_si3xxx_chip_info,
1394f032
BW
598 .mode = SPI_MODE_3,
599 },
600 {
1f83b8f1
MF
601 .modalias = "fxo-spi",
602 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb
BW
603 .bus_num = 0,
604 .chip_select = 8 - CONFIG_J19_JUMPER,
1f83b8f1 605 .controller_data = &spi_si3xxx_chip_info,
1394f032
BW
606 .mode = SPI_MODE_3,
607 },
608#endif
1394f032
BW
609#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
610 {
611 .modalias = "ad7877",
612 .platform_data = &bfin_ad7877_ts_info,
613 .irq = IRQ_PF6,
614 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
c7d48966 615 .bus_num = 0,
1394f032
BW
616 .chip_select = 1,
617 .controller_data = &spi_ad7877_chip_info,
618 },
619#endif
6e668936
MH
620#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
621 {
622 .modalias = "spidev",
623 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
624 .bus_num = 0,
625 .chip_select = 1,
626 .controller_data = &spidev_chip_info,
627 },
628#endif
1394f032
BW
629};
630
631/* SPI controller data */
c6c4d7bb 632static struct bfin5xx_spi_master bfin_spi0_info = {
1394f032
BW
633 .num_chipselect = 8,
634 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 635 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1394f032
BW
636};
637
c6c4d7bb
BW
638/* SPI (0) */
639static struct resource bfin_spi0_resource[] = {
640 [0] = {
641 .start = SPI0_REGBASE,
642 .end = SPI0_REGBASE + 0xFF,
643 .flags = IORESOURCE_MEM,
644 },
645 [1] = {
646 .start = CH_SPI,
647 .end = CH_SPI,
648 .flags = IORESOURCE_IRQ,
649 },
650};
651
652static struct platform_device bfin_spi0_device = {
653 .name = "bfin-spi",
654 .id = 0, /* Bus number */
655 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
656 .resource = bfin_spi0_resource,
1394f032 657 .dev = {
c6c4d7bb 658 .platform_data = &bfin_spi0_info, /* Passed to driver */
1394f032
BW
659 },
660};
661#endif /* spi master and devices */
662
663#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
664static struct platform_device bfin_fb_device = {
c6c4d7bb
BW
665 .name = "bf537-lq035",
666};
667#endif
668
669#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
670static struct platform_device bfin_fb_adv7393_device = {
671 .name = "bfin-adv7393",
1394f032
BW
672};
673#endif
674
675#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
676static struct resource bfin_uart_resources[] = {
233b28a9 677#ifdef CONFIG_SERIAL_BFIN_UART0
1394f032
BW
678 {
679 .start = 0xFFC00400,
680 .end = 0xFFC004FF,
681 .flags = IORESOURCE_MEM,
233b28a9
SZ
682 },
683#endif
684#ifdef CONFIG_SERIAL_BFIN_UART1
685 {
1394f032
BW
686 .start = 0xFFC02000,
687 .end = 0xFFC020FF,
688 .flags = IORESOURCE_MEM,
689 },
233b28a9 690#endif
1394f032
BW
691};
692
693static struct platform_device bfin_uart_device = {
694 .name = "bfin-uart",
695 .id = 1,
696 .num_resources = ARRAY_SIZE(bfin_uart_resources),
697 .resource = bfin_uart_resources,
698};
699#endif
700
5be36d22
GY
701#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
702static struct resource bfin_sir_resources[] = {
703#ifdef CONFIG_BFIN_SIR0
704 {
705 .start = 0xFFC00400,
706 .end = 0xFFC004FF,
707 .flags = IORESOURCE_MEM,
708 },
709#endif
710#ifdef CONFIG_BFIN_SIR1
711 {
712 .start = 0xFFC02000,
713 .end = 0xFFC020FF,
714 .flags = IORESOURCE_MEM,
715 },
716#endif
717};
718
719static struct platform_device bfin_sir_device = {
720 .name = "bfin_sir",
721 .id = 0,
722 .num_resources = ARRAY_SIZE(bfin_sir_resources),
723 .resource = bfin_sir_resources,
724};
725#endif
726
1394f032 727#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
c6c4d7bb
BW
728static struct resource bfin_twi0_resource[] = {
729 [0] = {
730 .start = TWI0_REGBASE,
731 .end = TWI0_REGBASE,
732 .flags = IORESOURCE_MEM,
733 },
734 [1] = {
735 .start = IRQ_TWI,
736 .end = IRQ_TWI,
737 .flags = IORESOURCE_IRQ,
738 },
739};
740
1394f032
BW
741static struct platform_device i2c_bfin_twi_device = {
742 .name = "i2c-bfin-twi",
743 .id = 0,
c6c4d7bb
BW
744 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
745 .resource = bfin_twi0_resource,
1394f032
BW
746};
747#endif
748
81d9c7f2
BW
749#ifdef CONFIG_I2C_BOARDINFO
750static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
751#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
752 {
753 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
754 .type = "ad7142_joystick",
755 .irq = 55,
756 },
757#endif
758#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
759 {
760 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
761 .type = "pcf8574_lcd",
762 },
763#endif
764#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
765 {
766 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
767 .type = "pcf8574_keypad",
768 .irq = 72,
769 },
770#endif
771};
772#endif
773
1394f032
BW
774#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
775static struct platform_device bfin_sport0_uart_device = {
776 .name = "bfin-sport-uart",
777 .id = 0,
778};
779
780static struct platform_device bfin_sport1_uart_device = {
781 .name = "bfin-sport-uart",
782 .id = 1,
783};
784#endif
785
c6c4d7bb
BW
786#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
787#define PATA_INT 55
788
789static struct pata_platform_info bfin_pata_platform_data = {
790 .ioport_shift = 1,
64e5c512 791 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
c6c4d7bb
BW
792};
793
794static struct resource bfin_pata_resources[] = {
795 {
796 .start = 0x20314020,
797 .end = 0x2031403F,
798 .flags = IORESOURCE_MEM,
799 },
800 {
801 .start = 0x2031401C,
802 .end = 0x2031401F,
803 .flags = IORESOURCE_MEM,
804 },
805 {
806 .start = PATA_INT,
807 .end = PATA_INT,
808 .flags = IORESOURCE_IRQ,
809 },
810};
811
812static struct platform_device bfin_pata_device = {
813 .name = "pata_platform",
814 .id = -1,
815 .num_resources = ARRAY_SIZE(bfin_pata_resources),
816 .resource = bfin_pata_resources,
817 .dev = {
818 .platform_data = &bfin_pata_platform_data,
819 }
820};
821#endif
822
1394f032
BW
823static struct platform_device *stamp_devices[] __initdata = {
824#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
825 &bfin_pcmcia_cf_device,
826#endif
827
828#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
829 &rtc_device,
830#endif
831
832#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
833 &sl811_hcd_device,
834#endif
835
836#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
837 &isp1362_hcd_device,
838#endif
839
840#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
841 &smc91x_device,
842#endif
843
f40d24d9
AL
844#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
845 &dm9000_device,
846#endif
847
561cc18b
MH
848#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
849 &ax88180_device,
850#endif
851
1394f032
BW
852#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
853 &bfin_mac_device,
854#endif
855
856#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
857 &net2272_bfin_device,
858#endif
859
860#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb 861 &bfin_spi0_device,
1394f032
BW
862#endif
863
864#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
865 &bfin_fb_device,
866#endif
867
c6c4d7bb
BW
868#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
869 &bfin_fb_adv7393_device,
870#endif
871
1394f032
BW
872#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
873 &bfin_uart_device,
874#endif
875
5be36d22
GY
876#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
877 &bfin_sir_device,
878#endif
879
1394f032
BW
880#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
881 &i2c_bfin_twi_device,
882#endif
883
884#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
885 &bfin_sport0_uart_device,
886 &bfin_sport1_uart_device,
887#endif
c6c4d7bb
BW
888
889#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
890 &bfin_pata_device,
891#endif
2463ef22
MH
892
893#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
894 &bfin_device_gpiokeys,
895#endif
cad2ab65
MF
896
897 &bfin_gpios_device,
793dc27b
MF
898
899#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
de8c43f2 900 &stamp_flash_device,
793dc27b 901#endif
1394f032
BW
902};
903
904static int __init stamp_init(void)
905{
b85d858b 906 printk(KERN_INFO "%s(): registering device resources\n", __func__);
81d9c7f2
BW
907
908#ifdef CONFIG_I2C_BOARDINFO
909 i2c_register_board_info(0, bfin_i2c_board_info,
910 ARRAY_SIZE(bfin_i2c_board_info));
911#endif
912
1394f032
BW
913 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
914#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
915 spi_register_board_info(bfin_spi_board_info,
916 ARRAY_SIZE(bfin_spi_board_info));
917#endif
c6c4d7bb
BW
918
919#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
920 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
921#endif
81d9c7f2 922
1394f032
BW
923 return 0;
924}
925
926arch_initcall(stamp_init);
c6c4d7bb
BW
927
928void native_machine_restart(char *cmd)
929{
930 /* workaround reboot hang when booting from SPI */
931 if ((bfin_read_SYSCR() & 0x7) == 0x3)
932 bfin_gpio_reset_spi0_ssel1();
933}
137b1529
MF
934
935/*
936 * Currently the MAC address is saved in Flash by U-Boot
937 */
938#define FLASH_MAC 0x203f0000
9862cc52 939void bfin_get_ether_addr(char *addr)
137b1529
MF
940{
941 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
942 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
943}
9862cc52 944EXPORT_SYMBOL(bfin_get_ether_addr);