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> | |
27f5d75a | 44 | #include <linux/usb/sl811.h> |
c6c4d7bb | 45 | #include <asm/dma.h> |
1f83b8f1 | 46 | #include <asm/bfin5xx_spi.h> |
c6c4d7bb | 47 | #include <asm/reboot.h> |
5d448dd5 | 48 | #include <asm/portmux.h> |
1394f032 BW |
49 | #include <linux/spi/ad7877.h> |
50 | ||
51 | /* | |
52 | * Name the Board for the /proc/cpuinfo | |
53 | */ | |
066954a3 | 54 | const char bfin_board_name[] = "ADDS-BF537-STAMP"; |
1394f032 BW |
55 | |
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) | |
64 | static 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 | ||
78 | static 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 | ||
85 | static struct platform_device *bfin_isp1761_devices[] = { | |
86 | &bfin_isp1761_device, | |
87 | }; | |
88 | ||
89 | int __init bfin_isp1761_init(void) | |
90 | { | |
1f83b8f1 | 91 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); |
1394f032 BW |
92 | |
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 | ||
99 | void __exit bfin_isp1761_exit(void) | |
100 | { | |
101 | platform_device_unregister(&bfin_isp1761_device); | |
102 | } | |
103 | ||
104 | arch_initcall(bfin_isp1761_init); | |
105 | #endif | |
106 | ||
2463ef22 MH |
107 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
108 | #include <linux/input.h> | |
109 | #include <linux/gpio_keys.h> | |
110 | ||
111 | static 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 | ||
118 | static 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 | ||
123 | static struct platform_device bfin_device_gpiokeys = { | |
124 | .name = "gpio-keys", | |
125 | .dev = { | |
126 | .platform_data = &bfin_gpio_keys_data, | |
127 | }, | |
128 | }; | |
129 | #endif | |
130 | ||
cad2ab65 MF |
131 | static struct resource bfin_gpios_resources = { |
132 | .start = 0, | |
133 | .end = MAX_BLACKFIN_GPIOS - 1, | |
134 | .flags = IORESOURCE_IRQ, | |
135 | }; | |
136 | ||
137 | static struct platform_device bfin_gpios_device = { | |
138 | .name = "simple-gpio", | |
139 | .id = -1, | |
140 | .num_resources = 1, | |
141 | .resource = &bfin_gpios_resources, | |
142 | }; | |
143 | ||
1394f032 BW |
144 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
145 | static struct resource bfin_pcmcia_cf_resources[] = { | |
146 | { | |
147 | .start = 0x20310000, /* IO PORT */ | |
148 | .end = 0x20312000, | |
149 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 150 | }, { |
d2d50aa9 | 151 | .start = 0x20311000, /* Attribute Memory */ |
1394f032 BW |
152 | .end = 0x20311FFF, |
153 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 154 | }, { |
1394f032 BW |
155 | .start = IRQ_PF4, |
156 | .end = IRQ_PF4, | |
157 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | |
1f83b8f1 | 158 | }, { |
1394f032 BW |
159 | .start = 6, /* Card Detect PF6 */ |
160 | .end = 6, | |
161 | .flags = IORESOURCE_IRQ, | |
162 | }, | |
163 | }; | |
164 | ||
165 | static 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) | |
174 | static 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) | |
181 | static struct resource smc91x_resources[] = { | |
182 | { | |
183 | .name = "smc91x-regs", | |
184 | .start = 0x20300300, | |
185 | .end = 0x20300300 + 16, | |
186 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 187 | }, { |
1394f032 BW |
188 | |
189 | .start = IRQ_PF7, | |
190 | .end = IRQ_PF7, | |
191 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
192 | }, | |
193 | }; | |
194 | static 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 | ||
f40d24d9 AL |
202 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
203 | static 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 | ||
216 | static 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 | ||
561cc18b MH |
224 | #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE) |
225 | static 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 | ||
238 | static 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 | ||
1394f032 BW |
246 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
247 | static struct resource sl811_hcd_resources[] = { | |
248 | { | |
249 | .start = 0x20340000, | |
250 | .end = 0x20340000, | |
251 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 252 | }, { |
1394f032 BW |
253 | .start = 0x20340004, |
254 | .end = 0x20340004, | |
255 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 256 | }, { |
1394f032 BW |
257 | .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) | |
264 | void sl811_port_power(struct device *dev, int is_on) | |
265 | { | |
c6c4d7bb | 266 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); |
acbcd263 | 267 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
1394f032 BW |
268 | } |
269 | #endif | |
270 | ||
271 | static 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 | ||
279 | static 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) | |
291 | static struct resource isp1362_hcd_resources[] = { | |
292 | { | |
293 | .start = 0x20360000, | |
294 | .end = 0x20360000, | |
295 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 296 | }, { |
1394f032 BW |
297 | .start = 0x20360004, |
298 | .end = 0x20360004, | |
299 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 300 | }, { |
1394f032 BW |
301 | .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 | ||
307 | static 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 | ||
318 | static 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) | |
330 | static 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) | |
336 | static struct resource net2272_bfin_resources[] = { | |
337 | { | |
338 | .start = 0x20300000, | |
339 | .end = 0x20300000 + 0x100, | |
340 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 341 | }, { |
1394f032 BW |
342 | .start = IRQ_PF7, |
343 | .end = IRQ_PF7, | |
344 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
345 | }, | |
346 | }; | |
347 | ||
348 | static 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 | ||
793dc27b | 356 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
de8c43f2 MF |
357 | static struct mtd_partition stamp_partitions[] = { |
358 | { | |
359 | .name = "Bootloader", | |
edf05641 | 360 | .size = 0x40000, |
de8c43f2 MF |
361 | .offset = 0, |
362 | }, { | |
363 | .name = "Kernel", | |
364 | .size = 0xE0000, | |
365 | .offset = MTDPART_OFS_APPEND, | |
366 | }, { | |
367 | .name = "RootFS", | |
edf05641 | 368 | .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000, |
de8c43f2 MF |
369 | .offset = MTDPART_OFS_APPEND, |
370 | }, { | |
371 | .name = "MAC Address", | |
372 | .size = MTDPART_SIZ_FULL, | |
373 | .offset = 0x3F0000, | |
374 | .mask_flags = MTD_WRITEABLE, | |
375 | } | |
376 | }; | |
377 | ||
378 | static struct physmap_flash_data stamp_flash_data = { | |
379 | .width = 2, | |
380 | .parts = stamp_partitions, | |
381 | .nr_parts = ARRAY_SIZE(stamp_partitions), | |
382 | }; | |
383 | ||
384 | static struct resource stamp_flash_resource = { | |
385 | .start = 0x20000000, | |
386 | .end = 0x203fffff, | |
387 | .flags = IORESOURCE_MEM, | |
388 | }; | |
389 | ||
390 | static struct platform_device stamp_flash_device = { | |
391 | .name = "physmap-flash", | |
392 | .id = 0, | |
393 | .dev = { | |
394 | .platform_data = &stamp_flash_data, | |
395 | }, | |
396 | .num_resources = 1, | |
397 | .resource = &stamp_flash_resource, | |
398 | }; | |
793dc27b | 399 | #endif |
de8c43f2 | 400 | |
1394f032 BW |
401 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
402 | /* all SPI peripherals info goes here */ | |
403 | ||
404 | #if defined(CONFIG_MTD_M25P80) \ | |
405 | || defined(CONFIG_MTD_M25P80_MODULE) | |
406 | static struct mtd_partition bfin_spi_flash_partitions[] = { | |
407 | { | |
408 | .name = "bootloader", | |
edf05641 | 409 | .size = 0x00040000, |
1394f032 BW |
410 | .offset = 0, |
411 | .mask_flags = MTD_CAP_ROM | |
1f83b8f1 | 412 | }, { |
1394f032 BW |
413 | .name = "kernel", |
414 | .size = 0xe0000, | |
edf05641 | 415 | .offset = MTDPART_OFS_APPEND, |
1f83b8f1 | 416 | }, { |
1394f032 | 417 | .name = "file system", |
edf05641 MF |
418 | .size = MTDPART_SIZ_FULL, |
419 | .offset = MTDPART_OFS_APPEND, | |
1394f032 BW |
420 | } |
421 | }; | |
422 | ||
423 | static struct flash_platform_data bfin_spi_flash_data = { | |
424 | .name = "m25p80", | |
425 | .parts = bfin_spi_flash_partitions, | |
426 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), | |
427 | .type = "m25p64", | |
428 | }; | |
429 | ||
430 | /* SPI flash chip (m25p64) */ | |
431 | static struct bfin5xx_spi_chip spi_flash_chip_info = { | |
432 | .enable_dma = 0, /* use dma transfer with this chip*/ | |
433 | .bits_per_word = 8, | |
434 | }; | |
435 | #endif | |
436 | ||
437 | #if defined(CONFIG_SPI_ADC_BF533) \ | |
438 | || defined(CONFIG_SPI_ADC_BF533_MODULE) | |
439 | /* SPI ADC chip */ | |
440 | static struct bfin5xx_spi_chip spi_adc_chip_info = { | |
441 | .enable_dma = 1, /* use dma transfer with this chip*/ | |
442 | .bits_per_word = 16, | |
443 | }; | |
444 | #endif | |
445 | ||
446 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ | |
447 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
448 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { | |
449 | .enable_dma = 0, | |
450 | .bits_per_word = 16, | |
451 | }; | |
452 | #endif | |
453 | ||
454 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) | |
455 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { | |
456 | .enable_dma = 0, | |
457 | .bits_per_word = 16, | |
458 | }; | |
459 | #endif | |
460 | ||
461 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | |
462 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { | |
463 | .enable_dma = 1, | |
464 | .bits_per_word = 8, | |
465 | }; | |
466 | #endif | |
467 | ||
468 | #if defined(CONFIG_PBX) | |
469 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { | |
470 | .ctl_reg = 0x4, /* send zero */ | |
471 | .enable_dma = 0, | |
472 | .bits_per_word = 8, | |
473 | .cs_change_per_word = 1, | |
474 | }; | |
475 | #endif | |
476 | ||
1394f032 BW |
477 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
478 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { | |
1394f032 BW |
479 | .enable_dma = 0, |
480 | .bits_per_word = 16, | |
481 | }; | |
482 | ||
483 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { | |
484 | .model = 7877, | |
485 | .vref_delay_usecs = 50, /* internal, no capacitor */ | |
486 | .x_plate_ohms = 419, | |
487 | .y_plate_ohms = 486, | |
488 | .pressure_max = 1000, | |
489 | .pressure_min = 0, | |
490 | .stopacq_polarity = 1, | |
491 | .first_conversion_delay = 3, | |
492 | .acquisition_time = 1, | |
493 | .averaging = 1, | |
494 | .pen_down_acc_interval = 1, | |
495 | }; | |
496 | #endif | |
497 | ||
6e668936 MH |
498 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
499 | static struct bfin5xx_spi_chip spidev_chip_info = { | |
500 | .enable_dma = 0, | |
501 | .bits_per_word = 8, | |
502 | }; | |
503 | #endif | |
504 | ||
1394f032 BW |
505 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
506 | #if defined(CONFIG_MTD_M25P80) \ | |
507 | || defined(CONFIG_MTD_M25P80_MODULE) | |
508 | { | |
509 | /* the modalias must be the same as spi device driver name */ | |
510 | .modalias = "m25p80", /* Name of spi_driver for this device */ | |
511 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb | 512 | .bus_num = 0, /* Framework bus number */ |
1394f032 BW |
513 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
514 | .platform_data = &bfin_spi_flash_data, | |
515 | .controller_data = &spi_flash_chip_info, | |
516 | .mode = SPI_MODE_3, | |
517 | }, | |
518 | #endif | |
519 | ||
520 | #if defined(CONFIG_SPI_ADC_BF533) \ | |
521 | || defined(CONFIG_SPI_ADC_BF533_MODULE) | |
522 | { | |
523 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ | |
524 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb | 525 | .bus_num = 0, /* Framework bus number */ |
1394f032 BW |
526 | .chip_select = 1, /* Framework chip select. */ |
527 | .platform_data = NULL, /* No spi_driver specific config */ | |
528 | .controller_data = &spi_adc_chip_info, | |
529 | }, | |
530 | #endif | |
531 | ||
532 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ | |
533 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
534 | { | |
535 | .modalias = "ad1836-spi", | |
536 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb | 537 | .bus_num = 0, |
1394f032 BW |
538 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
539 | .controller_data = &ad1836_spi_chip_info, | |
540 | }, | |
541 | #endif | |
542 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) | |
543 | { | |
544 | .modalias = "ad9960-spi", | |
545 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb | 546 | .bus_num = 0, |
1394f032 BW |
547 | .chip_select = 1, |
548 | .controller_data = &ad9960_spi_chip_info, | |
549 | }, | |
550 | #endif | |
551 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | |
552 | { | |
553 | .modalias = "spi_mmc_dummy", | |
111cf97d | 554 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
c6c4d7bb | 555 | .bus_num = 0, |
1394f032 BW |
556 | .chip_select = 0, |
557 | .platform_data = NULL, | |
558 | .controller_data = &spi_mmc_chip_info, | |
559 | .mode = SPI_MODE_3, | |
560 | }, | |
561 | { | |
562 | .modalias = "spi_mmc", | |
111cf97d | 563 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
c6c4d7bb | 564 | .bus_num = 0, |
1394f032 BW |
565 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
566 | .platform_data = NULL, | |
567 | .controller_data = &spi_mmc_chip_info, | |
568 | .mode = SPI_MODE_3, | |
569 | }, | |
570 | #endif | |
571 | #if defined(CONFIG_PBX) | |
572 | { | |
1f83b8f1 MF |
573 | .modalias = "fxs-spi", |
574 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb BW |
575 | .bus_num = 0, |
576 | .chip_select = 8 - CONFIG_J11_JUMPER, | |
1f83b8f1 | 577 | .controller_data = &spi_si3xxx_chip_info, |
1394f032 BW |
578 | .mode = SPI_MODE_3, |
579 | }, | |
580 | { | |
1f83b8f1 MF |
581 | .modalias = "fxo-spi", |
582 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ | |
c6c4d7bb BW |
583 | .bus_num = 0, |
584 | .chip_select = 8 - CONFIG_J19_JUMPER, | |
1f83b8f1 | 585 | .controller_data = &spi_si3xxx_chip_info, |
1394f032 BW |
586 | .mode = SPI_MODE_3, |
587 | }, | |
588 | #endif | |
1394f032 BW |
589 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
590 | { | |
591 | .modalias = "ad7877", | |
592 | .platform_data = &bfin_ad7877_ts_info, | |
593 | .irq = IRQ_PF6, | |
594 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ | |
c7d48966 | 595 | .bus_num = 0, |
1394f032 BW |
596 | .chip_select = 1, |
597 | .controller_data = &spi_ad7877_chip_info, | |
598 | }, | |
599 | #endif | |
6e668936 MH |
600 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
601 | { | |
602 | .modalias = "spidev", | |
603 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
604 | .bus_num = 0, | |
605 | .chip_select = 1, | |
606 | .controller_data = &spidev_chip_info, | |
607 | }, | |
608 | #endif | |
1394f032 BW |
609 | }; |
610 | ||
611 | /* SPI controller data */ | |
c6c4d7bb | 612 | static struct bfin5xx_spi_master bfin_spi0_info = { |
1394f032 BW |
613 | .num_chipselect = 8, |
614 | .enable_dma = 1, /* master has the ability to do dma transfer */ | |
5d448dd5 | 615 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
1394f032 BW |
616 | }; |
617 | ||
c6c4d7bb BW |
618 | /* SPI (0) */ |
619 | static struct resource bfin_spi0_resource[] = { | |
620 | [0] = { | |
621 | .start = SPI0_REGBASE, | |
622 | .end = SPI0_REGBASE + 0xFF, | |
623 | .flags = IORESOURCE_MEM, | |
624 | }, | |
625 | [1] = { | |
626 | .start = CH_SPI, | |
627 | .end = CH_SPI, | |
628 | .flags = IORESOURCE_IRQ, | |
629 | }, | |
630 | }; | |
631 | ||
632 | static struct platform_device bfin_spi0_device = { | |
633 | .name = "bfin-spi", | |
634 | .id = 0, /* Bus number */ | |
635 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), | |
636 | .resource = bfin_spi0_resource, | |
1394f032 | 637 | .dev = { |
c6c4d7bb | 638 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
1394f032 BW |
639 | }, |
640 | }; | |
641 | #endif /* spi master and devices */ | |
642 | ||
643 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | |
644 | static struct platform_device bfin_fb_device = { | |
c6c4d7bb BW |
645 | .name = "bf537-lq035", |
646 | }; | |
647 | #endif | |
648 | ||
649 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) | |
650 | static struct platform_device bfin_fb_adv7393_device = { | |
651 | .name = "bfin-adv7393", | |
1394f032 BW |
652 | }; |
653 | #endif | |
654 | ||
655 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | |
656 | static struct resource bfin_uart_resources[] = { | |
233b28a9 | 657 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
1394f032 BW |
658 | { |
659 | .start = 0xFFC00400, | |
660 | .end = 0xFFC004FF, | |
661 | .flags = IORESOURCE_MEM, | |
233b28a9 SZ |
662 | }, |
663 | #endif | |
664 | #ifdef CONFIG_SERIAL_BFIN_UART1 | |
665 | { | |
1394f032 BW |
666 | .start = 0xFFC02000, |
667 | .end = 0xFFC020FF, | |
668 | .flags = IORESOURCE_MEM, | |
669 | }, | |
233b28a9 | 670 | #endif |
1394f032 BW |
671 | }; |
672 | ||
673 | static struct platform_device bfin_uart_device = { | |
674 | .name = "bfin-uart", | |
675 | .id = 1, | |
676 | .num_resources = ARRAY_SIZE(bfin_uart_resources), | |
677 | .resource = bfin_uart_resources, | |
678 | }; | |
679 | #endif | |
680 | ||
681 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | |
c6c4d7bb BW |
682 | static struct resource bfin_twi0_resource[] = { |
683 | [0] = { | |
684 | .start = TWI0_REGBASE, | |
685 | .end = TWI0_REGBASE, | |
686 | .flags = IORESOURCE_MEM, | |
687 | }, | |
688 | [1] = { | |
689 | .start = IRQ_TWI, | |
690 | .end = IRQ_TWI, | |
691 | .flags = IORESOURCE_IRQ, | |
692 | }, | |
693 | }; | |
694 | ||
1394f032 BW |
695 | static struct platform_device i2c_bfin_twi_device = { |
696 | .name = "i2c-bfin-twi", | |
697 | .id = 0, | |
c6c4d7bb BW |
698 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
699 | .resource = bfin_twi0_resource, | |
1394f032 BW |
700 | }; |
701 | #endif | |
702 | ||
703 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | |
704 | static struct platform_device bfin_sport0_uart_device = { | |
705 | .name = "bfin-sport-uart", | |
706 | .id = 0, | |
707 | }; | |
708 | ||
709 | static struct platform_device bfin_sport1_uart_device = { | |
710 | .name = "bfin-sport-uart", | |
711 | .id = 1, | |
712 | }; | |
713 | #endif | |
714 | ||
c6c4d7bb BW |
715 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
716 | #define PATA_INT 55 | |
717 | ||
718 | static struct pata_platform_info bfin_pata_platform_data = { | |
719 | .ioport_shift = 1, | |
64e5c512 | 720 | .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
c6c4d7bb BW |
721 | }; |
722 | ||
723 | static struct resource bfin_pata_resources[] = { | |
724 | { | |
725 | .start = 0x20314020, | |
726 | .end = 0x2031403F, | |
727 | .flags = IORESOURCE_MEM, | |
728 | }, | |
729 | { | |
730 | .start = 0x2031401C, | |
731 | .end = 0x2031401F, | |
732 | .flags = IORESOURCE_MEM, | |
733 | }, | |
734 | { | |
735 | .start = PATA_INT, | |
736 | .end = PATA_INT, | |
737 | .flags = IORESOURCE_IRQ, | |
738 | }, | |
739 | }; | |
740 | ||
741 | static struct platform_device bfin_pata_device = { | |
742 | .name = "pata_platform", | |
743 | .id = -1, | |
744 | .num_resources = ARRAY_SIZE(bfin_pata_resources), | |
745 | .resource = bfin_pata_resources, | |
746 | .dev = { | |
747 | .platform_data = &bfin_pata_platform_data, | |
748 | } | |
749 | }; | |
750 | #endif | |
751 | ||
1394f032 BW |
752 | static struct platform_device *stamp_devices[] __initdata = { |
753 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) | |
754 | &bfin_pcmcia_cf_device, | |
755 | #endif | |
756 | ||
757 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | |
758 | &rtc_device, | |
759 | #endif | |
760 | ||
761 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) | |
762 | &sl811_hcd_device, | |
763 | #endif | |
764 | ||
765 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | |
766 | &isp1362_hcd_device, | |
767 | #endif | |
768 | ||
769 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | |
770 | &smc91x_device, | |
771 | #endif | |
772 | ||
f40d24d9 AL |
773 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
774 | &dm9000_device, | |
775 | #endif | |
776 | ||
561cc18b MH |
777 | #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE) |
778 | &ax88180_device, | |
779 | #endif | |
780 | ||
1394f032 BW |
781 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
782 | &bfin_mac_device, | |
783 | #endif | |
784 | ||
785 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | |
786 | &net2272_bfin_device, | |
787 | #endif | |
788 | ||
789 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
c6c4d7bb | 790 | &bfin_spi0_device, |
1394f032 BW |
791 | #endif |
792 | ||
793 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | |
794 | &bfin_fb_device, | |
795 | #endif | |
796 | ||
c6c4d7bb BW |
797 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
798 | &bfin_fb_adv7393_device, | |
799 | #endif | |
800 | ||
1394f032 BW |
801 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
802 | &bfin_uart_device, | |
803 | #endif | |
804 | ||
805 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | |
806 | &i2c_bfin_twi_device, | |
807 | #endif | |
808 | ||
809 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | |
810 | &bfin_sport0_uart_device, | |
811 | &bfin_sport1_uart_device, | |
812 | #endif | |
c6c4d7bb BW |
813 | |
814 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
815 | &bfin_pata_device, | |
816 | #endif | |
2463ef22 MH |
817 | |
818 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
819 | &bfin_device_gpiokeys, | |
820 | #endif | |
cad2ab65 MF |
821 | |
822 | &bfin_gpios_device, | |
793dc27b MF |
823 | |
824 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | |
de8c43f2 | 825 | &stamp_flash_device, |
793dc27b | 826 | #endif |
1394f032 BW |
827 | }; |
828 | ||
829 | static int __init stamp_init(void) | |
830 | { | |
831 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); | |
832 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | |
833 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
834 | spi_register_board_info(bfin_spi_board_info, | |
835 | ARRAY_SIZE(bfin_spi_board_info)); | |
836 | #endif | |
c6c4d7bb BW |
837 | |
838 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
839 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; | |
840 | #endif | |
1394f032 BW |
841 | return 0; |
842 | } | |
843 | ||
844 | arch_initcall(stamp_init); | |
c6c4d7bb BW |
845 | |
846 | void native_machine_restart(char *cmd) | |
847 | { | |
848 | /* workaround reboot hang when booting from SPI */ | |
849 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | |
850 | bfin_gpio_reset_spi0_ssel1(); | |
851 | } | |
137b1529 MF |
852 | |
853 | /* | |
854 | * Currently the MAC address is saved in Flash by U-Boot | |
855 | */ | |
856 | #define FLASH_MAC 0x203f0000 | |
9862cc52 | 857 | void bfin_get_ether_addr(char *addr) |
137b1529 MF |
858 | { |
859 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); | |
860 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); | |
861 | } | |
9862cc52 | 862 | EXPORT_SYMBOL(bfin_get_ether_addr); |