blob: 07c132dc41251aa43d0a91ac138c89bd52bb0737 [file] [log] [blame]
Michael Hennerich59003142007-10-21 16:54:27 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
Michael Hennerich59003142007-10-21 16:54:27 +08005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Michael Hennerich59003142007-10-21 16:54:27 +08007 */
8
9#include <linux/device.h>
10#include <linux/platform_device.h>
11#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
Michael Hennerichd7e5dd42008-05-07 11:41:26 +080013#include <linux/mtd/physmap.h>
Michael Hennerich59003142007-10-21 16:54:27 +080014#include <linux/spi/spi.h>
15#include <linux/spi/flash.h>
Bryan Wu72268682008-05-07 11:41:26 +080016#include <linux/i2c.h>
Michael Hennerich59003142007-10-21 16:54:27 +080017#include <linux/irq.h>
18#include <linux/interrupt.h>
Michael Hennerich1089e222007-12-24 11:49:29 +080019#include <linux/usb/musb.h>
Michael Hennerich6924dfb2009-12-07 13:41:28 +000020#include <linux/leds.h>
21#include <linux/input.h>
Michael Hennerich59003142007-10-21 16:54:27 +080022#include <asm/dma.h>
23#include <asm/bfin5xx_spi.h>
24#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080025#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080026#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080027#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080028#include <linux/spi/ad7877.h>
29
30/*
31 * Name the Board for the /proc/cpuinfo
32 */
Michael Hennerich6924dfb2009-12-07 13:41:28 +000033#ifdef CONFIG_BFIN527_EZKIT_V2
34const char bfin_board_name[] = "ADI BF527-EZKIT V2";
35#else
Mike Frysingerfe85cad2008-11-18 17:48:22 +080036const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich6924dfb2009-12-07 13:41:28 +000037#endif
Michael Hennerich59003142007-10-21 16:54:27 +080038
39/*
40 * Driver needs to know address, irq and flag pin.
41 */
42
Michael Hennerich59003142007-10-21 16:54:27 +080043#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080044#include <linux/usb/isp1760.h>
45static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080046 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080047 .start = 0x203C0000,
48 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080049 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080052 .start = IRQ_PF7,
53 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080054 .flags = IORESOURCE_IRQ,
55 },
56};
57
Michael Hennerich3f375692008-11-18 17:48:22 +080058static struct isp1760_platform_data isp1760_priv = {
59 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080060 .bus_width_16 = 1,
61 .port1_otg = 0,
62 .analog_oc = 0,
63 .dack_polarity_high = 0,
64 .dreq_polarity_high = 0,
65};
66
67static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb7682009-10-15 10:37:33 +000068 .name = "isp1760",
Michael Hennerich59003142007-10-21 16:54:27 +080069 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080070 .dev = {
71 .platform_data = &isp1760_priv,
72 },
73 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
74 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080075};
Michael Hennerich59003142007-10-21 16:54:27 +080076#endif
77
Michael Hennerich1089e222007-12-24 11:49:29 +080078#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
79static struct resource musb_resources[] = {
80 [0] = {
81 .start = 0xffc03800,
82 .end = 0xffc03cff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = { /* general IRQ */
86 .start = IRQ_USB_INT0,
87 .end = IRQ_USB_INT0,
88 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
89 },
90 [2] = { /* DMA IRQ */
91 .start = IRQ_USB_DMA,
92 .end = IRQ_USB_DMA,
93 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
94 },
95};
96
Bryan Wu50041ac2008-10-08 13:39:40 +080097static struct musb_hdrc_config musb_config = {
98 .multipoint = 0,
99 .dyn_fifo = 0,
100 .soft_con = 1,
101 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800102 .num_eps = 8,
103 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800104 .gpio_vrsel = GPIO_PG13,
Cliff Cai85eb0e42010-01-22 04:02:46 +0000105 /* Some custom boards need to be active low, just set it to "0"
106 * if it is the case.
107 */
108 .gpio_vrsel_active = 1,
Bryan Wu50041ac2008-10-08 13:39:40 +0800109};
110
Michael Hennerich1089e222007-12-24 11:49:29 +0800111static struct musb_hdrc_platform_data musb_plat = {
112#if defined(CONFIG_USB_MUSB_OTG)
113 .mode = MUSB_OTG,
114#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
115 .mode = MUSB_HOST,
116#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
117 .mode = MUSB_PERIPHERAL,
118#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800119 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800120};
121
122static u64 musb_dmamask = ~(u32)0;
123
124static struct platform_device musb_device = {
125 .name = "musb_hdrc",
126 .id = 0,
127 .dev = {
128 .dma_mask = &musb_dmamask,
129 .coherent_dma_mask = 0xffffffff,
130 .platform_data = &musb_plat,
131 },
132 .num_resources = ARRAY_SIZE(musb_resources),
133 .resource = musb_resources,
134};
135#endif
136
137#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
138
139static struct resource bf52x_t350mcqb_resources[] = {
140 {
141 .start = IRQ_PPI_ERROR,
142 .end = IRQ_PPI_ERROR,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct platform_device bf52x_t350mcqb_device = {
148 .name = "bfin-t350mcqb",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
151 .resource = bf52x_t350mcqb_resources,
152};
153#endif
154
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000155#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
156#include <asm/bfin-lq035q1.h>
157
158static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
159 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +0000160 .ppi_mode = USE_RGB565_8_BIT_PPI,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000161};
162
163static struct resource bfin_lq035q1_resources[] = {
164 {
165 .start = IRQ_PPI_ERROR,
166 .end = IRQ_PPI_ERROR,
167 .flags = IORESOURCE_IRQ,
168 },
169};
170
171static struct platform_device bfin_lq035q1_device = {
172 .name = "bfin-lq035q1",
173 .id = -1,
174 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
175 .resource = bfin_lq035q1_resources,
176 .dev = {
177 .platform_data = &bfin_lq035q1_data,
178 },
179};
180#endif
181
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800182#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
183static struct mtd_partition ezkit_partitions[] = {
184 {
Robin Getzaa582972008-08-05 17:47:29 +0800185 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800186 .size = 0x40000,
187 .offset = 0,
188 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800189 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800190 .size = 0x1C0000,
191 .offset = MTDPART_OFS_APPEND,
192 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800193 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800194 .size = MTDPART_SIZ_FULL,
195 .offset = MTDPART_OFS_APPEND,
196 }
197};
198
199static struct physmap_flash_data ezkit_flash_data = {
200 .width = 2,
201 .parts = ezkit_partitions,
202 .nr_parts = ARRAY_SIZE(ezkit_partitions),
203};
204
205static struct resource ezkit_flash_resource = {
206 .start = 0x20000000,
207 .end = 0x203fffff,
208 .flags = IORESOURCE_MEM,
209};
210
211static struct platform_device ezkit_flash_device = {
212 .name = "physmap-flash",
213 .id = 0,
214 .dev = {
215 .platform_data = &ezkit_flash_data,
216 },
217 .num_resources = 1,
218 .resource = &ezkit_flash_resource,
219};
220#endif
221
Michael Hennerich64307f72007-10-29 16:55:18 +0800222#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
223static struct mtd_partition partition_info[] = {
224 {
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000225 .name = "bootloader(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800226 .offset = 0,
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000227 .size = 0x40000,
228 }, {
229 .name = "linux kernel(nand)",
230 .offset = MTDPART_OFS_APPEND,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800231 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800232 },
233 {
Robin Getzaa582972008-08-05 17:47:29 +0800234 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800235 .offset = MTDPART_OFS_APPEND,
236 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800237 },
238};
239
240static struct bf5xx_nand_platform bf5xx_nand_platform = {
Michael Hennerich64307f72007-10-29 16:55:18 +0800241 .data_width = NFC_NWIDTH_8,
242 .partitions = partition_info,
243 .nr_partitions = ARRAY_SIZE(partition_info),
244 .rd_dly = 3,
245 .wr_dly = 3,
246};
247
248static struct resource bf5xx_nand_resources[] = {
249 {
250 .start = NFC_CTL,
251 .end = NFC_DATA_RD + 2,
252 .flags = IORESOURCE_MEM,
253 },
254 {
255 .start = CH_NFC,
256 .end = CH_NFC,
257 .flags = IORESOURCE_IRQ,
258 },
259};
260
261static struct platform_device bf5xx_nand_device = {
262 .name = "bf5xx-nand",
263 .id = 0,
264 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
265 .resource = bf5xx_nand_resources,
266 .dev = {
267 .platform_data = &bf5xx_nand_platform,
268 },
269};
270#endif
271
Michael Hennerich59003142007-10-21 16:54:27 +0800272#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
273static struct resource bfin_pcmcia_cf_resources[] = {
274 {
275 .start = 0x20310000, /* IO PORT */
276 .end = 0x20312000,
277 .flags = IORESOURCE_MEM,
278 }, {
279 .start = 0x20311000, /* Attribute Memory */
280 .end = 0x20311FFF,
281 .flags = IORESOURCE_MEM,
282 }, {
283 .start = IRQ_PF4,
284 .end = IRQ_PF4,
285 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
286 }, {
287 .start = 6, /* Card Detect PF6 */
288 .end = 6,
289 .flags = IORESOURCE_IRQ,
290 },
291};
292
293static struct platform_device bfin_pcmcia_cf_device = {
294 .name = "bfin_cf_pcmcia",
295 .id = -1,
296 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
297 .resource = bfin_pcmcia_cf_resources,
298};
299#endif
300
301#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
302static struct platform_device rtc_device = {
303 .name = "rtc-bfin",
304 .id = -1,
305};
306#endif
307
308#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000309#include <linux/smc91x.h>
310
311static struct smc91x_platdata smc91x_info = {
312 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
313 .leda = RPC_LED_100_10,
314 .ledb = RPC_LED_TX_RX,
315};
316
Michael Hennerich59003142007-10-21 16:54:27 +0800317static struct resource smc91x_resources[] = {
318 {
319 .name = "smc91x-regs",
320 .start = 0x20300300,
321 .end = 0x20300300 + 16,
322 .flags = IORESOURCE_MEM,
323 }, {
324
325 .start = IRQ_PF7,
326 .end = IRQ_PF7,
327 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
328 },
329};
330static struct platform_device smc91x_device = {
331 .name = "smc91x",
332 .id = 0,
333 .num_resources = ARRAY_SIZE(smc91x_resources),
334 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000335 .dev = {
336 .platform_data = &smc91x_info,
337 },
Michael Hennerich59003142007-10-21 16:54:27 +0800338};
339#endif
340
341#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
342static struct resource dm9000_resources[] = {
343 [0] = {
344 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100345 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800346 .flags = IORESOURCE_MEM,
347 },
348 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100349 .start = 0x203FB800 + 4,
350 .end = 0x203FB800 + 5,
351 .flags = IORESOURCE_MEM,
352 },
353 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800354 .start = IRQ_PF9,
355 .end = IRQ_PF9,
356 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
357 },
358};
359
360static struct platform_device dm9000_device = {
361 .name = "dm9000",
362 .id = -1,
363 .num_resources = ARRAY_SIZE(dm9000_resources),
364 .resource = dm9000_resources,
365};
366#endif
367
Michael Hennerich59003142007-10-21 16:54:27 +0800368#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800369static struct platform_device bfin_mii_bus = {
370 .name = "bfin_mii_bus",
371};
372
Michael Hennerich59003142007-10-21 16:54:27 +0800373static struct platform_device bfin_mac_device = {
374 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800375 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800376};
377#endif
378
379#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
380static struct resource net2272_bfin_resources[] = {
381 {
382 .start = 0x20300000,
383 .end = 0x20300000 + 0x100,
384 .flags = IORESOURCE_MEM,
385 }, {
386 .start = IRQ_PF7,
387 .end = IRQ_PF7,
388 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
389 },
390};
391
392static struct platform_device net2272_bfin_device = {
393 .name = "net2272",
394 .id = -1,
395 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
396 .resource = net2272_bfin_resources,
397};
398#endif
399
Michael Hennerich59003142007-10-21 16:54:27 +0800400#if defined(CONFIG_MTD_M25P80) \
401 || defined(CONFIG_MTD_M25P80_MODULE)
402static struct mtd_partition bfin_spi_flash_partitions[] = {
403 {
Robin Getzaa582972008-08-05 17:47:29 +0800404 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800405 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800406 .offset = 0,
407 .mask_flags = MTD_CAP_ROM
408 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800409 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800410 .size = MTDPART_SIZ_FULL,
411 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800412 }
413};
414
415static struct flash_platform_data bfin_spi_flash_data = {
416 .name = "m25p80",
417 .parts = bfin_spi_flash_partitions,
418 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800419 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800420};
421
422/* SPI flash chip (m25p64) */
423static struct bfin5xx_spi_chip spi_flash_chip_info = {
424 .enable_dma = 0, /* use dma transfer with this chip*/
425 .bits_per_word = 8,
426};
427#endif
428
Mike Frysingera261eec2009-05-20 14:05:36 +0000429#if defined(CONFIG_BFIN_SPI_ADC) \
430 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800431/* SPI ADC chip */
432static struct bfin5xx_spi_chip spi_adc_chip_info = {
433 .enable_dma = 1, /* use dma transfer with this chip*/
434 .bits_per_word = 16,
435};
436#endif
437
Barry Song7ba80062010-01-28 09:37:21 +0000438#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
439 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800440static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
441 .enable_dma = 0,
442 .bits_per_word = 16,
443};
444#endif
445
Yi Liffdf3ec2009-03-31 10:36:51 +0000446#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
447static struct bfin5xx_spi_chip mmc_spi_chip_info = {
448 .enable_dma = 0,
449 .bits_per_word = 8,
450};
451#endif
452
Michael Hennerich59003142007-10-21 16:54:27 +0800453#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
454static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
455 .enable_dma = 0,
456 .bits_per_word = 16,
457};
458
459static const struct ad7877_platform_data bfin_ad7877_ts_info = {
460 .model = 7877,
461 .vref_delay_usecs = 50, /* internal, no capacitor */
462 .x_plate_ohms = 419,
463 .y_plate_ohms = 486,
464 .pressure_max = 1000,
465 .pressure_min = 0,
466 .stopacq_polarity = 1,
467 .first_conversion_delay = 3,
468 .acquisition_time = 1,
469 .averaging = 1,
470 .pen_down_acc_interval = 1,
471};
472#endif
473
Michael Hennerich51054322009-01-07 23:14:38 +0800474#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
475#include <linux/spi/ad7879.h>
476static const struct ad7879_platform_data bfin_ad7879_ts_info = {
477 .model = 7879, /* Model = AD7879 */
478 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
479 .pressure_max = 10000,
480 .pressure_min = 0,
481 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
482 .acquisition_time = 1, /* 4us acquisition time per sample */
483 .median = 2, /* do 8 measurements */
484 .averaging = 1, /* take the average of 4 middle samples */
485 .pen_down_acc_interval = 255, /* 9.4 ms */
Michael Hennerich244d3422009-12-18 09:29:39 +0000486 .gpio_export = 0, /* Export GPIO to gpiolib */
Michael Hennerich51054322009-01-07 23:14:38 +0800487};
488#endif
489
490#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
491static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
492 .enable_dma = 0,
493 .bits_per_word = 16,
494};
495#endif
496
Michael Hennerich6e668932008-02-09 01:54:09 +0800497#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
498static struct bfin5xx_spi_chip spidev_chip_info = {
499 .enable_dma = 0,
500 .bits_per_word = 8,
501};
502#endif
503
Barry Song336746e2009-10-13 09:19:18 +0000504#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
505static struct platform_device bfin_i2s = {
506 .name = "bfin-i2s",
507 .id = CONFIG_SND_BF5XX_SPORT_NUM,
508 /* TODO: add platform data here */
509};
510#endif
511
512#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
513static struct platform_device bfin_tdm = {
514 .name = "bfin-tdm",
515 .id = CONFIG_SND_BF5XX_SPORT_NUM,
516 /* TODO: add platform data here */
517};
518#endif
519
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000520#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
521static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
522 .enable_dma = 0,
523 .bits_per_word = 8,
524};
525#endif
526
Michael Hennerich59003142007-10-21 16:54:27 +0800527static struct spi_board_info bfin_spi_board_info[] __initdata = {
528#if defined(CONFIG_MTD_M25P80) \
529 || defined(CONFIG_MTD_M25P80_MODULE)
530 {
531 /* the modalias must be the same as spi device driver name */
532 .modalias = "m25p80", /* Name of spi_driver for this device */
533 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
534 .bus_num = 0, /* Framework bus number */
535 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
536 .platform_data = &bfin_spi_flash_data,
537 .controller_data = &spi_flash_chip_info,
538 .mode = SPI_MODE_3,
539 },
540#endif
541
Mike Frysingera261eec2009-05-20 14:05:36 +0000542#if defined(CONFIG_BFIN_SPI_ADC) \
543 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800544 {
545 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
546 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
547 .bus_num = 0, /* Framework bus number */
548 .chip_select = 1, /* Framework chip select. */
549 .platform_data = NULL, /* No spi_driver specific config */
550 .controller_data = &spi_adc_chip_info,
551 },
552#endif
553
Barry Song7ba80062010-01-28 09:37:21 +0000554#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
555 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800556 {
Barry Song7ba80062010-01-28 09:37:21 +0000557 .modalias = "ad183x",
Michael Hennerich59003142007-10-21 16:54:27 +0800558 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
559 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000560 .chip_select = 4,
Michael Hennerich59003142007-10-21 16:54:27 +0800561 .controller_data = &ad1836_spi_chip_info,
562 },
563#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000564#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
565 {
566 .modalias = "mmc_spi",
567 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
568 .bus_num = 0,
569 .chip_select = 3,
570 .controller_data = &mmc_spi_chip_info,
571 .mode = SPI_MODE_0,
572 },
573#endif
574
Michael Hennerich59003142007-10-21 16:54:27 +0800575#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
576 {
577 .modalias = "ad7877",
578 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800579 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800580 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800581 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800582 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800583 .controller_data = &spi_ad7877_chip_info,
584 },
585#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800586#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
587 {
588 .modalias = "ad7879",
589 .platform_data = &bfin_ad7879_ts_info,
590 .irq = IRQ_PF8,
591 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
592 .bus_num = 0,
593 .chip_select = 3,
594 .controller_data = &spi_ad7879_chip_info,
595 .mode = SPI_CPHA | SPI_CPOL,
596 },
597#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800598#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
599 {
600 .modalias = "spidev",
601 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
602 .bus_num = 0,
603 .chip_select = 1,
604 .controller_data = &spidev_chip_info,
605 },
606#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000607#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
608 {
609 .modalias = "bfin-lq035q1-spi",
610 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
611 .bus_num = 0,
612 .chip_select = 7,
613 .controller_data = &lq035q1_spi_chip_info,
614 .mode = SPI_CPHA | SPI_CPOL,
615 },
616#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800617};
618
Mike Frysinger5bda2722008-06-07 15:03:01 +0800619#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800620/* SPI controller data */
621static struct bfin5xx_spi_master bfin_spi0_info = {
622 .num_chipselect = 8,
623 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800624 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800625};
626
627/* SPI (0) */
628static struct resource bfin_spi0_resource[] = {
629 [0] = {
630 .start = SPI0_REGBASE,
631 .end = SPI0_REGBASE + 0xFF,
632 .flags = IORESOURCE_MEM,
633 },
634 [1] = {
635 .start = CH_SPI,
636 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000637 .flags = IORESOURCE_DMA,
638 },
639 [2] = {
640 .start = IRQ_SPI,
641 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800642 .flags = IORESOURCE_IRQ,
643 },
644};
645
646static struct platform_device bfin_spi0_device = {
647 .name = "bfin-spi",
648 .id = 0, /* Bus number */
649 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
650 .resource = bfin_spi0_resource,
651 .dev = {
652 .platform_data = &bfin_spi0_info, /* Passed to driver */
653 },
654};
655#endif /* spi master and devices */
656
Michael Hennerich59003142007-10-21 16:54:27 +0800657#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800658#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000659static struct resource bfin_uart0_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800660 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000661 .start = UART0_THR,
662 .end = UART0_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800663 .flags = IORESOURCE_MEM,
664 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000665 {
666 .start = IRQ_UART0_RX,
667 .end = IRQ_UART0_RX+1,
668 .flags = IORESOURCE_IRQ,
669 },
670 {
671 .start = IRQ_UART0_ERROR,
672 .end = IRQ_UART0_ERROR,
673 .flags = IORESOURCE_IRQ,
674 },
675 {
676 .start = CH_UART0_TX,
677 .end = CH_UART0_TX,
678 .flags = IORESOURCE_DMA,
679 },
680 {
681 .start = CH_UART0_RX,
682 .end = CH_UART0_RX,
683 .flags = IORESOURCE_DMA,
684 },
685};
686
687unsigned short bfin_uart0_peripherals[] = {
688 P_UART0_TX, P_UART0_RX, 0
689};
690
691static struct platform_device bfin_uart0_device = {
692 .name = "bfin-uart",
693 .id = 0,
694 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
695 .resource = bfin_uart0_resources,
696 .dev = {
697 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
698 },
699};
Michael Hennerich59003142007-10-21 16:54:27 +0800700#endif
701#ifdef CONFIG_SERIAL_BFIN_UART1
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000702static struct resource bfin_uart1_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800703 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000704 .start = UART1_THR,
705 .end = UART1_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800706 .flags = IORESOURCE_MEM,
707 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000708 {
709 .start = IRQ_UART1_RX,
710 .end = IRQ_UART1_RX+1,
711 .flags = IORESOURCE_IRQ,
712 },
713 {
714 .start = IRQ_UART1_ERROR,
715 .end = IRQ_UART1_ERROR,
716 .flags = IORESOURCE_IRQ,
717 },
718 {
719 .start = CH_UART1_TX,
720 .end = CH_UART1_TX,
721 .flags = IORESOURCE_DMA,
722 },
723 {
724 .start = CH_UART1_RX,
725 .end = CH_UART1_RX,
726 .flags = IORESOURCE_DMA,
727 },
728#ifdef CONFIG_BFIN_UART1_CTSRTS
729 { /* CTS pin */
730 .start = GPIO_PF9,
731 .end = GPIO_PF9,
732 .flags = IORESOURCE_IO,
733 },
734 { /* RTS pin */
735 .start = GPIO_PF10,
736 .end = GPIO_PF10,
737 .flags = IORESOURCE_IO,
738 },
Michael Hennerich59003142007-10-21 16:54:27 +0800739#endif
740};
741
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000742unsigned short bfin_uart1_peripherals[] = {
743 P_UART1_TX, P_UART1_RX, 0
744};
745
746static struct platform_device bfin_uart1_device = {
Michael Hennerich59003142007-10-21 16:54:27 +0800747 .name = "bfin-uart",
748 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000749 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
750 .resource = bfin_uart1_resources,
751 .dev = {
752 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
753 },
Michael Hennerich59003142007-10-21 16:54:27 +0800754};
755#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000756#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800757
Graf Yang5be36d22008-04-25 03:09:15 +0800758#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800759#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800760static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800761 {
762 .start = 0xFFC00400,
763 .end = 0xFFC004FF,
764 .flags = IORESOURCE_MEM,
765 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800766 {
767 .start = IRQ_UART0_RX,
768 .end = IRQ_UART0_RX+1,
769 .flags = IORESOURCE_IRQ,
770 },
771 {
772 .start = CH_UART0_RX,
773 .end = CH_UART0_RX+1,
774 .flags = IORESOURCE_DMA,
775 },
776};
777
778static struct platform_device bfin_sir0_device = {
779 .name = "bfin_sir",
780 .id = 0,
781 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
782 .resource = bfin_sir0_resources,
783};
Graf Yang5be36d22008-04-25 03:09:15 +0800784#endif
785#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800786static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800787 {
788 .start = 0xFFC02000,
789 .end = 0xFFC020FF,
790 .flags = IORESOURCE_MEM,
791 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800792 {
793 .start = IRQ_UART1_RX,
794 .end = IRQ_UART1_RX+1,
795 .flags = IORESOURCE_IRQ,
796 },
797 {
798 .start = CH_UART1_RX,
799 .end = CH_UART1_RX+1,
800 .flags = IORESOURCE_DMA,
801 },
Graf Yang5be36d22008-04-25 03:09:15 +0800802};
803
Graf Yang42bd8bc2009-01-07 23:14:39 +0800804static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800805 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800806 .id = 1,
807 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
808 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800809};
810#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800811#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800812
Michael Hennerich59003142007-10-21 16:54:27 +0800813#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
814static struct resource bfin_twi0_resource[] = {
815 [0] = {
816 .start = TWI0_REGBASE,
817 .end = TWI0_REGBASE,
818 .flags = IORESOURCE_MEM,
819 },
820 [1] = {
821 .start = IRQ_TWI,
822 .end = IRQ_TWI,
823 .flags = IORESOURCE_IRQ,
824 },
825};
826
827static struct platform_device i2c_bfin_twi_device = {
828 .name = "i2c-bfin-twi",
829 .id = 0,
830 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
831 .resource = bfin_twi0_resource,
832};
833#endif
834
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000835#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
836#include <linux/mfd/adp5520.h>
837
838 /*
839 * ADP5520/5501 LEDs Data
840 */
841
842static struct led_info adp5520_leds[] = {
843 {
844 .name = "adp5520-led1",
845 .default_trigger = "none",
846 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
847 },
848};
849
850static struct adp5520_leds_platform_data adp5520_leds_data = {
851 .num_leds = ARRAY_SIZE(adp5520_leds),
852 .leds = adp5520_leds,
853 .fade_in = ADP5520_FADE_T_600ms,
854 .fade_out = ADP5520_FADE_T_600ms,
855 .led_on_time = ADP5520_LED_ONT_600ms,
856};
857
858 /*
859 * ADP5520 Keypad Data
860 */
861
862static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
863 [ADP5520_KEY(3, 3)] = KEY_1,
864 [ADP5520_KEY(2, 3)] = KEY_2,
865 [ADP5520_KEY(1, 3)] = KEY_3,
866 [ADP5520_KEY(0, 3)] = KEY_UP,
867 [ADP5520_KEY(3, 2)] = KEY_4,
868 [ADP5520_KEY(2, 2)] = KEY_5,
869 [ADP5520_KEY(1, 2)] = KEY_6,
870 [ADP5520_KEY(0, 2)] = KEY_DOWN,
871 [ADP5520_KEY(3, 1)] = KEY_7,
872 [ADP5520_KEY(2, 1)] = KEY_8,
873 [ADP5520_KEY(1, 1)] = KEY_9,
874 [ADP5520_KEY(0, 1)] = KEY_DOT,
875 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
876 [ADP5520_KEY(2, 0)] = KEY_0,
877 [ADP5520_KEY(1, 0)] = KEY_HELP,
878 [ADP5520_KEY(0, 0)] = KEY_ENTER,
879};
880
881static struct adp5520_keys_platform_data adp5520_keys_data = {
882 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
883 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
884 .keymap = adp5520_keymap,
885 .keymapsize = ARRAY_SIZE(adp5520_keymap),
886 .repeat = 0,
887};
888
889 /*
890 * ADP5520/5501 Multifuction Device Init Data
891 */
892
893static struct adp5520_platform_data adp5520_pdev_data = {
894 .leds = &adp5520_leds_data,
895 .keys = &adp5520_keys_data,
896};
897
898#endif
899
Bryan Wu72268682008-05-07 11:41:26 +0800900static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000901#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800902 {
903 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800904 },
905#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000906#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800907 {
908 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800909 .irq = IRQ_PF8,
910 },
911#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000912#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
913 {
914 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
915 },
916#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000917#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
918 {
919 I2C_BOARD_INFO("ad7879", 0x2C),
920 .irq = IRQ_PF8,
921 .platform_data = (void *)&bfin_ad7879_ts_info,
922 },
923#endif
924#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
925 {
926 I2C_BOARD_INFO("pmic-adp5520", 0x32),
927 .irq = IRQ_PF9,
928 .platform_data = (void *)&adp5520_pdev_data,
929 },
930#endif
Cliff Cai29bb3bc2010-01-14 08:28:38 +0000931#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
932 {
933 I2C_BOARD_INFO("ssm2602", 0x1b),
934 },
935#endif
steven miao39d3c1c2010-08-26 08:25:13 +0000936#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
937 {
938 I2C_BOARD_INFO("ad5252", 0x2f),
939 },
940#endif
Bryan Wu72268682008-05-07 11:41:26 +0800941};
Bryan Wu72268682008-05-07 11:41:26 +0800942
Michael Hennerich59003142007-10-21 16:54:27 +0800943#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000944#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
945static struct resource bfin_sport0_uart_resources[] = {
946 {
947 .start = SPORT0_TCR1,
948 .end = SPORT0_MRCS3+4,
949 .flags = IORESOURCE_MEM,
950 },
951 {
952 .start = IRQ_SPORT0_RX,
953 .end = IRQ_SPORT0_RX+1,
954 .flags = IORESOURCE_IRQ,
955 },
956 {
957 .start = IRQ_SPORT0_ERROR,
958 .end = IRQ_SPORT0_ERROR,
959 .flags = IORESOURCE_IRQ,
960 },
961};
962
963unsigned short bfin_sport0_peripherals[] = {
964 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
965 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
966};
967
Michael Hennerich59003142007-10-21 16:54:27 +0800968static struct platform_device bfin_sport0_uart_device = {
969 .name = "bfin-sport-uart",
970 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000971 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
972 .resource = bfin_sport0_uart_resources,
973 .dev = {
974 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
975 },
976};
977#endif
978#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
979static struct resource bfin_sport1_uart_resources[] = {
980 {
981 .start = SPORT1_TCR1,
982 .end = SPORT1_MRCS3+4,
983 .flags = IORESOURCE_MEM,
984 },
985 {
986 .start = IRQ_SPORT1_RX,
987 .end = IRQ_SPORT1_RX+1,
988 .flags = IORESOURCE_IRQ,
989 },
990 {
991 .start = IRQ_SPORT1_ERROR,
992 .end = IRQ_SPORT1_ERROR,
993 .flags = IORESOURCE_IRQ,
994 },
995};
996
997unsigned short bfin_sport1_peripherals[] = {
998 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
999 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
Michael Hennerich59003142007-10-21 16:54:27 +08001000};
1001
1002static struct platform_device bfin_sport1_uart_device = {
1003 .name = "bfin-sport-uart",
1004 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001005 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1006 .resource = bfin_sport1_uart_resources,
1007 .dev = {
1008 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1009 },
Michael Hennerich59003142007-10-21 16:54:27 +08001010};
1011#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001012#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001013
Michael Hennerich1089e222007-12-24 11:49:29 +08001014#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +08001015#include <linux/gpio_keys.h>
1016
1017static struct gpio_keys_button bfin_gpio_keys_table[] = {
1018 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1019 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1020};
1021
1022static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1023 .buttons = bfin_gpio_keys_table,
1024 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1025};
1026
1027static struct platform_device bfin_device_gpiokeys = {
1028 .name = "gpio-keys",
1029 .dev = {
1030 .platform_data = &bfin_gpio_keys_data,
1031 },
1032};
1033#endif
1034
Michael Hennerichadfc0462009-10-09 07:37:03 +00001035#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001036#include <asm/bfin_rotary.h>
1037
1038static struct bfin_rotary_platform_data bfin_rotary_data = {
1039 /*.rotary_up_key = KEY_UP,*/
1040 /*.rotary_down_key = KEY_DOWN,*/
1041 .rotary_rel_code = REL_WHEEL,
1042 .rotary_button_key = KEY_ENTER,
1043 .debounce = 10, /* 0..17 */
1044 .mode = ROT_QUAD_ENC | ROT_DEBE,
1045};
1046
1047static struct resource bfin_rotary_resources[] = {
1048 {
1049 .start = IRQ_CNT,
1050 .end = IRQ_CNT,
1051 .flags = IORESOURCE_IRQ,
1052 },
1053};
1054
1055static struct platform_device bfin_rotary_device = {
1056 .name = "bfin-rotary",
1057 .id = -1,
1058 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1059 .resource = bfin_rotary_resources,
1060 .dev = {
1061 .platform_data = &bfin_rotary_data,
1062 },
1063};
1064#endif
1065
Michael Hennerich14b03202008-05-07 11:41:26 +08001066static const unsigned int cclk_vlev_datasheet[] =
1067{
1068 VRPAIR(VLEV_100, 400000000),
1069 VRPAIR(VLEV_105, 426000000),
1070 VRPAIR(VLEV_110, 500000000),
1071 VRPAIR(VLEV_115, 533000000),
1072 VRPAIR(VLEV_120, 600000000),
1073};
1074
1075static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1076 .tuple_tab = cclk_vlev_datasheet,
1077 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1078 .vr_settling_time = 25 /* us */,
1079};
1080
1081static struct platform_device bfin_dpmc = {
1082 .name = "bfin dpmc",
1083 .dev = {
1084 .platform_data = &bfin_dmpc_vreg_data,
1085 },
1086};
1087
Michael Hennerich59003142007-10-21 16:54:27 +08001088static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001089
1090 &bfin_dpmc,
1091
Michael Hennerich64307f72007-10-29 16:55:18 +08001092#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1093 &bf5xx_nand_device,
1094#endif
1095
Michael Hennerich59003142007-10-21 16:54:27 +08001096#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1097 &bfin_pcmcia_cf_device,
1098#endif
1099
1100#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1101 &rtc_device,
1102#endif
1103
Michael Hennerich3f375692008-11-18 17:48:22 +08001104#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1105 &bfin_isp1760_device,
1106#endif
1107
Michael Hennerich1089e222007-12-24 11:49:29 +08001108#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1109 &musb_device,
1110#endif
1111
Michael Hennerich59003142007-10-21 16:54:27 +08001112#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1113 &smc91x_device,
1114#endif
1115
1116#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1117 &dm9000_device,
1118#endif
1119
1120#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001121 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +08001122 &bfin_mac_device,
1123#endif
1124
1125#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1126 &net2272_bfin_device,
1127#endif
1128
1129#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1130 &bfin_spi0_device,
1131#endif
1132
Michael Hennerich1089e222007-12-24 11:49:29 +08001133#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1134 &bf52x_t350mcqb_device,
1135#endif
1136
Michael Hennerich6924dfb2009-12-07 13:41:28 +00001137#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1138 &bfin_lq035q1_device,
1139#endif
1140
Michael Hennerich59003142007-10-21 16:54:27 +08001141#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001142#ifdef CONFIG_SERIAL_BFIN_UART0
1143 &bfin_uart0_device,
1144#endif
1145#ifdef CONFIG_SERIAL_BFIN_UART1
1146 &bfin_uart1_device,
1147#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001148#endif
1149
Graf Yang5be36d22008-04-25 03:09:15 +08001150#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001151#ifdef CONFIG_BFIN_SIR0
1152 &bfin_sir0_device,
1153#endif
1154#ifdef CONFIG_BFIN_SIR1
1155 &bfin_sir1_device,
1156#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001157#endif
1158
Michael Hennerich59003142007-10-21 16:54:27 +08001159#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1160 &i2c_bfin_twi_device,
1161#endif
1162
1163#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001164#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001165 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001166#endif
1167#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001168 &bfin_sport1_uart_device,
1169#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001170#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001171
Michael Hennerich1089e222007-12-24 11:49:29 +08001172#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1173 &bfin_device_gpiokeys,
1174#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001175
Michael Hennerichadfc0462009-10-09 07:37:03 +00001176#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001177 &bfin_rotary_device,
1178#endif
1179
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001180#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1181 &ezkit_flash_device,
1182#endif
Barry Song336746e2009-10-13 09:19:18 +00001183
1184#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1185 &bfin_i2s,
1186#endif
1187
1188#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1189 &bfin_tdm,
1190#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001191};
1192
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001193static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001194{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001195 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001196 i2c_register_board_info(0, bfin_i2c_board_info,
1197 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001198 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001199 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001200 return 0;
1201}
1202
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001203arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001204
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00001205static struct platform_device *ezkit_early_devices[] __initdata = {
1206#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1207#ifdef CONFIG_SERIAL_BFIN_UART0
1208 &bfin_uart0_device,
1209#endif
1210#ifdef CONFIG_SERIAL_BFIN_UART1
1211 &bfin_uart1_device,
1212#endif
1213#endif
1214
1215#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1216#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1217 &bfin_sport0_uart_device,
1218#endif
1219#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1220 &bfin_sport1_uart_device,
1221#endif
1222#endif
1223};
1224
1225void __init native_machine_early_platform_add_devices(void)
1226{
1227 printk(KERN_INFO "register early platform devices\n");
1228 early_platform_add_devices(ezkit_early_devices,
1229 ARRAY_SIZE(ezkit_early_devices));
1230}
1231
Michael Hennerich59003142007-10-21 16:54:27 +08001232void native_machine_restart(char *cmd)
1233{
1234 /* workaround reboot hang when booting from SPI */
1235 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001236 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001237}
Mike Frysinger137b1522007-11-22 16:07:03 +08001238
Mike Frysinger9862cc52007-11-15 21:21:20 +08001239void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001240{
Mike Frysinger181afa92008-02-25 11:42:17 +08001241 /* the MAC is stored in OTP memory page 0xDF */
1242 u32 ret;
1243 u64 otp_mac;
1244 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1245
1246 ret = otp_read(0xDF, 0x00, &otp_mac);
1247 if (!(ret & 0x1)) {
1248 char *otp_mac_p = (char *)&otp_mac;
1249 for (ret = 0; ret < 6; ++ret)
1250 addr[ret] = otp_mac_p[5 - ret];
1251 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001252}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001253EXPORT_SYMBOL(bfin_get_ether_addr);