blob: 4e9dc9cf824126c770aa3e74a0db1032a003d51d [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>
Scott Jiang6f53dbb2011-03-01 09:43:50 +000029#include <asm/bfin_sport.h>
Michael Hennerich59003142007-10-21 16:54:27 +080030
31/*
32 * Name the Board for the /proc/cpuinfo
33 */
Michael Hennerich6924dfb2009-12-07 13:41:28 +000034#ifdef CONFIG_BFIN527_EZKIT_V2
35const char bfin_board_name[] = "ADI BF527-EZKIT V2";
36#else
Mike Frysingerfe85cad2008-11-18 17:48:22 +080037const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich6924dfb2009-12-07 13:41:28 +000038#endif
Michael Hennerich59003142007-10-21 16:54:27 +080039
40/*
41 * Driver needs to know address, irq and flag pin.
42 */
43
Michael Hennerich59003142007-10-21 16:54:27 +080044#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080045#include <linux/usb/isp1760.h>
46static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080047 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080048 .start = 0x203C0000,
49 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080050 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080053 .start = IRQ_PF7,
54 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080055 .flags = IORESOURCE_IRQ,
56 },
57};
58
Michael Hennerich3f375692008-11-18 17:48:22 +080059static struct isp1760_platform_data isp1760_priv = {
60 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080061 .bus_width_16 = 1,
62 .port1_otg = 0,
63 .analog_oc = 0,
64 .dack_polarity_high = 0,
65 .dreq_polarity_high = 0,
66};
67
68static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb7682009-10-15 10:37:33 +000069 .name = "isp1760",
Michael Hennerich59003142007-10-21 16:54:27 +080070 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080071 .dev = {
72 .platform_data = &isp1760_priv,
73 },
74 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
75 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080076};
Michael Hennerich59003142007-10-21 16:54:27 +080077#endif
78
Michael Hennerich1089e222007-12-24 11:49:29 +080079#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
80static struct resource musb_resources[] = {
81 [0] = {
82 .start = 0xffc03800,
83 .end = 0xffc03cff,
84 .flags = IORESOURCE_MEM,
85 },
86 [1] = { /* general IRQ */
87 .start = IRQ_USB_INT0,
88 .end = IRQ_USB_INT0,
89 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
Hema Kalliguddifcf173e2010-09-29 11:26:39 -050090 .name = "mc"
Michael Hennerich1089e222007-12-24 11:49:29 +080091 },
92 [2] = { /* DMA IRQ */
93 .start = IRQ_USB_DMA,
94 .end = IRQ_USB_DMA,
95 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
Hema Kalliguddifcf173e2010-09-29 11:26:39 -050096 .name = "dma"
Michael Hennerich1089e222007-12-24 11:49:29 +080097 },
98};
99
Bryan Wu50041ac2008-10-08 13:39:40 +0800100static struct musb_hdrc_config musb_config = {
101 .multipoint = 0,
102 .dyn_fifo = 0,
103 .soft_con = 1,
104 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800105 .num_eps = 8,
106 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800107 .gpio_vrsel = GPIO_PG13,
Cliff Cai85eb0e42010-01-22 04:02:46 +0000108 /* Some custom boards need to be active low, just set it to "0"
109 * if it is the case.
110 */
111 .gpio_vrsel_active = 1,
Bob Liu759a3f32010-09-17 11:09:57 +0000112 .clkin = 24, /* musb CLKIN in MHZ */
Bryan Wu50041ac2008-10-08 13:39:40 +0800113};
114
Michael Hennerich1089e222007-12-24 11:49:29 +0800115static struct musb_hdrc_platform_data musb_plat = {
116#if defined(CONFIG_USB_MUSB_OTG)
117 .mode = MUSB_OTG,
118#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
119 .mode = MUSB_HOST,
120#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
121 .mode = MUSB_PERIPHERAL,
122#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800123 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800124};
125
126static u64 musb_dmamask = ~(u32)0;
127
128static struct platform_device musb_device = {
Felipe Balbi9cb03082010-12-02 09:21:05 +0200129 .name = "musb-blackfin",
Michael Hennerich1089e222007-12-24 11:49:29 +0800130 .id = 0,
131 .dev = {
132 .dma_mask = &musb_dmamask,
133 .coherent_dma_mask = 0xffffffff,
134 .platform_data = &musb_plat,
135 },
136 .num_resources = ARRAY_SIZE(musb_resources),
137 .resource = musb_resources,
138};
139#endif
140
141#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
142
143static struct resource bf52x_t350mcqb_resources[] = {
144 {
145 .start = IRQ_PPI_ERROR,
146 .end = IRQ_PPI_ERROR,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
151static struct platform_device bf52x_t350mcqb_device = {
152 .name = "bfin-t350mcqb",
153 .id = -1,
154 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
155 .resource = bf52x_t350mcqb_resources,
156};
157#endif
158
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000159#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
160#include <asm/bfin-lq035q1.h>
161
162static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
163 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +0000164 .ppi_mode = USE_RGB565_8_BIT_PPI,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000165};
166
167static struct resource bfin_lq035q1_resources[] = {
168 {
169 .start = IRQ_PPI_ERROR,
170 .end = IRQ_PPI_ERROR,
171 .flags = IORESOURCE_IRQ,
172 },
173};
174
175static struct platform_device bfin_lq035q1_device = {
176 .name = "bfin-lq035q1",
177 .id = -1,
178 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
179 .resource = bfin_lq035q1_resources,
180 .dev = {
181 .platform_data = &bfin_lq035q1_data,
182 },
183};
184#endif
185
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800186#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
187static struct mtd_partition ezkit_partitions[] = {
188 {
Robin Getzaa582972008-08-05 17:47:29 +0800189 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800190 .size = 0x40000,
191 .offset = 0,
192 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800193 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800194 .size = 0x1C0000,
195 .offset = MTDPART_OFS_APPEND,
196 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800197 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800198 .size = MTDPART_SIZ_FULL,
199 .offset = MTDPART_OFS_APPEND,
200 }
201};
202
203static struct physmap_flash_data ezkit_flash_data = {
204 .width = 2,
205 .parts = ezkit_partitions,
206 .nr_parts = ARRAY_SIZE(ezkit_partitions),
207};
208
209static struct resource ezkit_flash_resource = {
210 .start = 0x20000000,
211 .end = 0x203fffff,
212 .flags = IORESOURCE_MEM,
213};
214
215static struct platform_device ezkit_flash_device = {
216 .name = "physmap-flash",
217 .id = 0,
218 .dev = {
219 .platform_data = &ezkit_flash_data,
220 },
221 .num_resources = 1,
222 .resource = &ezkit_flash_resource,
223};
224#endif
225
Michael Hennerich64307f72007-10-29 16:55:18 +0800226#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
227static struct mtd_partition partition_info[] = {
228 {
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000229 .name = "bootloader(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800230 .offset = 0,
Mike Frysinger5cc1c562010-09-22 02:46:44 +0000231 .size = 0x40000,
232 }, {
233 .name = "linux kernel(nand)",
234 .offset = MTDPART_OFS_APPEND,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800235 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800236 },
237 {
Robin Getzaa582972008-08-05 17:47:29 +0800238 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800239 .offset = MTDPART_OFS_APPEND,
240 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800241 },
242};
243
244static struct bf5xx_nand_platform bf5xx_nand_platform = {
Michael Hennerich64307f72007-10-29 16:55:18 +0800245 .data_width = NFC_NWIDTH_8,
246 .partitions = partition_info,
247 .nr_partitions = ARRAY_SIZE(partition_info),
248 .rd_dly = 3,
249 .wr_dly = 3,
250};
251
252static struct resource bf5xx_nand_resources[] = {
253 {
254 .start = NFC_CTL,
255 .end = NFC_DATA_RD + 2,
256 .flags = IORESOURCE_MEM,
257 },
258 {
259 .start = CH_NFC,
260 .end = CH_NFC,
261 .flags = IORESOURCE_IRQ,
262 },
263};
264
265static struct platform_device bf5xx_nand_device = {
266 .name = "bf5xx-nand",
267 .id = 0,
268 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
269 .resource = bf5xx_nand_resources,
270 .dev = {
271 .platform_data = &bf5xx_nand_platform,
272 },
273};
274#endif
275
Michael Hennerich59003142007-10-21 16:54:27 +0800276#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
277static struct resource bfin_pcmcia_cf_resources[] = {
278 {
279 .start = 0x20310000, /* IO PORT */
280 .end = 0x20312000,
281 .flags = IORESOURCE_MEM,
282 }, {
283 .start = 0x20311000, /* Attribute Memory */
284 .end = 0x20311FFF,
285 .flags = IORESOURCE_MEM,
286 }, {
287 .start = IRQ_PF4,
288 .end = IRQ_PF4,
289 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
290 }, {
291 .start = 6, /* Card Detect PF6 */
292 .end = 6,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device bfin_pcmcia_cf_device = {
298 .name = "bfin_cf_pcmcia",
299 .id = -1,
300 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
301 .resource = bfin_pcmcia_cf_resources,
302};
303#endif
304
305#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
306static struct platform_device rtc_device = {
307 .name = "rtc-bfin",
308 .id = -1,
309};
310#endif
311
312#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000313#include <linux/smc91x.h>
314
315static struct smc91x_platdata smc91x_info = {
316 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
317 .leda = RPC_LED_100_10,
318 .ledb = RPC_LED_TX_RX,
319};
320
Michael Hennerich59003142007-10-21 16:54:27 +0800321static struct resource smc91x_resources[] = {
322 {
323 .name = "smc91x-regs",
324 .start = 0x20300300,
325 .end = 0x20300300 + 16,
326 .flags = IORESOURCE_MEM,
327 }, {
328
329 .start = IRQ_PF7,
330 .end = IRQ_PF7,
331 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
332 },
333};
334static struct platform_device smc91x_device = {
335 .name = "smc91x",
336 .id = 0,
337 .num_resources = ARRAY_SIZE(smc91x_resources),
338 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000339 .dev = {
340 .platform_data = &smc91x_info,
341 },
Michael Hennerich59003142007-10-21 16:54:27 +0800342};
343#endif
344
345#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
346static struct resource dm9000_resources[] = {
347 [0] = {
348 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100349 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800350 .flags = IORESOURCE_MEM,
351 },
352 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100353 .start = 0x203FB800 + 4,
354 .end = 0x203FB800 + 5,
355 .flags = IORESOURCE_MEM,
356 },
357 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800358 .start = IRQ_PF9,
359 .end = IRQ_PF9,
360 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
361 },
362};
363
364static struct platform_device dm9000_device = {
365 .name = "dm9000",
366 .id = -1,
367 .num_resources = ARRAY_SIZE(dm9000_resources),
368 .resource = dm9000_resources,
369};
370#endif
371
Michael Hennerich59003142007-10-21 16:54:27 +0800372#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000373#include <linux/bfin_mac.h>
374static const unsigned short bfin_mac_peripherals[] = P_RMII0;
375
376static struct bfin_phydev_platform_data bfin_phydev_data[] = {
377 {
378 .addr = 1,
379 .irq = IRQ_MAC_PHYINT,
380 },
381};
382
383static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
384 .phydev_number = 1,
385 .phydev_data = bfin_phydev_data,
386 .phy_mode = PHY_INTERFACE_MODE_RMII,
387 .mac_peripherals = bfin_mac_peripherals,
388};
389
Graf Yang65319622009-02-04 16:49:45 +0800390static struct platform_device bfin_mii_bus = {
391 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000392 .dev = {
393 .platform_data = &bfin_mii_bus_data,
394 }
Graf Yang65319622009-02-04 16:49:45 +0800395};
396
Michael Hennerich59003142007-10-21 16:54:27 +0800397static struct platform_device bfin_mac_device = {
398 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000399 .dev = {
400 .platform_data = &bfin_mii_bus,
401 }
Michael Hennerich59003142007-10-21 16:54:27 +0800402};
403#endif
404
405#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
406static struct resource net2272_bfin_resources[] = {
407 {
408 .start = 0x20300000,
409 .end = 0x20300000 + 0x100,
410 .flags = IORESOURCE_MEM,
411 }, {
Mike Frysinger9be86312011-05-04 11:20:15 -0400412 .start = 1,
413 .flags = IORESOURCE_BUS,
414 }, {
Michael Hennerich59003142007-10-21 16:54:27 +0800415 .start = IRQ_PF7,
416 .end = IRQ_PF7,
417 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
418 },
419};
420
421static struct platform_device net2272_bfin_device = {
422 .name = "net2272",
423 .id = -1,
424 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
425 .resource = net2272_bfin_resources,
426};
427#endif
428
Michael Hennerich59003142007-10-21 16:54:27 +0800429#if defined(CONFIG_MTD_M25P80) \
430 || defined(CONFIG_MTD_M25P80_MODULE)
431static struct mtd_partition bfin_spi_flash_partitions[] = {
432 {
Robin Getzaa582972008-08-05 17:47:29 +0800433 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800434 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800435 .offset = 0,
436 .mask_flags = MTD_CAP_ROM
437 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800438 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800439 .size = MTDPART_SIZ_FULL,
440 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800441 }
442};
443
444static struct flash_platform_data bfin_spi_flash_data = {
445 .name = "m25p80",
446 .parts = bfin_spi_flash_partitions,
447 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800448 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800449};
450
451/* SPI flash chip (m25p64) */
452static struct bfin5xx_spi_chip spi_flash_chip_info = {
453 .enable_dma = 0, /* use dma transfer with this chip*/
Michael Hennerich59003142007-10-21 16:54:27 +0800454};
455#endif
456
Yi Liffdf3ec2009-03-31 10:36:51 +0000457#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
458static struct bfin5xx_spi_chip mmc_spi_chip_info = {
459 .enable_dma = 0,
Yi Liffdf3ec2009-03-31 10:36:51 +0000460};
461#endif
462
Michael Hennerich59003142007-10-21 16:54:27 +0800463#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800464static const struct ad7877_platform_data bfin_ad7877_ts_info = {
465 .model = 7877,
466 .vref_delay_usecs = 50, /* internal, no capacitor */
467 .x_plate_ohms = 419,
468 .y_plate_ohms = 486,
469 .pressure_max = 1000,
470 .pressure_min = 0,
471 .stopacq_polarity = 1,
472 .first_conversion_delay = 3,
473 .acquisition_time = 1,
474 .averaging = 1,
475 .pen_down_acc_interval = 1,
476};
477#endif
478
Michael Hennerich51054322009-01-07 23:14:38 +0800479#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
480#include <linux/spi/ad7879.h>
481static const struct ad7879_platform_data bfin_ad7879_ts_info = {
482 .model = 7879, /* Model = AD7879 */
483 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
484 .pressure_max = 10000,
485 .pressure_min = 0,
486 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
487 .acquisition_time = 1, /* 4us acquisition time per sample */
488 .median = 2, /* do 8 measurements */
489 .averaging = 1, /* take the average of 4 middle samples */
490 .pen_down_acc_interval = 255, /* 9.4 ms */
Michael Hennerich244d3422009-12-18 09:29:39 +0000491 .gpio_export = 0, /* Export GPIO to gpiolib */
Michael Hennerich51054322009-01-07 23:14:38 +0800492};
493#endif
494
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000495#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
496 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
497
498static const u16 bfin_snd_pin[][7] = {
499 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
500 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0},
501 {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
502 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0},
503};
504
505static struct bfin_snd_platform_data bfin_snd_data[] = {
506 {
507 .pin_req = &bfin_snd_pin[0][0],
508 },
509 {
510 .pin_req = &bfin_snd_pin[1][0],
511 },
512};
513
514#define BFIN_SND_RES(x) \
515 [x] = { \
516 { \
517 .start = SPORT##x##_TCR1, \
518 .end = SPORT##x##_TCR1, \
519 .flags = IORESOURCE_MEM \
520 }, \
521 { \
522 .start = CH_SPORT##x##_RX, \
523 .end = CH_SPORT##x##_RX, \
524 .flags = IORESOURCE_DMA, \
525 }, \
526 { \
527 .start = CH_SPORT##x##_TX, \
528 .end = CH_SPORT##x##_TX, \
529 .flags = IORESOURCE_DMA, \
530 }, \
531 { \
532 .start = IRQ_SPORT##x##_ERROR, \
533 .end = IRQ_SPORT##x##_ERROR, \
534 .flags = IORESOURCE_IRQ, \
535 } \
536 }
537
538static struct resource bfin_snd_resources[][4] = {
539 BFIN_SND_RES(0),
540 BFIN_SND_RES(1),
541};
Scott Jiang2b6678c52011-07-05 19:27:25 -0400542#endif
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000543
Scott Jiang2b6678c52011-07-05 19:27:25 -0400544#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
545static struct platform_device bfin_i2s_pcm = {
546 .name = "bfin-i2s-pcm-audio",
547 .id = -1,
548};
549#endif
550
551#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
552static struct platform_device bfin_tdm_pcm = {
553 .name = "bfin-tdm-pcm-audio",
554 .id = -1,
555};
556#endif
557
558#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
559static struct platform_device bfin_ac97_pcm = {
560 .name = "bfin-ac97-pcm-audio",
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000561 .id = -1,
562};
563#endif
564
Barry Song336746e2009-10-13 09:19:18 +0000565#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
566static struct platform_device bfin_i2s = {
567 .name = "bfin-i2s",
568 .id = CONFIG_SND_BF5XX_SPORT_NUM,
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000569 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
570 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
571 .dev = {
572 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
573 },
Barry Song336746e2009-10-13 09:19:18 +0000574};
575#endif
576
577#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
578static struct platform_device bfin_tdm = {
579 .name = "bfin-tdm",
580 .id = CONFIG_SND_BF5XX_SPORT_NUM,
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000581 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
582 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
583 .dev = {
584 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
585 },
Barry Song336746e2009-10-13 09:19:18 +0000586};
587#endif
588
Michael Hennerich59003142007-10-21 16:54:27 +0800589static struct spi_board_info bfin_spi_board_info[] __initdata = {
590#if defined(CONFIG_MTD_M25P80) \
591 || defined(CONFIG_MTD_M25P80_MODULE)
592 {
593 /* the modalias must be the same as spi device driver name */
594 .modalias = "m25p80", /* Name of spi_driver for this device */
595 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
596 .bus_num = 0, /* Framework bus number */
597 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
598 .platform_data = &bfin_spi_flash_data,
599 .controller_data = &spi_flash_chip_info,
600 .mode = SPI_MODE_3,
601 },
602#endif
603
Barry Song7ba80062010-01-28 09:37:21 +0000604#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
605 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800606 {
Barry Song7ba80062010-01-28 09:37:21 +0000607 .modalias = "ad183x",
Michael Hennerich59003142007-10-21 16:54:27 +0800608 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
609 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000610 .chip_select = 4,
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000611 .platform_data = "ad1836",
Scott Jiang6f53dbb2011-03-01 09:43:50 +0000612 .mode = SPI_MODE_3,
Michael Hennerich59003142007-10-21 16:54:27 +0800613 },
614#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000615#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
616 {
617 .modalias = "mmc_spi",
618 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
619 .bus_num = 0,
620 .chip_select = 3,
621 .controller_data = &mmc_spi_chip_info,
622 .mode = SPI_MODE_0,
623 },
624#endif
625
Michael Hennerich59003142007-10-21 16:54:27 +0800626#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
627 {
628 .modalias = "ad7877",
629 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800630 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800631 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800632 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800633 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800634 },
635#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800636#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
637 {
638 .modalias = "ad7879",
639 .platform_data = &bfin_ad7879_ts_info,
640 .irq = IRQ_PF8,
641 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
642 .bus_num = 0,
643 .chip_select = 3,
Michael Hennerich51054322009-01-07 23:14:38 +0800644 .mode = SPI_CPHA | SPI_CPOL,
645 },
646#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800647#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
648 {
649 .modalias = "spidev",
650 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
651 .bus_num = 0,
652 .chip_select = 1,
Michael Hennerich6e668932008-02-09 01:54:09 +0800653 },
654#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000655#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
656 {
657 .modalias = "bfin-lq035q1-spi",
658 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
659 .bus_num = 0,
660 .chip_select = 7,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000661 .mode = SPI_CPHA | SPI_CPOL,
662 },
663#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800664};
665
Mike Frysinger5bda2722008-06-07 15:03:01 +0800666#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800667/* SPI controller data */
668static struct bfin5xx_spi_master bfin_spi0_info = {
669 .num_chipselect = 8,
670 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800671 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800672};
673
674/* SPI (0) */
675static struct resource bfin_spi0_resource[] = {
676 [0] = {
677 .start = SPI0_REGBASE,
678 .end = SPI0_REGBASE + 0xFF,
679 .flags = IORESOURCE_MEM,
680 },
681 [1] = {
682 .start = CH_SPI,
683 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000684 .flags = IORESOURCE_DMA,
685 },
686 [2] = {
687 .start = IRQ_SPI,
688 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800689 .flags = IORESOURCE_IRQ,
690 },
691};
692
693static struct platform_device bfin_spi0_device = {
694 .name = "bfin-spi",
695 .id = 0, /* Bus number */
696 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
697 .resource = bfin_spi0_resource,
698 .dev = {
699 .platform_data = &bfin_spi0_info, /* Passed to driver */
700 },
701};
702#endif /* spi master and devices */
703
Michael Hennerich59003142007-10-21 16:54:27 +0800704#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800705#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000706static struct resource bfin_uart0_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800707 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000708 .start = UART0_THR,
709 .end = UART0_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800710 .flags = IORESOURCE_MEM,
711 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000712 {
713 .start = IRQ_UART0_RX,
714 .end = IRQ_UART0_RX+1,
715 .flags = IORESOURCE_IRQ,
716 },
717 {
718 .start = IRQ_UART0_ERROR,
719 .end = IRQ_UART0_ERROR,
720 .flags = IORESOURCE_IRQ,
721 },
722 {
723 .start = CH_UART0_TX,
724 .end = CH_UART0_TX,
725 .flags = IORESOURCE_DMA,
726 },
727 {
728 .start = CH_UART0_RX,
729 .end = CH_UART0_RX,
730 .flags = IORESOURCE_DMA,
731 },
732};
733
Mike Frysingera8b19882010-11-24 09:23:04 +0000734static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000735 P_UART0_TX, P_UART0_RX, 0
736};
737
738static struct platform_device bfin_uart0_device = {
739 .name = "bfin-uart",
740 .id = 0,
741 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
742 .resource = bfin_uart0_resources,
743 .dev = {
744 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
745 },
746};
Michael Hennerich59003142007-10-21 16:54:27 +0800747#endif
748#ifdef CONFIG_SERIAL_BFIN_UART1
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000749static struct resource bfin_uart1_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800750 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000751 .start = UART1_THR,
752 .end = UART1_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800753 .flags = IORESOURCE_MEM,
754 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000755 {
756 .start = IRQ_UART1_RX,
757 .end = IRQ_UART1_RX+1,
758 .flags = IORESOURCE_IRQ,
759 },
760 {
761 .start = IRQ_UART1_ERROR,
762 .end = IRQ_UART1_ERROR,
763 .flags = IORESOURCE_IRQ,
764 },
765 {
766 .start = CH_UART1_TX,
767 .end = CH_UART1_TX,
768 .flags = IORESOURCE_DMA,
769 },
770 {
771 .start = CH_UART1_RX,
772 .end = CH_UART1_RX,
773 .flags = IORESOURCE_DMA,
774 },
775#ifdef CONFIG_BFIN_UART1_CTSRTS
776 { /* CTS pin */
777 .start = GPIO_PF9,
778 .end = GPIO_PF9,
779 .flags = IORESOURCE_IO,
780 },
781 { /* RTS pin */
782 .start = GPIO_PF10,
783 .end = GPIO_PF10,
784 .flags = IORESOURCE_IO,
785 },
Michael Hennerich59003142007-10-21 16:54:27 +0800786#endif
787};
788
Mike Frysingera8b19882010-11-24 09:23:04 +0000789static unsigned short bfin_uart1_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000790 P_UART1_TX, P_UART1_RX, 0
791};
792
793static struct platform_device bfin_uart1_device = {
Michael Hennerich59003142007-10-21 16:54:27 +0800794 .name = "bfin-uart",
795 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000796 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
797 .resource = bfin_uart1_resources,
798 .dev = {
799 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
800 },
Michael Hennerich59003142007-10-21 16:54:27 +0800801};
802#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000803#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800804
Graf Yang5be36d22008-04-25 03:09:15 +0800805#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800806#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800807static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800808 {
809 .start = 0xFFC00400,
810 .end = 0xFFC004FF,
811 .flags = IORESOURCE_MEM,
812 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800813 {
814 .start = IRQ_UART0_RX,
815 .end = IRQ_UART0_RX+1,
816 .flags = IORESOURCE_IRQ,
817 },
818 {
819 .start = CH_UART0_RX,
820 .end = CH_UART0_RX+1,
821 .flags = IORESOURCE_DMA,
822 },
823};
824
825static struct platform_device bfin_sir0_device = {
826 .name = "bfin_sir",
827 .id = 0,
828 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
829 .resource = bfin_sir0_resources,
830};
Graf Yang5be36d22008-04-25 03:09:15 +0800831#endif
832#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800833static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800834 {
835 .start = 0xFFC02000,
836 .end = 0xFFC020FF,
837 .flags = IORESOURCE_MEM,
838 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800839 {
840 .start = IRQ_UART1_RX,
841 .end = IRQ_UART1_RX+1,
842 .flags = IORESOURCE_IRQ,
843 },
844 {
845 .start = CH_UART1_RX,
846 .end = CH_UART1_RX+1,
847 .flags = IORESOURCE_DMA,
848 },
Graf Yang5be36d22008-04-25 03:09:15 +0800849};
850
Graf Yang42bd8bc2009-01-07 23:14:39 +0800851static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800852 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800853 .id = 1,
854 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
855 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800856};
857#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800858#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800859
Michael Hennerich59003142007-10-21 16:54:27 +0800860#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
861static struct resource bfin_twi0_resource[] = {
862 [0] = {
863 .start = TWI0_REGBASE,
864 .end = TWI0_REGBASE,
865 .flags = IORESOURCE_MEM,
866 },
867 [1] = {
868 .start = IRQ_TWI,
869 .end = IRQ_TWI,
870 .flags = IORESOURCE_IRQ,
871 },
872};
873
874static struct platform_device i2c_bfin_twi_device = {
875 .name = "i2c-bfin-twi",
876 .id = 0,
877 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
878 .resource = bfin_twi0_resource,
879};
880#endif
881
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000882#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
883#include <linux/mfd/adp5520.h>
884
885 /*
886 * ADP5520/5501 LEDs Data
887 */
888
889static struct led_info adp5520_leds[] = {
890 {
891 .name = "adp5520-led1",
892 .default_trigger = "none",
893 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
894 },
895};
896
897static struct adp5520_leds_platform_data adp5520_leds_data = {
898 .num_leds = ARRAY_SIZE(adp5520_leds),
899 .leds = adp5520_leds,
900 .fade_in = ADP5520_FADE_T_600ms,
901 .fade_out = ADP5520_FADE_T_600ms,
902 .led_on_time = ADP5520_LED_ONT_600ms,
903};
904
905 /*
906 * ADP5520 Keypad Data
907 */
908
909static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
910 [ADP5520_KEY(3, 3)] = KEY_1,
911 [ADP5520_KEY(2, 3)] = KEY_2,
912 [ADP5520_KEY(1, 3)] = KEY_3,
913 [ADP5520_KEY(0, 3)] = KEY_UP,
914 [ADP5520_KEY(3, 2)] = KEY_4,
915 [ADP5520_KEY(2, 2)] = KEY_5,
916 [ADP5520_KEY(1, 2)] = KEY_6,
917 [ADP5520_KEY(0, 2)] = KEY_DOWN,
918 [ADP5520_KEY(3, 1)] = KEY_7,
919 [ADP5520_KEY(2, 1)] = KEY_8,
920 [ADP5520_KEY(1, 1)] = KEY_9,
921 [ADP5520_KEY(0, 1)] = KEY_DOT,
922 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
923 [ADP5520_KEY(2, 0)] = KEY_0,
924 [ADP5520_KEY(1, 0)] = KEY_HELP,
925 [ADP5520_KEY(0, 0)] = KEY_ENTER,
926};
927
928static struct adp5520_keys_platform_data adp5520_keys_data = {
929 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
930 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
931 .keymap = adp5520_keymap,
932 .keymapsize = ARRAY_SIZE(adp5520_keymap),
933 .repeat = 0,
934};
935
936 /*
Stefan Weileef35c22010-08-06 21:11:15 +0200937 * ADP5520/5501 Multifunction Device Init Data
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000938 */
939
940static struct adp5520_platform_data adp5520_pdev_data = {
941 .leds = &adp5520_leds_data,
942 .keys = &adp5520_keys_data,
943};
944
945#endif
946
Bryan Wu72268682008-05-07 11:41:26 +0800947static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000948#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800949 {
950 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800951 },
952#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000953#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800954 {
955 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800956 .irq = IRQ_PF8,
957 },
958#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000959#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
960 {
961 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
962 },
963#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000964#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
965 {
966 I2C_BOARD_INFO("ad7879", 0x2C),
967 .irq = IRQ_PF8,
968 .platform_data = (void *)&bfin_ad7879_ts_info,
969 },
970#endif
971#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
972 {
973 I2C_BOARD_INFO("pmic-adp5520", 0x32),
974 .irq = IRQ_PF9,
975 .platform_data = (void *)&adp5520_pdev_data,
976 },
977#endif
Cliff Cai29bb3bc2010-01-14 08:28:38 +0000978#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
979 {
980 I2C_BOARD_INFO("ssm2602", 0x1b),
981 },
982#endif
steven miao39d3c1c2010-08-26 08:25:13 +0000983#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
984 {
985 I2C_BOARD_INFO("ad5252", 0x2f),
986 },
987#endif
Sonic Zhang624fab32010-11-05 11:29:46 +0000988#if defined(CONFIG_SND_SOC_ADAU1373) || defined(CONFIG_SND_SOC_ADAU1373_MODULE)
989 {
990 I2C_BOARD_INFO("adau1373", 0x1A),
991 },
992#endif
Bryan Wu72268682008-05-07 11:41:26 +0800993};
Bryan Wu72268682008-05-07 11:41:26 +0800994
Michael Hennerich59003142007-10-21 16:54:27 +0800995#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000996#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
997static struct resource bfin_sport0_uart_resources[] = {
998 {
999 .start = SPORT0_TCR1,
1000 .end = SPORT0_MRCS3+4,
1001 .flags = IORESOURCE_MEM,
1002 },
1003 {
1004 .start = IRQ_SPORT0_RX,
1005 .end = IRQ_SPORT0_RX+1,
1006 .flags = IORESOURCE_IRQ,
1007 },
1008 {
1009 .start = IRQ_SPORT0_ERROR,
1010 .end = IRQ_SPORT0_ERROR,
1011 .flags = IORESOURCE_IRQ,
1012 },
1013};
1014
Mike Frysingera8b19882010-11-24 09:23:04 +00001015static unsigned short bfin_sport0_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +00001016 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +00001017 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
Sonic Zhangdf5de262009-09-23 05:01:56 +00001018};
1019
Michael Hennerich59003142007-10-21 16:54:27 +08001020static struct platform_device bfin_sport0_uart_device = {
1021 .name = "bfin-sport-uart",
1022 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001023 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1024 .resource = bfin_sport0_uart_resources,
1025 .dev = {
1026 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1027 },
1028};
1029#endif
1030#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1031static struct resource bfin_sport1_uart_resources[] = {
1032 {
1033 .start = SPORT1_TCR1,
1034 .end = SPORT1_MRCS3+4,
1035 .flags = IORESOURCE_MEM,
1036 },
1037 {
1038 .start = IRQ_SPORT1_RX,
1039 .end = IRQ_SPORT1_RX+1,
1040 .flags = IORESOURCE_IRQ,
1041 },
1042 {
1043 .start = IRQ_SPORT1_ERROR,
1044 .end = IRQ_SPORT1_ERROR,
1045 .flags = IORESOURCE_IRQ,
1046 },
1047};
1048
Mike Frysingera8b19882010-11-24 09:23:04 +00001049static unsigned short bfin_sport1_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +00001050 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +00001051 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
Michael Hennerich59003142007-10-21 16:54:27 +08001052};
1053
1054static struct platform_device bfin_sport1_uart_device = {
1055 .name = "bfin-sport-uart",
1056 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001057 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1058 .resource = bfin_sport1_uart_resources,
1059 .dev = {
1060 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1061 },
Michael Hennerich59003142007-10-21 16:54:27 +08001062};
1063#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001064#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001065
Michael Hennerich1089e222007-12-24 11:49:29 +08001066#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +08001067#include <linux/gpio_keys.h>
1068
1069static struct gpio_keys_button bfin_gpio_keys_table[] = {
1070 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1071 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1072};
1073
1074static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1075 .buttons = bfin_gpio_keys_table,
1076 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1077};
1078
1079static struct platform_device bfin_device_gpiokeys = {
1080 .name = "gpio-keys",
1081 .dev = {
1082 .platform_data = &bfin_gpio_keys_data,
1083 },
1084};
1085#endif
1086
Michael Hennerichadfc0462009-10-09 07:37:03 +00001087#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001088#include <asm/bfin_rotary.h>
1089
1090static struct bfin_rotary_platform_data bfin_rotary_data = {
1091 /*.rotary_up_key = KEY_UP,*/
1092 /*.rotary_down_key = KEY_DOWN,*/
1093 .rotary_rel_code = REL_WHEEL,
1094 .rotary_button_key = KEY_ENTER,
1095 .debounce = 10, /* 0..17 */
1096 .mode = ROT_QUAD_ENC | ROT_DEBE,
1097};
1098
1099static struct resource bfin_rotary_resources[] = {
1100 {
1101 .start = IRQ_CNT,
1102 .end = IRQ_CNT,
1103 .flags = IORESOURCE_IRQ,
1104 },
1105};
1106
1107static struct platform_device bfin_rotary_device = {
1108 .name = "bfin-rotary",
1109 .id = -1,
1110 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1111 .resource = bfin_rotary_resources,
1112 .dev = {
1113 .platform_data = &bfin_rotary_data,
1114 },
1115};
1116#endif
1117
Michael Hennerich14b03202008-05-07 11:41:26 +08001118static const unsigned int cclk_vlev_datasheet[] =
1119{
1120 VRPAIR(VLEV_100, 400000000),
1121 VRPAIR(VLEV_105, 426000000),
1122 VRPAIR(VLEV_110, 500000000),
1123 VRPAIR(VLEV_115, 533000000),
1124 VRPAIR(VLEV_120, 600000000),
1125};
1126
1127static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1128 .tuple_tab = cclk_vlev_datasheet,
1129 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1130 .vr_settling_time = 25 /* us */,
1131};
1132
1133static struct platform_device bfin_dpmc = {
1134 .name = "bfin dpmc",
1135 .dev = {
1136 .platform_data = &bfin_dmpc_vreg_data,
1137 },
1138};
1139
Michael Hennerich59003142007-10-21 16:54:27 +08001140static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001141
1142 &bfin_dpmc,
1143
Michael Hennerich64307f72007-10-29 16:55:18 +08001144#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1145 &bf5xx_nand_device,
1146#endif
1147
Michael Hennerich59003142007-10-21 16:54:27 +08001148#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1149 &bfin_pcmcia_cf_device,
1150#endif
1151
1152#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1153 &rtc_device,
1154#endif
1155
Michael Hennerich3f375692008-11-18 17:48:22 +08001156#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1157 &bfin_isp1760_device,
1158#endif
1159
Michael Hennerich1089e222007-12-24 11:49:29 +08001160#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1161 &musb_device,
1162#endif
1163
Michael Hennerich59003142007-10-21 16:54:27 +08001164#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1165 &smc91x_device,
1166#endif
1167
1168#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1169 &dm9000_device,
1170#endif
1171
1172#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001173 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +08001174 &bfin_mac_device,
1175#endif
1176
1177#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1178 &net2272_bfin_device,
1179#endif
1180
1181#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1182 &bfin_spi0_device,
1183#endif
1184
Michael Hennerich1089e222007-12-24 11:49:29 +08001185#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1186 &bf52x_t350mcqb_device,
1187#endif
1188
Michael Hennerich6924dfb2009-12-07 13:41:28 +00001189#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1190 &bfin_lq035q1_device,
1191#endif
1192
Michael Hennerich59003142007-10-21 16:54:27 +08001193#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001194#ifdef CONFIG_SERIAL_BFIN_UART0
1195 &bfin_uart0_device,
1196#endif
1197#ifdef CONFIG_SERIAL_BFIN_UART1
1198 &bfin_uart1_device,
1199#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001200#endif
1201
Graf Yang5be36d22008-04-25 03:09:15 +08001202#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001203#ifdef CONFIG_BFIN_SIR0
1204 &bfin_sir0_device,
1205#endif
1206#ifdef CONFIG_BFIN_SIR1
1207 &bfin_sir1_device,
1208#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001209#endif
1210
Michael Hennerich59003142007-10-21 16:54:27 +08001211#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1212 &i2c_bfin_twi_device,
1213#endif
1214
1215#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001216#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001217 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001218#endif
1219#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001220 &bfin_sport1_uart_device,
1221#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001222#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001223
Michael Hennerich1089e222007-12-24 11:49:29 +08001224#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1225 &bfin_device_gpiokeys,
1226#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001227
Michael Hennerichadfc0462009-10-09 07:37:03 +00001228#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001229 &bfin_rotary_device,
1230#endif
1231
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001232#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1233 &ezkit_flash_device,
1234#endif
Barry Song336746e2009-10-13 09:19:18 +00001235
Scott Jiang2b6678c52011-07-05 19:27:25 -04001236#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1237 &bfin_i2s_pcm,
1238#endif
1239
1240#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1241 &bfin_tdm_pcm,
1242#endif
1243
1244#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1245 &bfin_ac97_pcm,
Scott Jiang6f53dbb2011-03-01 09:43:50 +00001246#endif
1247
Barry Song336746e2009-10-13 09:19:18 +00001248#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1249 &bfin_i2s,
1250#endif
1251
1252#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1253 &bfin_tdm,
1254#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001255};
1256
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001257static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001258{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001259 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001260 i2c_register_board_info(0, bfin_i2c_board_info,
1261 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001262 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001263 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001264 return 0;
1265}
1266
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001267arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001268
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00001269static struct platform_device *ezkit_early_devices[] __initdata = {
1270#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1271#ifdef CONFIG_SERIAL_BFIN_UART0
1272 &bfin_uart0_device,
1273#endif
1274#ifdef CONFIG_SERIAL_BFIN_UART1
1275 &bfin_uart1_device,
1276#endif
1277#endif
1278
1279#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1280#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1281 &bfin_sport0_uart_device,
1282#endif
1283#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1284 &bfin_sport1_uart_device,
1285#endif
1286#endif
1287};
1288
1289void __init native_machine_early_platform_add_devices(void)
1290{
1291 printk(KERN_INFO "register early platform devices\n");
1292 early_platform_add_devices(ezkit_early_devices,
1293 ARRAY_SIZE(ezkit_early_devices));
1294}
1295
Michael Hennerich59003142007-10-21 16:54:27 +08001296void native_machine_restart(char *cmd)
1297{
1298 /* workaround reboot hang when booting from SPI */
1299 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001300 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001301}
Mike Frysinger137b1522007-11-22 16:07:03 +08001302
Mike Frysinger9862cc52007-11-15 21:21:20 +08001303void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001304{
Mike Frysinger181afa92008-02-25 11:42:17 +08001305 /* the MAC is stored in OTP memory page 0xDF */
1306 u32 ret;
1307 u64 otp_mac;
1308 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1309
1310 ret = otp_read(0xDF, 0x00, &otp_mac);
1311 if (!(ret & 0x1)) {
1312 char *otp_mac_p = (char *)&otp_mac;
1313 for (ret = 0; ret < 6; ++ret)
1314 addr[ret] = otp_mac_p[5 - ret];
1315 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001316}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001317EXPORT_SYMBOL(bfin_get_ether_addr);