blob: 84562926029023768eb968d0dec7d16604501305 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
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>
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07007 */
8
9#include <linux/device.h>
Mike Frysingerfc689112008-06-25 11:41:42 +080010#include <linux/kernel.h>
Bryan Wu1394f032007-05-06 14:50:22 -070011#include <linux/platform_device.h>
Barry Song6e364752009-09-29 03:01:40 +000012#include <linux/io.h>
Bryan Wu1394f032007-05-06 14:50:22 -070013#include <linux/mtd/mtd.h>
Mike Frysingerfc689112008-06-25 11:41:42 +080014#include <linux/mtd/nand.h>
Bryan Wu1394f032007-05-06 14:50:22 -070015#include <linux/mtd/partitions.h>
Mike Frysingerfc689112008-06-25 11:41:42 +080016#include <linux/mtd/plat-ram.h>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080017#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070018#include <linux/spi/spi.h>
19#include <linux/spi/flash.h>
20#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080021#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070022#endif
Sonic Zhang7a9cc482009-12-22 04:47:04 +000023#include <linux/i2c.h>
24#include <linux/i2c/adp5588.h>
Mike Frysinger0531c462010-01-19 07:04:29 +000025#include <linux/etherdevice.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050026#include <linux/ata_platform.h>
Bryan Wu1394f032007-05-06 14:50:22 -070027#include <linux/irq.h>
28#include <linux/interrupt.h>
David Brownell27f5d752007-10-04 18:06:16 -070029#include <linux/usb/sl811.h>
Yi Lif79ea4c2009-01-07 23:14:38 +080030#include <linux/spi/mmc_spi.h>
Michael Hennerich78756c62009-10-13 15:28:33 +000031#include <linux/leds.h>
32#include <linux/input.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080033#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080034#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080035#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080036#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080037#include <asm/dpmc.h>
Sonic Zhangf32792d2010-02-09 02:47:09 +000038#ifdef CONFIG_REGULATOR_AD5398
39#include <linux/regulator/ad5398.h>
40#endif
41#include <linux/regulator/consumer.h>
42#include <linux/regulator/userspace-consumer.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043
44/*
45 * Name the Board for the /proc/cpuinfo
46 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080047const char bfin_board_name[] = "ADI BF537-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070048
49/*
50 * Driver needs to know address, irq and flag pin.
51 */
52
Bryan Wu1394f032007-05-06 14:50:22 -070053#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080054#include <linux/usb/isp1760.h>
55static struct resource bfin_isp1760_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -070056 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080057 .start = 0x203C0000,
58 .end = 0x203C0000 + 0x000fffff,
Bryan Wu1394f032007-05-06 14:50:22 -070059 .flags = IORESOURCE_MEM,
60 },
61 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080062 .start = IRQ_PF7,
63 .end = IRQ_PF7,
Michael Hennerich6a6be3d2009-01-07 23:14:39 +080064 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Bryan Wu1394f032007-05-06 14:50:22 -070065 },
66};
67
Michael Hennerich3f375692008-11-18 17:48:22 +080068static struct isp1760_platform_data isp1760_priv = {
69 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080070 .bus_width_16 = 1,
71 .port1_otg = 0,
72 .analog_oc = 0,
73 .dack_polarity_high = 0,
74 .dreq_polarity_high = 0,
75};
76
77static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb7682009-10-15 10:37:33 +000078 .name = "isp1760",
Bryan Wu1394f032007-05-06 14:50:22 -070079 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080080 .dev = {
81 .platform_data = &isp1760_priv,
82 },
83 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
84 .resource = bfin_isp1760_resources,
Bryan Wu1394f032007-05-06 14:50:22 -070085};
Bryan Wu1394f032007-05-06 14:50:22 -070086#endif
87
Michael Hennerich2463ef22008-01-27 16:49:48 +080088#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich2463ef22008-01-27 16:49:48 +080089#include <linux/gpio_keys.h>
90
91static struct gpio_keys_button bfin_gpio_keys_table[] = {
92 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
93 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
94 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
95 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
96};
97
98static struct gpio_keys_platform_data bfin_gpio_keys_data = {
99 .buttons = bfin_gpio_keys_table,
100 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
101};
102
103static struct platform_device bfin_device_gpiokeys = {
104 .name = "gpio-keys",
105 .dev = {
106 .platform_data = &bfin_gpio_keys_data,
107 },
108};
109#endif
110
Bryan Wu1394f032007-05-06 14:50:22 -0700111#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
112static struct resource bfin_pcmcia_cf_resources[] = {
113 {
114 .start = 0x20310000, /* IO PORT */
115 .end = 0x20312000,
116 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800117 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800118 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700119 .end = 0x20311FFF,
120 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800121 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700122 .start = IRQ_PF4,
123 .end = IRQ_PF4,
124 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800125 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700126 .start = 6, /* Card Detect PF6 */
127 .end = 6,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static struct platform_device bfin_pcmcia_cf_device = {
133 .name = "bfin_cf_pcmcia",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
136 .resource = bfin_pcmcia_cf_resources,
137};
138#endif
139
140#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
141static struct platform_device rtc_device = {
142 .name = "rtc-bfin",
143 .id = -1,
144};
145#endif
146
147#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000148#include <linux/smc91x.h>
149
150static struct smc91x_platdata smc91x_info = {
151 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
152 .leda = RPC_LED_100_10,
153 .ledb = RPC_LED_TX_RX,
154};
155
Bryan Wu1394f032007-05-06 14:50:22 -0700156static struct resource smc91x_resources[] = {
157 {
158 .name = "smc91x-regs",
159 .start = 0x20300300,
160 .end = 0x20300300 + 16,
161 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800162 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700163
164 .start = IRQ_PF7,
165 .end = IRQ_PF7,
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
167 },
168};
169static struct platform_device smc91x_device = {
170 .name = "smc91x",
171 .id = 0,
172 .num_resources = ARRAY_SIZE(smc91x_resources),
173 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000174 .dev = {
175 .platform_data = &smc91x_info,
176 },
Bryan Wu1394f032007-05-06 14:50:22 -0700177};
178#endif
179
Alex Landauf40d24d2007-07-12 12:11:48 +0800180#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
181static struct resource dm9000_resources[] = {
182 [0] = {
183 .start = 0x203FB800,
Barry Songb3dec4a2009-07-27 06:42:50 +0000184 .end = 0x203FB800 + 1,
Alex Landauf40d24d2007-07-12 12:11:48 +0800185 .flags = IORESOURCE_MEM,
186 },
187 [1] = {
Barry Songb3dec4a2009-07-27 06:42:50 +0000188 .start = 0x203FB804,
189 .end = 0x203FB804 + 1,
190 .flags = IORESOURCE_MEM,
191 },
192 [2] = {
Alex Landauf40d24d2007-07-12 12:11:48 +0800193 .start = IRQ_PF9,
194 .end = IRQ_PF9,
195 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
196 },
197};
198
199static struct platform_device dm9000_device = {
200 .name = "dm9000",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(dm9000_resources),
203 .resource = dm9000_resources,
204};
205#endif
206
Bryan Wu1394f032007-05-06 14:50:22 -0700207#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
208static struct resource sl811_hcd_resources[] = {
209 {
210 .start = 0x20340000,
211 .end = 0x20340000,
212 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800213 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700214 .start = 0x20340004,
215 .end = 0x20340004,
216 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800217 }, {
Mike Frysinger01218652009-12-21 15:07:43 +0000218 .start = IRQ_PF4,
219 .end = IRQ_PF4,
Bryan Wu1394f032007-05-06 14:50:22 -0700220 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
221 },
222};
223
224#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
225void sl811_port_power(struct device *dev, int is_on)
226{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800227 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800228 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Bryan Wu1394f032007-05-06 14:50:22 -0700229}
230#endif
231
232static struct sl811_platform_data sl811_priv = {
233 .potpg = 10,
234 .power = 250, /* == 500mA */
235#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
236 .port_power = &sl811_port_power,
237#endif
238};
239
240static struct platform_device sl811_hcd_device = {
241 .name = "sl811-hcd",
242 .id = 0,
243 .dev = {
244 .platform_data = &sl811_priv,
245 },
246 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
247 .resource = sl811_hcd_resources,
248};
249#endif
250
251#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
252static struct resource isp1362_hcd_resources[] = {
253 {
254 .start = 0x20360000,
255 .end = 0x20360000,
256 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800257 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700258 .start = 0x20360004,
259 .end = 0x20360004,
260 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800261 }, {
Mike Frysinger21b03cf2009-09-24 05:44:36 +0000262 .start = IRQ_PF3,
263 .end = IRQ_PF3,
Bryan Wu1394f032007-05-06 14:50:22 -0700264 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
265 },
266};
267
268static struct isp1362_platform_data isp1362_priv = {
269 .sel15Kres = 1,
270 .clknotstop = 0,
271 .oc_enable = 0,
272 .int_act_high = 0,
273 .int_edge_triggered = 0,
274 .remote_wakeup_connected = 0,
275 .no_power_switching = 1,
276 .power_switching_mode = 0,
277};
278
279static struct platform_device isp1362_hcd_device = {
280 .name = "isp1362-hcd",
281 .id = 0,
282 .dev = {
283 .platform_data = &isp1362_priv,
284 },
285 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
286 .resource = isp1362_hcd_resources,
287};
288#endif
289
Barry Song706a01b2009-11-02 07:29:07 +0000290#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
291unsigned short bfin_can_peripherals[] = {
292 P_CAN0_RX, P_CAN0_TX, 0
293};
294
295static struct resource bfin_can_resources[] = {
296 {
297 .start = 0xFFC02A00,
298 .end = 0xFFC02FFF,
299 .flags = IORESOURCE_MEM,
300 },
301 {
302 .start = IRQ_CAN_RX,
303 .end = IRQ_CAN_RX,
304 .flags = IORESOURCE_IRQ,
305 },
306 {
307 .start = IRQ_CAN_TX,
308 .end = IRQ_CAN_TX,
309 .flags = IORESOURCE_IRQ,
310 },
311 {
312 .start = IRQ_CAN_ERROR,
313 .end = IRQ_CAN_ERROR,
314 .flags = IORESOURCE_IRQ,
315 },
316};
317
318static struct platform_device bfin_can_device = {
319 .name = "bfin_can",
320 .num_resources = ARRAY_SIZE(bfin_can_resources),
321 .resource = bfin_can_resources,
322 .dev = {
323 .platform_data = &bfin_can_peripherals, /* Passed to driver */
324 },
325};
326#endif
327
Bryan Wu1394f032007-05-06 14:50:22 -0700328#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800329static struct platform_device bfin_mii_bus = {
330 .name = "bfin_mii_bus",
331};
332
Bryan Wu1394f032007-05-06 14:50:22 -0700333static struct platform_device bfin_mac_device = {
334 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800335 .dev.platform_data = &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700336};
337#endif
338
339#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
340static struct resource net2272_bfin_resources[] = {
341 {
342 .start = 0x20300000,
343 .end = 0x20300000 + 0x100,
344 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800345 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700346 .start = IRQ_PF7,
347 .end = IRQ_PF7,
348 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
349 },
350};
351
352static struct platform_device net2272_bfin_device = {
353 .name = "net2272",
354 .id = -1,
355 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
356 .resource = net2272_bfin_resources,
357};
358#endif
359
Mike Frysingerfc689112008-06-25 11:41:42 +0800360#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
361#ifdef CONFIG_MTD_PARTITIONS
362const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
363
364static struct mtd_partition bfin_plat_nand_partitions[] = {
365 {
Robin Getzaa582972008-08-05 17:47:29 +0800366 .name = "linux kernel(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800367 .size = 0x400000,
368 .offset = 0,
369 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800370 .name = "file system(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800371 .size = MTDPART_SIZ_FULL,
372 .offset = MTDPART_OFS_APPEND,
373 },
374};
375#endif
376
377#define BFIN_NAND_PLAT_CLE 2
378#define BFIN_NAND_PLAT_ALE 1
379static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
380{
381 struct nand_chip *this = mtd->priv;
382
383 if (cmd == NAND_CMD_NONE)
384 return;
385
386 if (ctrl & NAND_CLE)
387 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
388 else
389 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
390}
391
392#define BFIN_NAND_PLAT_READY GPIO_PF3
393static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
394{
395 return gpio_get_value(BFIN_NAND_PLAT_READY);
396}
397
398static struct platform_nand_data bfin_plat_nand_data = {
399 .chip = {
400 .chip_delay = 30,
401#ifdef CONFIG_MTD_PARTITIONS
402 .part_probe_types = part_probes,
403 .partitions = bfin_plat_nand_partitions,
404 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
405#endif
406 },
407 .ctrl = {
408 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
409 .dev_ready = bfin_plat_nand_dev_ready,
410 },
411};
412
413#define MAX(x, y) (x > y ? x : y)
414static struct resource bfin_plat_nand_resources = {
415 .start = 0x20212000,
416 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
417 .flags = IORESOURCE_IO,
418};
419
420static struct platform_device bfin_async_nand_device = {
421 .name = "gen_nand",
422 .id = -1,
423 .num_resources = 1,
424 .resource = &bfin_plat_nand_resources,
425 .dev = {
426 .platform_data = &bfin_plat_nand_data,
427 },
428};
429
430static void bfin_plat_nand_init(void)
431{
432 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
433}
434#else
435static void bfin_plat_nand_init(void) {}
436#endif
437
Mike Frysinger793dc272008-03-26 08:09:12 +0800438#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800439static struct mtd_partition stamp_partitions[] = {
440 {
Robin Getzaa582972008-08-05 17:47:29 +0800441 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800442 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800443 .offset = 0,
444 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800445 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800446 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800447 .offset = MTDPART_OFS_APPEND,
448 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800449 .name = "file system(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800450 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800451 .offset = MTDPART_OFS_APPEND,
452 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800453 .name = "MAC Address(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800454 .size = MTDPART_SIZ_FULL,
455 .offset = 0x3F0000,
456 .mask_flags = MTD_WRITEABLE,
457 }
458};
459
460static struct physmap_flash_data stamp_flash_data = {
461 .width = 2,
462 .parts = stamp_partitions,
463 .nr_parts = ARRAY_SIZE(stamp_partitions),
Barry Song38e76732010-01-15 03:24:39 +0000464#ifdef CONFIG_ROMKERNEL
465 .probe_type = "map_rom",
466#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800467};
468
469static struct resource stamp_flash_resource = {
470 .start = 0x20000000,
471 .end = 0x203fffff,
472 .flags = IORESOURCE_MEM,
473};
474
475static struct platform_device stamp_flash_device = {
476 .name = "physmap-flash",
477 .id = 0,
478 .dev = {
479 .platform_data = &stamp_flash_data,
480 },
481 .num_resources = 1,
482 .resource = &stamp_flash_resource,
483};
Mike Frysinger793dc272008-03-26 08:09:12 +0800484#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800485
Bryan Wu1394f032007-05-06 14:50:22 -0700486#if defined(CONFIG_MTD_M25P80) \
487 || defined(CONFIG_MTD_M25P80_MODULE)
488static struct mtd_partition bfin_spi_flash_partitions[] = {
489 {
Robin Getzaa582972008-08-05 17:47:29 +0800490 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800491 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700492 .offset = 0,
493 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800494 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800495 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800496 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800497 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800498 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800499 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800500 .size = MTDPART_SIZ_FULL,
501 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700502 }
503};
504
505static struct flash_platform_data bfin_spi_flash_data = {
506 .name = "m25p80",
507 .parts = bfin_spi_flash_partitions,
508 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerich88a80782008-11-18 17:48:22 +0800509 /* .type = "m25p64", */
Bryan Wu1394f032007-05-06 14:50:22 -0700510};
511
512/* SPI flash chip (m25p64) */
513static struct bfin5xx_spi_chip spi_flash_chip_info = {
514 .enable_dma = 0, /* use dma transfer with this chip*/
515 .bits_per_word = 8,
516};
517#endif
518
Mike Frysingera261eec2009-05-20 14:05:36 +0000519#if defined(CONFIG_BFIN_SPI_ADC) \
520 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700521/* SPI ADC chip */
522static struct bfin5xx_spi_chip spi_adc_chip_info = {
523 .enable_dma = 1, /* use dma transfer with this chip*/
524 .bits_per_word = 16,
525};
526#endif
527
Barry Song83124402009-08-06 21:03:02 +0000528#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
529 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700530static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
531 .enable_dma = 0,
532 .bits_per_word = 16,
533};
534#endif
535
Barry Song3b827902010-01-27 09:01:36 +0000536#if defined(CONFIG_SND_BF5XX_SOC_AD193X) \
537 || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
Barry Songd4b834c2009-06-04 10:14:17 +0000538static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
539 .enable_dma = 0,
540 .bits_per_word = 8,
Barry Songd4b834c2009-06-04 10:14:17 +0000541};
542#endif
543
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000544#if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
Barry Song427f2772009-07-17 07:04:55 +0000545#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
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000551static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
Barry Song427f2772009-07-17 07:04:55 +0000552 {
553 .start_stage = 0,
554 .end_stage = 7,
555 .max_coord = 128,
556 },
557};
558
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000559static struct ad714x_button_plat ad7147_spi_button_plat[] = {
Barry Song427f2772009-07-17 07:04:55 +0000560 {
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};
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000586static struct ad714x_platform_data ad7147_spi_platform_data = {
Barry Song427f2772009-07-17 07:04:55 +0000587 .slider_num = 1,
588 .button_num = 5,
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000589 .slider = ad7147_spi_slider_plat,
590 .button = ad7147_spi_button_plat,
Barry Song427f2772009-07-17 07:04:55 +0000591 .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
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000609#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
Barry Song427f2772009-07-17 07:04:55 +0000610#include <linux/input/ad714x.h>
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000611static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
Barry Song427f2772009-07-17 07:04:55 +0000612 {
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};
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000633static struct ad714x_platform_data ad7142_i2c_platform_data = {
Barry Song427f2772009-07-17 07:04:55 +0000634 .button_num = 4,
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000635 .button = ad7142_i2c_button_plat,
Barry Song427f2772009-07-17 07:04:55 +0000636 .stage_cfg_reg = {
637 /* fixme: figure out right setting for all comoponent according
638 * to hardware feature of EVAL-AD7142EB board */
639 {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
640 {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
641 {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
642 {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
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 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
650 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
651 },
652 .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
653};
654#endif
655
Yi Lif79ea4c2009-01-07 23:14:38 +0800656#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
657#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
658
659static int bfin_mmc_spi_init(struct device *dev,
660 irqreturn_t (*detect_int)(int, void *), void *data)
661{
662 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
663 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
664}
665
666static void bfin_mmc_spi_exit(struct device *dev, void *data)
667{
668 free_irq(MMC_SPI_CARD_DETECT_INT, data);
669}
670
671static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
672 .init = bfin_mmc_spi_init,
673 .exit = bfin_mmc_spi_exit,
674 .detect_delay = 100, /* msecs */
675};
676
677static struct bfin5xx_spi_chip mmc_spi_chip_info = {
678 .enable_dma = 0,
679 .bits_per_word = 8,
Yi Lie68d1eb2009-06-03 09:46:22 +0000680 .pio_interrupt = 0,
Yi Lif79ea4c2009-01-07 23:14:38 +0800681};
682#endif
683
Bryan Wu1394f032007-05-06 14:50:22 -0700684#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800685#include <linux/spi/ad7877.h>
Bryan Wu1394f032007-05-06 14:50:22 -0700686static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700687 .enable_dma = 0,
688 .bits_per_word = 16,
689};
690
691static const struct ad7877_platform_data bfin_ad7877_ts_info = {
692 .model = 7877,
693 .vref_delay_usecs = 50, /* internal, no capacitor */
694 .x_plate_ohms = 419,
695 .y_plate_ohms = 486,
696 .pressure_max = 1000,
697 .pressure_min = 0,
698 .stopacq_polarity = 1,
699 .first_conversion_delay = 3,
700 .acquisition_time = 1,
701 .averaging = 1,
702 .pen_down_acc_interval = 1,
703};
704#endif
705
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800706#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
707#include <linux/spi/ad7879.h>
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800708static const struct ad7879_platform_data bfin_ad7879_ts_info = {
709 .model = 7879, /* Model = AD7879 */
710 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
711 .pressure_max = 10000,
712 .pressure_min = 0,
713 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
714 .acquisition_time = 1, /* 4us acquisition time per sample */
715 .median = 2, /* do 8 measurements */
716 .averaging = 1, /* take the average of 4 middle samples */
717 .pen_down_acc_interval = 255, /* 9.4 ms */
Michael Hennerich244d3422009-12-18 09:29:39 +0000718 .gpio_export = 1, /* Export GPIO to gpiolib */
719 .gpio_base = -1, /* Dynamic allocation */
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800720};
721#endif
722
Michael Hennerichffc4d8b2009-05-29 15:41:18 +0000723#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
Michael Hennerich57af8ed2009-10-16 12:35:20 +0000724#include <linux/input/adxl34x.h>
Michael Hennerichffc4d8b2009-05-29 15:41:18 +0000725static const struct adxl34x_platform_data adxl34x_info = {
726 .x_axis_offset = 0,
727 .y_axis_offset = 0,
728 .z_axis_offset = 0,
729 .tap_threshold = 0x31,
730 .tap_duration = 0x10,
731 .tap_latency = 0x60,
732 .tap_window = 0xF0,
733 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
734 .act_axis_control = 0xFF,
735 .activity_threshold = 5,
736 .inactivity_threshold = 3,
737 .inactivity_time = 4,
738 .free_fall_threshold = 0x7,
739 .free_fall_time = 0x20,
740 .data_rate = 0x8,
741 .data_range = ADXL_FULL_RES,
742
743 .ev_type = EV_ABS,
744 .ev_code_x = ABS_X, /* EV_REL */
745 .ev_code_y = ABS_Y, /* EV_REL */
746 .ev_code_z = ABS_Z, /* EV_REL */
747
Michael Hennerich57af8ed2009-10-16 12:35:20 +0000748 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
Michael Hennerichffc4d8b2009-05-29 15:41:18 +0000749
750/* .ev_code_ff = KEY_F,*/ /* EV_KEY */
751/* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
752 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
753 .fifo_mode = ADXL_FIFO_STREAM,
754};
755#endif
756
Michael Hennerichf5150152008-10-16 23:23:18 +0800757#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
758static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
759 .enable_dma = 0,
760 .bits_per_word = 16,
761};
762#endif
763
Michael Hennerich6e668932008-02-09 01:54:09 +0800764#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
765static struct bfin5xx_spi_chip spidev_chip_info = {
766 .enable_dma = 0,
767 .bits_per_word = 8,
768};
769#endif
770
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800771#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
772static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
773 .enable_dma = 0,
774 .bits_per_word = 8,
775};
776#endif
777
Michael Hennerich85a192e2009-01-07 23:14:38 +0800778#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
779static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
780 .enable_dma = 1,
781 .bits_per_word = 8,
782 .cs_gpio = GPIO_PF10,
783};
784#endif
785
Michael Hennerichefaf7cd2009-11-12 16:54:08 +0000786#if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
787static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
788 .bits_per_word = 16,
789 .cs_gpio = GPIO_PF10,
790};
791
792#include <linux/spi/adf702x.h>
793#define TXREG 0x0160A470
794static const u32 adf7021_regs[] = {
795 0x09608FA0,
796 0x00575011,
797 0x00A7F092,
798 0x2B141563,
799 0x81F29E94,
800 0x00003155,
801 0x050A4F66,
802 0x00000007,
803 0x00000008,
804 0x000231E9,
805 0x3296354A,
806 0x891A2B3B,
807 0x00000D9C,
808 0x0000000D,
809 0x0000000E,
810 0x0000000F,
811};
812
813static struct adf702x_platform_data adf7021_platform_data = {
814 .regs_base = (void *)SPORT1_TCR1,
815 .dma_ch_rx = CH_SPORT1_RX,
816 .dma_ch_tx = CH_SPORT1_TX,
817 .irq_sport_err = IRQ_SPORT1_ERROR,
818 .gpio_int_rfs = GPIO_PF8,
819 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
820 P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
821 .adf702x_model = MODEL_ADF7021,
822 .adf702x_regs = adf7021_regs,
823 .tx_reg = TXREG,
824};
Mike Frysinger0531c462010-01-19 07:04:29 +0000825static inline void adf702x_mac_init(void)
826{
827 random_ether_addr(adf7021_platform_data.mac_addr);
828}
829#else
830static inline void adf702x_mac_init(void) {}
Michael Hennerichefaf7cd2009-11-12 16:54:08 +0000831#endif
832
Michael Hennerichfe5b25c2010-02-04 14:41:39 +0000833#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
834#include <linux/spi/ads7846.h>
835static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
836 .bits_per_word = 8,
837};
838
839static int ads7873_get_pendown_state(void)
840{
841 return gpio_get_value(GPIO_PF6);
842}
843
844static struct ads7846_platform_data __initdata ad7873_pdata = {
845 .model = 7873, /* AD7873 */
846 .x_max = 0xfff,
847 .y_max = 0xfff,
848 .x_plate_ohms = 620,
849 .debounce_max = 1,
850 .debounce_rep = 0,
851 .debounce_tol = (~0),
852 .get_pendown_state = ads7873_get_pendown_state,
853};
854#endif
855
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800856#if defined(CONFIG_MTD_DATAFLASH) \
857 || defined(CONFIG_MTD_DATAFLASH_MODULE)
Michael Hennerichceac2652008-08-25 17:39:11 +0800858
859static struct mtd_partition bfin_spi_dataflash_partitions[] = {
860 {
861 .name = "bootloader(spi)",
862 .size = 0x00040000,
863 .offset = 0,
864 .mask_flags = MTD_CAP_ROM
865 }, {
866 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800867 .size = 0x180000,
Michael Hennerichceac2652008-08-25 17:39:11 +0800868 .offset = MTDPART_OFS_APPEND,
869 }, {
870 .name = "file system(spi)",
871 .size = MTDPART_SIZ_FULL,
872 .offset = MTDPART_OFS_APPEND,
873 }
874};
875
876static struct flash_platform_data bfin_spi_dataflash_data = {
877 .name = "SPI Dataflash",
878 .parts = bfin_spi_dataflash_partitions,
879 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
880};
881
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800882/* DataFlash chip */
883static struct bfin5xx_spi_chip data_flash_chip_info = {
884 .enable_dma = 0, /* use dma transfer with this chip*/
885 .bits_per_word = 8,
886};
887#endif
888
Michael Hennerich57af8ed2009-10-16 12:35:20 +0000889#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
890static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
891 .enable_dma = 0, /* use dma transfer with this chip*/
892 .bits_per_word = 8,
893};
894#endif
895
Bryan Wu1394f032007-05-06 14:50:22 -0700896static struct spi_board_info bfin_spi_board_info[] __initdata = {
897#if defined(CONFIG_MTD_M25P80) \
898 || defined(CONFIG_MTD_M25P80_MODULE)
899 {
900 /* the modalias must be the same as spi device driver name */
901 .modalias = "m25p80", /* Name of spi_driver for this device */
902 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800903 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700904 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
905 .platform_data = &bfin_spi_flash_data,
906 .controller_data = &spi_flash_chip_info,
907 .mode = SPI_MODE_3,
908 },
909#endif
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800910#if defined(CONFIG_MTD_DATAFLASH) \
911 || defined(CONFIG_MTD_DATAFLASH_MODULE)
912 { /* DataFlash chip */
913 .modalias = "mtd_dataflash",
Michael Hennerichceac2652008-08-25 17:39:11 +0800914 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800915 .bus_num = 0, /* Framework bus number */
916 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
Michael Hennerichceac2652008-08-25 17:39:11 +0800917 .platform_data = &bfin_spi_dataflash_data,
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800918 .controller_data = &data_flash_chip_info,
919 .mode = SPI_MODE_3,
920 },
921#endif
Mike Frysingera261eec2009-05-20 14:05:36 +0000922#if defined(CONFIG_BFIN_SPI_ADC) \
923 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700924 {
925 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
926 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800927 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700928 .chip_select = 1, /* Framework chip select. */
929 .platform_data = NULL, /* No spi_driver specific config */
930 .controller_data = &spi_adc_chip_info,
931 },
932#endif
933
Barry Song83124402009-08-06 21:03:02 +0000934#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
935 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700936 {
Barry Songdac98172009-08-13 21:07:37 +0000937 .modalias = "ad1836",
Bryan Wu1394f032007-05-06 14:50:22 -0700938 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800939 .bus_num = 0,
Barry Song83124402009-08-06 21:03:02 +0000940 .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
Bryan Wu1394f032007-05-06 14:50:22 -0700941 .controller_data = &ad1836_spi_chip_info,
Barry Song83124402009-08-06 21:03:02 +0000942 .mode = SPI_MODE_3,
Bryan Wu1394f032007-05-06 14:50:22 -0700943 },
944#endif
Barry Songd4b834c2009-06-04 10:14:17 +0000945
Barry Song3b827902010-01-27 09:01:36 +0000946#if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
Barry Songd4b834c2009-06-04 10:14:17 +0000947 {
Barry Song3b827902010-01-27 09:01:36 +0000948 .modalias = "ad193x",
Barry Songd4b834c2009-06-04 10:14:17 +0000949 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
950 .bus_num = 0,
Barry Song08a54bf2009-09-18 09:14:38 +0000951 .chip_select = 5,
Barry Songd4b834c2009-06-04 10:14:17 +0000952 .controller_data = &ad1938_spi_chip_info,
953 .mode = SPI_MODE_3,
954 },
955#endif
956
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000957#if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
Barry Song427f2772009-07-17 07:04:55 +0000958 {
959 .modalias = "ad714x_captouch",
960 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
961 .irq = IRQ_PF4,
962 .bus_num = 0,
963 .chip_select = 5,
964 .mode = SPI_MODE_3,
Mike Frysinger5b7c5772009-10-12 15:56:58 +0000965 .platform_data = &ad7147_spi_platform_data,
Barry Song427f2772009-07-17 07:04:55 +0000966 .controller_data = &ad7147_spi_chip_info,
967 },
968#endif
969
Yi Lif79ea4c2009-01-07 23:14:38 +0800970#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
971 {
972 .modalias = "mmc_spi",
973 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
974 .bus_num = 0,
975 .chip_select = 4,
976 .platform_data = &bfin_mmc_spi_pdata,
977 .controller_data = &mmc_spi_chip_info,
978 .mode = SPI_MODE_3,
979 },
980#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700981#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
982 {
983 .modalias = "ad7877",
984 .platform_data = &bfin_ad7877_ts_info,
985 .irq = IRQ_PF6,
986 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800987 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700988 .chip_select = 1,
989 .controller_data = &spi_ad7877_chip_info,
990 },
991#endif
Michael Hennerichf5150152008-10-16 23:23:18 +0800992#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800993 {
994 .modalias = "ad7879",
995 .platform_data = &bfin_ad7879_ts_info,
996 .irq = IRQ_PF7,
997 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
998 .bus_num = 0,
999 .chip_select = 1,
1000 .controller_data = &spi_ad7879_chip_info,
1001 .mode = SPI_CPHA | SPI_CPOL,
1002 },
1003#endif
Michael Hennerich6e668932008-02-09 01:54:09 +08001004#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1005 {
1006 .modalias = "spidev",
1007 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1008 .bus_num = 0,
1009 .chip_select = 1,
1010 .controller_data = &spidev_chip_info,
1011 },
1012#endif
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001013#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1014 {
1015 .modalias = "bfin-lq035q1-spi",
1016 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
1017 .bus_num = 0,
Michael Hennerich46aa04f2008-10-13 11:30:17 +08001018 .chip_select = 2,
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001019 .controller_data = &lq035q1_spi_chip_info,
1020 .mode = SPI_CPHA | SPI_CPOL,
1021 },
1022#endif
Michael Hennerich85a192e2009-01-07 23:14:38 +08001023#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
1024 {
1025 .modalias = "enc28j60",
1026 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
1027 .irq = IRQ_PF6,
1028 .bus_num = 0,
1029 .chip_select = 0, /* GPIO controlled SSEL */
1030 .controller_data = &enc28j60_spi_chip_info,
1031 .mode = SPI_MODE_0,
1032 },
1033#endif
Michael Hennerich57af8ed2009-10-16 12:35:20 +00001034#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1035 {
1036 .modalias = "adxl34x",
1037 .platform_data = &adxl34x_info,
1038 .irq = IRQ_PF6,
1039 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1040 .bus_num = 0,
1041 .chip_select = 2,
1042 .controller_data = &spi_adxl34x_chip_info,
1043 .mode = SPI_MODE_3,
1044 },
1045#endif
Michael Hennerichefaf7cd2009-11-12 16:54:08 +00001046#if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
1047 {
1048 .modalias = "adf702x",
1049 .max_speed_hz = 16000000, /* max spi clock (SCK) speed in HZ */
1050 .bus_num = 0,
1051 .chip_select = 0, /* GPIO controlled SSEL */
1052 .controller_data = &adf7021_spi_chip_info,
1053 .platform_data = &adf7021_platform_data,
1054 .mode = SPI_MODE_0,
1055 },
1056#endif
Michael Hennerichfe5b25c2010-02-04 14:41:39 +00001057#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
1058 {
1059 .modalias = "ads7846",
1060 .max_speed_hz = 2000000, /* max spi clock (SCK) speed in HZ */
1061 .bus_num = 0,
1062 .irq = IRQ_PF6,
1063 .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* GPIO controlled SSEL */
1064 .controller_data = &ad7873_spi_chip_info,
1065 .platform_data = &ad7873_pdata,
1066 .mode = SPI_MODE_0,
1067 },
1068#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001069};
1070
Mike Frysinger5bda2722008-06-07 15:03:01 +08001071#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -07001072/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001073static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -07001074 .num_chipselect = 8,
1075 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +08001076 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -07001077};
1078
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001079/* SPI (0) */
1080static struct resource bfin_spi0_resource[] = {
1081 [0] = {
1082 .start = SPI0_REGBASE,
1083 .end = SPI0_REGBASE + 0xFF,
1084 .flags = IORESOURCE_MEM,
1085 },
1086 [1] = {
1087 .start = CH_SPI,
1088 .end = CH_SPI,
Yi Lie68d1eb2009-06-03 09:46:22 +00001089 .flags = IORESOURCE_DMA,
1090 },
1091 [2] = {
1092 .start = IRQ_SPI,
1093 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001094 .flags = IORESOURCE_IRQ,
1095 },
1096};
1097
1098static struct platform_device bfin_spi0_device = {
1099 .name = "bfin-spi",
1100 .id = 0, /* Bus number */
1101 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1102 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -07001103 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001104 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -07001105 },
1106};
1107#endif /* spi master and devices */
1108
Cliff Cai1e9aa952009-03-28 23:28:51 +08001109#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1110
1111/* SPORT SPI controller data */
1112static struct bfin5xx_spi_master bfin_sport_spi0_info = {
1113 .num_chipselect = 1, /* master only supports one device */
1114 .enable_dma = 0, /* master don't support DMA */
1115 .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
1116 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1117};
1118
1119static struct resource bfin_sport_spi0_resource[] = {
1120 [0] = {
1121 .start = SPORT0_TCR1,
1122 .end = SPORT0_TCR1 + 0xFF,
1123 .flags = IORESOURCE_MEM,
1124 },
1125 [1] = {
1126 .start = IRQ_SPORT0_ERROR,
1127 .end = IRQ_SPORT0_ERROR,
1128 .flags = IORESOURCE_IRQ,
1129 },
1130};
1131
1132static struct platform_device bfin_sport_spi0_device = {
1133 .name = "bfin-sport-spi",
1134 .id = 1, /* Bus number */
1135 .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1136 .resource = bfin_sport_spi0_resource,
1137 .dev = {
1138 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1139 },
1140};
1141
1142static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1143 .num_chipselect = 1, /* master only supports one device */
1144 .enable_dma = 0, /* master don't support DMA */
1145 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1146 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1147};
1148
1149static struct resource bfin_sport_spi1_resource[] = {
1150 [0] = {
1151 .start = SPORT1_TCR1,
1152 .end = SPORT1_TCR1 + 0xFF,
1153 .flags = IORESOURCE_MEM,
1154 },
1155 [1] = {
1156 .start = IRQ_SPORT1_ERROR,
1157 .end = IRQ_SPORT1_ERROR,
1158 .flags = IORESOURCE_IRQ,
1159 },
1160};
1161
1162static struct platform_device bfin_sport_spi1_device = {
1163 .name = "bfin-sport-spi",
1164 .id = 2, /* Bus number */
1165 .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1166 .resource = bfin_sport_spi1_resource,
1167 .dev = {
1168 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1169 },
1170};
1171
1172#endif /* sport spi master and devices */
1173
Bryan Wu1394f032007-05-06 14:50:22 -07001174#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1175static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001176 .name = "bf537-lq035",
1177};
1178#endif
1179
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001180#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1181#include <asm/bfin-lq035q1.h>
1182
1183static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
Michael Hennerichd94a1aa2009-12-08 11:45:55 +00001184 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
1185 .ppi_mode = USE_RGB565_16_BIT_PPI,
1186 .use_bl = 0, /* let something else control the LCD Blacklight */
1187 .gpio_bl = GPIO_PF7,
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001188};
1189
1190static struct resource bfin_lq035q1_resources[] = {
1191 {
1192 .start = IRQ_PPI_ERROR,
1193 .end = IRQ_PPI_ERROR,
1194 .flags = IORESOURCE_IRQ,
1195 },
1196};
1197
1198static struct platform_device bfin_lq035q1_device = {
1199 .name = "bfin-lq035q1",
1200 .id = -1,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +00001201 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
1202 .resource = bfin_lq035q1_resources,
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001203 .dev = {
1204 .platform_data = &bfin_lq035q1_data,
1205 },
1206};
1207#endif
1208
Bryan Wu1394f032007-05-06 14:50:22 -07001209#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang233b28a2007-11-21 17:04:41 +08001210#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001211static struct resource bfin_uart0_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -07001212 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001213 .start = UART0_THR,
1214 .end = UART0_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -07001215 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +08001216 },
Sonic Zhang233b28a2007-11-21 17:04:41 +08001217 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001218 .start = IRQ_UART0_RX,
1219 .end = IRQ_UART0_RX+1,
1220 .flags = IORESOURCE_IRQ,
1221 },
1222 {
1223 .start = IRQ_UART0_ERROR,
1224 .end = IRQ_UART0_ERROR,
1225 .flags = IORESOURCE_IRQ,
1226 },
1227 {
1228 .start = CH_UART0_TX,
1229 .end = CH_UART0_TX,
1230 .flags = IORESOURCE_DMA,
1231 },
1232 {
1233 .start = CH_UART0_RX,
1234 .end = CH_UART0_RX,
1235 .flags = IORESOURCE_DMA,
1236 },
1237#ifdef CONFIG_BFIN_UART0_CTSRTS
1238 { /* CTS pin */
1239 .start = GPIO_PG7,
1240 .end = GPIO_PG7,
1241 .flags = IORESOURCE_IO,
1242 },
1243 { /* RTS pin */
1244 .start = GPIO_PG6,
1245 .end = GPIO_PG6,
1246 .flags = IORESOURCE_IO,
Bryan Wu1394f032007-05-06 14:50:22 -07001247 },
Sonic Zhang233b28a2007-11-21 17:04:41 +08001248#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001249};
1250
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001251unsigned short bfin_uart0_peripherals[] = {
1252 P_UART0_TX, P_UART0_RX, 0
1253};
1254
1255static struct platform_device bfin_uart0_device = {
1256 .name = "bfin-uart",
1257 .id = 0,
1258 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
1259 .resource = bfin_uart0_resources,
1260 .dev = {
1261 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
1262 },
1263};
1264#endif
1265#ifdef CONFIG_SERIAL_BFIN_UART1
1266static struct resource bfin_uart1_resources[] = {
1267 {
1268 .start = UART1_THR,
1269 .end = UART1_GCTL+2,
1270 .flags = IORESOURCE_MEM,
1271 },
1272 {
1273 .start = IRQ_UART1_RX,
1274 .end = IRQ_UART1_RX+1,
1275 .flags = IORESOURCE_IRQ,
1276 },
1277 {
1278 .start = IRQ_UART1_ERROR,
1279 .end = IRQ_UART1_ERROR,
1280 .flags = IORESOURCE_IRQ,
1281 },
1282 {
1283 .start = CH_UART1_TX,
1284 .end = CH_UART1_TX,
1285 .flags = IORESOURCE_DMA,
1286 },
1287 {
1288 .start = CH_UART1_RX,
1289 .end = CH_UART1_RX,
1290 .flags = IORESOURCE_DMA,
1291 },
1292};
1293
1294unsigned short bfin_uart1_peripherals[] = {
1295 P_UART1_TX, P_UART1_RX, 0
1296};
1297
1298static struct platform_device bfin_uart1_device = {
Bryan Wu1394f032007-05-06 14:50:22 -07001299 .name = "bfin-uart",
1300 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001301 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
1302 .resource = bfin_uart1_resources,
1303 .dev = {
1304 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
1305 },
Bryan Wu1394f032007-05-06 14:50:22 -07001306};
1307#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001308#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001309
Graf Yang5be36d22008-04-25 03:09:15 +08001310#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +08001311#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +08001312static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +08001313 {
1314 .start = 0xFFC00400,
1315 .end = 0xFFC004FF,
1316 .flags = IORESOURCE_MEM,
1317 },
Graf Yang42bd8bc2009-01-07 23:14:39 +08001318 {
1319 .start = IRQ_UART0_RX,
1320 .end = IRQ_UART0_RX+1,
1321 .flags = IORESOURCE_IRQ,
1322 },
1323 {
1324 .start = CH_UART0_RX,
1325 .end = CH_UART0_RX+1,
1326 .flags = IORESOURCE_DMA,
1327 },
1328};
1329
1330static struct platform_device bfin_sir0_device = {
1331 .name = "bfin_sir",
1332 .id = 0,
1333 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
1334 .resource = bfin_sir0_resources,
1335};
Graf Yang5be36d22008-04-25 03:09:15 +08001336#endif
1337#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +08001338static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +08001339 {
1340 .start = 0xFFC02000,
1341 .end = 0xFFC020FF,
1342 .flags = IORESOURCE_MEM,
1343 },
Graf Yang42bd8bc2009-01-07 23:14:39 +08001344 {
1345 .start = IRQ_UART1_RX,
1346 .end = IRQ_UART1_RX+1,
1347 .flags = IORESOURCE_IRQ,
1348 },
1349 {
1350 .start = CH_UART1_RX,
1351 .end = CH_UART1_RX+1,
1352 .flags = IORESOURCE_DMA,
1353 },
Graf Yang5be36d22008-04-25 03:09:15 +08001354};
1355
Graf Yang42bd8bc2009-01-07 23:14:39 +08001356static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +08001357 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +08001358 .id = 1,
1359 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
1360 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +08001361};
1362#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +08001363#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001364
Bryan Wu1394f032007-05-06 14:50:22 -07001365#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001366static struct resource bfin_twi0_resource[] = {
1367 [0] = {
1368 .start = TWI0_REGBASE,
1369 .end = TWI0_REGBASE,
1370 .flags = IORESOURCE_MEM,
1371 },
1372 [1] = {
1373 .start = IRQ_TWI,
1374 .end = IRQ_TWI,
1375 .flags = IORESOURCE_IRQ,
1376 },
1377};
1378
Bryan Wu1394f032007-05-06 14:50:22 -07001379static struct platform_device i2c_bfin_twi_device = {
1380 .name = "i2c-bfin-twi",
1381 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001382 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1383 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -07001384};
1385#endif
1386
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001387#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001388static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1389 [0] = KEY_GRAVE,
1390 [1] = KEY_1,
1391 [2] = KEY_2,
1392 [3] = KEY_3,
1393 [4] = KEY_4,
1394 [5] = KEY_5,
1395 [6] = KEY_6,
1396 [7] = KEY_7,
1397 [8] = KEY_8,
1398 [9] = KEY_9,
1399 [10] = KEY_0,
1400 [11] = KEY_MINUS,
1401 [12] = KEY_EQUAL,
1402 [13] = KEY_BACKSLASH,
1403 [15] = KEY_KP0,
1404 [16] = KEY_Q,
1405 [17] = KEY_W,
1406 [18] = KEY_E,
1407 [19] = KEY_R,
1408 [20] = KEY_T,
1409 [21] = KEY_Y,
1410 [22] = KEY_U,
1411 [23] = KEY_I,
1412 [24] = KEY_O,
1413 [25] = KEY_P,
1414 [26] = KEY_LEFTBRACE,
1415 [27] = KEY_RIGHTBRACE,
1416 [29] = KEY_KP1,
1417 [30] = KEY_KP2,
1418 [31] = KEY_KP3,
1419 [32] = KEY_A,
1420 [33] = KEY_S,
1421 [34] = KEY_D,
1422 [35] = KEY_F,
1423 [36] = KEY_G,
1424 [37] = KEY_H,
1425 [38] = KEY_J,
1426 [39] = KEY_K,
1427 [40] = KEY_L,
1428 [41] = KEY_SEMICOLON,
1429 [42] = KEY_APOSTROPHE,
1430 [43] = KEY_BACKSLASH,
1431 [45] = KEY_KP4,
1432 [46] = KEY_KP5,
1433 [47] = KEY_KP6,
1434 [48] = KEY_102ND,
1435 [49] = KEY_Z,
1436 [50] = KEY_X,
1437 [51] = KEY_C,
1438 [52] = KEY_V,
1439 [53] = KEY_B,
1440 [54] = KEY_N,
1441 [55] = KEY_M,
1442 [56] = KEY_COMMA,
1443 [57] = KEY_DOT,
1444 [58] = KEY_SLASH,
1445 [60] = KEY_KPDOT,
1446 [61] = KEY_KP7,
1447 [62] = KEY_KP8,
1448 [63] = KEY_KP9,
1449 [64] = KEY_SPACE,
1450 [65] = KEY_BACKSPACE,
1451 [66] = KEY_TAB,
1452 [67] = KEY_KPENTER,
1453 [68] = KEY_ENTER,
1454 [69] = KEY_ESC,
1455 [70] = KEY_DELETE,
1456 [74] = KEY_KPMINUS,
1457 [76] = KEY_UP,
1458 [77] = KEY_DOWN,
1459 [78] = KEY_RIGHT,
1460 [79] = KEY_LEFT,
1461};
1462
1463static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1464 .rows = 8,
1465 .cols = 10,
1466 .keymap = adp5588_keymap,
1467 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1468 .repeat = 0,
1469};
1470#endif
1471
Michael Hennerich3ea57212009-03-28 22:15:07 +08001472#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1473#include <linux/mfd/adp5520.h>
1474
1475 /*
1476 * ADP5520/5501 Backlight Data
1477 */
1478
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001479static struct adp5520_backlight_platform_data adp5520_backlight_data = {
1480 .fade_in = ADP5520_FADE_T_1200ms,
1481 .fade_out = ADP5520_FADE_T_1200ms,
1482 .fade_led_law = ADP5520_BL_LAW_LINEAR,
1483 .en_ambl_sens = 1,
1484 .abml_filt = ADP5520_BL_AMBL_FILT_640ms,
1485 .l1_daylight_max = ADP5520_BL_CUR_mA(15),
1486 .l1_daylight_dim = ADP5520_BL_CUR_mA(0),
1487 .l2_office_max = ADP5520_BL_CUR_mA(7),
1488 .l2_office_dim = ADP5520_BL_CUR_mA(0),
1489 .l3_dark_max = ADP5520_BL_CUR_mA(3),
1490 .l3_dark_dim = ADP5520_BL_CUR_mA(0),
1491 .l2_trip = ADP5520_L2_COMP_CURR_uA(700),
1492 .l2_hyst = ADP5520_L2_COMP_CURR_uA(50),
1493 .l3_trip = ADP5520_L3_COMP_CURR_uA(80),
1494 .l3_hyst = ADP5520_L3_COMP_CURR_uA(20),
Michael Hennerich3ea57212009-03-28 22:15:07 +08001495};
1496
1497 /*
1498 * ADP5520/5501 LEDs Data
1499 */
1500
Michael Hennerich3ea57212009-03-28 22:15:07 +08001501static struct led_info adp5520_leds[] = {
1502 {
1503 .name = "adp5520-led1",
1504 .default_trigger = "none",
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001505 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001506 },
1507#ifdef ADP5520_EN_ALL_LEDS
1508 {
1509 .name = "adp5520-led2",
1510 .default_trigger = "none",
1511 .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1512 },
1513 {
1514 .name = "adp5520-led3",
1515 .default_trigger = "none",
1516 .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1517 },
1518#endif
1519};
1520
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001521static struct adp5520_leds_platform_data adp5520_leds_data = {
Michael Hennerich3ea57212009-03-28 22:15:07 +08001522 .num_leds = ARRAY_SIZE(adp5520_leds),
1523 .leds = adp5520_leds,
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001524 .fade_in = ADP5520_FADE_T_600ms,
1525 .fade_out = ADP5520_FADE_T_600ms,
1526 .led_on_time = ADP5520_LED_ONT_600ms,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001527};
1528
1529 /*
1530 * ADP5520 GPIO Data
1531 */
1532
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001533static struct adp5520_gpio_platform_data adp5520_gpio_data = {
Michael Hennerich3ea57212009-03-28 22:15:07 +08001534 .gpio_start = 50,
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001535 .gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1536 .gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001537};
1538
1539 /*
1540 * ADP5520 Keypad Data
1541 */
1542
Michael Hennerich3ea57212009-03-28 22:15:07 +08001543static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001544 [ADP5520_KEY(0, 0)] = KEY_GRAVE,
1545 [ADP5520_KEY(0, 1)] = KEY_1,
1546 [ADP5520_KEY(0, 2)] = KEY_2,
1547 [ADP5520_KEY(0, 3)] = KEY_3,
1548 [ADP5520_KEY(1, 0)] = KEY_4,
1549 [ADP5520_KEY(1, 1)] = KEY_5,
1550 [ADP5520_KEY(1, 2)] = KEY_6,
1551 [ADP5520_KEY(1, 3)] = KEY_7,
1552 [ADP5520_KEY(2, 0)] = KEY_8,
1553 [ADP5520_KEY(2, 1)] = KEY_9,
1554 [ADP5520_KEY(2, 2)] = KEY_0,
1555 [ADP5520_KEY(2, 3)] = KEY_MINUS,
1556 [ADP5520_KEY(3, 0)] = KEY_EQUAL,
1557 [ADP5520_KEY(3, 1)] = KEY_BACKSLASH,
1558 [ADP5520_KEY(3, 2)] = KEY_BACKSPACE,
1559 [ADP5520_KEY(3, 3)] = KEY_ENTER,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001560};
1561
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001562static struct adp5520_keys_platform_data adp5520_keys_data = {
1563 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
1564 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001565 .keymap = adp5520_keymap,
1566 .keymapsize = ARRAY_SIZE(adp5520_keymap),
1567 .repeat = 0,
1568};
1569
1570 /*
1571 * ADP5520/5501 Multifuction Device Init Data
1572 */
1573
Michael Hennerich3ea57212009-03-28 22:15:07 +08001574static struct adp5520_platform_data adp5520_pdev_data = {
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001575 .backlight = &adp5520_backlight_data,
1576 .leds = &adp5520_leds_data,
1577 .gpio = &adp5520_gpio_data,
1578 .keys = &adp5520_keys_data,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001579};
1580
1581#endif
1582
Michael Hennerichba877d42009-08-27 04:09:32 +00001583#if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
Michael Hennerich1d23dc82009-10-05 13:33:11 +00001584static struct adp5588_gpio_platform_data adp5588_gpio_data = {
Michael Hennerichba877d42009-08-27 04:09:32 +00001585 .gpio_start = 50,
1586 .pullup_dis_mask = 0,
1587};
1588#endif
1589
Michael Hennerich78756c62009-10-13 15:28:33 +00001590#if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1591#include <linux/i2c/adp8870.h>
1592static struct led_info adp8870_leds[] = {
1593 {
1594 .name = "adp8870-led7",
1595 .default_trigger = "none",
1596 .flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
1597 },
1598};
1599
1600
1601static struct adp8870_backlight_platform_data adp8870_pdata = {
1602 .bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
1603 ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6, /* 1 = Backlight 0 = Individual LED */
1604 .pwm_assign = 0, /* 1 = Enables PWM mode */
1605
1606 .bl_fade_in = ADP8870_FADE_T_1200ms, /* Backlight Fade-In Timer */
1607 .bl_fade_out = ADP8870_FADE_T_1200ms, /* Backlight Fade-Out Timer */
1608 .bl_fade_law = ADP8870_FADE_LAW_CUBIC1, /* fade-on/fade-off transfer characteristic */
1609
1610 .en_ambl_sens = 1, /* 1 = enable ambient light sensor */
1611 .abml_filt = ADP8870_BL_AMBL_FILT_320ms, /* Light sensor filter time */
1612
1613 .l1_daylight_max = ADP8870_BL_CUR_mA(20), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1614 .l1_daylight_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1615 .l2_bright_max = ADP8870_BL_CUR_mA(14), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1616 .l2_bright_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1617 .l3_office_max = ADP8870_BL_CUR_mA(6), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1618 .l3_office_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1619 .l4_indoor_max = ADP8870_BL_CUR_mA(3), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1620 .l4_indor_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1621 .l5_dark_max = ADP8870_BL_CUR_mA(2), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1622 .l5_dark_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1623
1624 .l2_trip = ADP8870_L2_COMP_CURR_uA(710), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1625 .l2_hyst = ADP8870_L2_COMP_CURR_uA(73), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1626 .l3_trip = ADP8870_L3_COMP_CURR_uA(389), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1627 .l3_hyst = ADP8870_L3_COMP_CURR_uA(54), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1628 .l4_trip = ADP8870_L4_COMP_CURR_uA(167), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1629 .l4_hyst = ADP8870_L4_COMP_CURR_uA(16), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1630 .l5_trip = ADP8870_L5_COMP_CURR_uA(43), /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1631 .l5_hyst = ADP8870_L5_COMP_CURR_uA(11), /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1632
1633 .leds = adp8870_leds,
1634 .num_leds = ARRAY_SIZE(adp8870_leds),
1635 .led_fade_law = ADP8870_FADE_LAW_SQUARE, /* fade-on/fade-off transfer characteristic */
1636 .led_fade_in = ADP8870_FADE_T_600ms,
1637 .led_fade_out = ADP8870_FADE_T_600ms,
1638 .led_on_time = ADP8870_LED_ONT_200ms,
1639};
1640#endif
1641
Sonic Zhangf32792d2010-02-09 02:47:09 +00001642#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1643static struct regulator_consumer_supply ad5398_consumer = {
1644 .supply = "current",
1645};
1646
1647static struct regulator_init_data ad5398_regulator_data = {
1648 .constraints = {
1649 .name = "current range",
1650 .max_uA = 120000,
1651 .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
1652 },
1653 .num_consumer_supplies = 1,
1654 .consumer_supplies = &ad5398_consumer,
1655};
1656
1657static struct ad5398_platform_data ad5398_i2c_platform_data = {
1658 .current_bits = 10,
1659 .current_offset = 4,
1660 .regulator_data = &ad5398_regulator_data,
1661};
1662
1663#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
1664 defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
1665static struct platform_device ad5398_virt_consumer_device = {
1666 .name = "reg-virt-consumer",
1667 .id = 0,
1668 .dev = {
1669 .platform_data = "current", /* Passed to driver */
1670 },
1671};
1672#endif
1673#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
1674 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
1675static struct regulator_bulk_data ad5398_bulk_data = {
1676 .supply = "current",
1677};
1678
1679static struct regulator_userspace_consumer_data ad5398_userspace_comsumer_data = {
1680 .name = "ad5398",
1681 .num_supplies = 1,
1682 .supplies = &ad5398_bulk_data,
1683};
1684
1685static struct platform_device ad5398_userspace_consumer_device = {
1686 .name = "reg-userspace-consumer",
1687 .id = 0,
1688 .dev = {
1689 .platform_data = &ad5398_userspace_comsumer_data,
1690 },
1691};
1692#endif
1693#endif
1694
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001695static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Mike Frysinger5b7c5772009-10-12 15:56:58 +00001696#if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001697 {
Barry Song427f2772009-07-17 07:04:55 +00001698 I2C_BOARD_INFO("ad7142_captouch", 0x2C),
Barry Song4c94c3e2009-07-07 07:41:50 +00001699 .irq = IRQ_PG5,
Mike Frysinger5b7c5772009-10-12 15:56:58 +00001700 .platform_data = (void *)&ad7142_i2c_platform_data,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001701 },
1702#endif
Barry Songad6720c2010-02-03 09:15:31 +00001703
1704#if defined(CONFIG_AD7150) || defined(CONFIG_AD7150_MODULE)
1705 {
1706 I2C_BOARD_INFO("ad7150", 0x48),
1707 .irq = IRQ_PG5, /* fixme: use real interrupt number */
1708 },
1709#endif
1710
1711#if defined(CONFIG_AD7152) || defined(CONFIG_AD7152_MODULE)
1712 {
1713 I2C_BOARD_INFO("ad7152", 0x48),
1714 },
1715#endif
1716
1717#if defined(CONFIG_AD774X) || defined(CONFIG_AD774X_MODULE)
1718 {
1719 I2C_BOARD_INFO("ad774x", 0x48),
1720 },
1721#endif
1722
Michael Hennerichebd58332009-07-02 11:00:38 +00001723#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001724 {
1725 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001726 },
1727#endif
Michael Hennerich204844e2009-06-30 14:57:22 +00001728#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001729 {
1730 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Michael Hennerichf5150152008-10-16 23:23:18 +08001731 .irq = IRQ_PG6,
1732 },
1733#endif
1734#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1735 {
1736 I2C_BOARD_INFO("ad7879", 0x2F),
1737 .irq = IRQ_PG5,
1738 .platform_data = (void *)&bfin_ad7879_ts_info,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001739 },
1740#endif
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001741#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1742 {
1743 I2C_BOARD_INFO("adp5588-keys", 0x34),
1744 .irq = IRQ_PG0,
1745 .platform_data = (void *)&adp5588_kpad_data,
1746 },
1747#endif
Michael Hennerich3ea57212009-03-28 22:15:07 +08001748#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1749 {
1750 I2C_BOARD_INFO("pmic-adp5520", 0x32),
Mike Frysinger4f84b6e2009-06-10 20:45:48 -04001751 .irq = IRQ_PG0,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001752 .platform_data = (void *)&adp5520_pdev_data,
1753 },
1754#endif
Michael Hennerichffc4d8b2009-05-29 15:41:18 +00001755#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1756 {
1757 I2C_BOARD_INFO("adxl34x", 0x53),
1758 .irq = IRQ_PG3,
1759 .platform_data = (void *)&adxl34x_info,
1760 },
1761#endif
Michael Hennerichba877d42009-08-27 04:09:32 +00001762#if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1763 {
1764 I2C_BOARD_INFO("adp5588-gpio", 0x34),
1765 .platform_data = (void *)&adp5588_gpio_data,
1766 },
1767#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +00001768#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1769 {
1770 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1771 },
1772#endif
Michael Hennerichddcd7cb2009-09-22 15:36:55 +00001773#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1774 {
1775 I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
1776 },
1777#endif
Michael Hennerich78756c62009-10-13 15:28:33 +00001778#if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1779 {
1780 I2C_BOARD_INFO("adp8870", 0x2B),
1781 .platform_data = (void *)&adp8870_pdata,
1782 },
1783#endif
Cliff Caid53127f2009-10-15 02:33:04 +00001784#if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
1785 {
1786 I2C_BOARD_INFO("adau1371", 0x1A),
1787 },
1788#endif
Cliff Cai04267632009-10-28 06:50:36 +00001789#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1790 {
1791 I2C_BOARD_INFO("adau1761", 0x38),
1792 },
1793#endif
Michael Hennerich1f13f2f2009-11-17 10:18:27 +00001794#if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
1795 {
1796 I2C_BOARD_INFO("ad5258", 0x18),
1797 },
1798#endif
Cliff Cai29bb3bc2010-01-14 08:28:38 +00001799#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1800 {
1801 I2C_BOARD_INFO("ssm2602", 0x1b),
1802 },
1803#endif
Sonic Zhangf32792d2010-02-09 02:47:09 +00001804#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
1805 {
1806 I2C_BOARD_INFO("ad5398", 0xC),
1807 .platform_data = (void *)&ad5398_i2c_platform_data,
1808 },
1809#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001810};
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001811
Bryan Wu1394f032007-05-06 14:50:22 -07001812#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001813#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1814static struct resource bfin_sport0_uart_resources[] = {
1815 {
1816 .start = SPORT0_TCR1,
1817 .end = SPORT0_MRCS3+4,
1818 .flags = IORESOURCE_MEM,
1819 },
1820 {
1821 .start = IRQ_SPORT0_RX,
1822 .end = IRQ_SPORT0_RX+1,
1823 .flags = IORESOURCE_IRQ,
1824 },
1825 {
1826 .start = IRQ_SPORT0_ERROR,
1827 .end = IRQ_SPORT0_ERROR,
1828 .flags = IORESOURCE_IRQ,
1829 },
1830};
1831
1832unsigned short bfin_sport0_peripherals[] = {
1833 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1834 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
1835};
1836
Bryan Wu1394f032007-05-06 14:50:22 -07001837static struct platform_device bfin_sport0_uart_device = {
1838 .name = "bfin-sport-uart",
1839 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001840 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1841 .resource = bfin_sport0_uart_resources,
1842 .dev = {
1843 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1844 },
1845};
1846#endif
1847#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1848static struct resource bfin_sport1_uart_resources[] = {
1849 {
1850 .start = SPORT1_TCR1,
1851 .end = SPORT1_MRCS3+4,
1852 .flags = IORESOURCE_MEM,
1853 },
1854 {
1855 .start = IRQ_SPORT1_RX,
1856 .end = IRQ_SPORT1_RX+1,
1857 .flags = IORESOURCE_IRQ,
1858 },
1859 {
1860 .start = IRQ_SPORT1_ERROR,
1861 .end = IRQ_SPORT1_ERROR,
1862 .flags = IORESOURCE_IRQ,
1863 },
1864};
1865
1866unsigned short bfin_sport1_peripherals[] = {
1867 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1868 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
Bryan Wu1394f032007-05-06 14:50:22 -07001869};
1870
1871static struct platform_device bfin_sport1_uart_device = {
1872 .name = "bfin-sport-uart",
1873 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001874 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1875 .resource = bfin_sport1_uart_resources,
1876 .dev = {
1877 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1878 },
Bryan Wu1394f032007-05-06 14:50:22 -07001879};
1880#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001881#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001882
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001883#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001884#define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1885/* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001886
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001887#ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1888#define PATA_INT IRQ_PF5
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001889static struct pata_platform_info bfin_pata_platform_data = {
1890 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +08001891 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001892};
1893
1894static struct resource bfin_pata_resources[] = {
1895 {
1896 .start = 0x20314020,
1897 .end = 0x2031403F,
1898 .flags = IORESOURCE_MEM,
1899 },
1900 {
1901 .start = 0x2031401C,
1902 .end = 0x2031401F,
1903 .flags = IORESOURCE_MEM,
1904 },
1905 {
1906 .start = PATA_INT,
1907 .end = PATA_INT,
1908 .flags = IORESOURCE_IRQ,
1909 },
1910};
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001911#elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
1912static struct pata_platform_info bfin_pata_platform_data = {
1913 .ioport_shift = 0,
1914};
Michael Hennerich648882d2009-04-21 12:05:50 +00001915/* CompactFlash Storage Card Memory Mapped Adressing
1916 * /REG = A11 = 1
1917 */
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001918static struct resource bfin_pata_resources[] = {
1919 {
Michael Hennerich648882d2009-04-21 12:05:50 +00001920 .start = 0x20211800,
1921 .end = 0x20211807,
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001922 .flags = IORESOURCE_MEM,
1923 },
1924 {
Michael Hennerich648882d2009-04-21 12:05:50 +00001925 .start = 0x2021180E, /* Device Ctl */
1926 .end = 0x2021180E,
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001927 .flags = IORESOURCE_MEM,
1928 },
1929};
1930#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001931
1932static struct platform_device bfin_pata_device = {
1933 .name = "pata_platform",
1934 .id = -1,
1935 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1936 .resource = bfin_pata_resources,
1937 .dev = {
1938 .platform_data = &bfin_pata_platform_data,
1939 }
1940};
1941#endif
1942
Michael Hennerich14b03202008-05-07 11:41:26 +08001943static const unsigned int cclk_vlev_datasheet[] =
1944{
1945 VRPAIR(VLEV_085, 250000000),
1946 VRPAIR(VLEV_090, 376000000),
1947 VRPAIR(VLEV_095, 426000000),
1948 VRPAIR(VLEV_100, 426000000),
1949 VRPAIR(VLEV_105, 476000000),
1950 VRPAIR(VLEV_110, 476000000),
1951 VRPAIR(VLEV_115, 476000000),
1952 VRPAIR(VLEV_120, 500000000),
1953 VRPAIR(VLEV_125, 533000000),
1954 VRPAIR(VLEV_130, 600000000),
1955};
1956
1957static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1958 .tuple_tab = cclk_vlev_datasheet,
1959 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1960 .vr_settling_time = 25 /* us */,
1961};
1962
1963static struct platform_device bfin_dpmc = {
1964 .name = "bfin dpmc",
1965 .dev = {
1966 .platform_data = &bfin_dmpc_vreg_data,
1967 },
1968};
1969
Barry Song336746e2009-10-13 09:19:18 +00001970#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1971static struct platform_device bfin_i2s = {
1972 .name = "bfin-i2s",
1973 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1974 /* TODO: add platform data here */
1975};
1976#endif
1977
Barry Song83124402009-08-06 21:03:02 +00001978#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1979static struct platform_device bfin_tdm = {
1980 .name = "bfin-tdm",
Barry Song336746e2009-10-13 09:19:18 +00001981 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1982 /* TODO: add platform data here */
1983};
1984#endif
1985
1986#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1987static struct platform_device bfin_ac97 = {
1988 .name = "bfin-ac97",
1989 .id = CONFIG_SND_BF5XX_SPORT_NUM,
Barry Song83124402009-08-06 21:03:02 +00001990 /* TODO: add platform data here */
1991};
1992#endif
1993
Bryan Wu1394f032007-05-06 14:50:22 -07001994static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001995
1996 &bfin_dpmc,
1997
Bryan Wu1394f032007-05-06 14:50:22 -07001998#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1999 &bfin_pcmcia_cf_device,
2000#endif
2001
2002#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
2003 &rtc_device,
2004#endif
2005
2006#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
2007 &sl811_hcd_device,
2008#endif
2009
2010#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
2011 &isp1362_hcd_device,
2012#endif
2013
Michael Hennerich3f375692008-11-18 17:48:22 +08002014#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
2015 &bfin_isp1760_device,
2016#endif
2017
Bryan Wu1394f032007-05-06 14:50:22 -07002018#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
2019 &smc91x_device,
2020#endif
2021
Alex Landauf40d24d2007-07-12 12:11:48 +08002022#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
2023 &dm9000_device,
2024#endif
2025
Barry Song706a01b2009-11-02 07:29:07 +00002026#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
2027 &bfin_can_device,
2028#endif
2029
Bryan Wu1394f032007-05-06 14:50:22 -07002030#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08002031 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -07002032 &bfin_mac_device,
2033#endif
2034
2035#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
2036 &net2272_bfin_device,
2037#endif
2038
2039#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002040 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -07002041#endif
2042
Cliff Cai1e9aa952009-03-28 23:28:51 +08002043#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
2044 &bfin_sport_spi0_device,
2045 &bfin_sport_spi1_device,
2046#endif
2047
Bryan Wu1394f032007-05-06 14:50:22 -07002048#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
2049 &bfin_fb_device,
2050#endif
2051
Michael Hennerich2043f3f2008-10-13 14:46:30 +08002052#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
2053 &bfin_lq035q1_device,
2054#endif
2055
Bryan Wu1394f032007-05-06 14:50:22 -07002056#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00002057#ifdef CONFIG_SERIAL_BFIN_UART0
2058 &bfin_uart0_device,
2059#endif
2060#ifdef CONFIG_SERIAL_BFIN_UART1
2061 &bfin_uart1_device,
2062#endif
Bryan Wu1394f032007-05-06 14:50:22 -07002063#endif
2064
Graf Yang5be36d22008-04-25 03:09:15 +08002065#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08002066#ifdef CONFIG_BFIN_SIR0
2067 &bfin_sir0_device,
2068#endif
2069#ifdef CONFIG_BFIN_SIR1
2070 &bfin_sir1_device,
2071#endif
Graf Yang5be36d22008-04-25 03:09:15 +08002072#endif
2073
Bryan Wu1394f032007-05-06 14:50:22 -07002074#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
2075 &i2c_bfin_twi_device,
2076#endif
2077
2078#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00002079#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Bryan Wu1394f032007-05-06 14:50:22 -07002080 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00002081#endif
2082#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Bryan Wu1394f032007-05-06 14:50:22 -07002083 &bfin_sport1_uart_device,
2084#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00002085#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002086
2087#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2088 &bfin_pata_device,
2089#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +08002090
2091#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2092 &bfin_device_gpiokeys,
2093#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08002094
Mike Frysingerfc689112008-06-25 11:41:42 +08002095#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
2096 &bfin_async_nand_device,
2097#endif
2098
Mike Frysinger793dc272008-03-26 08:09:12 +08002099#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +08002100 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08002101#endif
Barry Song83124402009-08-06 21:03:02 +00002102
Barry Song336746e2009-10-13 09:19:18 +00002103#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2104 &bfin_i2s,
2105#endif
2106
Barry Song83124402009-08-06 21:03:02 +00002107#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2108 &bfin_tdm,
2109#endif
Barry Song336746e2009-10-13 09:19:18 +00002110
2111#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2112 &bfin_ac97,
2113#endif
Sonic Zhangf32792d2010-02-09 02:47:09 +00002114#if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
2115#if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
2116 defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
2117 &ad5398_virt_consumer_device,
2118#endif
2119#if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
2120 defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
2121 &ad5398_userspace_consumer_device,
2122#endif
2123#endif
Bryan Wu1394f032007-05-06 14:50:22 -07002124};
2125
2126static int __init stamp_init(void)
2127{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08002128 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Mike Frysingerfc689112008-06-25 11:41:42 +08002129 bfin_plat_nand_init();
Mike Frysinger0531c462010-01-19 07:04:29 +00002130 adf702x_mac_init();
Bryan Wu1394f032007-05-06 14:50:22 -07002131 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Sonic Zhangdf5de262009-09-23 05:01:56 +00002132 i2c_register_board_info(0, bfin_i2c_board_info,
2133 ARRAY_SIZE(bfin_i2c_board_info));
Mike Frysinger5bda2722008-06-07 15:03:01 +08002134 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002135
Bryan Wu1394f032007-05-06 14:50:22 -07002136 return 0;
2137}
2138
2139arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002140
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00002141
2142static struct platform_device *stamp_early_devices[] __initdata = {
2143#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2144#ifdef CONFIG_SERIAL_BFIN_UART0
2145 &bfin_uart0_device,
2146#endif
2147#ifdef CONFIG_SERIAL_BFIN_UART1
2148 &bfin_uart1_device,
2149#endif
2150#endif
2151
2152#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
2153#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2154 &bfin_sport0_uart_device,
2155#endif
2156#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2157 &bfin_sport1_uart_device,
2158#endif
2159#endif
2160};
2161
2162void __init native_machine_early_platform_add_devices(void)
2163{
2164 printk(KERN_INFO "register early platform devices\n");
2165 early_platform_add_devices(stamp_early_devices,
2166 ARRAY_SIZE(stamp_early_devices));
2167}
2168
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002169void native_machine_restart(char *cmd)
2170{
2171 /* workaround reboot hang when booting from SPI */
2172 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08002173 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08002174}
Mike Frysinger137b1522007-11-22 16:07:03 +08002175
2176/*
2177 * Currently the MAC address is saved in Flash by U-Boot
2178 */
2179#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +08002180void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08002181{
2182 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
2183 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
2184}
Mike Frysinger9862cc52007-11-15 21:21:20 +08002185EXPORT_SYMBOL(bfin_get_ether_addr);