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