Blackfin: delete '-spi' suffix in ad1836/ad1938 driver name
[deliverable/linux.git] / arch / blackfin / mach-bf527 / boards / cm_bf527.c
CommitLineData
9db144fe
MH
1/*
2 * File: arch/blackfin/mach-bf527/boards/cm-bf527.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)
11 * Copyright 2004-2008 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>
35#include <linux/mtd/physmap.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#include <linux/etherdevice.h>
39#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40#include <linux/usb/isp1362.h>
41#endif
9db144fe
MH
42#include <linux/i2c.h>
43#include <linux/irq.h>
44#include <linux/interrupt.h>
45#include <linux/usb/sl811.h>
9db144fe 46#include <linux/usb/musb.h>
9db144fe
MH
47#include <asm/dma.h>
48#include <asm/bfin5xx_spi.h>
49#include <asm/reboot.h>
50#include <asm/nand.h>
51#include <asm/portmux.h>
52#include <asm/dpmc.h>
53#include <linux/spi/ad7877.h>
54
55/*
56 * Name the Board for the /proc/cpuinfo
57 */
58const char bfin_board_name[] = "Bluetechnix CM-BF527";
59
60/*
61 * Driver needs to know address, irq and flag pin.
62 */
63
9db144fe 64#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
3f375690
MH
65#include <linux/usb/isp1760.h>
66static struct resource bfin_isp1760_resources[] = {
9db144fe 67 [0] = {
3f375690
MH
68 .start = 0x203C0000,
69 .end = 0x203C0000 + 0x000fffff,
9db144fe
MH
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
3f375690
MH
73 .start = IRQ_PF7,
74 .end = IRQ_PF7,
9db144fe
MH
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
3f375690
MH
79static struct isp1760_platform_data isp1760_priv = {
80 .is_isp1761 = 0,
3f375690
MH
81 .bus_width_16 = 1,
82 .port1_otg = 0,
83 .analog_oc = 0,
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
9db144fe
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,
9db144fe 96};
9db144fe
MH
97#endif
98
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_PF11,
126};
127
9db144fe
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,
9db144fe
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_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
155static struct mtd_partition ezkit_partitions[] = {
156 {
aa582977 157 .name = "bootloader(nor)",
9db144fe
MH
158 .size = 0x40000,
159 .offset = 0,
160 }, {
aa582977 161 .name = "linux kernel(nor)",
9db144fe
MH
162 .size = 0x1C0000,
163 .offset = MTDPART_OFS_APPEND,
164 }, {
aa582977 165 .name = "file system(nor)",
9db144fe
MH
166 .size = MTDPART_SIZ_FULL,
167 .offset = MTDPART_OFS_APPEND,
168 }
169};
170
171static struct physmap_flash_data ezkit_flash_data = {
172 .width = 2,
173 .parts = ezkit_partitions,
174 .nr_parts = ARRAY_SIZE(ezkit_partitions),
175};
176
177static struct resource ezkit_flash_resource = {
178 .start = 0x20000000,
179 .end = 0x201fffff,
180 .flags = IORESOURCE_MEM,
181};
182
183static struct platform_device ezkit_flash_device = {
184 .name = "physmap-flash",
185 .id = 0,
186 .dev = {
187 .platform_data = &ezkit_flash_data,
188 },
189 .num_resources = 1,
190 .resource = &ezkit_flash_resource,
191};
192#endif
193
194#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
195static struct mtd_partition partition_info[] = {
196 {
aa582977 197 .name = "linux kernel(nand)",
9db144fe 198 .offset = 0,
f4585a08 199 .size = 4 * 1024 * 1024,
9db144fe
MH
200 },
201 {
aa582977 202 .name = "file system(nand)",
9db144fe
MH
203 .offset = MTDPART_OFS_APPEND,
204 .size = MTDPART_SIZ_FULL,
205 },
206};
207
208static struct bf5xx_nand_platform bf5xx_nand_platform = {
209 .page_size = NFC_PG_SIZE_256,
210 .data_width = NFC_NWIDTH_8,
211 .partitions = partition_info,
212 .nr_partitions = ARRAY_SIZE(partition_info),
213 .rd_dly = 3,
214 .wr_dly = 3,
215};
216
217static struct resource bf5xx_nand_resources[] = {
218 {
219 .start = NFC_CTL,
220 .end = NFC_DATA_RD + 2,
221 .flags = IORESOURCE_MEM,
222 },
223 {
224 .start = CH_NFC,
225 .end = CH_NFC,
226 .flags = IORESOURCE_IRQ,
227 },
228};
229
230static struct platform_device bf5xx_nand_device = {
231 .name = "bf5xx-nand",
232 .id = 0,
233 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
234 .resource = bf5xx_nand_resources,
235 .dev = {
236 .platform_data = &bf5xx_nand_platform,
237 },
238};
239#endif
240
241#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
242static struct resource bfin_pcmcia_cf_resources[] = {
243 {
244 .start = 0x20310000, /* IO PORT */
245 .end = 0x20312000,
246 .flags = IORESOURCE_MEM,
247 }, {
248 .start = 0x20311000, /* Attribute Memory */
249 .end = 0x20311FFF,
250 .flags = IORESOURCE_MEM,
251 }, {
252 .start = IRQ_PF4,
253 .end = IRQ_PF4,
254 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
255 }, {
256 .start = 6, /* Card Detect PF6 */
257 .end = 6,
258 .flags = IORESOURCE_IRQ,
259 },
260};
261
262static struct platform_device bfin_pcmcia_cf_device = {
263 .name = "bfin_cf_pcmcia",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
266 .resource = bfin_pcmcia_cf_resources,
267};
268#endif
269
270#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
271static struct platform_device rtc_device = {
272 .name = "rtc-bfin",
273 .id = -1,
274};
275#endif
276
277#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
61f09b5a
MH
278#include <linux/smc91x.h>
279
280static struct smc91x_platdata smc91x_info = {
281 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
282 .leda = RPC_LED_100_10,
283 .ledb = RPC_LED_TX_RX,
284};
285
9db144fe
MH
286static struct resource smc91x_resources[] = {
287 {
288 .name = "smc91x-regs",
289 .start = 0x20300300,
290 .end = 0x20300300 + 16,
291 .flags = IORESOURCE_MEM,
292 }, {
293
294 .start = IRQ_PF7,
295 .end = IRQ_PF7,
296 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
297 },
298};
299static struct platform_device smc91x_device = {
300 .name = "smc91x",
301 .id = 0,
302 .num_resources = ARRAY_SIZE(smc91x_resources),
303 .resource = smc91x_resources,
61f09b5a
MH
304 .dev = {
305 .platform_data = &smc91x_info,
306 },
9db144fe
MH
307};
308#endif
309
310#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
311static struct resource dm9000_resources[] = {
312 [0] = {
313 .start = 0x203FB800,
b3dec4a4 314 .end = 0x203FB800 + 1,
9db144fe
MH
315 .flags = IORESOURCE_MEM,
316 },
317 [1] = {
b3dec4a4
BS
318 .start = 0x203FB804,
319 .end = 0x203FB804 + 1,
320 .flags = IORESOURCE_MEM,
321 },
322 [2] = {
9db144fe
MH
323 .start = IRQ_PF9,
324 .end = IRQ_PF9,
325 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
326 },
327};
328
329static struct platform_device dm9000_device = {
330 .name = "dm9000",
331 .id = -1,
332 .num_resources = ARRAY_SIZE(dm9000_resources),
333 .resource = dm9000_resources,
334};
335#endif
336
337#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
338static struct resource sl811_hcd_resources[] = {
339 {
340 .start = 0x20340000,
341 .end = 0x20340000,
342 .flags = IORESOURCE_MEM,
343 }, {
344 .start = 0x20340004,
345 .end = 0x20340004,
346 .flags = IORESOURCE_MEM,
347 }, {
348 .start = CONFIG_USB_SL811_BFIN_IRQ,
349 .end = CONFIG_USB_SL811_BFIN_IRQ,
350 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
351 },
352};
353
354#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
355void sl811_port_power(struct device *dev, int is_on)
356{
357 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
358 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
359}
360#endif
361
362static struct sl811_platform_data sl811_priv = {
363 .potpg = 10,
364 .power = 250, /* == 500mA */
365#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
366 .port_power = &sl811_port_power,
367#endif
368};
369
370static struct platform_device sl811_hcd_device = {
371 .name = "sl811-hcd",
372 .id = 0,
373 .dev = {
374 .platform_data = &sl811_priv,
375 },
376 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
377 .resource = sl811_hcd_resources,
378};
379#endif
380
381#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
382static struct resource isp1362_hcd_resources[] = {
383 {
384 .start = 0x20360000,
385 .end = 0x20360000,
386 .flags = IORESOURCE_MEM,
387 }, {
388 .start = 0x20360004,
389 .end = 0x20360004,
390 .flags = IORESOURCE_MEM,
391 }, {
392 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
393 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
394 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
395 },
396};
397
398static struct isp1362_platform_data isp1362_priv = {
399 .sel15Kres = 1,
400 .clknotstop = 0,
401 .oc_enable = 0,
402 .int_act_high = 0,
403 .int_edge_triggered = 0,
404 .remote_wakeup_connected = 0,
405 .no_power_switching = 1,
406 .power_switching_mode = 0,
407};
408
409static struct platform_device isp1362_hcd_device = {
410 .name = "isp1362-hcd",
411 .id = 0,
412 .dev = {
413 .platform_data = &isp1362_priv,
414 },
415 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
416 .resource = isp1362_hcd_resources,
417};
418#endif
419
420#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
65319628
GY
421static struct platform_device bfin_mii_bus = {
422 .name = "bfin_mii_bus",
423};
424
9db144fe
MH
425static struct platform_device bfin_mac_device = {
426 .name = "bfin_mac",
65319628 427 .dev.platform_data = &bfin_mii_bus,
9db144fe
MH
428};
429#endif
430
431#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
432static struct resource net2272_bfin_resources[] = {
433 {
434 .start = 0x20300000,
435 .end = 0x20300000 + 0x100,
436 .flags = IORESOURCE_MEM,
437 }, {
438 .start = IRQ_PF7,
439 .end = IRQ_PF7,
440 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
441 },
442};
443
444static struct platform_device net2272_bfin_device = {
445 .name = "net2272",
446 .id = -1,
447 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
448 .resource = net2272_bfin_resources,
449};
450#endif
451
452#if defined(CONFIG_MTD_M25P80) \
453 || defined(CONFIG_MTD_M25P80_MODULE)
454static struct mtd_partition bfin_spi_flash_partitions[] = {
455 {
aa582977 456 .name = "bootloader(spi)",
9db144fe
MH
457 .size = 0x00040000,
458 .offset = 0,
459 .mask_flags = MTD_CAP_ROM
460 }, {
aa582977 461 .name = "linux kernel(spi)",
9db144fe
MH
462 .size = MTDPART_SIZ_FULL,
463 .offset = MTDPART_OFS_APPEND,
464 }
465};
466
467static struct flash_platform_data bfin_spi_flash_data = {
468 .name = "m25p80",
469 .parts = bfin_spi_flash_partitions,
470 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
471 .type = "m25p16",
472};
473
474/* SPI flash chip (m25p64) */
475static struct bfin5xx_spi_chip spi_flash_chip_info = {
476 .enable_dma = 0, /* use dma transfer with this chip*/
477 .bits_per_word = 8,
478};
479#endif
480
a261eec0
MF
481#if defined(CONFIG_BFIN_SPI_ADC) \
482 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
9db144fe
MH
483/* SPI ADC chip */
484static struct bfin5xx_spi_chip spi_adc_chip_info = {
485 .enable_dma = 1, /* use dma transfer with this chip*/
486 .bits_per_word = 16,
487};
488#endif
489
490#if defined(CONFIG_SND_BLACKFIN_AD1836) \
491 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
492static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
493 .enable_dma = 0,
494 .bits_per_word = 16,
495};
496#endif
497
f3f704d3
MH
498#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
499static struct bfin5xx_spi_chip mmc_spi_chip_info = {
500 .enable_dma = 0,
9db144fe
MH
501 .bits_per_word = 8,
502};
503#endif
504
9db144fe
MH
505#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
506static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
507 .enable_dma = 0,
508 .bits_per_word = 16,
509};
510
511static const struct ad7877_platform_data bfin_ad7877_ts_info = {
512 .model = 7877,
513 .vref_delay_usecs = 50, /* internal, no capacitor */
514 .x_plate_ohms = 419,
515 .y_plate_ohms = 486,
516 .pressure_max = 1000,
517 .pressure_min = 0,
518 .stopacq_polarity = 1,
519 .first_conversion_delay = 3,
520 .acquisition_time = 1,
521 .averaging = 1,
522 .pen_down_acc_interval = 1,
523};
524#endif
525
526#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
527 && defined(CONFIG_SND_SOC_WM8731_SPI)
528static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
529 .enable_dma = 0,
530 .bits_per_word = 16,
531};
532#endif
533
534#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
535static struct bfin5xx_spi_chip spidev_chip_info = {
536 .enable_dma = 0,
537 .bits_per_word = 8,
538};
539#endif
540
541static struct spi_board_info bfin_spi_board_info[] __initdata = {
542#if defined(CONFIG_MTD_M25P80) \
543 || defined(CONFIG_MTD_M25P80_MODULE)
544 {
545 /* the modalias must be the same as spi device driver name */
546 .modalias = "m25p80", /* Name of spi_driver for this device */
547 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
548 .bus_num = 0, /* Framework bus number */
549 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
550 .platform_data = &bfin_spi_flash_data,
551 .controller_data = &spi_flash_chip_info,
552 .mode = SPI_MODE_3,
553 },
554#endif
555
a261eec0
MF
556#if defined(CONFIG_BFIN_SPI_ADC) \
557 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
9db144fe
MH
558 {
559 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
560 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
561 .bus_num = 0, /* Framework bus number */
562 .chip_select = 1, /* Framework chip select. */
563 .platform_data = NULL, /* No spi_driver specific config */
564 .controller_data = &spi_adc_chip_info,
565 },
566#endif
567
568#if defined(CONFIG_SND_BLACKFIN_AD1836) \
569 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
570 {
dac98174 571 .modalias = "ad1836",
9db144fe
MH
572 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
573 .bus_num = 0,
574 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
575 .controller_data = &ad1836_spi_chip_info,
576 },
577#endif
f3f704d3 578#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
9db144fe 579 {
f3f704d3
MH
580 .modalias = "mmc_spi",
581 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
9db144fe 582 .bus_num = 0,
f3f704d3
MH
583 .chip_select = 5,
584 .controller_data = &mmc_spi_chip_info,
9db144fe
MH
585 .mode = SPI_MODE_3,
586 },
587#endif
9db144fe
MH
588#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
589 {
590 .modalias = "ad7877",
591 .platform_data = &bfin_ad7877_ts_info,
592 .irq = IRQ_PF8,
593 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
594 .bus_num = 0,
595 .chip_select = 2,
596 .controller_data = &spi_ad7877_chip_info,
597 },
598#endif
599#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
600 && defined(CONFIG_SND_SOC_WM8731_SPI)
601 {
602 .modalias = "wm8731",
603 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
604 .bus_num = 0,
605 .chip_select = 5,
606 .controller_data = &spi_wm8731_chip_info,
607 .mode = SPI_MODE_0,
608 },
609#endif
610#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
611 {
612 .modalias = "spidev",
613 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
614 .bus_num = 0,
615 .chip_select = 1,
616 .controller_data = &spidev_chip_info,
617 },
618#endif
619};
620
621#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
622/* SPI controller data */
623static struct bfin5xx_spi_master bfin_spi0_info = {
624 .num_chipselect = 8,
625 .enable_dma = 1, /* master has the ability to do dma transfer */
626 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
627};
628
629/* SPI (0) */
630static struct resource bfin_spi0_resource[] = {
631 [0] = {
632 .start = SPI0_REGBASE,
633 .end = SPI0_REGBASE + 0xFF,
634 .flags = IORESOURCE_MEM,
635 },
636 [1] = {
637 .start = CH_SPI,
638 .end = CH_SPI,
53122693
YL
639 .flags = IORESOURCE_DMA,
640 },
641 [2] = {
642 .start = IRQ_SPI,
643 .end = IRQ_SPI,
9db144fe
MH
644 .flags = IORESOURCE_IRQ,
645 },
646};
647
648static struct platform_device bfin_spi0_device = {
649 .name = "bfin-spi",
650 .id = 0, /* Bus number */
651 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
652 .resource = bfin_spi0_resource,
653 .dev = {
654 .platform_data = &bfin_spi0_info, /* Passed to driver */
655 },
656};
657#endif /* spi master and devices */
658
659#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
660static struct platform_device bfin_fb_adv7393_device = {
661 .name = "bfin-adv7393",
662};
663#endif
664
665#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
666static struct resource bfin_uart_resources[] = {
667#ifdef CONFIG_SERIAL_BFIN_UART0
668 {
669 .start = 0xFFC00400,
670 .end = 0xFFC004FF,
671 .flags = IORESOURCE_MEM,
672 },
673#endif
674#ifdef CONFIG_SERIAL_BFIN_UART1
675 {
676 .start = 0xFFC02000,
677 .end = 0xFFC020FF,
678 .flags = IORESOURCE_MEM,
679 },
680#endif
681};
682
683static struct platform_device bfin_uart_device = {
684 .name = "bfin-uart",
685 .id = 1,
686 .num_resources = ARRAY_SIZE(bfin_uart_resources),
687 .resource = bfin_uart_resources,
688};
689#endif
690
691#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
9db144fe 692#ifdef CONFIG_BFIN_SIR0
42bd8bcb 693static struct resource bfin_sir0_resources[] = {
9db144fe
MH
694 {
695 .start = 0xFFC00400,
696 .end = 0xFFC004FF,
697 .flags = IORESOURCE_MEM,
698 },
42bd8bcb
GY
699 {
700 .start = IRQ_UART0_RX,
701 .end = IRQ_UART0_RX+1,
702 .flags = IORESOURCE_IRQ,
703 },
704 {
705 .start = CH_UART0_RX,
706 .end = CH_UART0_RX+1,
707 .flags = IORESOURCE_DMA,
708 },
709};
710
711static struct platform_device bfin_sir0_device = {
712 .name = "bfin_sir",
713 .id = 0,
714 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
715 .resource = bfin_sir0_resources,
716};
9db144fe
MH
717#endif
718#ifdef CONFIG_BFIN_SIR1
42bd8bcb 719static struct resource bfin_sir1_resources[] = {
9db144fe
MH
720 {
721 .start = 0xFFC02000,
722 .end = 0xFFC020FF,
723 .flags = IORESOURCE_MEM,
724 },
42bd8bcb
GY
725 {
726 .start = IRQ_UART1_RX,
727 .end = IRQ_UART1_RX+1,
728 .flags = IORESOURCE_IRQ,
729 },
730 {
731 .start = CH_UART1_RX,
732 .end = CH_UART1_RX+1,
733 .flags = IORESOURCE_DMA,
734 },
9db144fe
MH
735};
736
42bd8bcb 737static struct platform_device bfin_sir1_device = {
9db144fe 738 .name = "bfin_sir",
42bd8bcb
GY
739 .id = 1,
740 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
741 .resource = bfin_sir1_resources,
9db144fe
MH
742};
743#endif
42bd8bcb 744#endif
9db144fe
MH
745
746#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
747static struct resource bfin_twi0_resource[] = {
748 [0] = {
749 .start = TWI0_REGBASE,
750 .end = TWI0_REGBASE,
751 .flags = IORESOURCE_MEM,
752 },
753 [1] = {
754 .start = IRQ_TWI,
755 .end = IRQ_TWI,
756 .flags = IORESOURCE_IRQ,
757 },
758};
759
760static struct platform_device i2c_bfin_twi_device = {
761 .name = "i2c-bfin-twi",
762 .id = 0,
763 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
764 .resource = bfin_twi0_resource,
765};
766#endif
767
9db144fe 768static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
ebd58333 769#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
9db144fe
MH
770 {
771 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
9db144fe
MH
772 },
773#endif
204844eb 774#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
9db144fe
MH
775 {
776 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
9db144fe
MH
777 .irq = IRQ_PF8,
778 },
779#endif
780};
9db144fe
MH
781
782#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
783static struct platform_device bfin_sport0_uart_device = {
784 .name = "bfin-sport-uart",
785 .id = 0,
786};
787
788static struct platform_device bfin_sport1_uart_device = {
789 .name = "bfin-sport-uart",
790 .id = 1,
791};
792#endif
793
9db144fe
MH
794#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
795#include <linux/input.h>
796#include <linux/gpio_keys.h>
797
798static struct gpio_keys_button bfin_gpio_keys_table[] = {
799 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
800};
801
802static struct gpio_keys_platform_data bfin_gpio_keys_data = {
803 .buttons = bfin_gpio_keys_table,
804 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
805};
806
807static struct platform_device bfin_device_gpiokeys = {
808 .name = "gpio-keys",
809 .dev = {
810 .platform_data = &bfin_gpio_keys_data,
811 },
812};
813#endif
814
815static struct resource bfin_gpios_resources = {
816 .start = 0,
817 .end = MAX_BLACKFIN_GPIOS - 1,
818 .flags = IORESOURCE_IRQ,
819};
820
821static struct platform_device bfin_gpios_device = {
822 .name = "simple-gpio",
823 .id = -1,
824 .num_resources = 1,
825 .resource = &bfin_gpios_resources,
826};
827
828static const unsigned int cclk_vlev_datasheet[] =
829{
830 VRPAIR(VLEV_100, 400000000),
831 VRPAIR(VLEV_105, 426000000),
832 VRPAIR(VLEV_110, 500000000),
833 VRPAIR(VLEV_115, 533000000),
834 VRPAIR(VLEV_120, 600000000),
835};
836
837static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
838 .tuple_tab = cclk_vlev_datasheet,
839 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
840 .vr_settling_time = 25 /* us */,
841};
842
843static struct platform_device bfin_dpmc = {
844 .name = "bfin dpmc",
845 .dev = {
846 .platform_data = &bfin_dmpc_vreg_data,
847 },
848};
849
850static struct platform_device *stamp_devices[] __initdata = {
851
852 &bfin_dpmc,
853
854#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
855 &bf5xx_nand_device,
856#endif
857
858#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
859 &bfin_pcmcia_cf_device,
860#endif
861
862#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
863 &rtc_device,
864#endif
865
866#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
867 &sl811_hcd_device,
868#endif
869
870#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
871 &isp1362_hcd_device,
872#endif
873
3f375690
MH
874#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
875 &bfin_isp1760_device,
876#endif
877
9db144fe
MH
878#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
879 &musb_device,
880#endif
881
882#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
883 &smc91x_device,
884#endif
885
886#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
887 &dm9000_device,
888#endif
889
890#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
65319628 891 &bfin_mii_bus,
9db144fe
MH
892 &bfin_mac_device,
893#endif
894
895#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
896 &net2272_bfin_device,
897#endif
898
899#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
900 &bfin_spi0_device,
901#endif
902
903#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
904 &bfin_fb_adv7393_device,
905#endif
906
907#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
908 &bfin_uart_device,
909#endif
910
911#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
42bd8bcb
GY
912#ifdef CONFIG_BFIN_SIR0
913 &bfin_sir0_device,
914#endif
915#ifdef CONFIG_BFIN_SIR1
916 &bfin_sir1_device,
917#endif
9db144fe
MH
918#endif
919
920#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
921 &i2c_bfin_twi_device,
922#endif
923
924#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
925 &bfin_sport0_uart_device,
926 &bfin_sport1_uart_device,
927#endif
928
9db144fe
MH
929#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
930 &bfin_device_gpiokeys,
931#endif
932
933#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
934 &ezkit_flash_device,
935#endif
936
937 &bfin_gpios_device,
938};
939
7f6678c5 940static int __init cm_init(void)
9db144fe
MH
941{
942 printk(KERN_INFO "%s(): registering device resources\n", __func__);
9db144fe
MH
943 i2c_register_board_info(0, bfin_i2c_board_info,
944 ARRAY_SIZE(bfin_i2c_board_info));
9db144fe
MH
945 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
946 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
9db144fe
MH
947 return 0;
948}
949
7f6678c5 950arch_initcall(cm_init);
9db144fe
MH
951
952void native_machine_restart(char *cmd)
953{
954 /* workaround reboot hang when booting from SPI */
955 if ((bfin_read_SYSCR() & 0x7) == 0x3)
b52dae31 956 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
9db144fe
MH
957}
958
959void bfin_get_ether_addr(char *addr)
960{
961 random_ether_addr(addr);
962 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
963}
964EXPORT_SYMBOL(bfin_get_ether_addr);
This page took 0.144648 seconds and 5 git commands to generate.