blob: 3e0ad04d8d75f5b2b62dbd63c596a17f8a61da13 [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>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080038#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070039#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080040#include <linux/pata_platform.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#include <linux/irq.h>
42#include <linux/interrupt.h>
David Brownell27f5d752007-10-04 18:06:16 -070043#include <linux/usb/sl811.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080044#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080045#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080046#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080047#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070048#include <linux/spi/ad7877.h>
49
50/*
51 * Name the Board for the /proc/cpuinfo
52 */
Mike Frysinger066954a2007-10-21 22:36:06 +080053const char bfin_board_name[] = "ADDS-BF537-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070054
55/*
56 * Driver needs to know address, irq and flag pin.
57 */
58
59#define ISP1761_BASE 0x203C0000
60#define ISP1761_IRQ IRQ_PF7
61
62#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
63static struct resource bfin_isp1761_resources[] = {
64 [0] = {
65 .name = "isp1761-regs",
66 .start = ISP1761_BASE + 0x00000000,
67 .end = ISP1761_BASE + 0x000fffff,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = ISP1761_IRQ,
72 .end = ISP1761_IRQ,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
77static struct platform_device bfin_isp1761_device = {
78 .name = "isp1761",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
81 .resource = bfin_isp1761_resources,
82};
83
84static struct platform_device *bfin_isp1761_devices[] = {
85 &bfin_isp1761_device,
86};
87
88int __init bfin_isp1761_init(void)
89{
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080090 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
Bryan Wu1394f032007-05-06 14:50:22 -070091
92 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
93 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
94
95 return platform_add_devices(bfin_isp1761_devices, num_devices);
96}
97
98void __exit bfin_isp1761_exit(void)
99{
100 platform_device_unregister(&bfin_isp1761_device);
101}
102
103arch_initcall(bfin_isp1761_init);
104#endif
105
Michael Hennerich2463ef22008-01-27 16:49:48 +0800106#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
107#include <linux/input.h>
108#include <linux/gpio_keys.h>
109
110static struct gpio_keys_button bfin_gpio_keys_table[] = {
111 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
112 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
113 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
114 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
115};
116
117static struct gpio_keys_platform_data bfin_gpio_keys_data = {
118 .buttons = bfin_gpio_keys_table,
119 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
120};
121
122static struct platform_device bfin_device_gpiokeys = {
123 .name = "gpio-keys",
124 .dev = {
125 .platform_data = &bfin_gpio_keys_data,
126 },
127};
128#endif
129
Bryan Wu1394f032007-05-06 14:50:22 -0700130#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
131static struct resource bfin_pcmcia_cf_resources[] = {
132 {
133 .start = 0x20310000, /* IO PORT */
134 .end = 0x20312000,
135 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800136 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800137 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700138 .end = 0x20311FFF,
139 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800140 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700141 .start = IRQ_PF4,
142 .end = IRQ_PF4,
143 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800144 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700145 .start = 6, /* Card Detect PF6 */
146 .end = 6,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
151static struct platform_device bfin_pcmcia_cf_device = {
152 .name = "bfin_cf_pcmcia",
153 .id = -1,
154 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
155 .resource = bfin_pcmcia_cf_resources,
156};
157#endif
158
159#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
160static struct platform_device rtc_device = {
161 .name = "rtc-bfin",
162 .id = -1,
163};
164#endif
165
166#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
167static struct resource smc91x_resources[] = {
168 {
169 .name = "smc91x-regs",
170 .start = 0x20300300,
171 .end = 0x20300300 + 16,
172 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800173 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700174
175 .start = IRQ_PF7,
176 .end = IRQ_PF7,
177 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
178 },
179};
180static struct platform_device smc91x_device = {
181 .name = "smc91x",
182 .id = 0,
183 .num_resources = ARRAY_SIZE(smc91x_resources),
184 .resource = smc91x_resources,
185};
186#endif
187
Alex Landauf40d24d2007-07-12 12:11:48 +0800188#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
189static struct resource dm9000_resources[] = {
190 [0] = {
191 .start = 0x203FB800,
192 .end = 0x203FB800 + 8,
193 .flags = IORESOURCE_MEM,
194 },
195 [1] = {
196 .start = IRQ_PF9,
197 .end = IRQ_PF9,
198 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
199 },
200};
201
202static struct platform_device dm9000_device = {
203 .name = "dm9000",
204 .id = -1,
205 .num_resources = ARRAY_SIZE(dm9000_resources),
206 .resource = dm9000_resources,
207};
208#endif
209
Michael Hennerich561cc182007-11-17 23:56:08 +0800210#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
211static struct resource ax88180_resources[] = {
212 [0] = {
213 .start = 0x20300000,
214 .end = 0x20300000 + 0x8000,
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .start = IRQ_PF7,
219 .end = IRQ_PF7,
220 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
221 },
222};
223
224static struct platform_device ax88180_device = {
225 .name = "ax88180",
226 .id = -1,
227 .num_resources = ARRAY_SIZE(ax88180_resources),
228 .resource = ax88180_resources,
229};
230#endif
231
Bryan Wu1394f032007-05-06 14:50:22 -0700232#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
233static struct resource sl811_hcd_resources[] = {
234 {
235 .start = 0x20340000,
236 .end = 0x20340000,
237 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800238 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700239 .start = 0x20340004,
240 .end = 0x20340004,
241 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800242 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700243 .start = CONFIG_USB_SL811_BFIN_IRQ,
244 .end = CONFIG_USB_SL811_BFIN_IRQ,
245 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
246 },
247};
248
249#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
250void sl811_port_power(struct device *dev, int is_on)
251{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800252 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
253 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS);
Bryan Wu1394f032007-05-06 14:50:22 -0700254
255 if (is_on)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800256 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
Bryan Wu1394f032007-05-06 14:50:22 -0700257 else
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800258 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
Bryan Wu1394f032007-05-06 14:50:22 -0700259}
260#endif
261
262static struct sl811_platform_data sl811_priv = {
263 .potpg = 10,
264 .power = 250, /* == 500mA */
265#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
266 .port_power = &sl811_port_power,
267#endif
268};
269
270static struct platform_device sl811_hcd_device = {
271 .name = "sl811-hcd",
272 .id = 0,
273 .dev = {
274 .platform_data = &sl811_priv,
275 },
276 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
277 .resource = sl811_hcd_resources,
278};
279#endif
280
281#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
282static struct resource isp1362_hcd_resources[] = {
283 {
284 .start = 0x20360000,
285 .end = 0x20360000,
286 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800287 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700288 .start = 0x20360004,
289 .end = 0x20360004,
290 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800291 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700292 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
293 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
294 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
295 },
296};
297
298static struct isp1362_platform_data isp1362_priv = {
299 .sel15Kres = 1,
300 .clknotstop = 0,
301 .oc_enable = 0,
302 .int_act_high = 0,
303 .int_edge_triggered = 0,
304 .remote_wakeup_connected = 0,
305 .no_power_switching = 1,
306 .power_switching_mode = 0,
307};
308
309static struct platform_device isp1362_hcd_device = {
310 .name = "isp1362-hcd",
311 .id = 0,
312 .dev = {
313 .platform_data = &isp1362_priv,
314 },
315 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
316 .resource = isp1362_hcd_resources,
317};
318#endif
319
320#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
321static struct platform_device bfin_mac_device = {
322 .name = "bfin_mac",
323};
324#endif
325
326#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
327static struct resource net2272_bfin_resources[] = {
328 {
329 .start = 0x20300000,
330 .end = 0x20300000 + 0x100,
331 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800332 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700333 .start = IRQ_PF7,
334 .end = IRQ_PF7,
335 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
336 },
337};
338
339static struct platform_device net2272_bfin_device = {
340 .name = "net2272",
341 .id = -1,
342 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
343 .resource = net2272_bfin_resources,
344};
345#endif
346
347#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
348/* all SPI peripherals info goes here */
349
350#if defined(CONFIG_MTD_M25P80) \
351 || defined(CONFIG_MTD_M25P80_MODULE)
352static struct mtd_partition bfin_spi_flash_partitions[] = {
353 {
354 .name = "bootloader",
355 .size = 0x00020000,
356 .offset = 0,
357 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800358 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700359 .name = "kernel",
360 .size = 0xe0000,
361 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800362 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700363 .name = "file system",
364 .size = 0x700000,
365 .offset = 0x00100000,
366 }
367};
368
369static struct flash_platform_data bfin_spi_flash_data = {
370 .name = "m25p80",
371 .parts = bfin_spi_flash_partitions,
372 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
373 .type = "m25p64",
374};
375
376/* SPI flash chip (m25p64) */
377static struct bfin5xx_spi_chip spi_flash_chip_info = {
378 .enable_dma = 0, /* use dma transfer with this chip*/
379 .bits_per_word = 8,
380};
381#endif
382
383#if defined(CONFIG_SPI_ADC_BF533) \
384 || defined(CONFIG_SPI_ADC_BF533_MODULE)
385/* SPI ADC chip */
386static struct bfin5xx_spi_chip spi_adc_chip_info = {
387 .enable_dma = 1, /* use dma transfer with this chip*/
388 .bits_per_word = 16,
389};
390#endif
391
392#if defined(CONFIG_SND_BLACKFIN_AD1836) \
393 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
394static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
395 .enable_dma = 0,
396 .bits_per_word = 16,
397};
398#endif
399
400#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
401static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
402 .enable_dma = 0,
403 .bits_per_word = 16,
404};
405#endif
406
407#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
408static struct bfin5xx_spi_chip spi_mmc_chip_info = {
409 .enable_dma = 1,
410 .bits_per_word = 8,
411};
412#endif
413
414#if defined(CONFIG_PBX)
415static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
416 .ctl_reg = 0x4, /* send zero */
417 .enable_dma = 0,
418 .bits_per_word = 8,
419 .cs_change_per_word = 1,
420};
421#endif
422
423#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
424static struct bfin5xx_spi_chip ad5304_chip_info = {
425 .enable_dma = 0,
426 .bits_per_word = 16,
427};
428#endif
429
430#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
431static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700432 .enable_dma = 0,
433 .bits_per_word = 16,
434};
435
436static const struct ad7877_platform_data bfin_ad7877_ts_info = {
437 .model = 7877,
438 .vref_delay_usecs = 50, /* internal, no capacitor */
439 .x_plate_ohms = 419,
440 .y_plate_ohms = 486,
441 .pressure_max = 1000,
442 .pressure_min = 0,
443 .stopacq_polarity = 1,
444 .first_conversion_delay = 3,
445 .acquisition_time = 1,
446 .averaging = 1,
447 .pen_down_acc_interval = 1,
448};
449#endif
450
451static struct spi_board_info bfin_spi_board_info[] __initdata = {
452#if defined(CONFIG_MTD_M25P80) \
453 || defined(CONFIG_MTD_M25P80_MODULE)
454 {
455 /* the modalias must be the same as spi device driver name */
456 .modalias = "m25p80", /* Name of spi_driver for this device */
457 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800458 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700459 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
460 .platform_data = &bfin_spi_flash_data,
461 .controller_data = &spi_flash_chip_info,
462 .mode = SPI_MODE_3,
463 },
464#endif
465
466#if defined(CONFIG_SPI_ADC_BF533) \
467 || defined(CONFIG_SPI_ADC_BF533_MODULE)
468 {
469 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
470 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800471 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700472 .chip_select = 1, /* Framework chip select. */
473 .platform_data = NULL, /* No spi_driver specific config */
474 .controller_data = &spi_adc_chip_info,
475 },
476#endif
477
478#if defined(CONFIG_SND_BLACKFIN_AD1836) \
479 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
480 {
481 .modalias = "ad1836-spi",
482 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800483 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700484 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
485 .controller_data = &ad1836_spi_chip_info,
486 },
487#endif
488#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
489 {
490 .modalias = "ad9960-spi",
491 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800492 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700493 .chip_select = 1,
494 .controller_data = &ad9960_spi_chip_info,
495 },
496#endif
497#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
498 {
499 .modalias = "spi_mmc_dummy",
Sonic Zhang111cf972007-10-30 11:48:42 +0800500 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800501 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700502 .chip_select = 0,
503 .platform_data = NULL,
504 .controller_data = &spi_mmc_chip_info,
505 .mode = SPI_MODE_3,
506 },
507 {
508 .modalias = "spi_mmc",
Sonic Zhang111cf972007-10-30 11:48:42 +0800509 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800510 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700511 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
512 .platform_data = NULL,
513 .controller_data = &spi_mmc_chip_info,
514 .mode = SPI_MODE_3,
515 },
516#endif
517#if defined(CONFIG_PBX)
518 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800519 .modalias = "fxs-spi",
520 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800521 .bus_num = 0,
522 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800523 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700524 .mode = SPI_MODE_3,
525 },
526 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800527 .modalias = "fxo-spi",
528 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800529 .bus_num = 0,
530 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800531 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700532 .mode = SPI_MODE_3,
533 },
534#endif
535#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
536 {
537 .modalias = "ad5304_spi",
538 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800539 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700540 .chip_select = 2,
541 .platform_data = NULL,
542 .controller_data = &ad5304_chip_info,
543 .mode = SPI_MODE_2,
544 },
545#endif
546#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
547 {
548 .modalias = "ad7877",
549 .platform_data = &bfin_ad7877_ts_info,
550 .irq = IRQ_PF6,
551 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800552 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700553 .chip_select = 1,
554 .controller_data = &spi_ad7877_chip_info,
555 },
556#endif
557};
558
559/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800560static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700561 .num_chipselect = 8,
562 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800563 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700564};
565
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800566/* SPI (0) */
567static struct resource bfin_spi0_resource[] = {
568 [0] = {
569 .start = SPI0_REGBASE,
570 .end = SPI0_REGBASE + 0xFF,
571 .flags = IORESOURCE_MEM,
572 },
573 [1] = {
574 .start = CH_SPI,
575 .end = CH_SPI,
576 .flags = IORESOURCE_IRQ,
577 },
578};
579
580static struct platform_device bfin_spi0_device = {
581 .name = "bfin-spi",
582 .id = 0, /* Bus number */
583 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
584 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700585 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800586 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700587 },
588};
589#endif /* spi master and devices */
590
591#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
592static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800593 .name = "bf537-lq035",
594};
595#endif
596
597#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
598static struct platform_device bfin_fb_adv7393_device = {
599 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -0700600};
601#endif
602
603#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
604static struct resource bfin_uart_resources[] = {
Sonic Zhang233b28a2007-11-21 17:04:41 +0800605#ifdef CONFIG_SERIAL_BFIN_UART0
Bryan Wu1394f032007-05-06 14:50:22 -0700606 {
607 .start = 0xFFC00400,
608 .end = 0xFFC004FF,
609 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +0800610 },
611#endif
612#ifdef CONFIG_SERIAL_BFIN_UART1
613 {
Bryan Wu1394f032007-05-06 14:50:22 -0700614 .start = 0xFFC02000,
615 .end = 0xFFC020FF,
616 .flags = IORESOURCE_MEM,
617 },
Sonic Zhang233b28a2007-11-21 17:04:41 +0800618#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700619};
620
621static struct platform_device bfin_uart_device = {
622 .name = "bfin-uart",
623 .id = 1,
624 .num_resources = ARRAY_SIZE(bfin_uart_resources),
625 .resource = bfin_uart_resources,
626};
627#endif
628
629#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800630static struct resource bfin_twi0_resource[] = {
631 [0] = {
632 .start = TWI0_REGBASE,
633 .end = TWI0_REGBASE,
634 .flags = IORESOURCE_MEM,
635 },
636 [1] = {
637 .start = IRQ_TWI,
638 .end = IRQ_TWI,
639 .flags = IORESOURCE_IRQ,
640 },
641};
642
Bryan Wu1394f032007-05-06 14:50:22 -0700643static struct platform_device i2c_bfin_twi_device = {
644 .name = "i2c-bfin-twi",
645 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800646 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
647 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700648};
649#endif
650
651#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
652static struct platform_device bfin_sport0_uart_device = {
653 .name = "bfin-sport-uart",
654 .id = 0,
655};
656
657static struct platform_device bfin_sport1_uart_device = {
658 .name = "bfin-sport-uart",
659 .id = 1,
660};
661#endif
662
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800663#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
664#define PATA_INT 55
665
666static struct pata_platform_info bfin_pata_platform_data = {
667 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +0800668 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800669};
670
671static struct resource bfin_pata_resources[] = {
672 {
673 .start = 0x20314020,
674 .end = 0x2031403F,
675 .flags = IORESOURCE_MEM,
676 },
677 {
678 .start = 0x2031401C,
679 .end = 0x2031401F,
680 .flags = IORESOURCE_MEM,
681 },
682 {
683 .start = PATA_INT,
684 .end = PATA_INT,
685 .flags = IORESOURCE_IRQ,
686 },
687};
688
689static struct platform_device bfin_pata_device = {
690 .name = "pata_platform",
691 .id = -1,
692 .num_resources = ARRAY_SIZE(bfin_pata_resources),
693 .resource = bfin_pata_resources,
694 .dev = {
695 .platform_data = &bfin_pata_platform_data,
696 }
697};
698#endif
699
Bryan Wu1394f032007-05-06 14:50:22 -0700700static struct platform_device *stamp_devices[] __initdata = {
701#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
702 &bfin_pcmcia_cf_device,
703#endif
704
705#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
706 &rtc_device,
707#endif
708
709#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
710 &sl811_hcd_device,
711#endif
712
713#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
714 &isp1362_hcd_device,
715#endif
716
717#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
718 &smc91x_device,
719#endif
720
Alex Landauf40d24d2007-07-12 12:11:48 +0800721#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
722 &dm9000_device,
723#endif
724
Michael Hennerich561cc182007-11-17 23:56:08 +0800725#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
726 &ax88180_device,
727#endif
728
Bryan Wu1394f032007-05-06 14:50:22 -0700729#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
730 &bfin_mac_device,
731#endif
732
733#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
734 &net2272_bfin_device,
735#endif
736
737#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800738 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700739#endif
740
741#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
742 &bfin_fb_device,
743#endif
744
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800745#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
746 &bfin_fb_adv7393_device,
747#endif
748
Bryan Wu1394f032007-05-06 14:50:22 -0700749#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
750 &bfin_uart_device,
751#endif
752
753#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
754 &i2c_bfin_twi_device,
755#endif
756
757#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
758 &bfin_sport0_uart_device,
759 &bfin_sport1_uart_device,
760#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800761
762#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
763 &bfin_pata_device,
764#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800765
766#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
767 &bfin_device_gpiokeys,
768#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700769};
770
771static int __init stamp_init(void)
772{
773 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
774 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
775#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
776 spi_register_board_info(bfin_spi_board_info,
777 ARRAY_SIZE(bfin_spi_board_info));
778#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800779
780#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
781 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
782#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700783 return 0;
784}
785
786arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800787
788void native_machine_restart(char *cmd)
789{
790 /* workaround reboot hang when booting from SPI */
791 if ((bfin_read_SYSCR() & 0x7) == 0x3)
792 bfin_gpio_reset_spi0_ssel1();
793}
Mike Frysinger137b1522007-11-22 16:07:03 +0800794
795/*
796 * Currently the MAC address is saved in Flash by U-Boot
797 */
798#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +0800799void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800800{
801 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
802 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
803}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800804EXPORT_SYMBOL(bfin_get_ether_addr);