blob: a2c347c85e20c6d7ab842fc1674d5926ca9ba69e [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
106#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
107static struct resource bfin_pcmcia_cf_resources[] = {
108 {
109 .start = 0x20310000, /* IO PORT */
110 .end = 0x20312000,
111 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800112 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800113 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700114 .end = 0x20311FFF,
115 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800116 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700117 .start = IRQ_PF4,
118 .end = IRQ_PF4,
119 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800120 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700121 .start = 6, /* Card Detect PF6 */
122 .end = 6,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127static struct platform_device bfin_pcmcia_cf_device = {
128 .name = "bfin_cf_pcmcia",
129 .id = -1,
130 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
131 .resource = bfin_pcmcia_cf_resources,
132};
133#endif
134
135#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
136static struct platform_device rtc_device = {
137 .name = "rtc-bfin",
138 .id = -1,
139};
140#endif
141
142#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
143static struct resource smc91x_resources[] = {
144 {
145 .name = "smc91x-regs",
146 .start = 0x20300300,
147 .end = 0x20300300 + 16,
148 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800149 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700150
151 .start = IRQ_PF7,
152 .end = IRQ_PF7,
153 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
154 },
155};
156static struct platform_device smc91x_device = {
157 .name = "smc91x",
158 .id = 0,
159 .num_resources = ARRAY_SIZE(smc91x_resources),
160 .resource = smc91x_resources,
161};
162#endif
163
Alex Landauf40d24d2007-07-12 12:11:48 +0800164#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
165static struct resource dm9000_resources[] = {
166 [0] = {
167 .start = 0x203FB800,
168 .end = 0x203FB800 + 8,
169 .flags = IORESOURCE_MEM,
170 },
171 [1] = {
172 .start = IRQ_PF9,
173 .end = IRQ_PF9,
174 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
175 },
176};
177
178static struct platform_device dm9000_device = {
179 .name = "dm9000",
180 .id = -1,
181 .num_resources = ARRAY_SIZE(dm9000_resources),
182 .resource = dm9000_resources,
183};
184#endif
185
Michael Hennerich561cc182007-11-17 23:56:08 +0800186#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
187static struct resource ax88180_resources[] = {
188 [0] = {
189 .start = 0x20300000,
190 .end = 0x20300000 + 0x8000,
191 .flags = IORESOURCE_MEM,
192 },
193 [1] = {
194 .start = IRQ_PF7,
195 .end = IRQ_PF7,
196 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
197 },
198};
199
200static struct platform_device ax88180_device = {
201 .name = "ax88180",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(ax88180_resources),
204 .resource = ax88180_resources,
205};
206#endif
207
Bryan Wu1394f032007-05-06 14:50:22 -0700208#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
209static struct resource sl811_hcd_resources[] = {
210 {
211 .start = 0x20340000,
212 .end = 0x20340000,
213 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800214 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700215 .start = 0x20340004,
216 .end = 0x20340004,
217 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800218 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700219 .start = CONFIG_USB_SL811_BFIN_IRQ,
220 .end = CONFIG_USB_SL811_BFIN_IRQ,
221 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
222 },
223};
224
225#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
226void sl811_port_power(struct device *dev, int is_on)
227{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800228 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
229 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS);
Bryan Wu1394f032007-05-06 14:50:22 -0700230
231 if (is_on)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800232 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
Bryan Wu1394f032007-05-06 14:50:22 -0700233 else
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800234 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
Bryan Wu1394f032007-05-06 14:50:22 -0700235}
236#endif
237
238static struct sl811_platform_data sl811_priv = {
239 .potpg = 10,
240 .power = 250, /* == 500mA */
241#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
242 .port_power = &sl811_port_power,
243#endif
244};
245
246static struct platform_device sl811_hcd_device = {
247 .name = "sl811-hcd",
248 .id = 0,
249 .dev = {
250 .platform_data = &sl811_priv,
251 },
252 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
253 .resource = sl811_hcd_resources,
254};
255#endif
256
257#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
258static struct resource isp1362_hcd_resources[] = {
259 {
260 .start = 0x20360000,
261 .end = 0x20360000,
262 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800263 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700264 .start = 0x20360004,
265 .end = 0x20360004,
266 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800267 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700268 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
269 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
270 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
271 },
272};
273
274static struct isp1362_platform_data isp1362_priv = {
275 .sel15Kres = 1,
276 .clknotstop = 0,
277 .oc_enable = 0,
278 .int_act_high = 0,
279 .int_edge_triggered = 0,
280 .remote_wakeup_connected = 0,
281 .no_power_switching = 1,
282 .power_switching_mode = 0,
283};
284
285static struct platform_device isp1362_hcd_device = {
286 .name = "isp1362-hcd",
287 .id = 0,
288 .dev = {
289 .platform_data = &isp1362_priv,
290 },
291 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
292 .resource = isp1362_hcd_resources,
293};
294#endif
295
296#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
297static struct platform_device bfin_mac_device = {
298 .name = "bfin_mac",
299};
300#endif
301
302#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
303static struct resource net2272_bfin_resources[] = {
304 {
305 .start = 0x20300000,
306 .end = 0x20300000 + 0x100,
307 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800308 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700309 .start = IRQ_PF7,
310 .end = IRQ_PF7,
311 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
312 },
313};
314
315static struct platform_device net2272_bfin_device = {
316 .name = "net2272",
317 .id = -1,
318 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
319 .resource = net2272_bfin_resources,
320};
321#endif
322
323#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
324/* all SPI peripherals info goes here */
325
326#if defined(CONFIG_MTD_M25P80) \
327 || defined(CONFIG_MTD_M25P80_MODULE)
328static struct mtd_partition bfin_spi_flash_partitions[] = {
329 {
330 .name = "bootloader",
331 .size = 0x00020000,
332 .offset = 0,
333 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800334 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700335 .name = "kernel",
336 .size = 0xe0000,
337 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800338 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700339 .name = "file system",
340 .size = 0x700000,
341 .offset = 0x00100000,
342 }
343};
344
345static struct flash_platform_data bfin_spi_flash_data = {
346 .name = "m25p80",
347 .parts = bfin_spi_flash_partitions,
348 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
349 .type = "m25p64",
350};
351
352/* SPI flash chip (m25p64) */
353static struct bfin5xx_spi_chip spi_flash_chip_info = {
354 .enable_dma = 0, /* use dma transfer with this chip*/
355 .bits_per_word = 8,
356};
357#endif
358
359#if defined(CONFIG_SPI_ADC_BF533) \
360 || defined(CONFIG_SPI_ADC_BF533_MODULE)
361/* SPI ADC chip */
362static struct bfin5xx_spi_chip spi_adc_chip_info = {
363 .enable_dma = 1, /* use dma transfer with this chip*/
364 .bits_per_word = 16,
365};
366#endif
367
368#if defined(CONFIG_SND_BLACKFIN_AD1836) \
369 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
370static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
371 .enable_dma = 0,
372 .bits_per_word = 16,
373};
374#endif
375
376#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
377static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
378 .enable_dma = 0,
379 .bits_per_word = 16,
380};
381#endif
382
383#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
384static struct bfin5xx_spi_chip spi_mmc_chip_info = {
385 .enable_dma = 1,
386 .bits_per_word = 8,
387};
388#endif
389
390#if defined(CONFIG_PBX)
391static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
392 .ctl_reg = 0x4, /* send zero */
393 .enable_dma = 0,
394 .bits_per_word = 8,
395 .cs_change_per_word = 1,
396};
397#endif
398
399#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
400static struct bfin5xx_spi_chip ad5304_chip_info = {
401 .enable_dma = 0,
402 .bits_per_word = 16,
403};
404#endif
405
406#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
407static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700408 .enable_dma = 0,
409 .bits_per_word = 16,
410};
411
412static const struct ad7877_platform_data bfin_ad7877_ts_info = {
413 .model = 7877,
414 .vref_delay_usecs = 50, /* internal, no capacitor */
415 .x_plate_ohms = 419,
416 .y_plate_ohms = 486,
417 .pressure_max = 1000,
418 .pressure_min = 0,
419 .stopacq_polarity = 1,
420 .first_conversion_delay = 3,
421 .acquisition_time = 1,
422 .averaging = 1,
423 .pen_down_acc_interval = 1,
424};
425#endif
426
427static struct spi_board_info bfin_spi_board_info[] __initdata = {
428#if defined(CONFIG_MTD_M25P80) \
429 || defined(CONFIG_MTD_M25P80_MODULE)
430 {
431 /* the modalias must be the same as spi device driver name */
432 .modalias = "m25p80", /* Name of spi_driver for this device */
433 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800434 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700435 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
436 .platform_data = &bfin_spi_flash_data,
437 .controller_data = &spi_flash_chip_info,
438 .mode = SPI_MODE_3,
439 },
440#endif
441
442#if defined(CONFIG_SPI_ADC_BF533) \
443 || defined(CONFIG_SPI_ADC_BF533_MODULE)
444 {
445 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
446 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800447 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700448 .chip_select = 1, /* Framework chip select. */
449 .platform_data = NULL, /* No spi_driver specific config */
450 .controller_data = &spi_adc_chip_info,
451 },
452#endif
453
454#if defined(CONFIG_SND_BLACKFIN_AD1836) \
455 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
456 {
457 .modalias = "ad1836-spi",
458 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800459 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700460 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
461 .controller_data = &ad1836_spi_chip_info,
462 },
463#endif
464#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
465 {
466 .modalias = "ad9960-spi",
467 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800468 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700469 .chip_select = 1,
470 .controller_data = &ad9960_spi_chip_info,
471 },
472#endif
473#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
474 {
475 .modalias = "spi_mmc_dummy",
Sonic Zhang111cf972007-10-30 11:48:42 +0800476 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800477 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700478 .chip_select = 0,
479 .platform_data = NULL,
480 .controller_data = &spi_mmc_chip_info,
481 .mode = SPI_MODE_3,
482 },
483 {
484 .modalias = "spi_mmc",
Sonic Zhang111cf972007-10-30 11:48:42 +0800485 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800486 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700487 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
488 .platform_data = NULL,
489 .controller_data = &spi_mmc_chip_info,
490 .mode = SPI_MODE_3,
491 },
492#endif
493#if defined(CONFIG_PBX)
494 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800495 .modalias = "fxs-spi",
496 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800497 .bus_num = 0,
498 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800499 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700500 .mode = SPI_MODE_3,
501 },
502 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800503 .modalias = "fxo-spi",
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800505 .bus_num = 0,
506 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800507 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700508 .mode = SPI_MODE_3,
509 },
510#endif
511#if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
512 {
513 .modalias = "ad5304_spi",
514 .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800515 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700516 .chip_select = 2,
517 .platform_data = NULL,
518 .controller_data = &ad5304_chip_info,
519 .mode = SPI_MODE_2,
520 },
521#endif
522#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
523 {
524 .modalias = "ad7877",
525 .platform_data = &bfin_ad7877_ts_info,
526 .irq = IRQ_PF6,
527 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800528 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700529 .chip_select = 1,
530 .controller_data = &spi_ad7877_chip_info,
531 },
532#endif
533};
534
535/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800536static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700537 .num_chipselect = 8,
538 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800539 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700540};
541
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800542/* SPI (0) */
543static struct resource bfin_spi0_resource[] = {
544 [0] = {
545 .start = SPI0_REGBASE,
546 .end = SPI0_REGBASE + 0xFF,
547 .flags = IORESOURCE_MEM,
548 },
549 [1] = {
550 .start = CH_SPI,
551 .end = CH_SPI,
552 .flags = IORESOURCE_IRQ,
553 },
554};
555
556static struct platform_device bfin_spi0_device = {
557 .name = "bfin-spi",
558 .id = 0, /* Bus number */
559 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
560 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700561 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800562 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700563 },
564};
565#endif /* spi master and devices */
566
567#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
568static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800569 .name = "bf537-lq035",
570};
571#endif
572
573#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
574static struct platform_device bfin_fb_adv7393_device = {
575 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -0700576};
577#endif
578
579#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
580static struct resource bfin_uart_resources[] = {
581 {
582 .start = 0xFFC00400,
583 .end = 0xFFC004FF,
584 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800585 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700586 .start = 0xFFC02000,
587 .end = 0xFFC020FF,
588 .flags = IORESOURCE_MEM,
589 },
590};
591
592static struct platform_device bfin_uart_device = {
593 .name = "bfin-uart",
594 .id = 1,
595 .num_resources = ARRAY_SIZE(bfin_uart_resources),
596 .resource = bfin_uart_resources,
597};
598#endif
599
600#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800601static struct resource bfin_twi0_resource[] = {
602 [0] = {
603 .start = TWI0_REGBASE,
604 .end = TWI0_REGBASE,
605 .flags = IORESOURCE_MEM,
606 },
607 [1] = {
608 .start = IRQ_TWI,
609 .end = IRQ_TWI,
610 .flags = IORESOURCE_IRQ,
611 },
612};
613
Bryan Wu1394f032007-05-06 14:50:22 -0700614static struct platform_device i2c_bfin_twi_device = {
615 .name = "i2c-bfin-twi",
616 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800617 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
618 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700619};
620#endif
621
622#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
623static struct platform_device bfin_sport0_uart_device = {
624 .name = "bfin-sport-uart",
625 .id = 0,
626};
627
628static struct platform_device bfin_sport1_uart_device = {
629 .name = "bfin-sport-uart",
630 .id = 1,
631};
632#endif
633
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800634#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
635#define PATA_INT 55
636
637static struct pata_platform_info bfin_pata_platform_data = {
638 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +0800639 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800640};
641
642static struct resource bfin_pata_resources[] = {
643 {
644 .start = 0x20314020,
645 .end = 0x2031403F,
646 .flags = IORESOURCE_MEM,
647 },
648 {
649 .start = 0x2031401C,
650 .end = 0x2031401F,
651 .flags = IORESOURCE_MEM,
652 },
653 {
654 .start = PATA_INT,
655 .end = PATA_INT,
656 .flags = IORESOURCE_IRQ,
657 },
658};
659
660static struct platform_device bfin_pata_device = {
661 .name = "pata_platform",
662 .id = -1,
663 .num_resources = ARRAY_SIZE(bfin_pata_resources),
664 .resource = bfin_pata_resources,
665 .dev = {
666 .platform_data = &bfin_pata_platform_data,
667 }
668};
669#endif
670
Bryan Wu1394f032007-05-06 14:50:22 -0700671static struct platform_device *stamp_devices[] __initdata = {
672#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
673 &bfin_pcmcia_cf_device,
674#endif
675
676#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
677 &rtc_device,
678#endif
679
680#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
681 &sl811_hcd_device,
682#endif
683
684#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
685 &isp1362_hcd_device,
686#endif
687
688#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
689 &smc91x_device,
690#endif
691
Alex Landauf40d24d2007-07-12 12:11:48 +0800692#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
693 &dm9000_device,
694#endif
695
Michael Hennerich561cc182007-11-17 23:56:08 +0800696#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
697 &ax88180_device,
698#endif
699
Bryan Wu1394f032007-05-06 14:50:22 -0700700#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
701 &bfin_mac_device,
702#endif
703
704#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
705 &net2272_bfin_device,
706#endif
707
708#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800709 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700710#endif
711
712#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
713 &bfin_fb_device,
714#endif
715
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800716#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
717 &bfin_fb_adv7393_device,
718#endif
719
Bryan Wu1394f032007-05-06 14:50:22 -0700720#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
721 &bfin_uart_device,
722#endif
723
724#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
725 &i2c_bfin_twi_device,
726#endif
727
728#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
729 &bfin_sport0_uart_device,
730 &bfin_sport1_uart_device,
731#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800732
733#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
734 &bfin_pata_device,
735#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700736};
737
738static int __init stamp_init(void)
739{
740 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
741 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
742#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
743 spi_register_board_info(bfin_spi_board_info,
744 ARRAY_SIZE(bfin_spi_board_info));
745#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800746
747#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
748 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
749#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700750 return 0;
751}
752
753arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800754
755void native_machine_restart(char *cmd)
756{
757 /* workaround reboot hang when booting from SPI */
758 if ((bfin_read_SYSCR() & 0x7) == 0x3)
759 bfin_gpio_reset_spi0_ssel1();
760}
Mike Frysinger137b1522007-11-22 16:07:03 +0800761
762/*
763 * Currently the MAC address is saved in Flash by U-Boot
764 */
765#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +0800766void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800767{
768 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
769 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
770}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800771EXPORT_SYMBOL(bfin_get_ether_addr);