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