blob: 27373127974026aa3c1a11d0ae5720030202b3b0 [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,
Hema Kalliguddifcf173e2010-09-29 11:26:39 -050089 .name = "mc"
Michael Hennerich1089e222007-12-24 11:49:29 +080090 },
91 [2] = { /* DMA IRQ */
92 .start = IRQ_USB_DMA,
93 .end = IRQ_USB_DMA,
94 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
Hema Kalliguddifcf173e2010-09-29 11:26:39 -050095 .name = "dma"
Michael Hennerich1089e222007-12-24 11:49:29 +080096 },
97};
98
Bryan Wu50041ac2008-10-08 13:39:40 +080099static struct musb_hdrc_config musb_config = {
100 .multipoint = 0,
101 .dyn_fifo = 0,
102 .soft_con = 1,
103 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800104 .num_eps = 8,
105 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800106 .gpio_vrsel = GPIO_PG13,
Cliff Cai85eb0e42010-01-22 04:02:46 +0000107 /* Some custom boards need to be active low, just set it to "0"
108 * if it is the case.
109 */
110 .gpio_vrsel_active = 1,
Bryan Wu50041ac2008-10-08 13:39:40 +0800111};
112
Michael Hennerich1089e222007-12-24 11:49:29 +0800113static struct musb_hdrc_platform_data musb_plat = {
114#if defined(CONFIG_USB_MUSB_OTG)
115 .mode = MUSB_OTG,
116#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
117 .mode = MUSB_HOST,
118#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
119 .mode = MUSB_PERIPHERAL,
120#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800121 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800122};
123
124static u64 musb_dmamask = ~(u32)0;
125
126static struct platform_device musb_device = {
127 .name = "musb_hdrc",
128 .id = 0,
129 .dev = {
130 .dma_mask = &musb_dmamask,
131 .coherent_dma_mask = 0xffffffff,
132 .platform_data = &musb_plat,
133 },
134 .num_resources = ARRAY_SIZE(musb_resources),
135 .resource = musb_resources,
136};
137#endif
138
139#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
140
141static struct resource bf52x_t350mcqb_resources[] = {
142 {
143 .start = IRQ_PPI_ERROR,
144 .end = IRQ_PPI_ERROR,
145 .flags = IORESOURCE_IRQ,
146 },
147};
148
149static struct platform_device bf52x_t350mcqb_device = {
150 .name = "bfin-t350mcqb",
151 .id = -1,
152 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
153 .resource = bf52x_t350mcqb_resources,
154};
155#endif
156
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000157#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
158#include <asm/bfin-lq035q1.h>
159
160static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
161 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +0000162 .ppi_mode = USE_RGB565_8_BIT_PPI,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000163};
164
165static struct resource bfin_lq035q1_resources[] = {
166 {
167 .start = IRQ_PPI_ERROR,
168 .end = IRQ_PPI_ERROR,
169 .flags = IORESOURCE_IRQ,
170 },
171};
172
173static struct platform_device bfin_lq035q1_device = {
174 .name = "bfin-lq035q1",
175 .id = -1,
176 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
177 .resource = bfin_lq035q1_resources,
178 .dev = {
179 .platform_data = &bfin_lq035q1_data,
180 },
181};
182#endif
183
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800184#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
185static struct mtd_partition ezkit_partitions[] = {
186 {
Robin Getzaa582972008-08-05 17:47:29 +0800187 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800188 .size = 0x40000,
189 .offset = 0,
190 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800191 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800192 .size = 0x1C0000,
193 .offset = MTDPART_OFS_APPEND,
194 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800195 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800196 .size = MTDPART_SIZ_FULL,
197 .offset = MTDPART_OFS_APPEND,
198 }
199};
200
201static struct physmap_flash_data ezkit_flash_data = {
202 .width = 2,
203 .parts = ezkit_partitions,
204 .nr_parts = ARRAY_SIZE(ezkit_partitions),
205};
206
207static struct resource ezkit_flash_resource = {
208 .start = 0x20000000,
209 .end = 0x203fffff,
210 .flags = IORESOURCE_MEM,
211};
212
213static struct platform_device ezkit_flash_device = {
214 .name = "physmap-flash",
215 .id = 0,
216 .dev = {
217 .platform_data = &ezkit_flash_data,
218 },
219 .num_resources = 1,
220 .resource = &ezkit_flash_resource,
221};
222#endif
223
Michael Hennerich64307f72007-10-29 16:55:18 +0800224#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
225static struct mtd_partition partition_info[] = {
226 {
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000227 .name = "bootloader(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800228 .offset = 0,
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000229 .size = 0x40000,
230 }, {
231 .name = "linux kernel(nand)",
232 .offset = MTDPART_OFS_APPEND,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800233 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800234 },
235 {
Robin Getzaa582972008-08-05 17:47:29 +0800236 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800237 .offset = MTDPART_OFS_APPEND,
238 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800239 },
240};
241
242static struct bf5xx_nand_platform bf5xx_nand_platform = {
Michael Hennerich64307f72007-10-29 16:55:18 +0800243 .data_width = NFC_NWIDTH_8,
244 .partitions = partition_info,
245 .nr_partitions = ARRAY_SIZE(partition_info),
246 .rd_dly = 3,
247 .wr_dly = 3,
248};
249
250static struct resource bf5xx_nand_resources[] = {
251 {
252 .start = NFC_CTL,
253 .end = NFC_DATA_RD + 2,
254 .flags = IORESOURCE_MEM,
255 },
256 {
257 .start = CH_NFC,
258 .end = CH_NFC,
259 .flags = IORESOURCE_IRQ,
260 },
261};
262
263static struct platform_device bf5xx_nand_device = {
264 .name = "bf5xx-nand",
265 .id = 0,
266 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
267 .resource = bf5xx_nand_resources,
268 .dev = {
269 .platform_data = &bf5xx_nand_platform,
270 },
271};
272#endif
273
Michael Hennerich59003142007-10-21 16:54:27 +0800274#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
275static struct resource bfin_pcmcia_cf_resources[] = {
276 {
277 .start = 0x20310000, /* IO PORT */
278 .end = 0x20312000,
279 .flags = IORESOURCE_MEM,
280 }, {
281 .start = 0x20311000, /* Attribute Memory */
282 .end = 0x20311FFF,
283 .flags = IORESOURCE_MEM,
284 }, {
285 .start = IRQ_PF4,
286 .end = IRQ_PF4,
287 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
288 }, {
289 .start = 6, /* Card Detect PF6 */
290 .end = 6,
291 .flags = IORESOURCE_IRQ,
292 },
293};
294
295static struct platform_device bfin_pcmcia_cf_device = {
296 .name = "bfin_cf_pcmcia",
297 .id = -1,
298 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
299 .resource = bfin_pcmcia_cf_resources,
300};
301#endif
302
303#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
304static struct platform_device rtc_device = {
305 .name = "rtc-bfin",
306 .id = -1,
307};
308#endif
309
310#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000311#include <linux/smc91x.h>
312
313static struct smc91x_platdata smc91x_info = {
314 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
315 .leda = RPC_LED_100_10,
316 .ledb = RPC_LED_TX_RX,
317};
318
Michael Hennerich59003142007-10-21 16:54:27 +0800319static struct resource smc91x_resources[] = {
320 {
321 .name = "smc91x-regs",
322 .start = 0x20300300,
323 .end = 0x20300300 + 16,
324 .flags = IORESOURCE_MEM,
325 }, {
326
327 .start = IRQ_PF7,
328 .end = IRQ_PF7,
329 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
330 },
331};
332static struct platform_device smc91x_device = {
333 .name = "smc91x",
334 .id = 0,
335 .num_resources = ARRAY_SIZE(smc91x_resources),
336 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000337 .dev = {
338 .platform_data = &smc91x_info,
339 },
Michael Hennerich59003142007-10-21 16:54:27 +0800340};
341#endif
342
343#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
344static struct resource dm9000_resources[] = {
345 [0] = {
346 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100347 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800348 .flags = IORESOURCE_MEM,
349 },
350 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100351 .start = 0x203FB800 + 4,
352 .end = 0x203FB800 + 5,
353 .flags = IORESOURCE_MEM,
354 },
355 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800356 .start = IRQ_PF9,
357 .end = IRQ_PF9,
358 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
359 },
360};
361
362static struct platform_device dm9000_device = {
363 .name = "dm9000",
364 .id = -1,
365 .num_resources = ARRAY_SIZE(dm9000_resources),
366 .resource = dm9000_resources,
367};
368#endif
369
Michael Hennerich59003142007-10-21 16:54:27 +0800370#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000371#include <linux/bfin_mac.h>
372static const unsigned short bfin_mac_peripherals[] = P_RMII0;
373
374static struct bfin_phydev_platform_data bfin_phydev_data[] = {
375 {
376 .addr = 1,
377 .irq = IRQ_MAC_PHYINT,
378 },
379};
380
381static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
382 .phydev_number = 1,
383 .phydev_data = bfin_phydev_data,
384 .phy_mode = PHY_INTERFACE_MODE_RMII,
385 .mac_peripherals = bfin_mac_peripherals,
386};
387
Graf Yang65319622009-02-04 16:49:45 +0800388static struct platform_device bfin_mii_bus = {
389 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000390 .dev = {
391 .platform_data = &bfin_mii_bus_data,
392 }
Graf Yang65319622009-02-04 16:49:45 +0800393};
394
Michael Hennerich59003142007-10-21 16:54:27 +0800395static struct platform_device bfin_mac_device = {
396 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000397 .dev = {
398 .platform_data = &bfin_mii_bus,
399 }
Michael Hennerich59003142007-10-21 16:54:27 +0800400};
401#endif
402
403#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
404static struct resource net2272_bfin_resources[] = {
405 {
406 .start = 0x20300000,
407 .end = 0x20300000 + 0x100,
408 .flags = IORESOURCE_MEM,
409 }, {
410 .start = IRQ_PF7,
411 .end = IRQ_PF7,
412 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
413 },
414};
415
416static struct platform_device net2272_bfin_device = {
417 .name = "net2272",
418 .id = -1,
419 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
420 .resource = net2272_bfin_resources,
421};
422#endif
423
Michael Hennerich59003142007-10-21 16:54:27 +0800424#if defined(CONFIG_MTD_M25P80) \
425 || defined(CONFIG_MTD_M25P80_MODULE)
426static struct mtd_partition bfin_spi_flash_partitions[] = {
427 {
Robin Getzaa582972008-08-05 17:47:29 +0800428 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800429 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800430 .offset = 0,
431 .mask_flags = MTD_CAP_ROM
432 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800433 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800434 .size = MTDPART_SIZ_FULL,
435 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800436 }
437};
438
439static struct flash_platform_data bfin_spi_flash_data = {
440 .name = "m25p80",
441 .parts = bfin_spi_flash_partitions,
442 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800443 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800444};
445
446/* SPI flash chip (m25p64) */
447static struct bfin5xx_spi_chip spi_flash_chip_info = {
448 .enable_dma = 0, /* use dma transfer with this chip*/
449 .bits_per_word = 8,
450};
451#endif
452
Mike Frysingera261eec2009-05-20 14:05:36 +0000453#if defined(CONFIG_BFIN_SPI_ADC) \
454 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800455/* SPI ADC chip */
456static struct bfin5xx_spi_chip spi_adc_chip_info = {
457 .enable_dma = 1, /* use dma transfer with this chip*/
458 .bits_per_word = 16,
459};
460#endif
461
Barry Song7ba80062010-01-28 09:37:21 +0000462#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
463 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800464static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
465 .enable_dma = 0,
466 .bits_per_word = 16,
467};
468#endif
469
Yi Liffdf3ec2009-03-31 10:36:51 +0000470#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
471static struct bfin5xx_spi_chip mmc_spi_chip_info = {
472 .enable_dma = 0,
473 .bits_per_word = 8,
474};
475#endif
476
Michael Hennerich59003142007-10-21 16:54:27 +0800477#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
478static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
479 .enable_dma = 0,
480 .bits_per_word = 16,
481};
482
483static const struct ad7877_platform_data bfin_ad7877_ts_info = {
484 .model = 7877,
485 .vref_delay_usecs = 50, /* internal, no capacitor */
486 .x_plate_ohms = 419,
487 .y_plate_ohms = 486,
488 .pressure_max = 1000,
489 .pressure_min = 0,
490 .stopacq_polarity = 1,
491 .first_conversion_delay = 3,
492 .acquisition_time = 1,
493 .averaging = 1,
494 .pen_down_acc_interval = 1,
495};
496#endif
497
Michael Hennerich51054322009-01-07 23:14:38 +0800498#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
499#include <linux/spi/ad7879.h>
500static const struct ad7879_platform_data bfin_ad7879_ts_info = {
501 .model = 7879, /* Model = AD7879 */
502 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
503 .pressure_max = 10000,
504 .pressure_min = 0,
505 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
506 .acquisition_time = 1, /* 4us acquisition time per sample */
507 .median = 2, /* do 8 measurements */
508 .averaging = 1, /* take the average of 4 middle samples */
509 .pen_down_acc_interval = 255, /* 9.4 ms */
Michael Hennerich244d3422009-12-18 09:29:39 +0000510 .gpio_export = 0, /* Export GPIO to gpiolib */
Michael Hennerich51054322009-01-07 23:14:38 +0800511};
512#endif
513
514#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
515static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
516 .enable_dma = 0,
517 .bits_per_word = 16,
518};
519#endif
520
Michael Hennerich6e668932008-02-09 01:54:09 +0800521#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
522static struct bfin5xx_spi_chip spidev_chip_info = {
523 .enable_dma = 0,
524 .bits_per_word = 8,
525};
526#endif
527
Barry Song336746e2009-10-13 09:19:18 +0000528#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
529static struct platform_device bfin_i2s = {
530 .name = "bfin-i2s",
531 .id = CONFIG_SND_BF5XX_SPORT_NUM,
532 /* TODO: add platform data here */
533};
534#endif
535
536#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
537static struct platform_device bfin_tdm = {
538 .name = "bfin-tdm",
539 .id = CONFIG_SND_BF5XX_SPORT_NUM,
540 /* TODO: add platform data here */
541};
542#endif
543
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000544#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
545static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
546 .enable_dma = 0,
547 .bits_per_word = 8,
548};
549#endif
550
Michael Hennerich59003142007-10-21 16:54:27 +0800551static struct spi_board_info bfin_spi_board_info[] __initdata = {
552#if defined(CONFIG_MTD_M25P80) \
553 || defined(CONFIG_MTD_M25P80_MODULE)
554 {
555 /* the modalias must be the same as spi device driver name */
556 .modalias = "m25p80", /* Name of spi_driver for this device */
557 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
558 .bus_num = 0, /* Framework bus number */
559 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
560 .platform_data = &bfin_spi_flash_data,
561 .controller_data = &spi_flash_chip_info,
562 .mode = SPI_MODE_3,
563 },
564#endif
565
Mike Frysingera261eec2009-05-20 14:05:36 +0000566#if defined(CONFIG_BFIN_SPI_ADC) \
567 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800568 {
569 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
570 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
571 .bus_num = 0, /* Framework bus number */
572 .chip_select = 1, /* Framework chip select. */
573 .platform_data = NULL, /* No spi_driver specific config */
574 .controller_data = &spi_adc_chip_info,
575 },
576#endif
577
Barry Song7ba80062010-01-28 09:37:21 +0000578#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
579 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800580 {
Barry Song7ba80062010-01-28 09:37:21 +0000581 .modalias = "ad183x",
Michael Hennerich59003142007-10-21 16:54:27 +0800582 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
583 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000584 .chip_select = 4,
Michael Hennerich59003142007-10-21 16:54:27 +0800585 .controller_data = &ad1836_spi_chip_info,
586 },
587#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000588#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
589 {
590 .modalias = "mmc_spi",
591 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
592 .bus_num = 0,
593 .chip_select = 3,
594 .controller_data = &mmc_spi_chip_info,
595 .mode = SPI_MODE_0,
596 },
597#endif
598
Michael Hennerich59003142007-10-21 16:54:27 +0800599#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
600 {
601 .modalias = "ad7877",
602 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800603 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800604 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800605 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800606 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800607 .controller_data = &spi_ad7877_chip_info,
608 },
609#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800610#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
611 {
612 .modalias = "ad7879",
613 .platform_data = &bfin_ad7879_ts_info,
614 .irq = IRQ_PF8,
615 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
616 .bus_num = 0,
617 .chip_select = 3,
618 .controller_data = &spi_ad7879_chip_info,
619 .mode = SPI_CPHA | SPI_CPOL,
620 },
621#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800622#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
623 {
624 .modalias = "spidev",
625 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
626 .bus_num = 0,
627 .chip_select = 1,
628 .controller_data = &spidev_chip_info,
629 },
630#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000631#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
632 {
633 .modalias = "bfin-lq035q1-spi",
634 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
635 .bus_num = 0,
636 .chip_select = 7,
637 .controller_data = &lq035q1_spi_chip_info,
638 .mode = SPI_CPHA | SPI_CPOL,
639 },
640#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800641};
642
Mike Frysinger5bda2722008-06-07 15:03:01 +0800643#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800644/* SPI controller data */
645static struct bfin5xx_spi_master bfin_spi0_info = {
646 .num_chipselect = 8,
647 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800648 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800649};
650
651/* SPI (0) */
652static struct resource bfin_spi0_resource[] = {
653 [0] = {
654 .start = SPI0_REGBASE,
655 .end = SPI0_REGBASE + 0xFF,
656 .flags = IORESOURCE_MEM,
657 },
658 [1] = {
659 .start = CH_SPI,
660 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000661 .flags = IORESOURCE_DMA,
662 },
663 [2] = {
664 .start = IRQ_SPI,
665 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800666 .flags = IORESOURCE_IRQ,
667 },
668};
669
670static struct platform_device bfin_spi0_device = {
671 .name = "bfin-spi",
672 .id = 0, /* Bus number */
673 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
674 .resource = bfin_spi0_resource,
675 .dev = {
676 .platform_data = &bfin_spi0_info, /* Passed to driver */
677 },
678};
679#endif /* spi master and devices */
680
Michael Hennerich59003142007-10-21 16:54:27 +0800681#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800682#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000683static struct resource bfin_uart0_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800684 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000685 .start = UART0_THR,
686 .end = UART0_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800687 .flags = IORESOURCE_MEM,
688 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000689 {
690 .start = IRQ_UART0_RX,
691 .end = IRQ_UART0_RX+1,
692 .flags = IORESOURCE_IRQ,
693 },
694 {
695 .start = IRQ_UART0_ERROR,
696 .end = IRQ_UART0_ERROR,
697 .flags = IORESOURCE_IRQ,
698 },
699 {
700 .start = CH_UART0_TX,
701 .end = CH_UART0_TX,
702 .flags = IORESOURCE_DMA,
703 },
704 {
705 .start = CH_UART0_RX,
706 .end = CH_UART0_RX,
707 .flags = IORESOURCE_DMA,
708 },
709};
710
711unsigned short bfin_uart0_peripherals[] = {
712 P_UART0_TX, P_UART0_RX, 0
713};
714
715static struct platform_device bfin_uart0_device = {
716 .name = "bfin-uart",
717 .id = 0,
718 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
719 .resource = bfin_uart0_resources,
720 .dev = {
721 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
722 },
723};
Michael Hennerich59003142007-10-21 16:54:27 +0800724#endif
725#ifdef CONFIG_SERIAL_BFIN_UART1
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000726static struct resource bfin_uart1_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800727 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000728 .start = UART1_THR,
729 .end = UART1_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800730 .flags = IORESOURCE_MEM,
731 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000732 {
733 .start = IRQ_UART1_RX,
734 .end = IRQ_UART1_RX+1,
735 .flags = IORESOURCE_IRQ,
736 },
737 {
738 .start = IRQ_UART1_ERROR,
739 .end = IRQ_UART1_ERROR,
740 .flags = IORESOURCE_IRQ,
741 },
742 {
743 .start = CH_UART1_TX,
744 .end = CH_UART1_TX,
745 .flags = IORESOURCE_DMA,
746 },
747 {
748 .start = CH_UART1_RX,
749 .end = CH_UART1_RX,
750 .flags = IORESOURCE_DMA,
751 },
752#ifdef CONFIG_BFIN_UART1_CTSRTS
753 { /* CTS pin */
754 .start = GPIO_PF9,
755 .end = GPIO_PF9,
756 .flags = IORESOURCE_IO,
757 },
758 { /* RTS pin */
759 .start = GPIO_PF10,
760 .end = GPIO_PF10,
761 .flags = IORESOURCE_IO,
762 },
Michael Hennerich59003142007-10-21 16:54:27 +0800763#endif
764};
765
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000766unsigned short bfin_uart1_peripherals[] = {
767 P_UART1_TX, P_UART1_RX, 0
768};
769
770static struct platform_device bfin_uart1_device = {
Michael Hennerich59003142007-10-21 16:54:27 +0800771 .name = "bfin-uart",
772 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000773 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
774 .resource = bfin_uart1_resources,
775 .dev = {
776 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
777 },
Michael Hennerich59003142007-10-21 16:54:27 +0800778};
779#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000780#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800781
Graf Yang5be36d22008-04-25 03:09:15 +0800782#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800783#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800784static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800785 {
786 .start = 0xFFC00400,
787 .end = 0xFFC004FF,
788 .flags = IORESOURCE_MEM,
789 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800790 {
791 .start = IRQ_UART0_RX,
792 .end = IRQ_UART0_RX+1,
793 .flags = IORESOURCE_IRQ,
794 },
795 {
796 .start = CH_UART0_RX,
797 .end = CH_UART0_RX+1,
798 .flags = IORESOURCE_DMA,
799 },
800};
801
802static struct platform_device bfin_sir0_device = {
803 .name = "bfin_sir",
804 .id = 0,
805 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
806 .resource = bfin_sir0_resources,
807};
Graf Yang5be36d22008-04-25 03:09:15 +0800808#endif
809#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800810static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800811 {
812 .start = 0xFFC02000,
813 .end = 0xFFC020FF,
814 .flags = IORESOURCE_MEM,
815 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800816 {
817 .start = IRQ_UART1_RX,
818 .end = IRQ_UART1_RX+1,
819 .flags = IORESOURCE_IRQ,
820 },
821 {
822 .start = CH_UART1_RX,
823 .end = CH_UART1_RX+1,
824 .flags = IORESOURCE_DMA,
825 },
Graf Yang5be36d22008-04-25 03:09:15 +0800826};
827
Graf Yang42bd8bc2009-01-07 23:14:39 +0800828static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800829 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800830 .id = 1,
831 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
832 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800833};
834#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800835#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800836
Michael Hennerich59003142007-10-21 16:54:27 +0800837#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
838static struct resource bfin_twi0_resource[] = {
839 [0] = {
840 .start = TWI0_REGBASE,
841 .end = TWI0_REGBASE,
842 .flags = IORESOURCE_MEM,
843 },
844 [1] = {
845 .start = IRQ_TWI,
846 .end = IRQ_TWI,
847 .flags = IORESOURCE_IRQ,
848 },
849};
850
851static struct platform_device i2c_bfin_twi_device = {
852 .name = "i2c-bfin-twi",
853 .id = 0,
854 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
855 .resource = bfin_twi0_resource,
856};
857#endif
858
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000859#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
860#include <linux/mfd/adp5520.h>
861
862 /*
863 * ADP5520/5501 LEDs Data
864 */
865
866static struct led_info adp5520_leds[] = {
867 {
868 .name = "adp5520-led1",
869 .default_trigger = "none",
870 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
871 },
872};
873
874static struct adp5520_leds_platform_data adp5520_leds_data = {
875 .num_leds = ARRAY_SIZE(adp5520_leds),
876 .leds = adp5520_leds,
877 .fade_in = ADP5520_FADE_T_600ms,
878 .fade_out = ADP5520_FADE_T_600ms,
879 .led_on_time = ADP5520_LED_ONT_600ms,
880};
881
882 /*
883 * ADP5520 Keypad Data
884 */
885
886static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
887 [ADP5520_KEY(3, 3)] = KEY_1,
888 [ADP5520_KEY(2, 3)] = KEY_2,
889 [ADP5520_KEY(1, 3)] = KEY_3,
890 [ADP5520_KEY(0, 3)] = KEY_UP,
891 [ADP5520_KEY(3, 2)] = KEY_4,
892 [ADP5520_KEY(2, 2)] = KEY_5,
893 [ADP5520_KEY(1, 2)] = KEY_6,
894 [ADP5520_KEY(0, 2)] = KEY_DOWN,
895 [ADP5520_KEY(3, 1)] = KEY_7,
896 [ADP5520_KEY(2, 1)] = KEY_8,
897 [ADP5520_KEY(1, 1)] = KEY_9,
898 [ADP5520_KEY(0, 1)] = KEY_DOT,
899 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
900 [ADP5520_KEY(2, 0)] = KEY_0,
901 [ADP5520_KEY(1, 0)] = KEY_HELP,
902 [ADP5520_KEY(0, 0)] = KEY_ENTER,
903};
904
905static struct adp5520_keys_platform_data adp5520_keys_data = {
906 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
907 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
908 .keymap = adp5520_keymap,
909 .keymapsize = ARRAY_SIZE(adp5520_keymap),
910 .repeat = 0,
911};
912
913 /*
Stefan Weileef35c22010-08-06 21:11:15 +0200914 * ADP5520/5501 Multifunction Device Init Data
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000915 */
916
917static struct adp5520_platform_data adp5520_pdev_data = {
918 .leds = &adp5520_leds_data,
919 .keys = &adp5520_keys_data,
920};
921
922#endif
923
Bryan Wu72268682008-05-07 11:41:26 +0800924static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000925#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800926 {
927 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800928 },
929#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000930#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800931 {
932 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800933 .irq = IRQ_PF8,
934 },
935#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000936#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
937 {
938 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
939 },
940#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000941#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
942 {
943 I2C_BOARD_INFO("ad7879", 0x2C),
944 .irq = IRQ_PF8,
945 .platform_data = (void *)&bfin_ad7879_ts_info,
946 },
947#endif
948#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
949 {
950 I2C_BOARD_INFO("pmic-adp5520", 0x32),
951 .irq = IRQ_PF9,
952 .platform_data = (void *)&adp5520_pdev_data,
953 },
954#endif
Cliff Cai29bb3bc2010-01-14 08:28:38 +0000955#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
956 {
957 I2C_BOARD_INFO("ssm2602", 0x1b),
958 },
959#endif
steven miao39d3c1c2010-08-26 08:25:13 +0000960#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
961 {
962 I2C_BOARD_INFO("ad5252", 0x2f),
963 },
964#endif
Bryan Wu72268682008-05-07 11:41:26 +0800965};
Bryan Wu72268682008-05-07 11:41:26 +0800966
Michael Hennerich59003142007-10-21 16:54:27 +0800967#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000968#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
969static struct resource bfin_sport0_uart_resources[] = {
970 {
971 .start = SPORT0_TCR1,
972 .end = SPORT0_MRCS3+4,
973 .flags = IORESOURCE_MEM,
974 },
975 {
976 .start = IRQ_SPORT0_RX,
977 .end = IRQ_SPORT0_RX+1,
978 .flags = IORESOURCE_IRQ,
979 },
980 {
981 .start = IRQ_SPORT0_ERROR,
982 .end = IRQ_SPORT0_ERROR,
983 .flags = IORESOURCE_IRQ,
984 },
985};
986
987unsigned short bfin_sport0_peripherals[] = {
988 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
989 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
990};
991
Michael Hennerich59003142007-10-21 16:54:27 +0800992static struct platform_device bfin_sport0_uart_device = {
993 .name = "bfin-sport-uart",
994 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000995 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
996 .resource = bfin_sport0_uart_resources,
997 .dev = {
998 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
999 },
1000};
1001#endif
1002#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1003static struct resource bfin_sport1_uart_resources[] = {
1004 {
1005 .start = SPORT1_TCR1,
1006 .end = SPORT1_MRCS3+4,
1007 .flags = IORESOURCE_MEM,
1008 },
1009 {
1010 .start = IRQ_SPORT1_RX,
1011 .end = IRQ_SPORT1_RX+1,
1012 .flags = IORESOURCE_IRQ,
1013 },
1014 {
1015 .start = IRQ_SPORT1_ERROR,
1016 .end = IRQ_SPORT1_ERROR,
1017 .flags = IORESOURCE_IRQ,
1018 },
1019};
1020
1021unsigned short bfin_sport1_peripherals[] = {
1022 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1023 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
Michael Hennerich59003142007-10-21 16:54:27 +08001024};
1025
1026static struct platform_device bfin_sport1_uart_device = {
1027 .name = "bfin-sport-uart",
1028 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001029 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1030 .resource = bfin_sport1_uart_resources,
1031 .dev = {
1032 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1033 },
Michael Hennerich59003142007-10-21 16:54:27 +08001034};
1035#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001036#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001037
Michael Hennerich1089e222007-12-24 11:49:29 +08001038#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +08001039#include <linux/gpio_keys.h>
1040
1041static struct gpio_keys_button bfin_gpio_keys_table[] = {
1042 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1043 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1044};
1045
1046static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1047 .buttons = bfin_gpio_keys_table,
1048 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1049};
1050
1051static struct platform_device bfin_device_gpiokeys = {
1052 .name = "gpio-keys",
1053 .dev = {
1054 .platform_data = &bfin_gpio_keys_data,
1055 },
1056};
1057#endif
1058
Michael Hennerichadfc0462009-10-09 07:37:03 +00001059#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001060#include <asm/bfin_rotary.h>
1061
1062static struct bfin_rotary_platform_data bfin_rotary_data = {
1063 /*.rotary_up_key = KEY_UP,*/
1064 /*.rotary_down_key = KEY_DOWN,*/
1065 .rotary_rel_code = REL_WHEEL,
1066 .rotary_button_key = KEY_ENTER,
1067 .debounce = 10, /* 0..17 */
1068 .mode = ROT_QUAD_ENC | ROT_DEBE,
1069};
1070
1071static struct resource bfin_rotary_resources[] = {
1072 {
1073 .start = IRQ_CNT,
1074 .end = IRQ_CNT,
1075 .flags = IORESOURCE_IRQ,
1076 },
1077};
1078
1079static struct platform_device bfin_rotary_device = {
1080 .name = "bfin-rotary",
1081 .id = -1,
1082 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1083 .resource = bfin_rotary_resources,
1084 .dev = {
1085 .platform_data = &bfin_rotary_data,
1086 },
1087};
1088#endif
1089
Michael Hennerich14b03202008-05-07 11:41:26 +08001090static const unsigned int cclk_vlev_datasheet[] =
1091{
1092 VRPAIR(VLEV_100, 400000000),
1093 VRPAIR(VLEV_105, 426000000),
1094 VRPAIR(VLEV_110, 500000000),
1095 VRPAIR(VLEV_115, 533000000),
1096 VRPAIR(VLEV_120, 600000000),
1097};
1098
1099static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1100 .tuple_tab = cclk_vlev_datasheet,
1101 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1102 .vr_settling_time = 25 /* us */,
1103};
1104
1105static struct platform_device bfin_dpmc = {
1106 .name = "bfin dpmc",
1107 .dev = {
1108 .platform_data = &bfin_dmpc_vreg_data,
1109 },
1110};
1111
Michael Hennerich59003142007-10-21 16:54:27 +08001112static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001113
1114 &bfin_dpmc,
1115
Michael Hennerich64307f72007-10-29 16:55:18 +08001116#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1117 &bf5xx_nand_device,
1118#endif
1119
Michael Hennerich59003142007-10-21 16:54:27 +08001120#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1121 &bfin_pcmcia_cf_device,
1122#endif
1123
1124#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1125 &rtc_device,
1126#endif
1127
Michael Hennerich3f375692008-11-18 17:48:22 +08001128#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1129 &bfin_isp1760_device,
1130#endif
1131
Michael Hennerich1089e222007-12-24 11:49:29 +08001132#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1133 &musb_device,
1134#endif
1135
Michael Hennerich59003142007-10-21 16:54:27 +08001136#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1137 &smc91x_device,
1138#endif
1139
1140#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1141 &dm9000_device,
1142#endif
1143
1144#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001145 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +08001146 &bfin_mac_device,
1147#endif
1148
1149#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1150 &net2272_bfin_device,
1151#endif
1152
1153#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1154 &bfin_spi0_device,
1155#endif
1156
Michael Hennerich1089e222007-12-24 11:49:29 +08001157#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1158 &bf52x_t350mcqb_device,
1159#endif
1160
Michael Hennerich6924dfb2009-12-07 13:41:28 +00001161#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1162 &bfin_lq035q1_device,
1163#endif
1164
Michael Hennerich59003142007-10-21 16:54:27 +08001165#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001166#ifdef CONFIG_SERIAL_BFIN_UART0
1167 &bfin_uart0_device,
1168#endif
1169#ifdef CONFIG_SERIAL_BFIN_UART1
1170 &bfin_uart1_device,
1171#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001172#endif
1173
Graf Yang5be36d22008-04-25 03:09:15 +08001174#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001175#ifdef CONFIG_BFIN_SIR0
1176 &bfin_sir0_device,
1177#endif
1178#ifdef CONFIG_BFIN_SIR1
1179 &bfin_sir1_device,
1180#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001181#endif
1182
Michael Hennerich59003142007-10-21 16:54:27 +08001183#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1184 &i2c_bfin_twi_device,
1185#endif
1186
1187#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001188#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001189 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001190#endif
1191#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001192 &bfin_sport1_uart_device,
1193#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001194#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001195
Michael Hennerich1089e222007-12-24 11:49:29 +08001196#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1197 &bfin_device_gpiokeys,
1198#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001199
Michael Hennerichadfc0462009-10-09 07:37:03 +00001200#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001201 &bfin_rotary_device,
1202#endif
1203
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001204#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1205 &ezkit_flash_device,
1206#endif
Barry Song336746e2009-10-13 09:19:18 +00001207
1208#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1209 &bfin_i2s,
1210#endif
1211
1212#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1213 &bfin_tdm,
1214#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001215};
1216
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001217static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001218{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001219 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001220 i2c_register_board_info(0, bfin_i2c_board_info,
1221 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001222 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001223 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001224 return 0;
1225}
1226
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001227arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001228
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00001229static struct platform_device *ezkit_early_devices[] __initdata = {
1230#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1231#ifdef CONFIG_SERIAL_BFIN_UART0
1232 &bfin_uart0_device,
1233#endif
1234#ifdef CONFIG_SERIAL_BFIN_UART1
1235 &bfin_uart1_device,
1236#endif
1237#endif
1238
1239#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1240#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1241 &bfin_sport0_uart_device,
1242#endif
1243#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1244 &bfin_sport1_uart_device,
1245#endif
1246#endif
1247};
1248
1249void __init native_machine_early_platform_add_devices(void)
1250{
1251 printk(KERN_INFO "register early platform devices\n");
1252 early_platform_add_devices(ezkit_early_devices,
1253 ARRAY_SIZE(ezkit_early_devices));
1254}
1255
Michael Hennerich59003142007-10-21 16:54:27 +08001256void native_machine_restart(char *cmd)
1257{
1258 /* workaround reboot hang when booting from SPI */
1259 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001260 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001261}
Mike Frysinger137b1522007-11-22 16:07:03 +08001262
Mike Frysinger9862cc52007-11-15 21:21:20 +08001263void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001264{
Mike Frysinger181afa92008-02-25 11:42:17 +08001265 /* the MAC is stored in OTP memory page 0xDF */
1266 u32 ret;
1267 u64 otp_mac;
1268 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1269
1270 ret = otp_read(0xDF, 0x00, &otp_mac);
1271 if (!(ret & 0x1)) {
1272 char *otp_mac_p = (char *)&otp_mac;
1273 for (ret = 0; ret < 6; ++ret)
1274 addr[ret] = otp_mac_p[5 - ret];
1275 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001276}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001277EXPORT_SYMBOL(bfin_get_ether_addr);