• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/arch/blackfin/mach-bf537/boards/
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 *                2005 National ICT Australia (NICTA)
4 *                      Aidan Williams <aidan@nicta.com.au>
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/device.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12#include <linux/io.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/nand.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/plat-ram.h>
17#include <linux/mtd/physmap.h>
18#include <linux/spi/spi.h>
19#include <linux/spi/flash.h>
20#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
21#include <linux/usb/isp1362.h>
22#endif
23#include <linux/i2c.h>
24#include <linux/i2c/adp5588.h>
25#include <linux/etherdevice.h>
26#include <linux/ata_platform.h>
27#include <linux/irq.h>
28#include <linux/interrupt.h>
29#include <linux/usb/sl811.h>
30#include <linux/spi/mmc_spi.h>
31#include <linux/leds.h>
32#include <linux/input.h>
33#include <asm/dma.h>
34#include <asm/bfin5xx_spi.h>
35#include <asm/reboot.h>
36#include <asm/portmux.h>
37#include <asm/dpmc.h>
38#ifdef CONFIG_REGULATOR_ADP_SWITCH
39#include <linux/regulator/adp_switch.h>
40#endif
41#ifdef CONFIG_REGULATOR_AD5398
42#include <linux/regulator/ad5398.h>
43#endif
44#include <linux/regulator/consumer.h>
45#include <linux/regulator/userspace-consumer.h>
46
47/*
48 * Name the Board for the /proc/cpuinfo
49 */
50const char bfin_board_name[] = "ADI BF537-STAMP";
51
52/*
53 *  Driver needs to know address, irq and flag pin.
54 */
55
56#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
57#include <linux/usb/isp1760.h>
58static struct resource bfin_isp1760_resources[] = {
59	[0] = {
60		.start  = 0x203C0000,
61		.end    = 0x203C0000 + 0x000fffff,
62		.flags  = IORESOURCE_MEM,
63	},
64	[1] = {
65		.start  = IRQ_PF7,
66		.end    = IRQ_PF7,
67		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
68	},
69};
70
71static struct isp1760_platform_data isp1760_priv = {
72	.is_isp1761 = 0,
73	.bus_width_16 = 1,
74	.port1_otg = 0,
75	.analog_oc = 0,
76	.dack_polarity_high = 0,
77	.dreq_polarity_high = 0,
78};
79
80static struct platform_device bfin_isp1760_device = {
81	.name           = "isp1760",
82	.id             = 0,
83	.dev = {
84		.platform_data = &isp1760_priv,
85	},
86	.num_resources  = ARRAY_SIZE(bfin_isp1760_resources),
87	.resource       = bfin_isp1760_resources,
88};
89#endif
90
91#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
92#include <linux/gpio_keys.h>
93
94static struct gpio_keys_button bfin_gpio_keys_table[] = {
95	{BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
96	{BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
97	{BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
98	{BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
99};
100
101static struct gpio_keys_platform_data bfin_gpio_keys_data = {
102	.buttons        = bfin_gpio_keys_table,
103	.nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
104};
105
106static struct platform_device bfin_device_gpiokeys = {
107	.name      = "gpio-keys",
108	.dev = {
109		.platform_data = &bfin_gpio_keys_data,
110	},
111};
112#endif
113
114#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
115static struct resource bfin_pcmcia_cf_resources[] = {
116	{
117		.start = 0x20310000, /* IO PORT */
118		.end = 0x20312000,
119		.flags = IORESOURCE_MEM,
120	}, {
121		.start = 0x20311000, /* Attribute Memory */
122		.end = 0x20311FFF,
123		.flags = IORESOURCE_MEM,
124	}, {
125		.start = IRQ_PF4,
126		.end = IRQ_PF4,
127		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
128	}, {
129		.start = 6, /* Card Detect PF6 */
130		.end = 6,
131		.flags = IORESOURCE_IRQ,
132	},
133};
134
135static struct platform_device bfin_pcmcia_cf_device = {
136	.name = "bfin_cf_pcmcia",
137	.id = -1,
138	.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
139	.resource = bfin_pcmcia_cf_resources,
140};
141#endif
142
143#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
144static struct platform_device rtc_device = {
145	.name = "rtc-bfin",
146	.id   = -1,
147};
148#endif
149
150#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
151#include <linux/smc91x.h>
152
153static struct smc91x_platdata smc91x_info = {
154	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
155	.leda = RPC_LED_100_10,
156	.ledb = RPC_LED_TX_RX,
157};
158
159static struct resource smc91x_resources[] = {
160	{
161		.name = "smc91x-regs",
162		.start = 0x20300300,
163		.end = 0x20300300 + 16,
164		.flags = IORESOURCE_MEM,
165	}, {
166
167		.start = IRQ_PF7,
168		.end = IRQ_PF7,
169		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
170	},
171};
172static struct platform_device smc91x_device = {
173	.name = "smc91x",
174	.id = 0,
175	.num_resources = ARRAY_SIZE(smc91x_resources),
176	.resource = smc91x_resources,
177	.dev	= {
178		.platform_data	= &smc91x_info,
179	},
180};
181#endif
182
183#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
184static struct resource dm9000_resources[] = {
185	[0] = {
186		.start	= 0x203FB800,
187		.end	= 0x203FB800 + 1,
188		.flags	= IORESOURCE_MEM,
189	},
190	[1] = {
191		.start	= 0x203FB804,
192		.end	= 0x203FB804 + 1,
193		.flags	= IORESOURCE_MEM,
194	},
195	[2] = {
196		.start	= IRQ_PF9,
197		.end	= IRQ_PF9,
198		.flags	= (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
199	},
200};
201
202static struct platform_device dm9000_device = {
203	.name		= "dm9000",
204	.id		= -1,
205	.num_resources	= ARRAY_SIZE(dm9000_resources),
206	.resource	= dm9000_resources,
207};
208#endif
209
210#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
211static struct resource sl811_hcd_resources[] = {
212	{
213		.start = 0x20340000,
214		.end = 0x20340000,
215		.flags = IORESOURCE_MEM,
216	}, {
217		.start = 0x20340004,
218		.end = 0x20340004,
219		.flags = IORESOURCE_MEM,
220	}, {
221		.start = IRQ_PF4,
222		.end = IRQ_PF4,
223		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
224	},
225};
226
227#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
228void sl811_port_power(struct device *dev, int is_on)
229{
230	gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
231	gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
232}
233#endif
234
235static struct sl811_platform_data sl811_priv = {
236	.potpg = 10,
237	.power = 250,       /* == 500mA */
238#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
239	.port_power = &sl811_port_power,
240#endif
241};
242
243static struct platform_device sl811_hcd_device = {
244	.name = "sl811-hcd",
245	.id = 0,
246	.dev = {
247		.platform_data = &sl811_priv,
248	},
249	.num_resources = ARRAY_SIZE(sl811_hcd_resources),
250	.resource = sl811_hcd_resources,
251};
252#endif
253
254#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
255static struct resource isp1362_hcd_resources[] = {
256	{
257		.start = 0x20360000,
258		.end = 0x20360000,
259		.flags = IORESOURCE_MEM,
260	}, {
261		.start = 0x20360004,
262		.end = 0x20360004,
263		.flags = IORESOURCE_MEM,
264	}, {
265		.start = IRQ_PF3,
266		.end = IRQ_PF3,
267		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
268	},
269};
270
271static struct isp1362_platform_data isp1362_priv = {
272	.sel15Kres = 1,
273	.clknotstop = 0,
274	.oc_enable = 0,
275	.int_act_high = 0,
276	.int_edge_triggered = 0,
277	.remote_wakeup_connected = 0,
278	.no_power_switching = 1,
279	.power_switching_mode = 0,
280};
281
282static struct platform_device isp1362_hcd_device = {
283	.name = "isp1362-hcd",
284	.id = 0,
285	.dev = {
286		.platform_data = &isp1362_priv,
287	},
288	.num_resources = ARRAY_SIZE(isp1362_hcd_resources),
289	.resource = isp1362_hcd_resources,
290};
291#endif
292
293#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
294unsigned short bfin_can_peripherals[] = {
295	P_CAN0_RX, P_CAN0_TX, 0
296};
297
298static struct resource bfin_can_resources[] = {
299	{
300		.start = 0xFFC02A00,
301		.end = 0xFFC02FFF,
302		.flags = IORESOURCE_MEM,
303	},
304	{
305		.start = IRQ_CAN_RX,
306		.end = IRQ_CAN_RX,
307		.flags = IORESOURCE_IRQ,
308	},
309	{
310		.start = IRQ_CAN_TX,
311		.end = IRQ_CAN_TX,
312		.flags = IORESOURCE_IRQ,
313	},
314	{
315		.start = IRQ_CAN_ERROR,
316		.end = IRQ_CAN_ERROR,
317		.flags = IORESOURCE_IRQ,
318	},
319};
320
321static struct platform_device bfin_can_device = {
322	.name = "bfin_can",
323	.num_resources = ARRAY_SIZE(bfin_can_resources),
324	.resource = bfin_can_resources,
325	.dev = {
326		.platform_data = &bfin_can_peripherals, /* Passed to driver */
327	},
328};
329#endif
330
331#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
332static struct platform_device bfin_mii_bus = {
333	.name = "bfin_mii_bus",
334};
335
336static struct platform_device bfin_mac_device = {
337	.name = "bfin_mac",
338	.dev.platform_data = &bfin_mii_bus,
339};
340#endif
341
342#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
343static struct resource net2272_bfin_resources[] = {
344	{
345		.start = 0x20300000,
346		.end = 0x20300000 + 0x100,
347		.flags = IORESOURCE_MEM,
348	}, {
349		.start = IRQ_PF7,
350		.end = IRQ_PF7,
351		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
352	},
353};
354
355static struct platform_device net2272_bfin_device = {
356	.name = "net2272",
357	.id = -1,
358	.num_resources = ARRAY_SIZE(net2272_bfin_resources),
359	.resource = net2272_bfin_resources,
360};
361#endif
362
363#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
364#ifdef CONFIG_MTD_PARTITIONS
365const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
366
367static struct mtd_partition bfin_plat_nand_partitions[] = {
368	{
369		.name   = "linux kernel(nand)",
370		.size   = 0x400000,
371		.offset = 0,
372	}, {
373		.name   = "file system(nand)",
374		.size   = MTDPART_SIZ_FULL,
375		.offset = MTDPART_OFS_APPEND,
376	},
377};
378#endif
379
380#define BFIN_NAND_PLAT_CLE 2
381#define BFIN_NAND_PLAT_ALE 1
382static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
383{
384	struct nand_chip *this = mtd->priv;
385
386	if (cmd == NAND_CMD_NONE)
387		return;
388
389	if (ctrl & NAND_CLE)
390		writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
391	else
392		writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
393}
394
395#define BFIN_NAND_PLAT_READY GPIO_PF3
396static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
397{
398	return gpio_get_value(BFIN_NAND_PLAT_READY);
399}
400
401static struct platform_nand_data bfin_plat_nand_data = {
402	.chip = {
403		.nr_chips = 1,
404		.chip_delay = 30,
405#ifdef CONFIG_MTD_PARTITIONS
406		.part_probe_types = part_probes,
407		.partitions = bfin_plat_nand_partitions,
408		.nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
409#endif
410	},
411	.ctrl = {
412		.cmd_ctrl  = bfin_plat_nand_cmd_ctrl,
413		.dev_ready = bfin_plat_nand_dev_ready,
414	},
415};
416
417#define MAX(x, y) (x > y ? x : y)
418static struct resource bfin_plat_nand_resources = {
419	.start = 0x20212000,
420	.end   = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
421	.flags = IORESOURCE_IO,
422};
423
424static struct platform_device bfin_async_nand_device = {
425	.name = "gen_nand",
426	.id = -1,
427	.num_resources = 1,
428	.resource = &bfin_plat_nand_resources,
429	.dev = {
430		.platform_data = &bfin_plat_nand_data,
431	},
432};
433
434static void bfin_plat_nand_init(void)
435{
436	gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
437}
438#else
439static void bfin_plat_nand_init(void) {}
440#endif
441
442#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
443static struct mtd_partition stamp_partitions[] = {
444	{
445		.name       = "bootloader(nor)",
446		.size       = 0x40000,
447		.offset     = 0,
448	}, {
449		.name       = "linux kernel(nor)",
450		.size       = 0x180000,
451		.offset     = MTDPART_OFS_APPEND,
452	}, {
453		.name       = "file system(nor)",
454		.size       = 0x400000 - 0x40000 - 0x180000 - 0x10000,
455		.offset     = MTDPART_OFS_APPEND,
456	}, {
457		.name       = "MAC Address(nor)",
458		.size       = MTDPART_SIZ_FULL,
459		.offset     = 0x3F0000,
460		.mask_flags = MTD_WRITEABLE,
461	}
462};
463
464static struct physmap_flash_data stamp_flash_data = {
465	.width      = 2,
466	.parts      = stamp_partitions,
467	.nr_parts   = ARRAY_SIZE(stamp_partitions),
468#ifdef CONFIG_ROMKERNEL
469	.probe_type = "map_rom",
470#endif
471};
472
473static struct resource stamp_flash_resource = {
474	.start = 0x20000000,
475	.end   = 0x203fffff,
476	.flags = IORESOURCE_MEM,
477};
478
479static struct platform_device stamp_flash_device = {
480	.name          = "physmap-flash",
481	.id            = 0,
482	.dev = {
483		.platform_data = &stamp_flash_data,
484	},
485	.num_resources = 1,
486	.resource      = &stamp_flash_resource,
487};
488#endif
489
490#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
491static struct mtd_partition bfin_spi_flash_partitions[] = {
492	{
493		.name = "bootloader(spi)",
494		.size = 0x00040000,
495		.offset = 0,
496		.mask_flags = MTD_CAP_ROM
497	}, {
498		.name = "linux kernel(spi)",
499		.size = 0x180000,
500		.offset = MTDPART_OFS_APPEND,
501	}, {
502		.name = "file system(spi)",
503		.size = MTDPART_SIZ_FULL,
504		.offset = MTDPART_OFS_APPEND,
505	}
506};
507
508static struct flash_platform_data bfin_spi_flash_data = {
509	.name = "m25p80",
510	.parts = bfin_spi_flash_partitions,
511	.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
512	/* .type = "m25p64", */
513};
514
515/* SPI flash chip (m25p64) */
516static struct bfin5xx_spi_chip spi_flash_chip_info = {
517	.enable_dma = 0,         /* use dma transfer with this chip*/
518	.bits_per_word = 8,
519};
520#endif
521
522#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
523/* SPI ADC chip */
524static struct bfin5xx_spi_chip spi_adc_chip_info = {
525	.enable_dma = 1,         /* use dma transfer with this chip*/
526	.bits_per_word = 16,
527};
528#endif
529
530#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
531static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
532	.enable_dma = 0,
533	.bits_per_word = 16,
534};
535#endif
536
537#if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
538static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
539	.enable_dma = 0,
540	.bits_per_word = 8,
541};
542#endif
543
544#if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
545#include <linux/input/ad714x.h>
546static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
547	.enable_dma = 0,
548	.bits_per_word = 16,
549};
550
551static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
552	{
553		.start_stage = 0,
554		.end_stage = 7,
555		.max_coord = 128,
556	},
557};
558
559static struct ad714x_button_plat ad7147_spi_button_plat[] = {
560	{
561		.keycode = BTN_FORWARD,
562		.l_mask = 0,
563		.h_mask = 0x600,
564	},
565	{
566		.keycode = BTN_LEFT,
567		.l_mask = 0,
568		.h_mask = 0x500,
569	},
570	{
571		.keycode = BTN_MIDDLE,
572		.l_mask = 0,
573		.h_mask = 0x800,
574	},
575	{
576		.keycode = BTN_RIGHT,
577		.l_mask = 0x100,
578		.h_mask = 0x400,
579	},
580	{
581		.keycode = BTN_BACK,
582		.l_mask = 0x200,
583		.h_mask = 0x400,
584	},
585};
586static struct ad714x_platform_data ad7147_spi_platform_data = {
587	.slider_num = 1,
588	.button_num = 5,
589	.slider = ad7147_spi_slider_plat,
590	.button = ad7147_spi_button_plat,
591	.stage_cfg_reg =  {
592		{0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
593		{0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
594		{0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
595		{0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
596		{0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
597		{0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
598		{0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
599		{0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
600		{0xFF7B, 0x3FFF, 0x506,  0x2626, 1100, 1100, 1150, 1150},
601		{0xFDFE, 0x3FFF, 0x606,  0x2626, 1100, 1100, 1150, 1150},
602		{0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
603		{0xFFEF, 0x1FFF, 0x0,    0x2626, 1100, 1100, 1150, 1150},
604	},
605	.sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
606};
607#endif
608
609#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
610#include <linux/input/ad714x.h>
611static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
612	{
613		.keycode = BTN_1,
614		.l_mask = 0,
615		.h_mask = 0x1,
616	},
617	{
618		.keycode = BTN_2,
619		.l_mask = 0,
620		.h_mask = 0x2,
621	},
622	{
623		.keycode = BTN_3,
624		.l_mask = 0,
625		.h_mask = 0x4,
626	},
627	{
628		.keycode = BTN_4,
629		.l_mask = 0x0,
630		.h_mask = 0x8,
631	},
632};
633static struct ad714x_platform_data ad7142_i2c_platform_data = {
634	.button_num = 4,
635	.button = ad7142_i2c_button_plat,
636	.stage_cfg_reg =  {
637		{0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
638		{0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
639		{0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
640		{0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
641		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
642		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
643		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
644		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
645		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
646		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
647		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
648		{0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
649	},
650	.sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
651};
652#endif
653
654#if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
655static struct bfin5xx_spi_chip ad2s90_spi_chip_info = {
656	.enable_dma = 0,
657	.bits_per_word = 16,
658};
659#endif
660
661#if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
662unsigned short ad2s120x_platform_data[] = {
663	/* used as SAMPLE and RDVEL */
664	GPIO_PF5, GPIO_PF6, 0
665};
666
667static struct bfin5xx_spi_chip ad2s120x_spi_chip_info = {
668	.enable_dma = 0,
669	.bits_per_word = 16,
670};
671#endif
672
673#if defined(CONFIG_AD2S1210) || defined(CONFIG_AD2S1210_MODULE)
674unsigned short ad2s1210_platform_data[] = {
675	/* use as SAMPLE, A0, A1 */
676	GPIO_PF7, GPIO_PF8, GPIO_PF9,
677# if defined(CONFIG_AD2S1210_GPIO_INPUT) || defined(CONFIG_AD2S1210_GPIO_OUTPUT)
678	/* the RES0 and RES1 pins */
679	GPIO_PF4, GPIO_PF5,
680# endif
681	0,
682};
683
684static struct bfin5xx_spi_chip ad2s1210_spi_chip_info = {
685	.enable_dma = 0,
686	.bits_per_word = 8,
687};
688#endif
689
690#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
691#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
692
693static int bfin_mmc_spi_init(struct device *dev,
694	irqreturn_t (*detect_int)(int, void *), void *data)
695{
696	return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
697		IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
698}
699
700static void bfin_mmc_spi_exit(struct device *dev, void *data)
701{
702	free_irq(MMC_SPI_CARD_DETECT_INT, data);
703}
704
705static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
706	.init = bfin_mmc_spi_init,
707	.exit = bfin_mmc_spi_exit,
708	.detect_delay = 100, /* msecs */
709};
710
711static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
712	.enable_dma = 0,
713	.bits_per_word = 8,
714	.pio_interrupt = 0,
715};
716#endif
717
718#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
719#include <linux/spi/ad7877.h>
720static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
721	.enable_dma = 0,
722	.bits_per_word = 16,
723};
724
725static const struct ad7877_platform_data bfin_ad7877_ts_info = {
726	.model			= 7877,
727	.vref_delay_usecs	= 50,	/* internal, no capacitor */
728	.x_plate_ohms		= 419,
729	.y_plate_ohms		= 486,
730	.pressure_max		= 1000,
731	.pressure_min		= 0,
732	.stopacq_polarity	= 1,
733	.first_conversion_delay	= 3,
734	.acquisition_time	= 1,
735	.averaging		= 1,
736	.pen_down_acc_interval	= 1,
737};
738#endif
739
740#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
741#include <linux/spi/ad7879.h>
742static const struct ad7879_platform_data bfin_ad7879_ts_info = {
743	.model			= 7879,	/* Model = AD7879 */
744	.x_plate_ohms		= 620,	/* 620 Ohm from the touch datasheet */
745	.pressure_max		= 10000,
746	.pressure_min		= 0,
747	.first_conversion_delay	= 3,	/* wait 512us before do a first conversion */
748	.acquisition_time	= 1,	/* 4us acquisition time per sample */
749	.median			= 2,	/* do 8 measurements */
750	.averaging		= 1,	/* take the average of 4 middle samples */
751	.pen_down_acc_interval	= 255,	/* 9.4 ms */
752	.gpio_export		= 1,	/* Export GPIO to gpiolib */
753	.gpio_base		= -1,	/* Dynamic allocation */
754};
755#endif
756
757#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
758#include <linux/input/adxl34x.h>
759static const struct adxl34x_platform_data adxl34x_info = {
760	.x_axis_offset = 0,
761	.y_axis_offset = 0,
762	.z_axis_offset = 0,
763	.tap_threshold = 0x31,
764	.tap_duration = 0x10,
765	.tap_latency = 0x60,
766	.tap_window = 0xF0,
767	.tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
768	.act_axis_control = 0xFF,
769	.activity_threshold = 5,
770	.inactivity_threshold = 3,
771	.inactivity_time = 4,
772	.free_fall_threshold = 0x7,
773	.free_fall_time = 0x20,
774	.data_rate = 0x8,
775	.data_range = ADXL_FULL_RES,
776
777	.ev_type = EV_ABS,
778	.ev_code_x = ABS_X,		/* EV_REL */
779	.ev_code_y = ABS_Y,		/* EV_REL */
780	.ev_code_z = ABS_Z,		/* EV_REL */
781
782	.ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
783
784/*	.ev_code_ff = KEY_F,*/		/* EV_KEY */
785/*	.ev_code_act_inactivity = KEY_A,*/	/* EV_KEY */
786	.power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
787	.fifo_mode = ADXL_FIFO_STREAM,
788	.orientation_enable = ADXL_EN_ORIENTATION_3D,
789	.deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
790	.divisor_length =  ADXL_LP_FILTER_DIVISOR_16,
791	/* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
792	.ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
793};
794#endif
795
796#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || \
797	defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
798static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
799	.enable_dma = 0,
800	.bits_per_word = 16,
801};
802#endif
803
804#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
805static struct bfin5xx_spi_chip spidev_chip_info = {
806	.enable_dma = 0,
807	.bits_per_word = 8,
808};
809#endif
810
811#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
812static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
813	.enable_dma	= 0,
814	.bits_per_word	= 8,
815};
816#endif
817
818#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
819static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
820	.enable_dma	= 1,
821	.bits_per_word	= 8,
822	.cs_gpio = GPIO_PF10,
823};
824#endif
825
826#if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
827static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
828	.bits_per_word = 16,
829	.cs_gpio = GPIO_PF10,
830};
831
832#include <linux/spi/adf702x.h>
833#define TXREG 0x0160A470
834static const u32 adf7021_regs[] = {
835	0x09608FA0,
836	0x00575011,
837	0x00A7F092,
838	0x2B141563,
839	0x81F29E94,
840	0x00003155,
841	0x050A4F66,
842	0x00000007,
843	0x00000008,
844	0x000231E9,
845	0x3296354A,
846	0x891A2B3B,
847	0x00000D9C,
848	0x0000000D,
849	0x0000000E,
850	0x0000000F,
851};
852
853static struct adf702x_platform_data adf7021_platform_data = {
854	.regs_base = (void *)SPORT1_TCR1,
855	.dma_ch_rx = CH_SPORT1_RX,
856	.dma_ch_tx = CH_SPORT1_TX,
857	.irq_sport_err = IRQ_SPORT1_ERROR,
858	.gpio_int_rfs = GPIO_PF8,
859	.pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
860			P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
861	.adf702x_model = MODEL_ADF7021,
862	.adf702x_regs = adf7021_regs,
863	.tx_reg = TXREG,
864};
865static inline void adf702x_mac_init(void)
866{
867	random_ether_addr(adf7021_platform_data.mac_addr);
868}
869#else
870static inline void adf702x_mac_init(void) {}
871#endif
872
873#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
874#include <linux/spi/ads7846.h>
875static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
876	.bits_per_word	= 8,
877};
878
879static int ads7873_get_pendown_state(void)
880{
881	return gpio_get_value(GPIO_PF6);
882}
883
884static struct ads7846_platform_data __initdata ad7873_pdata = {
885	.model		= 7873,		/* AD7873 */
886	.x_max		= 0xfff,
887	.y_max		= 0xfff,
888	.x_plate_ohms	= 620,
889	.debounce_max	= 1,
890	.debounce_rep	= 0,
891	.debounce_tol	= (~0),
892	.get_pendown_state = ads7873_get_pendown_state,
893};
894#endif
895
896#if defined(CONFIG_MTD_DATAFLASH) || defined(CONFIG_MTD_DATAFLASH_MODULE)
897
898static struct mtd_partition bfin_spi_dataflash_partitions[] = {
899	{
900		.name = "bootloader(spi)",
901		.size = 0x00040000,
902		.offset = 0,
903		.mask_flags = MTD_CAP_ROM
904	}, {
905		.name = "linux kernel(spi)",
906		.size = 0x180000,
907		.offset = MTDPART_OFS_APPEND,
908	}, {
909		.name = "file system(spi)",
910		.size = MTDPART_SIZ_FULL,
911		.offset = MTDPART_OFS_APPEND,
912	}
913};
914
915static struct flash_platform_data bfin_spi_dataflash_data = {
916	.name = "SPI Dataflash",
917	.parts = bfin_spi_dataflash_partitions,
918	.nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
919};
920
921/* DataFlash chip */
922static struct bfin5xx_spi_chip data_flash_chip_info = {
923	.enable_dma = 0,         /* use dma transfer with this chip*/
924	.bits_per_word = 8,
925};
926#endif
927
928#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
929static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
930	.enable_dma = 0,         /* use dma transfer with this chip*/
931	.bits_per_word = 8,
932};
933#endif
934
935static struct spi_board_info bfin_spi_board_info[] __initdata = {
936#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
937	{
938		/* the modalias must be the same as spi device driver name */
939		.modalias = "m25p80", /* Name of spi_driver for this device */
940		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
941		.bus_num = 0, /* Framework bus number */
942		.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
943		.platform_data = &bfin_spi_flash_data,
944		.controller_data = &spi_flash_chip_info,
945		.mode = SPI_MODE_3,
946	},
947#endif
948#if defined(CONFIG_MTD_DATAFLASH) || defined(CONFIG_MTD_DATAFLASH_MODULE)
949	{	/* DataFlash chip */
950		.modalias = "mtd_dataflash",
951		.max_speed_hz = 33250000,     /* max spi clock (SCK) speed in HZ */
952		.bus_num = 0, /* Framework bus number */
953		.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
954		.platform_data = &bfin_spi_dataflash_data,
955		.controller_data = &data_flash_chip_info,
956		.mode = SPI_MODE_3,
957	},
958#endif
959#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
960	{
961		.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
962		.max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
963		.bus_num = 0, /* Framework bus number */
964		.chip_select = 1, /* Framework chip select. */
965		.platform_data = NULL, /* No spi_driver specific config */
966		.controller_data = &spi_adc_chip_info,
967	},
968#endif
969
970#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
971	{
972		.modalias = "ad183x",
973		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
974		.bus_num = 0,
975		.chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
976		.platform_data = "ad1836", /* only includes chip name for the moment */
977		.controller_data = &ad1836_spi_chip_info,
978		.mode = SPI_MODE_3,
979	},
980#endif
981
982#if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
983	{
984		.modalias = "ad193x",
985		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
986		.bus_num = 0,
987		.chip_select = 5,
988		.controller_data = &ad1938_spi_chip_info,
989		.mode = SPI_MODE_3,
990	},
991#endif
992
993#if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
994	{
995		.modalias = "ad714x_captouch",
996		.max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */
997		.irq = IRQ_PF4,
998		.bus_num = 0,
999		.chip_select = 5,
1000		.mode = SPI_MODE_3,
1001		.platform_data = &ad7147_spi_platform_data,
1002		.controller_data = &ad7147_spi_chip_info,
1003	},
1004#endif
1005
1006#if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
1007	{
1008		.modalias = "ad2s90",
1009		.bus_num = 0,
1010		.chip_select = 3,            /* change it for your board */
1011		.platform_data = NULL,
1012		.controller_data = &ad2s90_spi_chip_info,
1013	},
1014#endif
1015
1016#if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
1017	{
1018		.modalias = "ad2s120x",
1019		.bus_num = 0,
1020		.chip_select = 4,            /* CS, change it for your board */
1021		.platform_data = ad2s120x_platform_data,
1022		.controller_data = &ad2s120x_spi_chip_info,
1023	},
1024#endif
1025
1026#if defined(CONFIG_AD2S1210) || defined(CONFIG_AD2S1210_MODULE)
1027	{
1028		.modalias = "ad2s1210",
1029		.max_speed_hz = 8192000,
1030		.bus_num = 0,
1031		.chip_select = 4,            /* CS, change it for your board */
1032		.platform_data = ad2s1210_platform_data,
1033		.controller_data = &ad2s1210_spi_chip_info,
1034	},
1035#endif
1036
1037#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
1038	{
1039		.modalias = "mmc_spi",
1040		.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
1041		.bus_num = 0,
1042		.chip_select = 4,
1043		.platform_data = &bfin_mmc_spi_pdata,
1044		.controller_data = &mmc_spi_chip_info,
1045		.mode = SPI_MODE_3,
1046	},
1047#endif
1048#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
1049	{
1050		.modalias		= "ad7877",
1051		.platform_data		= &bfin_ad7877_ts_info,
1052		.irq			= IRQ_PF6,
1053		.max_speed_hz	= 12500000,     /* max spi clock (SCK) speed in HZ */
1054		.bus_num	= 0,
1055		.chip_select  = 1,
1056		.controller_data = &spi_ad7877_chip_info,
1057	},
1058#endif
1059#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || \
1060	defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
1061	{
1062		.modalias = "ad7879",
1063		.platform_data = &bfin_ad7879_ts_info,
1064		.irq = IRQ_PF7,
1065		.max_speed_hz = 5000000,     /* max spi clock (SCK) speed in HZ */
1066		.bus_num = 0,
1067		.chip_select = 1,
1068		.controller_data = &spi_ad7879_chip_info,
1069		.mode = SPI_CPHA | SPI_CPOL,
1070	},
1071#endif
1072#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1073	{
1074		.modalias = "spidev",
1075		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
1076		.bus_num = 0,
1077		.chip_select = 1,
1078		.controller_data = &spidev_chip_info,
1079	},
1080#endif
1081#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1082	{
1083		.modalias = "bfin-lq035q1-spi",
1084		.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
1085		.bus_num = 0,
1086		.chip_select = 2,
1087		.controller_data = &lq035q1_spi_chip_info,
1088		.mode = SPI_CPHA | SPI_CPOL,
1089	},
1090#endif
1091#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
1092	{
1093		.modalias = "enc28j60",
1094		.max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
1095		.irq = IRQ_PF6,
1096		.bus_num = 0,
1097		.chip_select = 0,	/* GPIO controlled SSEL */
1098		.controller_data = &enc28j60_spi_chip_info,
1099		.mode = SPI_MODE_0,
1100	},
1101#endif
1102#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1103	{
1104		.modalias	= "adxl34x",
1105		.platform_data	= &adxl34x_info,
1106		.irq		= IRQ_PF6,
1107		.max_speed_hz	= 5000000,    /* max spi clock (SCK) speed in HZ */
1108		.bus_num	= 0,
1109		.chip_select	= 2,
1110		.controller_data = &spi_adxl34x_chip_info,
1111		.mode = SPI_MODE_3,
1112	},
1113#endif
1114#if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
1115	{
1116		.modalias = "adf702x",
1117		.max_speed_hz = 16000000,     /* max spi clock (SCK) speed in HZ */
1118		.bus_num = 0,
1119		.chip_select = 0,	/* GPIO controlled SSEL */
1120		.controller_data = &adf7021_spi_chip_info,
1121		.platform_data = &adf7021_platform_data,
1122		.mode = SPI_MODE_0,
1123	},
1124#endif
1125#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
1126	{
1127		.modalias = "ads7846",
1128		.max_speed_hz = 2000000,     /* max spi clock (SCK) speed in HZ */
1129		.bus_num = 0,
1130		.irq = IRQ_PF6,
1131		.chip_select = GPIO_PF10 + MAX_CTRL_CS,	/* GPIO controlled SSEL */
1132		.controller_data = &ad7873_spi_chip_info,
1133		.platform_data = &ad7873_pdata,
1134		.mode = SPI_MODE_0,
1135	},
1136#endif
1137};
1138
1139#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1140/* SPI controller data */
1141static struct bfin5xx_spi_master bfin_spi0_info = {
1142	.num_chipselect = 8,
1143	.enable_dma = 1,  /* master has the ability to do dma transfer */
1144	.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1145};
1146
1147/* SPI (0) */
1148static struct resource bfin_spi0_resource[] = {
1149	[0] = {
1150		.start = SPI0_REGBASE,
1151		.end   = SPI0_REGBASE + 0xFF,
1152		.flags = IORESOURCE_MEM,
1153		},
1154	[1] = {
1155		.start = CH_SPI,
1156		.end   = CH_SPI,
1157		.flags = IORESOURCE_DMA,
1158	},
1159	[2] = {
1160		.start = IRQ_SPI,
1161		.end   = IRQ_SPI,
1162		.flags = IORESOURCE_IRQ,
1163	},
1164};
1165
1166static struct platform_device bfin_spi0_device = {
1167	.name = "bfin-spi",
1168	.id = 0, /* Bus number */
1169	.num_resources = ARRAY_SIZE(bfin_spi0_resource),
1170	.resource = bfin_spi0_resource,
1171	.dev = {
1172		.platform_data = &bfin_spi0_info, /* Passed to driver */
1173	},
1174};
1175#endif  /* spi master and devices */
1176
1177#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1178
1179/* SPORT SPI controller data */
1180static struct bfin5xx_spi_master bfin_sport_spi0_info = {
1181	.num_chipselect = 1, /* master only supports one device */
1182	.enable_dma = 0,  /* master don't support DMA */
1183	.pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
1184		P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1185};
1186
1187static struct resource bfin_sport_spi0_resource[] = {
1188	[0] = {
1189		.start = SPORT0_TCR1,
1190		.end   = SPORT0_TCR1 + 0xFF,
1191		.flags = IORESOURCE_MEM,
1192		},
1193	[1] = {
1194		.start = IRQ_SPORT0_ERROR,
1195		.end   = IRQ_SPORT0_ERROR,
1196		.flags = IORESOURCE_IRQ,
1197		},
1198};
1199
1200static struct platform_device bfin_sport_spi0_device = {
1201	.name = "bfin-sport-spi",
1202	.id = 1, /* Bus number */
1203	.num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1204	.resource = bfin_sport_spi0_resource,
1205	.dev = {
1206		.platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1207	},
1208};
1209
1210static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1211	.num_chipselect = 1, /* master only supports one device */
1212	.enable_dma = 0,  /* master don't support DMA */
1213	.pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1214		P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1215};
1216
1217static struct resource bfin_sport_spi1_resource[] = {
1218	[0] = {
1219		.start = SPORT1_TCR1,
1220		.end   = SPORT1_TCR1 + 0xFF,
1221		.flags = IORESOURCE_MEM,
1222		},
1223	[1] = {
1224		.start = IRQ_SPORT1_ERROR,
1225		.end   = IRQ_SPORT1_ERROR,
1226		.flags = IORESOURCE_IRQ,
1227		},
1228};
1229
1230static struct platform_device bfin_sport_spi1_device = {
1231	.name = "bfin-sport-spi",
1232	.id = 2, /* Bus number */
1233	.num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1234	.resource = bfin_sport_spi1_resource,
1235	.dev = {
1236		.platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1237	},
1238};
1239
1240#endif  /* sport spi master and devices */
1241
1242#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1243static struct platform_device bfin_fb_device = {
1244	.name = "bf537-lq035",
1245};
1246#endif
1247
1248#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1249#include <asm/bfin-lq035q1.h>
1250
1251static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
1252	.mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
1253	.ppi_mode = USE_RGB565_16_BIT_PPI,
1254	.use_bl = 0,	/* let something else control the LCD Blacklight */
1255	.gpio_bl = GPIO_PF7,
1256};
1257
1258static struct resource bfin_lq035q1_resources[] = {
1259	{
1260		.start = IRQ_PPI_ERROR,
1261		.end = IRQ_PPI_ERROR,
1262		.flags = IORESOURCE_IRQ,
1263	},
1264};
1265
1266static struct platform_device bfin_lq035q1_device = {
1267	.name		= "bfin-lq035q1",
1268	.id		= -1,
1269	.num_resources	= ARRAY_SIZE(bfin_lq035q1_resources),
1270	.resource	= bfin_lq035q1_resources,
1271	.dev		= {
1272		.platform_data = &bfin_lq035q1_data,
1273	},
1274};
1275#endif
1276
1277#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1278#ifdef CONFIG_SERIAL_BFIN_UART0
1279static struct resource bfin_uart0_resources[] = {
1280	{
1281		.start = UART0_THR,
1282		.end = UART0_GCTL+2,
1283		.flags = IORESOURCE_MEM,
1284	},
1285	{
1286		.start = IRQ_UART0_RX,
1287		.end = IRQ_UART0_RX+1,
1288		.flags = IORESOURCE_IRQ,
1289	},
1290	{
1291		.start = IRQ_UART0_ERROR,
1292		.end = IRQ_UART0_ERROR,
1293		.flags = IORESOURCE_IRQ,
1294	},
1295	{
1296		.start = CH_UART0_TX,
1297		.end = CH_UART0_TX,
1298		.flags = IORESOURCE_DMA,
1299	},
1300	{
1301		.start = CH_UART0_RX,
1302		.end = CH_UART0_RX,
1303		.flags = IORESOURCE_DMA,
1304	},
1305#ifdef CONFIG_BFIN_UART0_CTSRTS
1306	{	/* CTS pin */
1307		.start = GPIO_PG7,
1308		.end = GPIO_PG7,
1309		.flags = IORESOURCE_IO,
1310	},
1311	{	/* RTS pin */
1312		.start = GPIO_PG6,
1313		.end = GPIO_PG6,
1314		.flags = IORESOURCE_IO,
1315	},
1316#endif
1317};
1318
1319unsigned short bfin_uart0_peripherals[] = {
1320	P_UART0_TX, P_UART0_RX, 0
1321};
1322
1323static struct platform_device bfin_uart0_device = {
1324	.name = "bfin-uart",
1325	.id = 0,
1326	.num_resources = ARRAY_SIZE(bfin_uart0_resources),
1327	.resource = bfin_uart0_resources,
1328	.dev = {
1329		.platform_data = &bfin_uart0_peripherals, /* Passed to driver */
1330	},
1331};
1332#endif
1333#ifdef CONFIG_SERIAL_BFIN_UART1
1334static struct resource bfin_uart1_resources[] = {
1335	{
1336		.start = UART1_THR,
1337		.end = UART1_GCTL+2,
1338		.flags = IORESOURCE_MEM,
1339	},
1340	{
1341		.start = IRQ_UART1_RX,
1342		.end = IRQ_UART1_RX+1,
1343		.flags = IORESOURCE_IRQ,
1344	},
1345	{
1346		.start = IRQ_UART1_ERROR,
1347		.end = IRQ_UART1_ERROR,
1348		.flags = IORESOURCE_IRQ,
1349	},
1350	{
1351		.start = CH_UART1_TX,
1352		.end = CH_UART1_TX,
1353		.flags = IORESOURCE_DMA,
1354	},
1355	{
1356		.start = CH_UART1_RX,
1357		.end = CH_UART1_RX,
1358		.flags = IORESOURCE_DMA,
1359	},
1360};
1361
1362unsigned short bfin_uart1_peripherals[] = {
1363	P_UART1_TX, P_UART1_RX, 0
1364};
1365
1366static struct platform_device bfin_uart1_device = {
1367	.name = "bfin-uart",
1368	.id = 1,
1369	.num_resources = ARRAY_SIZE(bfin_uart1_resources),
1370	.resource = bfin_uart1_resources,
1371	.dev = {
1372		.platform_data = &bfin_uart1_peripherals, /* Passed to driver */
1373	},
1374};
1375#endif
1376#endif
1377
1378#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1379#ifdef CONFIG_BFIN_SIR0
1380static struct resource bfin_sir0_resources[] = {
1381	{
1382		.start = 0xFFC00400,
1383		.end = 0xFFC004FF,
1384		.flags = IORESOURCE_MEM,
1385	},
1386	{
1387		.start = IRQ_UART0_RX,
1388		.end = IRQ_UART0_RX+1,
1389		.flags = IORESOURCE_IRQ,
1390	},
1391	{
1392		.start = CH_UART0_RX,
1393		.end = CH_UART0_RX+1,
1394		.flags = IORESOURCE_DMA,
1395	},
1396};
1397
1398static struct platform_device bfin_sir0_device = {
1399	.name = "bfin_sir",
1400	.id = 0,
1401	.num_resources = ARRAY_SIZE(bfin_sir0_resources),
1402	.resource = bfin_sir0_resources,
1403};
1404#endif
1405#ifdef CONFIG_BFIN_SIR1
1406static struct resource bfin_sir1_resources[] = {
1407	{
1408		.start = 0xFFC02000,
1409		.end = 0xFFC020FF,
1410		.flags = IORESOURCE_MEM,
1411	},
1412	{
1413		.start = IRQ_UART1_RX,
1414		.end = IRQ_UART1_RX+1,
1415		.flags = IORESOURCE_IRQ,
1416	},
1417	{
1418		.start = CH_UART1_RX,
1419		.end = CH_UART1_RX+1,
1420		.flags = IORESOURCE_DMA,
1421	},
1422};
1423
1424static struct platform_device bfin_sir1_device = {
1425	.name = "bfin_sir",
1426	.id = 1,
1427	.num_resources = ARRAY_SIZE(bfin_sir1_resources),
1428	.resource = bfin_sir1_resources,
1429};
1430#endif
1431#endif
1432
1433#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1434static struct resource bfin_twi0_resource[] = {
1435	[0] = {
1436		.start = TWI0_REGBASE,
1437		.end   = TWI0_REGBASE,
1438		.flags = IORESOURCE_MEM,
1439	},
1440	[1] = {
1441		.start = IRQ_TWI,
1442		.end   = IRQ_TWI,
1443		.flags = IORESOURCE_IRQ,
1444	},
1445};
1446
1447static struct platform_device i2c_bfin_twi_device = {
1448	.name = "i2c-bfin-twi",
1449	.id = 0,
1450	.num_resources = ARRAY_SIZE(bfin_twi0_resource),
1451	.resource = bfin_twi0_resource,
1452};
1453#endif
1454
1455#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1456static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1457	[0]	 = KEY_GRAVE,
1458	[1]	 = KEY_1,
1459	[2]	 = KEY_2,
1460	[3]	 = KEY_3,
1461	[4]	 = KEY_4,
1462	[5]	 = KEY_5,
1463	[6]	 = KEY_6,
1464	[7]	 = KEY_7,
1465	[8]	 = KEY_8,
1466	[9]	 = KEY_9,
1467	[10]	 = KEY_0,
1468	[11]	 = KEY_MINUS,
1469	[12]	 = KEY_EQUAL,
1470	[13]	 = KEY_BACKSLASH,
1471	[15]	 = KEY_KP0,
1472	[16]	 = KEY_Q,
1473	[17]	 = KEY_W,
1474	[18]	 = KEY_E,
1475	[19]	 = KEY_R,
1476	[20]	 = KEY_T,
1477	[21]	 = KEY_Y,
1478	[22]	 = KEY_U,
1479	[23]	 = KEY_I,
1480	[24]	 = KEY_O,
1481	[25]	 = KEY_P,
1482	[26]	 = KEY_LEFTBRACE,
1483	[27]	 = KEY_RIGHTBRACE,
1484	[29]	 = KEY_KP1,
1485	[30]	 = KEY_KP2,
1486	[31]	 = KEY_KP3,
1487	[32]	 = KEY_A,
1488	[33]	 = KEY_S,
1489	[34]	 = KEY_D,
1490	[35]	 = KEY_F,
1491	[36]	 = KEY_G,
1492	[37]	 = KEY_H,
1493	[38]	 = KEY_J,
1494	[39]	 = KEY_K,
1495	[40]	 = KEY_L,
1496	[41]	 = KEY_SEMICOLON,
1497	[42]	 = KEY_APOSTROPHE,
1498	[43]	 = KEY_BACKSLASH,
1499	[45]	 = KEY_KP4,
1500	[46]	 = KEY_KP5,
1501	[47]	 = KEY_KP6,
1502	[48]	 = KEY_102ND,
1503	[49]	 = KEY_Z,
1504	[50]	 = KEY_X,
1505	[51]	 = KEY_C,
1506	[52]	 = KEY_V,
1507	[53]	 = KEY_B,
1508	[54]	 = KEY_N,
1509	[55]	 = KEY_M,
1510	[56]	 = KEY_COMMA,
1511	[57]	 = KEY_DOT,
1512	[58]	 = KEY_SLASH,
1513	[60]	 = KEY_KPDOT,
1514	[61]	 = KEY_KP7,
1515	[62]	 = KEY_KP8,
1516	[63]	 = KEY_KP9,
1517	[64]	 = KEY_SPACE,
1518	[65]	 = KEY_BACKSPACE,
1519	[66]	 = KEY_TAB,
1520	[67]	 = KEY_KPENTER,
1521	[68]	 = KEY_ENTER,
1522	[69]	 = KEY_ESC,
1523	[70]	 = KEY_DELETE,
1524	[74]	 = KEY_KPMINUS,
1525	[76]	 = KEY_UP,
1526	[77]	 = KEY_DOWN,
1527	[78]	 = KEY_RIGHT,
1528	[79]	 = KEY_LEFT,
1529};
1530
1531static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1532	.rows		= 8,
1533	.cols		= 10,
1534	.keymap		= adp5588_keymap,
1535	.keymapsize	= ARRAY_SIZE(adp5588_keymap),
1536	.repeat		= 0,
1537};
1538#endif
1539
1540#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1541#include <linux/mfd/adp5520.h>
1542
1543	/*
1544	 *  ADP5520/5501 Backlight Data
1545	 */
1546
1547static struct adp5520_backlight_platform_data adp5520_backlight_data = {
1548	.fade_in		= ADP5520_FADE_T_1200ms,
1549	.fade_out		= ADP5520_FADE_T_1200ms,
1550	.fade_led_law		= ADP5520_BL_LAW_LINEAR,
1551	.en_ambl_sens		= 1,
1552	.abml_filt		= ADP5520_BL_AMBL_FILT_640ms,
1553	.l1_daylight_max	= ADP5520_BL_CUR_mA(15),
1554	.l1_daylight_dim	= ADP5520_BL_CUR_mA(0),
1555	.l2_office_max		= ADP5520_BL_CUR_mA(7),
1556	.l2_office_dim		= ADP5520_BL_CUR_mA(0),
1557	.l3_dark_max		= ADP5520_BL_CUR_mA(3),
1558	.l3_dark_dim		= ADP5520_BL_CUR_mA(0),
1559	.l2_trip		= ADP5520_L2_COMP_CURR_uA(700),
1560	.l2_hyst		= ADP5520_L2_COMP_CURR_uA(50),
1561	.l3_trip		= ADP5520_L3_COMP_CURR_uA(80),
1562	.l3_hyst		= ADP5520_L3_COMP_CURR_uA(20),
1563};
1564
1565	/*
1566	 *  ADP5520/5501 LEDs Data
1567	 */
1568
1569static struct led_info adp5520_leds[] = {
1570	{
1571		.name = "adp5520-led1",
1572		.default_trigger = "none",
1573		.flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
1574	},
1575#ifdef ADP5520_EN_ALL_LEDS
1576	{
1577		.name = "adp5520-led2",
1578		.default_trigger = "none",
1579		.flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1580	},
1581	{
1582		.name = "adp5520-led3",
1583		.default_trigger = "none",
1584		.flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1585	},
1586#endif
1587};
1588
1589static struct adp5520_leds_platform_data adp5520_leds_data = {
1590	.num_leds = ARRAY_SIZE(adp5520_leds),
1591	.leds = adp5520_leds,
1592	.fade_in = ADP5520_FADE_T_600ms,
1593	.fade_out = ADP5520_FADE_T_600ms,
1594	.led_on_time = ADP5520_LED_ONT_600ms,
1595};
1596
1597	/*
1598	 *  ADP5520 GPIO Data
1599	 */
1600
1601static struct adp5520_gpio_platform_data adp5520_gpio_data = {
1602	.gpio_start = 50,
1603	.gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1604	.gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1605};
1606
1607	/*
1608	 *  ADP5520 Keypad Data
1609	 */
1610
1611static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
1612	[ADP5520_KEY(0, 0)]	= KEY_GRAVE,
1613	[ADP5520_KEY(0, 1)]	= KEY_1,
1614	[ADP5520_KEY(0, 2)]	= KEY_2,
1615	[ADP5520_KEY(0, 3)]	= KEY_3,
1616	[ADP5520_KEY(1, 0)]	= KEY_4,
1617	[ADP5520_KEY(1, 1)]	= KEY_5,
1618	[ADP5520_KEY(1, 2)]	= KEY_6,
1619	[ADP5520_KEY(1, 3)]	= KEY_7,
1620	[ADP5520_KEY(2, 0)]	= KEY_8,
1621	[ADP5520_KEY(2, 1)]	= KEY_9,
1622	[ADP5520_KEY(2, 2)]	= KEY_0,
1623	[ADP5520_KEY(2, 3)]	= KEY_MINUS,
1624	[ADP5520_KEY(3, 0)]	= KEY_EQUAL,
1625	[ADP5520_KEY(3, 1)]	= KEY_BACKSLASH,
1626	[ADP5520_KEY(3, 2)]	= KEY_BACKSPACE,
1627	[ADP5520_KEY(3, 3)]	= KEY_ENTER,
1628};
1629
1630static struct adp5520_keys_platform_data adp5520_keys_data = {
1631	.rows_en_mask	= ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
1632	.cols_en_mask	= ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
1633	.keymap		= adp5520_keymap,
1634	.keymapsize	= ARRAY_SIZE(adp5520_keymap),
1635	.repeat		= 0,
1636};
1637
1638	/*
1639	 *  ADP5520/5501 Multifuction Device Init Data
1640	 */
1641
1642static struct adp5520_platform_data adp5520_pdev_data = {
1643	.backlight = &adp5520_backlight_data,
1644	.leds = &adp5520_leds_data,
1645	.gpio = &adp5520_gpio_data,
1646	.keys = &adp5520_keys_data,
1647};
1648
1649#endif
1650
1651#if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1652static struct adp5588_gpio_platform_data adp5588_gpio_data = {
1653	.gpio_start = 50,
1654	.pullup_dis_mask = 0,
1655};
1656#endif
1657
1658#if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1659#include <linux/i2c/adp8870.h>
1660static struct led_info adp8870_leds[] = {
1661	{
1662		.name = "adp8870-led7",
1663		.default_trigger = "none",
1664		.flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
1665	},
1666};
1667
1668
1669static struct adp8870_backlight_platform_data adp8870_pdata = {
1670	.bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
1671			 ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6,	/* 1 = Backlight 0 = Individual LED */
1672	.pwm_assign = 0,				/* 1 = Enables PWM mode */
1673
1674	.bl_fade_in = ADP8870_FADE_T_1200ms,		/* Backlight Fade-In Timer */
1675	.bl_fade_out = ADP8870_FADE_T_1200ms,		/* Backlight Fade-Out Timer */
1676	.bl_fade_law = ADP8870_FADE_LAW_CUBIC1,		/* fade-on/fade-off transfer characteristic */
1677
1678	.en_ambl_sens = 1,				/* 1 = enable ambient light sensor */
1679	.abml_filt = ADP8870_BL_AMBL_FILT_320ms,	/* Light sensor filter time */
1680
1681	.l1_daylight_max = ADP8870_BL_CUR_mA(20),	/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1682	.l1_daylight_dim = ADP8870_BL_CUR_mA(0),	/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1683	.l2_bright_max = ADP8870_BL_CUR_mA(14),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1684	.l2_bright_dim = ADP8870_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1685	.l3_office_max = ADP8870_BL_CUR_mA(6),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1686	.l3_office_dim = ADP8870_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1687	.l4_indoor_max = ADP8870_BL_CUR_mA(3),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1688	.l4_indor_dim = ADP8870_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1689	.l5_dark_max = ADP8870_BL_CUR_mA(2),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1690	.l5_dark_dim = ADP8870_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1691
1692	.l2_trip = ADP8870_L2_COMP_CURR_uA(710),	/* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1693	.l2_hyst = ADP8870_L2_COMP_CURR_uA(73),		/* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1694	.l3_trip = ADP8870_L3_COMP_CURR_uA(389),	/* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1695	.l3_hyst = ADP8870_L3_COMP_CURR_uA(54),		/* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1696	.l4_trip = ADP8870_L4_COMP_CURR_uA(167),	/* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1697	.l4_hyst = ADP8870_L4_COMP_CURR_uA(16),		/* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1698	.l5_trip = ADP8870_L5_COMP_CURR_uA(43),		/* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1699	.l5_hyst = ADP8870_L5_COMP_CURR_uA(11),		/* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1700
1701	.leds = adp8870_leds,
1702	.num_leds = ARRAY_SIZE(adp8870_leds),
1703	.led_fade_law = ADP8870_FADE_LAW_SQUARE,	/* fade-on/fade-off transfer characteristic */
1704	.led_fade_in = ADP8870_FADE_T_600ms,
1705	.led_fade_out = ADP8870_FADE_T_600ms,
1706	.led_on_time = ADP8870_LED_ONT_200ms,
1707};
1708#endif
1709
1710#if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
1711#include <linux/i2c/adp8860.h>
1712static struct led_info adp8860_leds[] = {
1713	{
1714		.name = "adp8860-led7",
1715		.default_trigger = "none",
1716		.flags = ADP8860_LED_D7 | ADP8860_LED_OFFT_600ms,
1717	},
1718};
1719
1720static struct adp8860_backlight_platform_data adp8860_pdata = {
1721	.bl_led_assign = ADP8860_BL_D1 | ADP8860_BL_D2 | ADP8860_BL_D3 |
1722			 ADP8860_BL_D4 | ADP8860_BL_D5 | ADP8860_BL_D6,	/* 1 = Backlight 0 = Individual LED */
1723
1724	.bl_fade_in = ADP8860_FADE_T_1200ms,		/* Backlight Fade-In Timer */
1725	.bl_fade_out = ADP8860_FADE_T_1200ms,		/* Backlight Fade-Out Timer */
1726	.bl_fade_law = ADP8860_FADE_LAW_CUBIC1,		/* fade-on/fade-off transfer characteristic */
1727
1728	.en_ambl_sens = 1,				/* 1 = enable ambient light sensor */
1729	.abml_filt = ADP8860_BL_AMBL_FILT_320ms,	/* Light sensor filter time */
1730
1731	.l1_daylight_max = ADP8860_BL_CUR_mA(20),	/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1732	.l1_daylight_dim = ADP8860_BL_CUR_mA(0),	/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1733	.l2_office_max = ADP8860_BL_CUR_mA(6),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1734	.l2_office_dim = ADP8860_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1735	.l3_dark_max = ADP8860_BL_CUR_mA(2),		/* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1736	.l3_dark_dim = ADP8860_BL_CUR_mA(0),		/* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1737
1738	.l2_trip = ADP8860_L2_COMP_CURR_uA(710),	/* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1739	.l2_hyst = ADP8860_L2_COMP_CURR_uA(73),		/* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1740	.l3_trip = ADP8860_L3_COMP_CURR_uA(43),		/* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1741	.l3_hyst = ADP8860_L3_COMP_CURR_uA(11),		/* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1742
1743	.leds = adp8860_leds,
1744	.num_leds = ARRAY_SIZE(adp8860_leds),
1745	.led_fade_law = ADP8860_FADE_LAW_SQUARE,	/* fade-on/fade-off transfer characteristic */
1746	.led_fade_in = ADP8860_FADE_T_600ms,
1747	.led_fade_out = ADP8860_FADE_T_600ms,
1748	.led_on_time = ADP8860_LED_ONT_200ms,
1749};
1750#endif
1751
1752#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1753static struct regulator_consumer_supply ad5398_consumer = {
1754	.supply = "current",
1755};
1756
1757static struct regulator_init_data ad5398_regulator_data = {
1758	.constraints = {
1759		.name = "current range",
1760		.max_uA = 120000,
1761		.valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
1762	},
1763	.num_consumer_supplies = 1,
1764	.consumer_supplies     = &ad5398_consumer,
1765};
1766
1767static struct ad5398_platform_data ad5398_i2c_platform_data = {
1768	.current_bits = 10,
1769	.current_offset = 4,
1770	.regulator_data = &ad5398_regulator_data,
1771};
1772
1773#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
1774	defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
1775static struct platform_device ad5398_virt_consumer_device = {
1776	.name = "reg-virt-consumer",
1777	.id = 0,
1778	.dev = {
1779		.platform_data = "current", /* Passed to driver */
1780	},
1781};
1782#endif
1783#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
1784	defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
1785static struct regulator_bulk_data ad5398_bulk_data = {
1786	.supply = "current",
1787};
1788
1789static struct regulator_userspace_consumer_data ad5398_userspace_comsumer_data = {
1790	.name = "ad5398",
1791	.num_supplies = 1,
1792	.supplies = &ad5398_bulk_data,
1793};
1794
1795static struct platform_device ad5398_userspace_consumer_device = {
1796	.name = "reg-userspace-consumer",
1797	.id = 0,
1798	.dev = {
1799		.platform_data = &ad5398_userspace_comsumer_data,
1800	},
1801};
1802#endif
1803#endif
1804
1805static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1806#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
1807	{
1808		I2C_BOARD_INFO("ad7142_captouch", 0x2C),
1809		.irq = IRQ_PG5,
1810		.platform_data = (void *)&ad7142_i2c_platform_data,
1811	},
1812#endif
1813
1814#if defined(CONFIG_AD7150) || defined(CONFIG_AD7150_MODULE)
1815	{
1816		I2C_BOARD_INFO("ad7150", 0x48),
1817		.irq = IRQ_PG5,
1818	},
1819#endif
1820
1821#if defined(CONFIG_AD7152) || defined(CONFIG_AD7152_MODULE)
1822	{
1823		I2C_BOARD_INFO("ad7152", 0x48),
1824	},
1825#endif
1826
1827#if defined(CONFIG_AD774X) || defined(CONFIG_AD774X_MODULE)
1828	{
1829		I2C_BOARD_INFO("ad774x", 0x48),
1830	},
1831#endif
1832
1833#if defined(CONFIG_AD7414) || defined(CONFIG_AD7414_MODULE)
1834	{
1835		I2C_BOARD_INFO("ad7414", 0x9),
1836		.irq = IRQ_PG5,
1837		/*
1838		 * platform_data pointer is borrwoed by the driver to
1839		 * store custimer defined IRQ ALART level mode.
1840		 * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
1841		 */
1842		.platform_data = (void *)IRQF_TRIGGER_LOW,
1843	},
1844#endif
1845
1846#if defined(CONFIG_AD7416) || defined(CONFIG_AD7416_MODULE)
1847	{
1848		I2C_BOARD_INFO("ad7417", 0xb),
1849		.irq = IRQ_PG5,
1850		/*
1851		 * platform_data pointer is borrwoed by the driver to
1852		 * store custimer defined IRQ ALART level mode.
1853		 * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
1854		 */
1855		.platform_data = (void *)IRQF_TRIGGER_LOW,
1856	},
1857#endif
1858
1859#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1860	{
1861		I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1862	},
1863#endif
1864#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1865	{
1866		I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1867		.irq = IRQ_PG6,
1868	},
1869#endif
1870#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || \
1871	defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1872	{
1873		I2C_BOARD_INFO("ad7879", 0x2F),
1874		.irq = IRQ_PG5,
1875		.platform_data = (void *)&bfin_ad7879_ts_info,
1876	},
1877#endif
1878#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1879	{
1880		I2C_BOARD_INFO("adp5588-keys", 0x34),
1881		.irq = IRQ_PG0,
1882		.platform_data = (void *)&adp5588_kpad_data,
1883	},
1884#endif
1885#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1886	{
1887		I2C_BOARD_INFO("pmic-adp5520", 0x32),
1888		.irq = IRQ_PG0,
1889		.platform_data = (void *)&adp5520_pdev_data,
1890	},
1891#endif
1892#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1893	{
1894		I2C_BOARD_INFO("adxl34x", 0x53),
1895		.irq = IRQ_PG3,
1896		.platform_data = (void *)&adxl34x_info,
1897	},
1898#endif
1899#if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1900	{
1901		I2C_BOARD_INFO("adp5588-gpio", 0x34),
1902		.platform_data = (void *)&adp5588_gpio_data,
1903	},
1904#endif
1905#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1906	{
1907		I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1908	},
1909#endif
1910#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1911	{
1912		I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
1913	},
1914#endif
1915#if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1916	{
1917		I2C_BOARD_INFO("adp8870", 0x2B),
1918		.platform_data = (void *)&adp8870_pdata,
1919	},
1920#endif
1921#if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
1922	{
1923		I2C_BOARD_INFO("adau1371", 0x1A),
1924	},
1925#endif
1926#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1927	{
1928		I2C_BOARD_INFO("adau1761", 0x38),
1929	},
1930#endif
1931#if defined(CONFIG_SND_SOC_ADAU1361) || defined(CONFIG_SND_SOC_ADAU1361_MODULE)
1932	{
1933		I2C_BOARD_INFO("adau1361", 0x38),
1934	},
1935#endif
1936#if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
1937	{
1938		I2C_BOARD_INFO("ad5258", 0x18),
1939	},
1940#endif
1941#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1942	{
1943		I2C_BOARD_INFO("ssm2602", 0x1b),
1944	},
1945#endif
1946#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1947	{
1948		I2C_BOARD_INFO("ad5398", 0xC),
1949		.platform_data = (void *)&ad5398_i2c_platform_data,
1950	},
1951#endif
1952#if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
1953	{
1954		I2C_BOARD_INFO("adp8860", 0x2A),
1955		.platform_data = (void *)&adp8860_pdata,
1956	},
1957#endif
1958};
1959
1960#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1961#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1962static struct resource bfin_sport0_uart_resources[] = {
1963	{
1964		.start = SPORT0_TCR1,
1965		.end = SPORT0_MRCS3+4,
1966		.flags = IORESOURCE_MEM,
1967	},
1968	{
1969		.start = IRQ_SPORT0_RX,
1970		.end = IRQ_SPORT0_RX+1,
1971		.flags = IORESOURCE_IRQ,
1972	},
1973	{
1974		.start = IRQ_SPORT0_ERROR,
1975		.end = IRQ_SPORT0_ERROR,
1976		.flags = IORESOURCE_IRQ,
1977	},
1978};
1979
1980unsigned short bfin_sport0_peripherals[] = {
1981	P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1982	P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
1983};
1984
1985static struct platform_device bfin_sport0_uart_device = {
1986	.name = "bfin-sport-uart",
1987	.id = 0,
1988	.num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1989	.resource = bfin_sport0_uart_resources,
1990	.dev = {
1991		.platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1992	},
1993};
1994#endif
1995#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1996static struct resource bfin_sport1_uart_resources[] = {
1997	{
1998		.start = SPORT1_TCR1,
1999		.end = SPORT1_MRCS3+4,
2000		.flags = IORESOURCE_MEM,
2001	},
2002	{
2003		.start = IRQ_SPORT1_RX,
2004		.end = IRQ_SPORT1_RX+1,
2005		.flags = IORESOURCE_IRQ,
2006	},
2007	{
2008		.start = IRQ_SPORT1_ERROR,
2009		.end = IRQ_SPORT1_ERROR,
2010		.flags = IORESOURCE_IRQ,
2011	},
2012};
2013
2014unsigned short bfin_sport1_peripherals[] = {
2015	P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
2016	P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
2017};
2018
2019static struct platform_device bfin_sport1_uart_device = {
2020	.name = "bfin-sport-uart",
2021	.id = 1,
2022	.num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
2023	.resource = bfin_sport1_uart_resources,
2024	.dev = {
2025		.platform_data = &bfin_sport1_peripherals, /* Passed to driver */
2026	},
2027};
2028#endif
2029#endif
2030
2031#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2032#define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
2033/* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
2034
2035#ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
2036#define PATA_INT	IRQ_PF5
2037static struct pata_platform_info bfin_pata_platform_data = {
2038	.ioport_shift = 1,
2039	.irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
2040};
2041
2042static struct resource bfin_pata_resources[] = {
2043	{
2044		.start = 0x20314020,
2045		.end = 0x2031403F,
2046		.flags = IORESOURCE_MEM,
2047	},
2048	{
2049		.start = 0x2031401C,
2050		.end = 0x2031401F,
2051		.flags = IORESOURCE_MEM,
2052	},
2053	{
2054		.start = PATA_INT,
2055		.end = PATA_INT,
2056		.flags = IORESOURCE_IRQ,
2057	},
2058};
2059#elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
2060static struct pata_platform_info bfin_pata_platform_data = {
2061	.ioport_shift = 0,
2062};
2063/* CompactFlash Storage Card Memory Mapped Adressing
2064 * /REG = A11 = 1
2065 */
2066static struct resource bfin_pata_resources[] = {
2067	{
2068		.start = 0x20211800,
2069		.end = 0x20211807,
2070		.flags = IORESOURCE_MEM,
2071	},
2072	{
2073		.start = 0x2021180E,	/* Device Ctl */
2074		.end = 0x2021180E,
2075		.flags = IORESOURCE_MEM,
2076	},
2077};
2078#endif
2079
2080static struct platform_device bfin_pata_device = {
2081	.name = "pata_platform",
2082	.id = -1,
2083	.num_resources = ARRAY_SIZE(bfin_pata_resources),
2084	.resource = bfin_pata_resources,
2085	.dev = {
2086		.platform_data = &bfin_pata_platform_data,
2087	}
2088};
2089#endif
2090
2091static const unsigned int cclk_vlev_datasheet[] =
2092{
2093	VRPAIR(VLEV_085, 250000000),
2094	VRPAIR(VLEV_090, 376000000),
2095	VRPAIR(VLEV_095, 426000000),
2096	VRPAIR(VLEV_100, 426000000),
2097	VRPAIR(VLEV_105, 476000000),
2098	VRPAIR(VLEV_110, 476000000),
2099	VRPAIR(VLEV_115, 476000000),
2100	VRPAIR(VLEV_120, 500000000),
2101	VRPAIR(VLEV_125, 533000000),
2102	VRPAIR(VLEV_130, 600000000),
2103};
2104
2105static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
2106	.tuple_tab = cclk_vlev_datasheet,
2107	.tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
2108	.vr_settling_time = 25 /* us */,
2109};
2110
2111static struct platform_device bfin_dpmc = {
2112	.name = "bfin dpmc",
2113	.dev = {
2114		.platform_data = &bfin_dmpc_vreg_data,
2115	},
2116};
2117
2118#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2119static struct platform_device bfin_i2s = {
2120	.name = "bfin-i2s",
2121	.id = CONFIG_SND_BF5XX_SPORT_NUM,
2122	/* TODO: add platform data here */
2123};
2124#endif
2125
2126#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2127static struct platform_device bfin_tdm = {
2128	.name = "bfin-tdm",
2129	.id = CONFIG_SND_BF5XX_SPORT_NUM,
2130	/* TODO: add platform data here */
2131};
2132#endif
2133
2134#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2135static struct platform_device bfin_ac97 = {
2136	.name = "bfin-ac97",
2137	.id = CONFIG_SND_BF5XX_SPORT_NUM,
2138	/* TODO: add platform data here */
2139};
2140#endif
2141
2142#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2143#define REGULATOR_ADP122        "adp122"
2144#define REGULATOR_ADP150        "adp150"
2145
2146static struct regulator_consumer_supply adp122_consumers = {
2147		.supply = REGULATOR_ADP122,
2148};
2149
2150static struct regulator_consumer_supply adp150_consumers = {
2151		.supply = REGULATOR_ADP150,
2152};
2153
2154static struct regulator_init_data adp_switch_regulator_data[] = {
2155	{
2156		.constraints = {
2157			.name = REGULATOR_ADP122,
2158			.valid_ops_mask = REGULATOR_CHANGE_STATUS,
2159			.min_uA = 0,
2160			.max_uA = 300000,
2161		},
2162		.num_consumer_supplies = 1,	/* only 1 */
2163		.consumer_supplies     = &adp122_consumers,
2164		.driver_data	       = (void *)GPIO_PF2, /* gpio port only */
2165	},
2166	{
2167		.constraints = {
2168			.name = REGULATOR_ADP150,
2169			.valid_ops_mask = REGULATOR_CHANGE_STATUS,
2170			.min_uA = 0,
2171			.max_uA = 150000,
2172		},
2173		.num_consumer_supplies = 1,	/* only 1 */
2174		.consumer_supplies     = &adp150_consumers,
2175		.driver_data	       = (void *)GPIO_PF3, /* gpio port only */
2176	},
2177};
2178
2179static struct adp_switch_platform_data adp_switch_pdata = {
2180	.regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
2181	.regulator_data = adp_switch_regulator_data,
2182};
2183
2184static struct platform_device adp_switch_device = {
2185	.name = "adp_switch",
2186	.id = 0,
2187	.dev = {
2188		.platform_data = &adp_switch_pdata,
2189	},
2190};
2191
2192#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2193	defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2194static struct regulator_bulk_data adp122_bulk_data = {
2195	.supply = REGULATOR_ADP122,
2196};
2197
2198static struct regulator_userspace_consumer_data adp122_userspace_comsumer_data = {
2199	.name = REGULATOR_ADP122,
2200	.num_supplies = 1,
2201	.supplies = &adp122_bulk_data,
2202};
2203
2204static struct platform_device adp122_userspace_consumer_device = {
2205	.name = "reg-userspace-consumer",
2206	.id = 0,
2207	.dev = {
2208		.platform_data = &adp122_userspace_comsumer_data,
2209	},
2210};
2211
2212static struct regulator_bulk_data adp150_bulk_data = {
2213	.supply = REGULATOR_ADP150,
2214};
2215
2216static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
2217	.name = REGULATOR_ADP150,
2218	.num_supplies = 1,
2219	.supplies = &adp150_bulk_data,
2220};
2221
2222static struct platform_device adp150_userspace_consumer_device = {
2223	.name = "reg-userspace-consumer",
2224	.id = 1,
2225	.dev = {
2226		.platform_data = &adp150_userspace_comsumer_data,
2227	},
2228};
2229#endif
2230#endif
2231
2232
2233static struct platform_device *stamp_devices[] __initdata = {
2234
2235	&bfin_dpmc,
2236
2237#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
2238	&bfin_pcmcia_cf_device,
2239#endif
2240
2241#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
2242	&rtc_device,
2243#endif
2244
2245#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
2246	&sl811_hcd_device,
2247#endif
2248
2249#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
2250	&isp1362_hcd_device,
2251#endif
2252
2253#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
2254	&bfin_isp1760_device,
2255#endif
2256
2257#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
2258	&smc91x_device,
2259#endif
2260
2261#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
2262	&dm9000_device,
2263#endif
2264
2265#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
2266	&bfin_can_device,
2267#endif
2268
2269#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
2270	&bfin_mii_bus,
2271	&bfin_mac_device,
2272#endif
2273
2274#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
2275	&net2272_bfin_device,
2276#endif
2277
2278#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
2279	&bfin_spi0_device,
2280#endif
2281
2282#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
2283	&bfin_sport_spi0_device,
2284	&bfin_sport_spi1_device,
2285#endif
2286
2287#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
2288	&bfin_fb_device,
2289#endif
2290
2291#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
2292	&bfin_lq035q1_device,
2293#endif
2294
2295#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
2296#ifdef CONFIG_SERIAL_BFIN_UART0
2297	&bfin_uart0_device,
2298#endif
2299#ifdef CONFIG_SERIAL_BFIN_UART1
2300	&bfin_uart1_device,
2301#endif
2302#endif
2303
2304#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
2305#ifdef CONFIG_BFIN_SIR0
2306	&bfin_sir0_device,
2307#endif
2308#ifdef CONFIG_BFIN_SIR1
2309	&bfin_sir1_device,
2310#endif
2311#endif
2312
2313#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
2314	&i2c_bfin_twi_device,
2315#endif
2316
2317#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
2318#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2319	&bfin_sport0_uart_device,
2320#endif
2321#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2322	&bfin_sport1_uart_device,
2323#endif
2324#endif
2325
2326#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2327	&bfin_pata_device,
2328#endif
2329
2330#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2331	&bfin_device_gpiokeys,
2332#endif
2333
2334#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
2335	&bfin_async_nand_device,
2336#endif
2337
2338#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
2339	&stamp_flash_device,
2340#endif
2341
2342#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2343	&bfin_i2s,
2344#endif
2345
2346#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2347	&bfin_tdm,
2348#endif
2349
2350#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2351	&bfin_ac97,
2352#endif
2353#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
2354#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
2355	defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
2356	&ad5398_virt_consumer_device,
2357#endif
2358#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2359	defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2360	&ad5398_userspace_consumer_device,
2361#endif
2362#endif
2363
2364#if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
2365	&adp_switch_device,
2366#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2367	defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2368	&adp122_userspace_consumer_device,
2369	&adp150_userspace_consumer_device,
2370#endif
2371#endif
2372};
2373
2374static int __init stamp_init(void)
2375{
2376	printk(KERN_INFO "%s(): registering device resources\n", __func__);
2377	bfin_plat_nand_init();
2378	adf702x_mac_init();
2379	platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
2380	i2c_register_board_info(0, bfin_i2c_board_info,
2381				ARRAY_SIZE(bfin_i2c_board_info));
2382	spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
2383
2384	return 0;
2385}
2386
2387arch_initcall(stamp_init);
2388
2389
2390static struct platform_device *stamp_early_devices[] __initdata = {
2391#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2392#ifdef CONFIG_SERIAL_BFIN_UART0
2393	&bfin_uart0_device,
2394#endif
2395#ifdef CONFIG_SERIAL_BFIN_UART1
2396	&bfin_uart1_device,
2397#endif
2398#endif
2399
2400#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
2401#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2402	&bfin_sport0_uart_device,
2403#endif
2404#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2405	&bfin_sport1_uart_device,
2406#endif
2407#endif
2408};
2409
2410void __init native_machine_early_platform_add_devices(void)
2411{
2412	printk(KERN_INFO "register early platform devices\n");
2413	early_platform_add_devices(stamp_early_devices,
2414		ARRAY_SIZE(stamp_early_devices));
2415}
2416
2417void native_machine_restart(char *cmd)
2418{
2419	if ((bfin_read_SYSCR() & 0x7) == 0x3)
2420		bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
2421}
2422
2423/*
2424 * Currently the MAC address is saved in Flash by U-Boot
2425 */
2426#define FLASH_MAC	0x203f0000
2427void bfin_get_ether_addr(char *addr)
2428{
2429	*(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
2430	*(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
2431}
2432EXPORT_SYMBOL(bfin_get_ether_addr);
2433