Blackfin arch: add supporting for kgdb
[deliverable/linux.git] / arch / blackfin / mach-bf527 / boards / ezkit.c
CommitLineData
59003145
MH
1/*
2 * File: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
a628a8bc 11 * Copyright 2004-2008 Analog Devices Inc.
59003145
MH
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>
d7e5dd41 35#include <linux/mtd/physmap.h>
59003145
MH
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>
59003145 40#endif
72268689 41#include <linux/i2c.h>
59003145
MH
42#include <linux/irq.h>
43#include <linux/interrupt.h>
632f658b 44#include <linux/usb/sl811.h>
1089e228 45#include <linux/usb/musb.h>
59003145
MH
46#include <asm/dma.h>
47#include <asm/bfin5xx_spi.h>
48#include <asm/reboot.h>
64307f7d 49#include <asm/nand.h>
5d448dd5 50#include <asm/portmux.h>
14b03204 51#include <asm/dpmc.h>
59003145
MH
52#include <linux/spi/ad7877.h>
53
54/*
55 * Name the Board for the /proc/cpuinfo
56 */
066954a3 57const char bfin_board_name[] = "ADDS-BF527-EZKIT";
59003145
MH
58
59/*
60 * Driver needs to know address, irq and flag pin.
61 */
62
63#define ISP1761_BASE 0x203C0000
64#define ISP1761_IRQ IRQ_PF7
65
66#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
67static struct resource bfin_isp1761_resources[] = {
68 [0] = {
69 .name = "isp1761-regs",
70 .start = ISP1761_BASE + 0x00000000,
71 .end = ISP1761_BASE + 0x000fffff,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = ISP1761_IRQ,
76 .end = ISP1761_IRQ,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct platform_device bfin_isp1761_device = {
82 .name = "isp1761",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
85 .resource = bfin_isp1761_resources,
86};
87
88static struct platform_device *bfin_isp1761_devices[] = {
89 &bfin_isp1761_device,
90};
91
92int __init bfin_isp1761_init(void)
93{
94 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
95
b85d858b 96 printk(KERN_INFO "%s(): registering device resources\n", __func__);
59003145
MH
97 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
98
99 return platform_add_devices(bfin_isp1761_devices, num_devices);
100}
101
102void __exit bfin_isp1761_exit(void)
103{
104 platform_device_unregister(&bfin_isp1761_device);
105}
106
107arch_initcall(bfin_isp1761_init);
108#endif
109
1089e228
MH
110#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
111static struct resource musb_resources[] = {
112 [0] = {
113 .start = 0xffc03800,
114 .end = 0xffc03cff,
115 .flags = IORESOURCE_MEM,
116 },
117 [1] = { /* general IRQ */
118 .start = IRQ_USB_INT0,
119 .end = IRQ_USB_INT0,
120 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
121 },
122 [2] = { /* DMA IRQ */
123 .start = IRQ_USB_DMA,
124 .end = IRQ_USB_DMA,
125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
126 },
127};
128
50041acb
BW
129static struct musb_hdrc_config musb_config = {
130 .multipoint = 0,
131 .dyn_fifo = 0,
132 .soft_con = 1,
133 .dma = 1,
134 .num_eps = 7,
135 .dma_channels = 7,
136 .gpio_vrsel = GPIO_PG13,
137};
138
1089e228
MH
139static struct musb_hdrc_platform_data musb_plat = {
140#if defined(CONFIG_USB_MUSB_OTG)
141 .mode = MUSB_OTG,
142#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
143 .mode = MUSB_HOST,
144#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
145 .mode = MUSB_PERIPHERAL,
146#endif
50041acb 147 .config = &musb_config,
1089e228
MH
148};
149
150static u64 musb_dmamask = ~(u32)0;
151
152static struct platform_device musb_device = {
153 .name = "musb_hdrc",
154 .id = 0,
155 .dev = {
156 .dma_mask = &musb_dmamask,
157 .coherent_dma_mask = 0xffffffff,
158 .platform_data = &musb_plat,
159 },
160 .num_resources = ARRAY_SIZE(musb_resources),
161 .resource = musb_resources,
162};
163#endif
164
165#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
166
167static struct resource bf52x_t350mcqb_resources[] = {
168 {
169 .start = IRQ_PPI_ERROR,
170 .end = IRQ_PPI_ERROR,
171 .flags = IORESOURCE_IRQ,
172 },
173};
174
175static struct platform_device bf52x_t350mcqb_device = {
176 .name = "bfin-t350mcqb",
177 .id = -1,
178 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
179 .resource = bf52x_t350mcqb_resources,
180};
181#endif
182
d7e5dd41
MH
183#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
184static struct mtd_partition ezkit_partitions[] = {
185 {
aa582977 186 .name = "bootloader(nor)",
d7e5dd41
MH
187 .size = 0x40000,
188 .offset = 0,
189 }, {
aa582977 190 .name = "linux kernel(nor)",
d7e5dd41
MH
191 .size = 0x1C0000,
192 .offset = MTDPART_OFS_APPEND,
193 }, {
aa582977 194 .name = "file system(nor)",
d7e5dd41
MH
195 .size = MTDPART_SIZ_FULL,
196 .offset = MTDPART_OFS_APPEND,
197 }
198};
199
200static struct physmap_flash_data ezkit_flash_data = {
201 .width = 2,
202 .parts = ezkit_partitions,
203 .nr_parts = ARRAY_SIZE(ezkit_partitions),
204};
205
206static struct resource ezkit_flash_resource = {
207 .start = 0x20000000,
208 .end = 0x203fffff,
209 .flags = IORESOURCE_MEM,
210};
211
212static struct platform_device ezkit_flash_device = {
213 .name = "physmap-flash",
214 .id = 0,
215 .dev = {
216 .platform_data = &ezkit_flash_data,
217 },
218 .num_resources = 1,
219 .resource = &ezkit_flash_resource,
220};
221#endif
222
64307f7d
MH
223#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
224static struct mtd_partition partition_info[] = {
225 {
aa582977 226 .name = "linux kernel(nand)",
64307f7d 227 .offset = 0,
f4585a08 228 .size = 4 * 1024 * 1024,
64307f7d
MH
229 },
230 {
aa582977 231 .name = "file system(nand)",
edf05641
MF
232 .offset = MTDPART_OFS_APPEND,
233 .size = MTDPART_SIZ_FULL,
64307f7d
MH
234 },
235};
236
237static struct bf5xx_nand_platform bf5xx_nand_platform = {
238 .page_size = NFC_PG_SIZE_256,
239 .data_width = NFC_NWIDTH_8,
240 .partitions = partition_info,
241 .nr_partitions = ARRAY_SIZE(partition_info),
242 .rd_dly = 3,
243 .wr_dly = 3,
244};
245
246static struct resource bf5xx_nand_resources[] = {
247 {
248 .start = NFC_CTL,
249 .end = NFC_DATA_RD + 2,
250 .flags = IORESOURCE_MEM,
251 },
252 {
253 .start = CH_NFC,
254 .end = CH_NFC,
255 .flags = IORESOURCE_IRQ,
256 },
257};
258
259static struct platform_device bf5xx_nand_device = {
260 .name = "bf5xx-nand",
261 .id = 0,
262 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
263 .resource = bf5xx_nand_resources,
264 .dev = {
265 .platform_data = &bf5xx_nand_platform,
266 },
267};
268#endif
269
59003145
MH
270#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
271static struct resource bfin_pcmcia_cf_resources[] = {
272 {
273 .start = 0x20310000, /* IO PORT */
274 .end = 0x20312000,
275 .flags = IORESOURCE_MEM,
276 }, {
277 .start = 0x20311000, /* Attribute Memory */
278 .end = 0x20311FFF,
279 .flags = IORESOURCE_MEM,
280 }, {
281 .start = IRQ_PF4,
282 .end = IRQ_PF4,
283 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
284 }, {
285 .start = 6, /* Card Detect PF6 */
286 .end = 6,
287 .flags = IORESOURCE_IRQ,
288 },
289};
290
291static struct platform_device bfin_pcmcia_cf_device = {
292 .name = "bfin_cf_pcmcia",
293 .id = -1,
294 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
295 .resource = bfin_pcmcia_cf_resources,
296};
297#endif
298
299#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
300static struct platform_device rtc_device = {
301 .name = "rtc-bfin",
302 .id = -1,
303};
304#endif
305
306#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
307static struct resource smc91x_resources[] = {
308 {
309 .name = "smc91x-regs",
310 .start = 0x20300300,
311 .end = 0x20300300 + 16,
312 .flags = IORESOURCE_MEM,
313 }, {
314
315 .start = IRQ_PF7,
316 .end = IRQ_PF7,
317 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
318 },
319};
320static struct platform_device smc91x_device = {
321 .name = "smc91x",
322 .id = 0,
323 .num_resources = ARRAY_SIZE(smc91x_resources),
324 .resource = smc91x_resources,
325};
326#endif
327
328#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
329static struct resource dm9000_resources[] = {
330 [0] = {
331 .start = 0x203FB800,
da3854fc 332 .end = 0x203FB800 + 1,
59003145
MH
333 .flags = IORESOURCE_MEM,
334 },
335 [1] = {
da3854fc
LP
336 .start = 0x203FB800 + 4,
337 .end = 0x203FB800 + 5,
338 .flags = IORESOURCE_MEM,
339 },
340 [2] = {
59003145
MH
341 .start = IRQ_PF9,
342 .end = IRQ_PF9,
343 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
344 },
345};
346
347static struct platform_device dm9000_device = {
348 .name = "dm9000",
349 .id = -1,
350 .num_resources = ARRAY_SIZE(dm9000_resources),
351 .resource = dm9000_resources,
352};
353#endif
354
355#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
356static struct resource sl811_hcd_resources[] = {
357 {
358 .start = 0x20340000,
359 .end = 0x20340000,
360 .flags = IORESOURCE_MEM,
361 }, {
362 .start = 0x20340004,
363 .end = 0x20340004,
364 .flags = IORESOURCE_MEM,
365 }, {
366 .start = CONFIG_USB_SL811_BFIN_IRQ,
367 .end = CONFIG_USB_SL811_BFIN_IRQ,
368 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
369 },
370};
371
372#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
373void sl811_port_power(struct device *dev, int is_on)
374{
375 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
acbcd263 376 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
59003145
MH
377}
378#endif
379
380static struct sl811_platform_data sl811_priv = {
381 .potpg = 10,
382 .power = 250, /* == 500mA */
383#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
384 .port_power = &sl811_port_power,
385#endif
386};
387
388static struct platform_device sl811_hcd_device = {
389 .name = "sl811-hcd",
390 .id = 0,
391 .dev = {
392 .platform_data = &sl811_priv,
393 },
394 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
395 .resource = sl811_hcd_resources,
396};
397#endif
398
399#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
400static struct resource isp1362_hcd_resources[] = {
401 {
402 .start = 0x20360000,
403 .end = 0x20360000,
404 .flags = IORESOURCE_MEM,
405 }, {
406 .start = 0x20360004,
407 .end = 0x20360004,
408 .flags = IORESOURCE_MEM,
409 }, {
410 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
411 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
412 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
413 },
414};
415
416static struct isp1362_platform_data isp1362_priv = {
417 .sel15Kres = 1,
418 .clknotstop = 0,
419 .oc_enable = 0,
420 .int_act_high = 0,
421 .int_edge_triggered = 0,
422 .remote_wakeup_connected = 0,
423 .no_power_switching = 1,
424 .power_switching_mode = 0,
425};
426
427static struct platform_device isp1362_hcd_device = {
428 .name = "isp1362-hcd",
429 .id = 0,
430 .dev = {
431 .platform_data = &isp1362_priv,
432 },
433 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
434 .resource = isp1362_hcd_resources,
435};
436#endif
437
438#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
439static struct platform_device bfin_mac_device = {
440 .name = "bfin_mac",
441};
442#endif
443
444#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
445static struct resource net2272_bfin_resources[] = {
446 {
447 .start = 0x20300000,
448 .end = 0x20300000 + 0x100,
449 .flags = IORESOURCE_MEM,
450 }, {
451 .start = IRQ_PF7,
452 .end = IRQ_PF7,
453 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
454 },
455};
456
457static struct platform_device net2272_bfin_device = {
458 .name = "net2272",
459 .id = -1,
460 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
461 .resource = net2272_bfin_resources,
462};
463#endif
464
59003145
MH
465#if defined(CONFIG_MTD_M25P80) \
466 || defined(CONFIG_MTD_M25P80_MODULE)
467static struct mtd_partition bfin_spi_flash_partitions[] = {
468 {
aa582977 469 .name = "bootloader(spi)",
ac76d889 470 .size = 0x00040000,
59003145
MH
471 .offset = 0,
472 .mask_flags = MTD_CAP_ROM
473 }, {
aa582977 474 .name = "linux kernel(spi)",
edf05641
MF
475 .size = MTDPART_SIZ_FULL,
476 .offset = MTDPART_OFS_APPEND,
59003145
MH
477 }
478};
479
480static struct flash_platform_data bfin_spi_flash_data = {
481 .name = "m25p80",
482 .parts = bfin_spi_flash_partitions,
483 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
b9c9e788 484 .type = "m25p16",
59003145
MH
485};
486
487/* SPI flash chip (m25p64) */
488static struct bfin5xx_spi_chip spi_flash_chip_info = {
489 .enable_dma = 0, /* use dma transfer with this chip*/
490 .bits_per_word = 8,
491};
492#endif
493
494#if defined(CONFIG_SPI_ADC_BF533) \
495 || defined(CONFIG_SPI_ADC_BF533_MODULE)
496/* SPI ADC chip */
497static struct bfin5xx_spi_chip spi_adc_chip_info = {
498 .enable_dma = 1, /* use dma transfer with this chip*/
499 .bits_per_word = 16,
500};
501#endif
502
503#if defined(CONFIG_SND_BLACKFIN_AD1836) \
504 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
505static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
506 .enable_dma = 0,
507 .bits_per_word = 16,
508};
509#endif
510
511#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
512static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
513 .enable_dma = 0,
514 .bits_per_word = 16,
515};
516#endif
517
518#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
519static struct bfin5xx_spi_chip spi_mmc_chip_info = {
520 .enable_dma = 1,
521 .bits_per_word = 8,
522};
523#endif
524
525#if defined(CONFIG_PBX)
526static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
527 .ctl_reg = 0x4, /* send zero */
528 .enable_dma = 0,
529 .bits_per_word = 8,
530 .cs_change_per_word = 1,
531};
532#endif
533
59003145
MH
534#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
535static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
536 .enable_dma = 0,
537 .bits_per_word = 16,
538};
539
540static const struct ad7877_platform_data bfin_ad7877_ts_info = {
541 .model = 7877,
542 .vref_delay_usecs = 50, /* internal, no capacitor */
543 .x_plate_ohms = 419,
544 .y_plate_ohms = 486,
545 .pressure_max = 1000,
546 .pressure_min = 0,
547 .stopacq_polarity = 1,
548 .first_conversion_delay = 3,
549 .acquisition_time = 1,
550 .averaging = 1,
551 .pen_down_acc_interval = 1,
552};
553#endif
554
c7d48966 555#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
0954f70a
MH
556 && defined(CONFIG_SND_SOC_WM8731_SPI)
557static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
558 .enable_dma = 0,
559 .bits_per_word = 16,
560};
561#endif
6e668936
MH
562
563#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
564static struct bfin5xx_spi_chip spidev_chip_info = {
565 .enable_dma = 0,
566 .bits_per_word = 8,
567};
568#endif
569
59003145
MH
570static struct spi_board_info bfin_spi_board_info[] __initdata = {
571#if defined(CONFIG_MTD_M25P80) \
572 || defined(CONFIG_MTD_M25P80_MODULE)
573 {
574 /* the modalias must be the same as spi device driver name */
575 .modalias = "m25p80", /* Name of spi_driver for this device */
576 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
577 .bus_num = 0, /* Framework bus number */
578 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
579 .platform_data = &bfin_spi_flash_data,
580 .controller_data = &spi_flash_chip_info,
581 .mode = SPI_MODE_3,
582 },
583#endif
584
585#if defined(CONFIG_SPI_ADC_BF533) \
586 || defined(CONFIG_SPI_ADC_BF533_MODULE)
587 {
588 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
589 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
590 .bus_num = 0, /* Framework bus number */
591 .chip_select = 1, /* Framework chip select. */
592 .platform_data = NULL, /* No spi_driver specific config */
593 .controller_data = &spi_adc_chip_info,
594 },
595#endif
596
597#if defined(CONFIG_SND_BLACKFIN_AD1836) \
598 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
599 {
600 .modalias = "ad1836-spi",
601 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
602 .bus_num = 0,
603 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
604 .controller_data = &ad1836_spi_chip_info,
605 },
606#endif
607#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
608 {
609 .modalias = "ad9960-spi",
610 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
611 .bus_num = 0,
612 .chip_select = 1,
613 .controller_data = &ad9960_spi_chip_info,
614 },
615#endif
616#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
617 {
618 .modalias = "spi_mmc_dummy",
619 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
620 .bus_num = 0,
621 .chip_select = 0,
622 .platform_data = NULL,
623 .controller_data = &spi_mmc_chip_info,
624 .mode = SPI_MODE_3,
625 },
626 {
627 .modalias = "spi_mmc",
628 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
629 .bus_num = 0,
630 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
631 .platform_data = NULL,
632 .controller_data = &spi_mmc_chip_info,
633 .mode = SPI_MODE_3,
634 },
635#endif
636#if defined(CONFIG_PBX)
637 {
638 .modalias = "fxs-spi",
639 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
640 .bus_num = 0,
641 .chip_select = 8 - CONFIG_J11_JUMPER,
642 .controller_data = &spi_si3xxx_chip_info,
643 .mode = SPI_MODE_3,
644 },
645 {
646 .modalias = "fxo-spi",
647 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
648 .bus_num = 0,
649 .chip_select = 8 - CONFIG_J19_JUMPER,
650 .controller_data = &spi_si3xxx_chip_info,
651 .mode = SPI_MODE_3,
652 },
653#endif
59003145
MH
654#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
655 {
656 .modalias = "ad7877",
657 .platform_data = &bfin_ad7877_ts_info,
2eb74ae2 658 .irq = IRQ_PF8,
59003145 659 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
0954f70a 660 .bus_num = 0,
2eb74ae2 661 .chip_select = 2,
59003145
MH
662 .controller_data = &spi_ad7877_chip_info,
663 },
664#endif
c7d48966 665#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
0954f70a
MH
666 && defined(CONFIG_SND_SOC_WM8731_SPI)
667 {
668 .modalias = "wm8731",
669 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
670 .bus_num = 0,
671 .chip_select = 5,
672 .controller_data = &spi_wm8731_chip_info,
673 .mode = SPI_MODE_0,
674 },
675#endif
6e668936
MH
676#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
677 {
678 .modalias = "spidev",
679 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
680 .bus_num = 0,
681 .chip_select = 1,
682 .controller_data = &spidev_chip_info,
683 },
684#endif
59003145
MH
685};
686
5bda2723 687#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
59003145
MH
688/* SPI controller data */
689static struct bfin5xx_spi_master bfin_spi0_info = {
690 .num_chipselect = 8,
691 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 692 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
59003145
MH
693};
694
695/* SPI (0) */
696static struct resource bfin_spi0_resource[] = {
697 [0] = {
698 .start = SPI0_REGBASE,
699 .end = SPI0_REGBASE + 0xFF,
700 .flags = IORESOURCE_MEM,
701 },
702 [1] = {
703 .start = CH_SPI,
704 .end = CH_SPI,
705 .flags = IORESOURCE_IRQ,
706 },
707};
708
709static struct platform_device bfin_spi0_device = {
710 .name = "bfin-spi",
711 .id = 0, /* Bus number */
712 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
713 .resource = bfin_spi0_resource,
714 .dev = {
715 .platform_data = &bfin_spi0_info, /* Passed to driver */
716 },
717};
718#endif /* spi master and devices */
719
720#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
721static struct platform_device bfin_fb_device = {
722 .name = "bf537-lq035",
723};
724#endif
725
726#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
727static struct platform_device bfin_fb_adv7393_device = {
728 .name = "bfin-adv7393",
729};
730#endif
731
732#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
733static struct resource bfin_uart_resources[] = {
734#ifdef CONFIG_SERIAL_BFIN_UART0
735 {
736 .start = 0xFFC00400,
737 .end = 0xFFC004FF,
738 .flags = IORESOURCE_MEM,
739 },
740#endif
741#ifdef CONFIG_SERIAL_BFIN_UART1
742 {
743 .start = 0xFFC02000,
744 .end = 0xFFC020FF,
745 .flags = IORESOURCE_MEM,
746 },
747#endif
748};
749
750static struct platform_device bfin_uart_device = {
751 .name = "bfin-uart",
752 .id = 1,
753 .num_resources = ARRAY_SIZE(bfin_uart_resources),
754 .resource = bfin_uart_resources,
755};
756#endif
757
5be36d22
GY
758#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
759static struct resource bfin_sir_resources[] = {
760#ifdef CONFIG_BFIN_SIR0
761 {
762 .start = 0xFFC00400,
763 .end = 0xFFC004FF,
764 .flags = IORESOURCE_MEM,
765 },
766#endif
767#ifdef CONFIG_BFIN_SIR1
768 {
769 .start = 0xFFC02000,
770 .end = 0xFFC020FF,
771 .flags = IORESOURCE_MEM,
772 },
773#endif
774};
775
776static struct platform_device bfin_sir_device = {
777 .name = "bfin_sir",
778 .id = 0,
779 .num_resources = ARRAY_SIZE(bfin_sir_resources),
780 .resource = bfin_sir_resources,
781};
782#endif
783
59003145
MH
784#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
785static struct resource bfin_twi0_resource[] = {
786 [0] = {
787 .start = TWI0_REGBASE,
788 .end = TWI0_REGBASE,
789 .flags = IORESOURCE_MEM,
790 },
791 [1] = {
792 .start = IRQ_TWI,
793 .end = IRQ_TWI,
794 .flags = IORESOURCE_IRQ,
795 },
796};
797
798static struct platform_device i2c_bfin_twi_device = {
799 .name = "i2c-bfin-twi",
800 .id = 0,
801 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
802 .resource = bfin_twi0_resource,
803};
804#endif
805
72268689
BW
806#ifdef CONFIG_I2C_BOARDINFO
807static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
808#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
809 {
810 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
72268689
BW
811 },
812#endif
813#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
814 {
815 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
72268689
BW
816 .irq = IRQ_PF8,
817 },
818#endif
819};
820#endif
821
59003145
MH
822#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
823static struct platform_device bfin_sport0_uart_device = {
824 .name = "bfin-sport-uart",
825 .id = 0,
826};
827
828static struct platform_device bfin_sport1_uart_device = {
829 .name = "bfin-sport-uart",
830 .id = 1,
831};
832#endif
833
1089e228
MH
834#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
835#include <linux/input.h>
836#include <linux/gpio_keys.h>
837
838static struct gpio_keys_button bfin_gpio_keys_table[] = {
839 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
840 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
841};
842
843static struct gpio_keys_platform_data bfin_gpio_keys_data = {
844 .buttons = bfin_gpio_keys_table,
845 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
846};
847
848static struct platform_device bfin_device_gpiokeys = {
849 .name = "gpio-keys",
850 .dev = {
851 .platform_data = &bfin_gpio_keys_data,
852 },
853};
854#endif
855
cad2ab65
MF
856static struct resource bfin_gpios_resources = {
857 .start = 0,
858 .end = MAX_BLACKFIN_GPIOS - 1,
859 .flags = IORESOURCE_IRQ,
860};
861
862static struct platform_device bfin_gpios_device = {
863 .name = "simple-gpio",
864 .id = -1,
865 .num_resources = 1,
866 .resource = &bfin_gpios_resources,
867};
868
14b03204
MH
869static const unsigned int cclk_vlev_datasheet[] =
870{
871 VRPAIR(VLEV_100, 400000000),
872 VRPAIR(VLEV_105, 426000000),
873 VRPAIR(VLEV_110, 500000000),
874 VRPAIR(VLEV_115, 533000000),
875 VRPAIR(VLEV_120, 600000000),
876};
877
878static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
879 .tuple_tab = cclk_vlev_datasheet,
880 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
881 .vr_settling_time = 25 /* us */,
882};
883
884static struct platform_device bfin_dpmc = {
885 .name = "bfin dpmc",
886 .dev = {
887 .platform_data = &bfin_dmpc_vreg_data,
888 },
889};
890
59003145 891static struct platform_device *stamp_devices[] __initdata = {
14b03204
MH
892
893 &bfin_dpmc,
894
64307f7d
MH
895#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
896 &bf5xx_nand_device,
897#endif
898
59003145
MH
899#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
900 &bfin_pcmcia_cf_device,
901#endif
902
903#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
904 &rtc_device,
905#endif
906
907#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
908 &sl811_hcd_device,
909#endif
910
911#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
912 &isp1362_hcd_device,
913#endif
914
1089e228
MH
915#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
916 &musb_device,
917#endif
918
59003145
MH
919#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
920 &smc91x_device,
921#endif
922
923#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
924 &dm9000_device,
925#endif
926
927#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
928 &bfin_mac_device,
929#endif
930
931#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
932 &net2272_bfin_device,
933#endif
934
935#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
936 &bfin_spi0_device,
937#endif
938
939#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
940 &bfin_fb_device,
941#endif
942
1089e228
MH
943#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
944 &bf52x_t350mcqb_device,
945#endif
946
59003145
MH
947#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
948 &bfin_fb_adv7393_device,
949#endif
950
951#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
952 &bfin_uart_device,
953#endif
954
5be36d22
GY
955#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
956 &bfin_sir_device,
957#endif
958
59003145
MH
959#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
960 &i2c_bfin_twi_device,
961#endif
962
963#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
964 &bfin_sport0_uart_device,
965 &bfin_sport1_uart_device,
966#endif
967
1089e228
MH
968#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
969 &bfin_device_gpiokeys,
970#endif
cad2ab65 971
d7e5dd41
MH
972#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
973 &ezkit_flash_device,
974#endif
975
cad2ab65 976 &bfin_gpios_device,
59003145
MH
977};
978
979static int __init stamp_init(void)
980{
b85d858b 981 printk(KERN_INFO "%s(): registering device resources\n", __func__);
72268689
BW
982
983#ifdef CONFIG_I2C_BOARDINFO
984 i2c_register_board_info(0, bfin_i2c_board_info,
985 ARRAY_SIZE(bfin_i2c_board_info));
986#endif
987
59003145 988 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
5bda2723 989 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
59003145
MH
990 return 0;
991}
992
993arch_initcall(stamp_init);
994
995void native_machine_restart(char *cmd)
996{
997 /* workaround reboot hang when booting from SPI */
998 if ((bfin_read_SYSCR() & 0x7) == 0x3)
999 bfin_gpio_reset_spi0_ssel1();
1000}
137b1529 1001
9862cc52 1002void bfin_get_ether_addr(char *addr)
137b1529 1003{
181afa94
MF
1004 /* the MAC is stored in OTP memory page 0xDF */
1005 u32 ret;
1006 u64 otp_mac;
1007 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1008
1009 ret = otp_read(0xDF, 0x00, &otp_mac);
1010 if (!(ret & 0x1)) {
1011 char *otp_mac_p = (char *)&otp_mac;
1012 for (ret = 0; ret < 6; ++ret)
1013 addr[ret] = otp_mac_p[5 - ret];
1014 }
137b1529 1015}
9862cc52 1016EXPORT_SYMBOL(bfin_get_ether_addr);
This page took 0.23381 seconds and 5 git commands to generate.