Commit | Line | Data |
---|---|---|
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 | 55 | const 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) | |
65 | static 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 | ||
79 | static 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 | ||
86 | static struct platform_device *bfin_isp1761_devices[] = { | |
87 | &bfin_isp1761_device, | |
88 | }; | |
89 | ||
90 | int __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 | ||
100 | void __exit bfin_isp1761_exit(void) | |
101 | { | |
102 | platform_device_unregister(&bfin_isp1761_device); | |
103 | } | |
104 | ||
105 | arch_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 | ||
112 | static 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 | ||
119 | static 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 | ||
124 | static 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 |
132 | static struct resource bfin_gpios_resources = { |
133 | .start = 0, | |
134 | .end = MAX_BLACKFIN_GPIOS - 1, | |
135 | .flags = IORESOURCE_IRQ, | |
136 | }; | |
137 | ||
138 | static 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) |
146 | static 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 | ||
166 | static 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) | |
175 | static 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) | |
182 | static 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 | }; | |
195 | static 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) |
204 | static 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 | ||
217 | static 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) |
226 | static 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 | ||
239 | static 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) |
248 | static 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) | |
265 | void 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 | ||
272 | static 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 | ||
280 | static 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) | |
292 | static 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 | ||
308 | static 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 | ||
319 | static 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) | |
331 | static 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) | |
337 | static 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 | ||
349 | static 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 |
358 | static 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 | ||
379 | static struct physmap_flash_data stamp_flash_data = { | |
380 | .width = 2, | |
381 | .parts = stamp_partitions, | |
382 | .nr_parts = ARRAY_SIZE(stamp_partitions), | |
383 | }; | |
384 | ||
385 | static struct resource stamp_flash_resource = { | |
386 | .start = 0x20000000, | |
387 | .end = 0x203fffff, | |
388 | .flags = IORESOURCE_MEM, | |
389 | }; | |
390 | ||
391 | static 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) | |
407 | static 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 | ||
424 | static 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) */ | |
432 | static 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 */ | |
441 | static 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) | |
449 | static 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) | |
456 | static 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) | |
463 | static 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) | |
470 | static 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) |
479 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { | |
1394f032 BW |
480 | .enable_dma = 0, |
481 | .bits_per_word = 16, | |
482 | }; | |
483 | ||
484 | static 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) |
500 | static 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 */ | |
509 | static 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 |
515 | static 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 | 632 | static 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) */ |
639 | static 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 | ||
652 | static 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) | |
664 | static 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) | |
670 | static 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) | |
676 | static 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 | ||
693 | static 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 | ||
701 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | |
c6c4d7bb BW |
702 | static struct resource bfin_twi0_resource[] = { |
703 | [0] = { | |
704 | .start = TWI0_REGBASE, | |
705 | .end = TWI0_REGBASE, | |
706 | .flags = IORESOURCE_MEM, | |
707 | }, | |
708 | [1] = { | |
709 | .start = IRQ_TWI, | |
710 | .end = IRQ_TWI, | |
711 | .flags = IORESOURCE_IRQ, | |
712 | }, | |
713 | }; | |
714 | ||
1394f032 BW |
715 | static struct platform_device i2c_bfin_twi_device = { |
716 | .name = "i2c-bfin-twi", | |
717 | .id = 0, | |
c6c4d7bb BW |
718 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
719 | .resource = bfin_twi0_resource, | |
1394f032 BW |
720 | }; |
721 | #endif | |
722 | ||
81d9c7f2 BW |
723 | #ifdef CONFIG_I2C_BOARDINFO |
724 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |
725 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) | |
726 | { | |
727 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), | |
728 | .type = "ad7142_joystick", | |
729 | .irq = 55, | |
730 | }, | |
731 | #endif | |
732 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | |
733 | { | |
734 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | |
735 | .type = "pcf8574_lcd", | |
736 | }, | |
737 | #endif | |
738 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | |
739 | { | |
740 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | |
741 | .type = "pcf8574_keypad", | |
742 | .irq = 72, | |
743 | }, | |
744 | #endif | |
745 | }; | |
746 | #endif | |
747 | ||
1394f032 BW |
748 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
749 | static struct platform_device bfin_sport0_uart_device = { | |
750 | .name = "bfin-sport-uart", | |
751 | .id = 0, | |
752 | }; | |
753 | ||
754 | static struct platform_device bfin_sport1_uart_device = { | |
755 | .name = "bfin-sport-uart", | |
756 | .id = 1, | |
757 | }; | |
758 | #endif | |
759 | ||
c6c4d7bb BW |
760 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
761 | #define PATA_INT 55 | |
762 | ||
763 | static struct pata_platform_info bfin_pata_platform_data = { | |
764 | .ioport_shift = 1, | |
64e5c512 | 765 | .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
c6c4d7bb BW |
766 | }; |
767 | ||
768 | static struct resource bfin_pata_resources[] = { | |
769 | { | |
770 | .start = 0x20314020, | |
771 | .end = 0x2031403F, | |
772 | .flags = IORESOURCE_MEM, | |
773 | }, | |
774 | { | |
775 | .start = 0x2031401C, | |
776 | .end = 0x2031401F, | |
777 | .flags = IORESOURCE_MEM, | |
778 | }, | |
779 | { | |
780 | .start = PATA_INT, | |
781 | .end = PATA_INT, | |
782 | .flags = IORESOURCE_IRQ, | |
783 | }, | |
784 | }; | |
785 | ||
786 | static struct platform_device bfin_pata_device = { | |
787 | .name = "pata_platform", | |
788 | .id = -1, | |
789 | .num_resources = ARRAY_SIZE(bfin_pata_resources), | |
790 | .resource = bfin_pata_resources, | |
791 | .dev = { | |
792 | .platform_data = &bfin_pata_platform_data, | |
793 | } | |
794 | }; | |
795 | #endif | |
796 | ||
1394f032 BW |
797 | static struct platform_device *stamp_devices[] __initdata = { |
798 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) | |
799 | &bfin_pcmcia_cf_device, | |
800 | #endif | |
801 | ||
802 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | |
803 | &rtc_device, | |
804 | #endif | |
805 | ||
806 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) | |
807 | &sl811_hcd_device, | |
808 | #endif | |
809 | ||
810 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | |
811 | &isp1362_hcd_device, | |
812 | #endif | |
813 | ||
814 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | |
815 | &smc91x_device, | |
816 | #endif | |
817 | ||
f40d24d9 AL |
818 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
819 | &dm9000_device, | |
820 | #endif | |
821 | ||
561cc18b MH |
822 | #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE) |
823 | &ax88180_device, | |
824 | #endif | |
825 | ||
1394f032 BW |
826 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
827 | &bfin_mac_device, | |
828 | #endif | |
829 | ||
830 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | |
831 | &net2272_bfin_device, | |
832 | #endif | |
833 | ||
834 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
c6c4d7bb | 835 | &bfin_spi0_device, |
1394f032 BW |
836 | #endif |
837 | ||
838 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | |
839 | &bfin_fb_device, | |
840 | #endif | |
841 | ||
c6c4d7bb BW |
842 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
843 | &bfin_fb_adv7393_device, | |
844 | #endif | |
845 | ||
1394f032 BW |
846 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
847 | &bfin_uart_device, | |
848 | #endif | |
849 | ||
850 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | |
851 | &i2c_bfin_twi_device, | |
852 | #endif | |
853 | ||
854 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | |
855 | &bfin_sport0_uart_device, | |
856 | &bfin_sport1_uart_device, | |
857 | #endif | |
c6c4d7bb BW |
858 | |
859 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
860 | &bfin_pata_device, | |
861 | #endif | |
2463ef22 MH |
862 | |
863 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
864 | &bfin_device_gpiokeys, | |
865 | #endif | |
cad2ab65 MF |
866 | |
867 | &bfin_gpios_device, | |
793dc27b MF |
868 | |
869 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | |
de8c43f2 | 870 | &stamp_flash_device, |
793dc27b | 871 | #endif |
1394f032 BW |
872 | }; |
873 | ||
874 | static int __init stamp_init(void) | |
875 | { | |
b85d858b | 876 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
81d9c7f2 BW |
877 | |
878 | #ifdef CONFIG_I2C_BOARDINFO | |
879 | i2c_register_board_info(0, bfin_i2c_board_info, | |
880 | ARRAY_SIZE(bfin_i2c_board_info)); | |
881 | #endif | |
882 | ||
1394f032 BW |
883 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
884 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
885 | spi_register_board_info(bfin_spi_board_info, | |
886 | ARRAY_SIZE(bfin_spi_board_info)); | |
887 | #endif | |
c6c4d7bb BW |
888 | |
889 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
890 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; | |
891 | #endif | |
81d9c7f2 | 892 | |
1394f032 BW |
893 | return 0; |
894 | } | |
895 | ||
896 | arch_initcall(stamp_init); | |
c6c4d7bb BW |
897 | |
898 | void native_machine_restart(char *cmd) | |
899 | { | |
900 | /* workaround reboot hang when booting from SPI */ | |
901 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | |
902 | bfin_gpio_reset_spi0_ssel1(); | |
903 | } | |
137b1529 MF |
904 | |
905 | /* | |
906 | * Currently the MAC address is saved in Flash by U-Boot | |
907 | */ | |
908 | #define FLASH_MAC 0x203f0000 | |
9862cc52 | 909 | void bfin_get_ether_addr(char *addr) |
137b1529 MF |
910 | { |
911 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); | |
912 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); | |
913 | } | |
9862cc52 | 914 | EXPORT_SYMBOL(bfin_get_ether_addr); |