blob: 7a5629a0c374f1bf11932339fb08eeaa20d40aab [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
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>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080035#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070040#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050041#include <linux/ata_platform.h>
Bryan Wu1394f032007-05-06 14:50:22 -070042#include <linux/irq.h>
43#include <linux/interrupt.h>
David Brownell27f5d752007-10-04 18:06:16 -070044#include <linux/usb/sl811.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080045#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080046#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080047#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080048#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070049#include <linux/spi/ad7877.h>
50
51/*
52 * Name the Board for the /proc/cpuinfo
53 */
Mike Frysinger066954a2007-10-21 22:36:06 +080054const char bfin_board_name[] = "ADDS-BF537-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070055
56/*
57 * Driver needs to know address, irq and flag pin.
58 */
59
60#define ISP1761_BASE 0x203C0000
61#define ISP1761_IRQ IRQ_PF7
62
63#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
64static struct resource bfin_isp1761_resources[] = {
65 [0] = {
66 .name = "isp1761-regs",
67 .start = ISP1761_BASE + 0x00000000,
68 .end = ISP1761_BASE + 0x000fffff,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = ISP1761_IRQ,
73 .end = ISP1761_IRQ,
74 .flags = IORESOURCE_IRQ,
75 },
76};
77
78static struct platform_device bfin_isp1761_device = {
79 .name = "isp1761",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
82 .resource = bfin_isp1761_resources,
83};
84
85static struct platform_device *bfin_isp1761_devices[] = {
86 &bfin_isp1761_device,
87};
88
89int __init bfin_isp1761_init(void)
90{
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080091 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
Bryan Wu1394f032007-05-06 14:50:22 -070092
93 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
94 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
95
96 return platform_add_devices(bfin_isp1761_devices, num_devices);
97}
98
99void __exit bfin_isp1761_exit(void)
100{
101 platform_device_unregister(&bfin_isp1761_device);
102}
103
104arch_initcall(bfin_isp1761_init);
105#endif
106
Michael Hennerich2463ef22008-01-27 16:49:48 +0800107#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
108#include <linux/input.h>
109#include <linux/gpio_keys.h>
110
111static struct gpio_keys_button bfin_gpio_keys_table[] = {
112 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
113 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
114 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
115 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
116};
117
118static struct gpio_keys_platform_data bfin_gpio_keys_data = {
119 .buttons = bfin_gpio_keys_table,
120 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
121};
122
123static struct platform_device bfin_device_gpiokeys = {
124 .name = "gpio-keys",
125 .dev = {
126 .platform_data = &bfin_gpio_keys_data,
127 },
128};
129#endif
130
Mike Frysingercad2ab62008-02-22 17:01:31 +0800131static struct resource bfin_gpios_resources = {
132 .start = 0,
133 .end = MAX_BLACKFIN_GPIOS - 1,
134 .flags = IORESOURCE_IRQ,
135};
136
137static struct platform_device bfin_gpios_device = {
138 .name = "simple-gpio",
139 .id = -1,
140 .num_resources = 1,
141 .resource = &bfin_gpios_resources,
142};
143
Bryan Wu1394f032007-05-06 14:50:22 -0700144#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
145static struct resource bfin_pcmcia_cf_resources[] = {
146 {
147 .start = 0x20310000, /* IO PORT */
148 .end = 0x20312000,
149 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800150 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800151 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700152 .end = 0x20311FFF,
153 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800154 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700155 .start = IRQ_PF4,
156 .end = IRQ_PF4,
157 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800158 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700159 .start = 6, /* Card Detect PF6 */
160 .end = 6,
161 .flags = IORESOURCE_IRQ,
162 },
163};
164
165static struct platform_device bfin_pcmcia_cf_device = {
166 .name = "bfin_cf_pcmcia",
167 .id = -1,
168 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
169 .resource = bfin_pcmcia_cf_resources,
170};
171#endif
172
173#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
174static struct platform_device rtc_device = {
175 .name = "rtc-bfin",
176 .id = -1,
177};
178#endif
179
180#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
181static struct resource smc91x_resources[] = {
182 {
183 .name = "smc91x-regs",
184 .start = 0x20300300,
185 .end = 0x20300300 + 16,
186 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800187 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700188
189 .start = IRQ_PF7,
190 .end = IRQ_PF7,
191 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
192 },
193};
194static struct platform_device smc91x_device = {
195 .name = "smc91x",
196 .id = 0,
197 .num_resources = ARRAY_SIZE(smc91x_resources),
198 .resource = smc91x_resources,
199};
200#endif
201
Alex Landauf40d24d2007-07-12 12:11:48 +0800202#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
203static struct resource dm9000_resources[] = {
204 [0] = {
205 .start = 0x203FB800,
206 .end = 0x203FB800 + 8,
207 .flags = IORESOURCE_MEM,
208 },
209 [1] = {
210 .start = IRQ_PF9,
211 .end = IRQ_PF9,
212 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
213 },
214};
215
216static struct platform_device dm9000_device = {
217 .name = "dm9000",
218 .id = -1,
219 .num_resources = ARRAY_SIZE(dm9000_resources),
220 .resource = dm9000_resources,
221};
222#endif
223
Michael Hennerich561cc182007-11-17 23:56:08 +0800224#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
225static struct resource ax88180_resources[] = {
226 [0] = {
227 .start = 0x20300000,
228 .end = 0x20300000 + 0x8000,
229 .flags = IORESOURCE_MEM,
230 },
231 [1] = {
232 .start = IRQ_PF7,
233 .end = IRQ_PF7,
234 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
235 },
236};
237
238static struct platform_device ax88180_device = {
239 .name = "ax88180",
240 .id = -1,
241 .num_resources = ARRAY_SIZE(ax88180_resources),
242 .resource = ax88180_resources,
243};
244#endif
245
Bryan Wu1394f032007-05-06 14:50:22 -0700246#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
247static struct resource sl811_hcd_resources[] = {
248 {
249 .start = 0x20340000,
250 .end = 0x20340000,
251 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800252 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700253 .start = 0x20340004,
254 .end = 0x20340004,
255 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800256 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700257 .start = CONFIG_USB_SL811_BFIN_IRQ,
258 .end = CONFIG_USB_SL811_BFIN_IRQ,
259 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
260 },
261};
262
263#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
264void sl811_port_power(struct device *dev, int is_on)
265{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800266 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800267 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Bryan Wu1394f032007-05-06 14:50:22 -0700268}
269#endif
270
271static struct sl811_platform_data sl811_priv = {
272 .potpg = 10,
273 .power = 250, /* == 500mA */
274#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
275 .port_power = &sl811_port_power,
276#endif
277};
278
279static struct platform_device sl811_hcd_device = {
280 .name = "sl811-hcd",
281 .id = 0,
282 .dev = {
283 .platform_data = &sl811_priv,
284 },
285 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
286 .resource = sl811_hcd_resources,
287};
288#endif
289
290#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
291static struct resource isp1362_hcd_resources[] = {
292 {
293 .start = 0x20360000,
294 .end = 0x20360000,
295 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800296 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700297 .start = 0x20360004,
298 .end = 0x20360004,
299 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800300 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700301 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
302 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
303 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
304 },
305};
306
307static struct isp1362_platform_data isp1362_priv = {
308 .sel15Kres = 1,
309 .clknotstop = 0,
310 .oc_enable = 0,
311 .int_act_high = 0,
312 .int_edge_triggered = 0,
313 .remote_wakeup_connected = 0,
314 .no_power_switching = 1,
315 .power_switching_mode = 0,
316};
317
318static struct platform_device isp1362_hcd_device = {
319 .name = "isp1362-hcd",
320 .id = 0,
321 .dev = {
322 .platform_data = &isp1362_priv,
323 },
324 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
325 .resource = isp1362_hcd_resources,
326};
327#endif
328
329#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
330static struct platform_device bfin_mac_device = {
331 .name = "bfin_mac",
332};
333#endif
334
335#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
336static struct resource net2272_bfin_resources[] = {
337 {
338 .start = 0x20300000,
339 .end = 0x20300000 + 0x100,
340 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800341 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700342 .start = IRQ_PF7,
343 .end = IRQ_PF7,
344 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
345 },
346};
347
348static struct platform_device net2272_bfin_device = {
349 .name = "net2272",
350 .id = -1,
351 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
352 .resource = net2272_bfin_resources,
353};
354#endif
355
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800356static struct mtd_partition stamp_partitions[] = {
357 {
358 .name = "Bootloader",
Mike Frysingeredf05642008-02-25 11:38:11 +0800359 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800360 .offset = 0,
361 }, {
362 .name = "Kernel",
363 .size = 0xE0000,
364 .offset = MTDPART_OFS_APPEND,
365 }, {
366 .name = "RootFS",
Mike Frysingeredf05642008-02-25 11:38:11 +0800367 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800368 .offset = MTDPART_OFS_APPEND,
369 }, {
370 .name = "MAC Address",
371 .size = MTDPART_SIZ_FULL,
372 .offset = 0x3F0000,
373 .mask_flags = MTD_WRITEABLE,
374 }
375};
376
377static struct physmap_flash_data stamp_flash_data = {
378 .width = 2,
379 .parts = stamp_partitions,
380 .nr_parts = ARRAY_SIZE(stamp_partitions),
381};
382
383static struct resource stamp_flash_resource = {
384 .start = 0x20000000,
385 .end = 0x203fffff,
386 .flags = IORESOURCE_MEM,
387};
388
389static struct platform_device stamp_flash_device = {
390 .name = "physmap-flash",
391 .id = 0,
392 .dev = {
393 .platform_data = &stamp_flash_data,
394 },
395 .num_resources = 1,
396 .resource = &stamp_flash_resource,
397};
398
Bryan Wu1394f032007-05-06 14:50:22 -0700399#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
400/* all SPI peripherals info goes here */
401
402#if defined(CONFIG_MTD_M25P80) \
403 || defined(CONFIG_MTD_M25P80_MODULE)
404static struct mtd_partition bfin_spi_flash_partitions[] = {
405 {
406 .name = "bootloader",
Mike Frysingeredf05642008-02-25 11:38:11 +0800407 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700408 .offset = 0,
409 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800410 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700411 .name = "kernel",
412 .size = 0xe0000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800413 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800414 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700415 .name = "file system",
Mike Frysingeredf05642008-02-25 11:38:11 +0800416 .size = MTDPART_SIZ_FULL,
417 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700418 }
419};
420
421static struct flash_platform_data bfin_spi_flash_data = {
422 .name = "m25p80",
423 .parts = bfin_spi_flash_partitions,
424 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
425 .type = "m25p64",
426};
427
428/* SPI flash chip (m25p64) */
429static struct bfin5xx_spi_chip spi_flash_chip_info = {
430 .enable_dma = 0, /* use dma transfer with this chip*/
431 .bits_per_word = 8,
432};
433#endif
434
435#if defined(CONFIG_SPI_ADC_BF533) \
436 || defined(CONFIG_SPI_ADC_BF533_MODULE)
437/* SPI ADC chip */
438static struct bfin5xx_spi_chip spi_adc_chip_info = {
439 .enable_dma = 1, /* use dma transfer with this chip*/
440 .bits_per_word = 16,
441};
442#endif
443
444#if defined(CONFIG_SND_BLACKFIN_AD1836) \
445 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
446static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
447 .enable_dma = 0,
448 .bits_per_word = 16,
449};
450#endif
451
452#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
453static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
454 .enable_dma = 0,
455 .bits_per_word = 16,
456};
457#endif
458
459#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
460static struct bfin5xx_spi_chip spi_mmc_chip_info = {
461 .enable_dma = 1,
462 .bits_per_word = 8,
463};
464#endif
465
466#if defined(CONFIG_PBX)
467static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
468 .ctl_reg = 0x4, /* send zero */
469 .enable_dma = 0,
470 .bits_per_word = 8,
471 .cs_change_per_word = 1,
472};
473#endif
474
475#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
476static struct bfin5xx_spi_chip ad5304_chip_info = {
477 .enable_dma = 0,
478 .bits_per_word = 16,
479};
480#endif
481
482#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
483static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700484 .enable_dma = 0,
485 .bits_per_word = 16,
486};
487
488static const struct ad7877_platform_data bfin_ad7877_ts_info = {
489 .model = 7877,
490 .vref_delay_usecs = 50, /* internal, no capacitor */
491 .x_plate_ohms = 419,
492 .y_plate_ohms = 486,
493 .pressure_max = 1000,
494 .pressure_min = 0,
495 .stopacq_polarity = 1,
496 .first_conversion_delay = 3,
497 .acquisition_time = 1,
498 .averaging = 1,
499 .pen_down_acc_interval = 1,
500};
501#endif
502
Michael Hennerich6e668932008-02-09 01:54:09 +0800503#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
504static struct bfin5xx_spi_chip spidev_chip_info = {
505 .enable_dma = 0,
506 .bits_per_word = 8,
507};
508#endif
509
Bryan Wu1394f032007-05-06 14:50:22 -0700510static struct spi_board_info bfin_spi_board_info[] __initdata = {
511#if defined(CONFIG_MTD_M25P80) \
512 || defined(CONFIG_MTD_M25P80_MODULE)
513 {
514 /* the modalias must be the same as spi device driver name */
515 .modalias = "m25p80", /* Name of spi_driver for this device */
516 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800517 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700518 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
519 .platform_data = &bfin_spi_flash_data,
520 .controller_data = &spi_flash_chip_info,
521 .mode = SPI_MODE_3,
522 },
523#endif
524
525#if defined(CONFIG_SPI_ADC_BF533) \
526 || defined(CONFIG_SPI_ADC_BF533_MODULE)
527 {
528 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
529 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800530 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700531 .chip_select = 1, /* Framework chip select. */
532 .platform_data = NULL, /* No spi_driver specific config */
533 .controller_data = &spi_adc_chip_info,
534 },
535#endif
536
537#if defined(CONFIG_SND_BLACKFIN_AD1836) \
538 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
539 {
540 .modalias = "ad1836-spi",
541 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800542 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700543 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
544 .controller_data = &ad1836_spi_chip_info,
545 },
546#endif
547#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
548 {
549 .modalias = "ad9960-spi",
550 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800551 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700552 .chip_select = 1,
553 .controller_data = &ad9960_spi_chip_info,
554 },
555#endif
556#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
557 {
558 .modalias = "spi_mmc_dummy",
Sonic Zhang111cf972007-10-30 11:48:42 +0800559 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800560 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700561 .chip_select = 0,
562 .platform_data = NULL,
563 .controller_data = &spi_mmc_chip_info,
564 .mode = SPI_MODE_3,
565 },
566 {
567 .modalias = "spi_mmc",
Sonic Zhang111cf972007-10-30 11:48:42 +0800568 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800569 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700570 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
571 .platform_data = NULL,
572 .controller_data = &spi_mmc_chip_info,
573 .mode = SPI_MODE_3,
574 },
575#endif
576#if defined(CONFIG_PBX)
577 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800578 .modalias = "fxs-spi",
579 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800580 .bus_num = 0,
581 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800582 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700583 .mode = SPI_MODE_3,
584 },
585 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800586 .modalias = "fxo-spi",
587 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800588 .bus_num = 0,
589 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800590 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700591 .mode = SPI_MODE_3,
592 },
593#endif
594#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
595 {
596 .modalias = "ad5304_spi",
597 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800598 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700599 .chip_select = 2,
600 .platform_data = NULL,
601 .controller_data = &ad5304_chip_info,
602 .mode = SPI_MODE_2,
603 },
604#endif
605#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
606 {
607 .modalias = "ad7877",
608 .platform_data = &bfin_ad7877_ts_info,
609 .irq = IRQ_PF6,
610 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800611 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700612 .chip_select = 1,
613 .controller_data = &spi_ad7877_chip_info,
614 },
615#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800616#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
617 {
618 .modalias = "spidev",
619 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
620 .bus_num = 0,
621 .chip_select = 1,
622 .controller_data = &spidev_chip_info,
623 },
624#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700625};
626
627/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800628static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700629 .num_chipselect = 8,
630 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800631 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700632};
633
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800634/* SPI (0) */
635static struct resource bfin_spi0_resource[] = {
636 [0] = {
637 .start = SPI0_REGBASE,
638 .end = SPI0_REGBASE + 0xFF,
639 .flags = IORESOURCE_MEM,
640 },
641 [1] = {
642 .start = CH_SPI,
643 .end = CH_SPI,
644 .flags = IORESOURCE_IRQ,
645 },
646};
647
648static struct platform_device bfin_spi0_device = {
649 .name = "bfin-spi",
650 .id = 0, /* Bus number */
651 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
652 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700653 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800654 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700655 },
656};
657#endif /* spi master and devices */
658
659#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
660static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800661 .name = "bf537-lq035",
662};
663#endif
664
665#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
666static struct platform_device bfin_fb_adv7393_device = {
667 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -0700668};
669#endif
670
671#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
672static struct resource bfin_uart_resources[] = {
Sonic Zhang233b28a2007-11-21 17:04:41 +0800673#ifdef CONFIG_SERIAL_BFIN_UART0
Bryan Wu1394f032007-05-06 14:50:22 -0700674 {
675 .start = 0xFFC00400,
676 .end = 0xFFC004FF,
677 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +0800678 },
679#endif
680#ifdef CONFIG_SERIAL_BFIN_UART1
681 {
Bryan Wu1394f032007-05-06 14:50:22 -0700682 .start = 0xFFC02000,
683 .end = 0xFFC020FF,
684 .flags = IORESOURCE_MEM,
685 },
Sonic Zhang233b28a2007-11-21 17:04:41 +0800686#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700687};
688
689static struct platform_device bfin_uart_device = {
690 .name = "bfin-uart",
691 .id = 1,
692 .num_resources = ARRAY_SIZE(bfin_uart_resources),
693 .resource = bfin_uart_resources,
694};
695#endif
696
697#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800698static struct resource bfin_twi0_resource[] = {
699 [0] = {
700 .start = TWI0_REGBASE,
701 .end = TWI0_REGBASE,
702 .flags = IORESOURCE_MEM,
703 },
704 [1] = {
705 .start = IRQ_TWI,
706 .end = IRQ_TWI,
707 .flags = IORESOURCE_IRQ,
708 },
709};
710
Bryan Wu1394f032007-05-06 14:50:22 -0700711static struct platform_device i2c_bfin_twi_device = {
712 .name = "i2c-bfin-twi",
713 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800714 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
715 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700716};
717#endif
718
719#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
720static struct platform_device bfin_sport0_uart_device = {
721 .name = "bfin-sport-uart",
722 .id = 0,
723};
724
725static struct platform_device bfin_sport1_uart_device = {
726 .name = "bfin-sport-uart",
727 .id = 1,
728};
729#endif
730
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800731#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
732#define PATA_INT 55
733
734static struct pata_platform_info bfin_pata_platform_data = {
735 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +0800736 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800737};
738
739static struct resource bfin_pata_resources[] = {
740 {
741 .start = 0x20314020,
742 .end = 0x2031403F,
743 .flags = IORESOURCE_MEM,
744 },
745 {
746 .start = 0x2031401C,
747 .end = 0x2031401F,
748 .flags = IORESOURCE_MEM,
749 },
750 {
751 .start = PATA_INT,
752 .end = PATA_INT,
753 .flags = IORESOURCE_IRQ,
754 },
755};
756
757static struct platform_device bfin_pata_device = {
758 .name = "pata_platform",
759 .id = -1,
760 .num_resources = ARRAY_SIZE(bfin_pata_resources),
761 .resource = bfin_pata_resources,
762 .dev = {
763 .platform_data = &bfin_pata_platform_data,
764 }
765};
766#endif
767
Bryan Wu1394f032007-05-06 14:50:22 -0700768static struct platform_device *stamp_devices[] __initdata = {
769#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
770 &bfin_pcmcia_cf_device,
771#endif
772
773#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
774 &rtc_device,
775#endif
776
777#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
778 &sl811_hcd_device,
779#endif
780
781#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
782 &isp1362_hcd_device,
783#endif
784
785#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
786 &smc91x_device,
787#endif
788
Alex Landauf40d24d2007-07-12 12:11:48 +0800789#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
790 &dm9000_device,
791#endif
792
Michael Hennerich561cc182007-11-17 23:56:08 +0800793#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
794 &ax88180_device,
795#endif
796
Bryan Wu1394f032007-05-06 14:50:22 -0700797#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
798 &bfin_mac_device,
799#endif
800
801#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
802 &net2272_bfin_device,
803#endif
804
805#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800806 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700807#endif
808
809#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
810 &bfin_fb_device,
811#endif
812
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800813#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
814 &bfin_fb_adv7393_device,
815#endif
816
Bryan Wu1394f032007-05-06 14:50:22 -0700817#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
818 &bfin_uart_device,
819#endif
820
821#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
822 &i2c_bfin_twi_device,
823#endif
824
825#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
826 &bfin_sport0_uart_device,
827 &bfin_sport1_uart_device,
828#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800829
830#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
831 &bfin_pata_device,
832#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800833
834#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
835 &bfin_device_gpiokeys,
836#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800837
838 &bfin_gpios_device,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800839 &stamp_flash_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700840};
841
842static int __init stamp_init(void)
843{
844 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
845 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
846#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
847 spi_register_board_info(bfin_spi_board_info,
848 ARRAY_SIZE(bfin_spi_board_info));
849#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800850
851#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
852 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
853#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700854 return 0;
855}
856
857arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800858
859void native_machine_restart(char *cmd)
860{
861 /* workaround reboot hang when booting from SPI */
862 if ((bfin_read_SYSCR() & 0x7) == 0x3)
863 bfin_gpio_reset_spi0_ssel1();
864}
Mike Frysinger137b1522007-11-22 16:07:03 +0800865
866/*
867 * Currently the MAC address is saved in Flash by U-Boot
868 */
869#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +0800870void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800871{
872 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
873 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
874}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800875EXPORT_SYMBOL(bfin_get_ether_addr);