Blackfin: bf537-stamp: add adau1761 i2c address
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / blackfin / mach-bf537 / boards / stamp.c
blob2ba6f3687d61595f266c3216bb16438a315d0c92
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
7 */
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/ata_platform.h>
24 #include <linux/irq.h>
25 #include <linux/interrupt.h>
26 #include <linux/i2c.h>
27 #include <linux/usb/sl811.h>
28 #include <linux/spi/mmc_spi.h>
29 #include <linux/leds.h>
30 #include <linux/input.h>
31 #include <asm/dma.h>
32 #include <asm/bfin5xx_spi.h>
33 #include <asm/reboot.h>
34 #include <asm/portmux.h>
35 #include <asm/dpmc.h>
38 * Name the Board for the /proc/cpuinfo
40 const char bfin_board_name[] = "ADI BF537-STAMP";
43 * Driver needs to know address, irq and flag pin.
46 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
47 #include <linux/usb/isp1760.h>
48 static struct resource bfin_isp1760_resources[] = {
49 [0] = {
50 .start = 0x203C0000,
51 .end = 0x203C0000 + 0x000fffff,
52 .flags = IORESOURCE_MEM,
54 [1] = {
55 .start = IRQ_PF7,
56 .end = IRQ_PF7,
57 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
61 static struct isp1760_platform_data isp1760_priv = {
62 .is_isp1761 = 0,
63 .bus_width_16 = 1,
64 .port1_otg = 0,
65 .analog_oc = 0,
66 .dack_polarity_high = 0,
67 .dreq_polarity_high = 0,
70 static struct platform_device bfin_isp1760_device = {
71 .name = "isp1760",
72 .id = 0,
73 .dev = {
74 .platform_data = &isp1760_priv,
76 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
77 .resource = bfin_isp1760_resources,
79 #endif
81 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
82 #include <linux/gpio_keys.h>
84 static struct gpio_keys_button bfin_gpio_keys_table[] = {
85 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
86 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
87 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
88 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
91 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
92 .buttons = bfin_gpio_keys_table,
93 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
96 static struct platform_device bfin_device_gpiokeys = {
97 .name = "gpio-keys",
98 .dev = {
99 .platform_data = &bfin_gpio_keys_data,
102 #endif
104 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
105 static struct resource bfin_pcmcia_cf_resources[] = {
107 .start = 0x20310000, /* IO PORT */
108 .end = 0x20312000,
109 .flags = IORESOURCE_MEM,
110 }, {
111 .start = 0x20311000, /* Attribute Memory */
112 .end = 0x20311FFF,
113 .flags = IORESOURCE_MEM,
114 }, {
115 .start = IRQ_PF4,
116 .end = IRQ_PF4,
117 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
118 }, {
119 .start = 6, /* Card Detect PF6 */
120 .end = 6,
121 .flags = IORESOURCE_IRQ,
125 static struct platform_device bfin_pcmcia_cf_device = {
126 .name = "bfin_cf_pcmcia",
127 .id = -1,
128 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
129 .resource = bfin_pcmcia_cf_resources,
131 #endif
133 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
134 static struct platform_device rtc_device = {
135 .name = "rtc-bfin",
136 .id = -1,
138 #endif
140 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
141 #include <linux/smc91x.h>
143 static struct smc91x_platdata smc91x_info = {
144 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
145 .leda = RPC_LED_100_10,
146 .ledb = RPC_LED_TX_RX,
149 static struct resource smc91x_resources[] = {
151 .name = "smc91x-regs",
152 .start = 0x20300300,
153 .end = 0x20300300 + 16,
154 .flags = IORESOURCE_MEM,
155 }, {
157 .start = IRQ_PF7,
158 .end = IRQ_PF7,
159 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
162 static struct platform_device smc91x_device = {
163 .name = "smc91x",
164 .id = 0,
165 .num_resources = ARRAY_SIZE(smc91x_resources),
166 .resource = smc91x_resources,
167 .dev = {
168 .platform_data = &smc91x_info,
171 #endif
173 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
174 static struct resource dm9000_resources[] = {
175 [0] = {
176 .start = 0x203FB800,
177 .end = 0x203FB800 + 1,
178 .flags = IORESOURCE_MEM,
180 [1] = {
181 .start = 0x203FB804,
182 .end = 0x203FB804 + 1,
183 .flags = IORESOURCE_MEM,
185 [2] = {
186 .start = IRQ_PF9,
187 .end = IRQ_PF9,
188 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
192 static struct platform_device dm9000_device = {
193 .name = "dm9000",
194 .id = -1,
195 .num_resources = ARRAY_SIZE(dm9000_resources),
196 .resource = dm9000_resources,
198 #endif
200 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
201 static struct resource ax88180_resources[] = {
202 [0] = {
203 .start = 0x20300000,
204 .end = 0x20300000 + 0x8000,
205 .flags = IORESOURCE_MEM,
207 [1] = {
208 .start = IRQ_PF7,
209 .end = IRQ_PF7,
210 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
214 static struct platform_device ax88180_device = {
215 .name = "ax88180",
216 .id = -1,
217 .num_resources = ARRAY_SIZE(ax88180_resources),
218 .resource = ax88180_resources,
220 #endif
222 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
223 static struct resource sl811_hcd_resources[] = {
225 .start = 0x20340000,
226 .end = 0x20340000,
227 .flags = IORESOURCE_MEM,
228 }, {
229 .start = 0x20340004,
230 .end = 0x20340004,
231 .flags = IORESOURCE_MEM,
232 }, {
233 .start = CONFIG_USB_SL811_BFIN_IRQ,
234 .end = CONFIG_USB_SL811_BFIN_IRQ,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
239 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
240 void sl811_port_power(struct device *dev, int is_on)
242 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
243 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
245 #endif
247 static struct sl811_platform_data sl811_priv = {
248 .potpg = 10,
249 .power = 250, /* == 500mA */
250 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
251 .port_power = &sl811_port_power,
252 #endif
255 static struct platform_device sl811_hcd_device = {
256 .name = "sl811-hcd",
257 .id = 0,
258 .dev = {
259 .platform_data = &sl811_priv,
261 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
262 .resource = sl811_hcd_resources,
264 #endif
266 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
267 static struct resource isp1362_hcd_resources[] = {
269 .start = 0x20360000,
270 .end = 0x20360000,
271 .flags = IORESOURCE_MEM,
272 }, {
273 .start = 0x20360004,
274 .end = 0x20360004,
275 .flags = IORESOURCE_MEM,
276 }, {
277 .start = IRQ_PF3,
278 .end = IRQ_PF3,
279 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
283 static struct isp1362_platform_data isp1362_priv = {
284 .sel15Kres = 1,
285 .clknotstop = 0,
286 .oc_enable = 0,
287 .int_act_high = 0,
288 .int_edge_triggered = 0,
289 .remote_wakeup_connected = 0,
290 .no_power_switching = 1,
291 .power_switching_mode = 0,
294 static struct platform_device isp1362_hcd_device = {
295 .name = "isp1362-hcd",
296 .id = 0,
297 .dev = {
298 .platform_data = &isp1362_priv,
300 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
301 .resource = isp1362_hcd_resources,
303 #endif
305 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
306 static struct platform_device bfin_mii_bus = {
307 .name = "bfin_mii_bus",
310 static struct platform_device bfin_mac_device = {
311 .name = "bfin_mac",
312 .dev.platform_data = &bfin_mii_bus,
314 #endif
316 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
317 static struct resource net2272_bfin_resources[] = {
319 .start = 0x20300000,
320 .end = 0x20300000 + 0x100,
321 .flags = IORESOURCE_MEM,
322 }, {
323 .start = IRQ_PF7,
324 .end = IRQ_PF7,
325 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
329 static struct platform_device net2272_bfin_device = {
330 .name = "net2272",
331 .id = -1,
332 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
333 .resource = net2272_bfin_resources,
335 #endif
337 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
338 #ifdef CONFIG_MTD_PARTITIONS
339 const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
341 static struct mtd_partition bfin_plat_nand_partitions[] = {
343 .name = "linux kernel(nand)",
344 .size = 0x400000,
345 .offset = 0,
346 }, {
347 .name = "file system(nand)",
348 .size = MTDPART_SIZ_FULL,
349 .offset = MTDPART_OFS_APPEND,
352 #endif
354 #define BFIN_NAND_PLAT_CLE 2
355 #define BFIN_NAND_PLAT_ALE 1
356 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
358 struct nand_chip *this = mtd->priv;
360 if (cmd == NAND_CMD_NONE)
361 return;
363 if (ctrl & NAND_CLE)
364 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
365 else
366 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
369 #define BFIN_NAND_PLAT_READY GPIO_PF3
370 static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
372 return gpio_get_value(BFIN_NAND_PLAT_READY);
375 static struct platform_nand_data bfin_plat_nand_data = {
376 .chip = {
377 .chip_delay = 30,
378 #ifdef CONFIG_MTD_PARTITIONS
379 .part_probe_types = part_probes,
380 .partitions = bfin_plat_nand_partitions,
381 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
382 #endif
384 .ctrl = {
385 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
386 .dev_ready = bfin_plat_nand_dev_ready,
390 #define MAX(x, y) (x > y ? x : y)
391 static struct resource bfin_plat_nand_resources = {
392 .start = 0x20212000,
393 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
394 .flags = IORESOURCE_IO,
397 static struct platform_device bfin_async_nand_device = {
398 .name = "gen_nand",
399 .id = -1,
400 .num_resources = 1,
401 .resource = &bfin_plat_nand_resources,
402 .dev = {
403 .platform_data = &bfin_plat_nand_data,
407 static void bfin_plat_nand_init(void)
409 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
411 #else
412 static void bfin_plat_nand_init(void) {}
413 #endif
415 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
416 static struct mtd_partition stamp_partitions[] = {
418 .name = "bootloader(nor)",
419 .size = 0x40000,
420 .offset = 0,
421 }, {
422 .name = "linux kernel(nor)",
423 .size = 0x180000,
424 .offset = MTDPART_OFS_APPEND,
425 }, {
426 .name = "file system(nor)",
427 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
428 .offset = MTDPART_OFS_APPEND,
429 }, {
430 .name = "MAC Address(nor)",
431 .size = MTDPART_SIZ_FULL,
432 .offset = 0x3F0000,
433 .mask_flags = MTD_WRITEABLE,
437 static struct physmap_flash_data stamp_flash_data = {
438 .width = 2,
439 .parts = stamp_partitions,
440 .nr_parts = ARRAY_SIZE(stamp_partitions),
443 static struct resource stamp_flash_resource = {
444 .start = 0x20000000,
445 .end = 0x203fffff,
446 .flags = IORESOURCE_MEM,
449 static struct platform_device stamp_flash_device = {
450 .name = "physmap-flash",
451 .id = 0,
452 .dev = {
453 .platform_data = &stamp_flash_data,
455 .num_resources = 1,
456 .resource = &stamp_flash_resource,
458 #endif
460 #if defined(CONFIG_MTD_M25P80) \
461 || defined(CONFIG_MTD_M25P80_MODULE)
462 static struct mtd_partition bfin_spi_flash_partitions[] = {
464 .name = "bootloader(spi)",
465 .size = 0x00040000,
466 .offset = 0,
467 .mask_flags = MTD_CAP_ROM
468 }, {
469 .name = "linux kernel(spi)",
470 .size = 0x180000,
471 .offset = MTDPART_OFS_APPEND,
472 }, {
473 .name = "file system(spi)",
474 .size = MTDPART_SIZ_FULL,
475 .offset = MTDPART_OFS_APPEND,
479 static struct flash_platform_data bfin_spi_flash_data = {
480 .name = "m25p80",
481 .parts = bfin_spi_flash_partitions,
482 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
483 /* .type = "m25p64", */
486 /* SPI flash chip (m25p64) */
487 static struct bfin5xx_spi_chip spi_flash_chip_info = {
488 .enable_dma = 0, /* use dma transfer with this chip*/
489 .bits_per_word = 8,
491 #endif
493 #if defined(CONFIG_BFIN_SPI_ADC) \
494 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
495 /* SPI ADC chip */
496 static struct bfin5xx_spi_chip spi_adc_chip_info = {
497 .enable_dma = 1, /* use dma transfer with this chip*/
498 .bits_per_word = 16,
500 #endif
502 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
503 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
504 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
505 .enable_dma = 0,
506 .bits_per_word = 16,
508 #endif
510 #if defined(CONFIG_SND_BF5XX_SOC_AD1938) \
511 || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
512 static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
513 .enable_dma = 0,
514 .bits_per_word = 8,
515 .cs_gpio = GPIO_PF5,
517 #endif
519 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
520 #include <linux/input/ad714x.h>
521 static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
522 .enable_dma = 0,
523 .bits_per_word = 16,
526 static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
528 .start_stage = 0,
529 .end_stage = 7,
530 .max_coord = 128,
534 static struct ad714x_button_plat ad7147_spi_button_plat[] = {
536 .keycode = BTN_FORWARD,
537 .l_mask = 0,
538 .h_mask = 0x600,
541 .keycode = BTN_LEFT,
542 .l_mask = 0,
543 .h_mask = 0x500,
546 .keycode = BTN_MIDDLE,
547 .l_mask = 0,
548 .h_mask = 0x800,
551 .keycode = BTN_RIGHT,
552 .l_mask = 0x100,
553 .h_mask = 0x400,
556 .keycode = BTN_BACK,
557 .l_mask = 0x200,
558 .h_mask = 0x400,
561 static struct ad714x_platform_data ad7147_spi_platform_data = {
562 .slider_num = 1,
563 .button_num = 5,
564 .slider = ad7147_spi_slider_plat,
565 .button = ad7147_spi_button_plat,
566 .stage_cfg_reg = {
567 {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
568 {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
569 {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
570 {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
571 {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
572 {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
573 {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
574 {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
575 {0xFF7B, 0x3FFF, 0x506, 0x2626, 1100, 1100, 1150, 1150},
576 {0xFDFE, 0x3FFF, 0x606, 0x2626, 1100, 1100, 1150, 1150},
577 {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
578 {0xFFEF, 0x1FFF, 0x0, 0x2626, 1100, 1100, 1150, 1150},
580 .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
582 #endif
584 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
585 #include <linux/input/ad714x.h>
586 static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
588 .keycode = BTN_1,
589 .l_mask = 0,
590 .h_mask = 0x1,
593 .keycode = BTN_2,
594 .l_mask = 0,
595 .h_mask = 0x2,
598 .keycode = BTN_3,
599 .l_mask = 0,
600 .h_mask = 0x4,
603 .keycode = BTN_4,
604 .l_mask = 0x0,
605 .h_mask = 0x8,
608 static struct ad714x_platform_data ad7142_i2c_platform_data = {
609 .button_num = 4,
610 .button = ad7142_i2c_button_plat,
611 .stage_cfg_reg = {
612 /* fixme: figure out right setting for all comoponent according
613 * to hardware feature of EVAL-AD7142EB board */
614 {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
615 {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
616 {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
617 {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
618 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
619 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
620 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
621 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
622 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
623 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
624 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
625 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
627 .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
629 #endif
631 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
632 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
634 static int bfin_mmc_spi_init(struct device *dev,
635 irqreturn_t (*detect_int)(int, void *), void *data)
637 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
638 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
641 static void bfin_mmc_spi_exit(struct device *dev, void *data)
643 free_irq(MMC_SPI_CARD_DETECT_INT, data);
646 static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
647 .init = bfin_mmc_spi_init,
648 .exit = bfin_mmc_spi_exit,
649 .detect_delay = 100, /* msecs */
652 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
653 .enable_dma = 0,
654 .bits_per_word = 8,
655 .pio_interrupt = 0,
657 #endif
659 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
660 #include <linux/spi/ad7877.h>
661 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
662 .enable_dma = 0,
663 .bits_per_word = 16,
666 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
667 .model = 7877,
668 .vref_delay_usecs = 50, /* internal, no capacitor */
669 .x_plate_ohms = 419,
670 .y_plate_ohms = 486,
671 .pressure_max = 1000,
672 .pressure_min = 0,
673 .stopacq_polarity = 1,
674 .first_conversion_delay = 3,
675 .acquisition_time = 1,
676 .averaging = 1,
677 .pen_down_acc_interval = 1,
679 #endif
681 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
682 #include <linux/spi/ad7879.h>
683 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
684 .model = 7879, /* Model = AD7879 */
685 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
686 .pressure_max = 10000,
687 .pressure_min = 0,
688 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
689 .acquisition_time = 1, /* 4us acquisition time per sample */
690 .median = 2, /* do 8 measurements */
691 .averaging = 1, /* take the average of 4 middle samples */
692 .pen_down_acc_interval = 255, /* 9.4 ms */
693 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
694 .gpio_default = 1, /* During initialization set GPIO = HIGH */
696 #endif
698 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
699 #include <linux/input/adxl34x.h>
700 static const struct adxl34x_platform_data adxl34x_info = {
701 .x_axis_offset = 0,
702 .y_axis_offset = 0,
703 .z_axis_offset = 0,
704 .tap_threshold = 0x31,
705 .tap_duration = 0x10,
706 .tap_latency = 0x60,
707 .tap_window = 0xF0,
708 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
709 .act_axis_control = 0xFF,
710 .activity_threshold = 5,
711 .inactivity_threshold = 3,
712 .inactivity_time = 4,
713 .free_fall_threshold = 0x7,
714 .free_fall_time = 0x20,
715 .data_rate = 0x8,
716 .data_range = ADXL_FULL_RES,
718 .ev_type = EV_ABS,
719 .ev_code_x = ABS_X, /* EV_REL */
720 .ev_code_y = ABS_Y, /* EV_REL */
721 .ev_code_z = ABS_Z, /* EV_REL */
723 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
725 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
726 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
727 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
728 .fifo_mode = ADXL_FIFO_STREAM,
730 #endif
732 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
733 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
734 .enable_dma = 0,
735 .bits_per_word = 16,
737 #endif
739 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
740 static struct bfin5xx_spi_chip spidev_chip_info = {
741 .enable_dma = 0,
742 .bits_per_word = 8,
744 #endif
746 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
747 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
748 .enable_dma = 0,
749 .bits_per_word = 8,
751 #endif
753 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
754 static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
755 .enable_dma = 1,
756 .bits_per_word = 8,
757 .cs_gpio = GPIO_PF10,
759 #endif
761 #if defined(CONFIG_MTD_DATAFLASH) \
762 || defined(CONFIG_MTD_DATAFLASH_MODULE)
764 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
766 .name = "bootloader(spi)",
767 .size = 0x00040000,
768 .offset = 0,
769 .mask_flags = MTD_CAP_ROM
770 }, {
771 .name = "linux kernel(spi)",
772 .size = 0x180000,
773 .offset = MTDPART_OFS_APPEND,
774 }, {
775 .name = "file system(spi)",
776 .size = MTDPART_SIZ_FULL,
777 .offset = MTDPART_OFS_APPEND,
781 static struct flash_platform_data bfin_spi_dataflash_data = {
782 .name = "SPI Dataflash",
783 .parts = bfin_spi_dataflash_partitions,
784 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
787 /* DataFlash chip */
788 static struct bfin5xx_spi_chip data_flash_chip_info = {
789 .enable_dma = 0, /* use dma transfer with this chip*/
790 .bits_per_word = 8,
792 #endif
794 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
795 static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
796 .enable_dma = 0, /* use dma transfer with this chip*/
797 .bits_per_word = 8,
799 #endif
801 static struct spi_board_info bfin_spi_board_info[] __initdata = {
802 #if defined(CONFIG_MTD_M25P80) \
803 || defined(CONFIG_MTD_M25P80_MODULE)
805 /* the modalias must be the same as spi device driver name */
806 .modalias = "m25p80", /* Name of spi_driver for this device */
807 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
808 .bus_num = 0, /* Framework bus number */
809 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
810 .platform_data = &bfin_spi_flash_data,
811 .controller_data = &spi_flash_chip_info,
812 .mode = SPI_MODE_3,
814 #endif
815 #if defined(CONFIG_MTD_DATAFLASH) \
816 || defined(CONFIG_MTD_DATAFLASH_MODULE)
817 { /* DataFlash chip */
818 .modalias = "mtd_dataflash",
819 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
820 .bus_num = 0, /* Framework bus number */
821 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
822 .platform_data = &bfin_spi_dataflash_data,
823 .controller_data = &data_flash_chip_info,
824 .mode = SPI_MODE_3,
826 #endif
827 #if defined(CONFIG_BFIN_SPI_ADC) \
828 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
830 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
831 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
832 .bus_num = 0, /* Framework bus number */
833 .chip_select = 1, /* Framework chip select. */
834 .platform_data = NULL, /* No spi_driver specific config */
835 .controller_data = &spi_adc_chip_info,
837 #endif
839 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
840 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
842 .modalias = "ad1836",
843 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
844 .bus_num = 0,
845 .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
846 .controller_data = &ad1836_spi_chip_info,
847 .mode = SPI_MODE_3,
849 #endif
851 #if defined(CONFIG_SND_BF5XX_SOC_AD1938) || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
853 .modalias = "ad1938",
854 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
855 .bus_num = 0,
856 .chip_select = 0,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
857 .controller_data = &ad1938_spi_chip_info,
858 .mode = SPI_MODE_3,
860 #endif
862 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
864 .modalias = "ad714x_captouch",
865 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
866 .irq = IRQ_PF4,
867 .bus_num = 0,
868 .chip_select = 5,
869 .mode = SPI_MODE_3,
870 .platform_data = &ad7147_spi_platform_data,
871 .controller_data = &ad7147_spi_chip_info,
873 #endif
875 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
877 .modalias = "mmc_spi",
878 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
879 .bus_num = 0,
880 .chip_select = 4,
881 .platform_data = &bfin_mmc_spi_pdata,
882 .controller_data = &mmc_spi_chip_info,
883 .mode = SPI_MODE_3,
885 #endif
886 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
888 .modalias = "ad7877",
889 .platform_data = &bfin_ad7877_ts_info,
890 .irq = IRQ_PF6,
891 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
892 .bus_num = 0,
893 .chip_select = 1,
894 .controller_data = &spi_ad7877_chip_info,
896 #endif
897 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
899 .modalias = "ad7879",
900 .platform_data = &bfin_ad7879_ts_info,
901 .irq = IRQ_PF7,
902 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
903 .bus_num = 0,
904 .chip_select = 1,
905 .controller_data = &spi_ad7879_chip_info,
906 .mode = SPI_CPHA | SPI_CPOL,
908 #endif
909 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
911 .modalias = "spidev",
912 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
913 .bus_num = 0,
914 .chip_select = 1,
915 .controller_data = &spidev_chip_info,
917 #endif
918 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
920 .modalias = "bfin-lq035q1-spi",
921 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
922 .bus_num = 0,
923 .chip_select = 2,
924 .controller_data = &lq035q1_spi_chip_info,
925 .mode = SPI_CPHA | SPI_CPOL,
927 #endif
928 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
930 .modalias = "enc28j60",
931 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
932 .irq = IRQ_PF6,
933 .bus_num = 0,
934 .chip_select = 0, /* GPIO controlled SSEL */
935 .controller_data = &enc28j60_spi_chip_info,
936 .mode = SPI_MODE_0,
938 #endif
939 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
941 .modalias = "adxl34x",
942 .platform_data = &adxl34x_info,
943 .irq = IRQ_PF6,
944 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
945 .bus_num = 0,
946 .chip_select = 2,
947 .controller_data = &spi_adxl34x_chip_info,
948 .mode = SPI_MODE_3,
950 #endif
953 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
954 /* SPI controller data */
955 static struct bfin5xx_spi_master bfin_spi0_info = {
956 .num_chipselect = 8,
957 .enable_dma = 1, /* master has the ability to do dma transfer */
958 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
961 /* SPI (0) */
962 static struct resource bfin_spi0_resource[] = {
963 [0] = {
964 .start = SPI0_REGBASE,
965 .end = SPI0_REGBASE + 0xFF,
966 .flags = IORESOURCE_MEM,
968 [1] = {
969 .start = CH_SPI,
970 .end = CH_SPI,
971 .flags = IORESOURCE_DMA,
973 [2] = {
974 .start = IRQ_SPI,
975 .end = IRQ_SPI,
976 .flags = IORESOURCE_IRQ,
980 static struct platform_device bfin_spi0_device = {
981 .name = "bfin-spi",
982 .id = 0, /* Bus number */
983 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
984 .resource = bfin_spi0_resource,
985 .dev = {
986 .platform_data = &bfin_spi0_info, /* Passed to driver */
989 #endif /* spi master and devices */
991 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
993 /* SPORT SPI controller data */
994 static struct bfin5xx_spi_master bfin_sport_spi0_info = {
995 .num_chipselect = 1, /* master only supports one device */
996 .enable_dma = 0, /* master don't support DMA */
997 .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
998 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1001 static struct resource bfin_sport_spi0_resource[] = {
1002 [0] = {
1003 .start = SPORT0_TCR1,
1004 .end = SPORT0_TCR1 + 0xFF,
1005 .flags = IORESOURCE_MEM,
1007 [1] = {
1008 .start = IRQ_SPORT0_ERROR,
1009 .end = IRQ_SPORT0_ERROR,
1010 .flags = IORESOURCE_IRQ,
1014 static struct platform_device bfin_sport_spi0_device = {
1015 .name = "bfin-sport-spi",
1016 .id = 1, /* Bus number */
1017 .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1018 .resource = bfin_sport_spi0_resource,
1019 .dev = {
1020 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1024 static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1025 .num_chipselect = 1, /* master only supports one device */
1026 .enable_dma = 0, /* master don't support DMA */
1027 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1028 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1031 static struct resource bfin_sport_spi1_resource[] = {
1032 [0] = {
1033 .start = SPORT1_TCR1,
1034 .end = SPORT1_TCR1 + 0xFF,
1035 .flags = IORESOURCE_MEM,
1037 [1] = {
1038 .start = IRQ_SPORT1_ERROR,
1039 .end = IRQ_SPORT1_ERROR,
1040 .flags = IORESOURCE_IRQ,
1044 static struct platform_device bfin_sport_spi1_device = {
1045 .name = "bfin-sport-spi",
1046 .id = 2, /* Bus number */
1047 .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1048 .resource = bfin_sport_spi1_resource,
1049 .dev = {
1050 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1054 #endif /* sport spi master and devices */
1056 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1057 static struct platform_device bfin_fb_device = {
1058 .name = "bf537-lq035",
1060 #endif
1062 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1063 #include <asm/bfin-lq035q1.h>
1065 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
1066 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
1067 .use_bl = 0, /* let something else control the LCD Blacklight */
1068 .gpio_bl = GPIO_PF7,
1071 static struct resource bfin_lq035q1_resources[] = {
1073 .start = IRQ_PPI_ERROR,
1074 .end = IRQ_PPI_ERROR,
1075 .flags = IORESOURCE_IRQ,
1079 static struct platform_device bfin_lq035q1_device = {
1080 .name = "bfin-lq035q1",
1081 .id = -1,
1082 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
1083 .resource = bfin_lq035q1_resources,
1084 .dev = {
1085 .platform_data = &bfin_lq035q1_data,
1088 #endif
1090 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1091 static struct resource bfin_uart_resources[] = {
1092 #ifdef CONFIG_SERIAL_BFIN_UART0
1094 .start = 0xFFC00400,
1095 .end = 0xFFC004FF,
1096 .flags = IORESOURCE_MEM,
1098 #endif
1099 #ifdef CONFIG_SERIAL_BFIN_UART1
1101 .start = 0xFFC02000,
1102 .end = 0xFFC020FF,
1103 .flags = IORESOURCE_MEM,
1105 #endif
1108 static struct platform_device bfin_uart_device = {
1109 .name = "bfin-uart",
1110 .id = 1,
1111 .num_resources = ARRAY_SIZE(bfin_uart_resources),
1112 .resource = bfin_uart_resources,
1114 #endif
1116 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1117 #ifdef CONFIG_BFIN_SIR0
1118 static struct resource bfin_sir0_resources[] = {
1120 .start = 0xFFC00400,
1121 .end = 0xFFC004FF,
1122 .flags = IORESOURCE_MEM,
1125 .start = IRQ_UART0_RX,
1126 .end = IRQ_UART0_RX+1,
1127 .flags = IORESOURCE_IRQ,
1130 .start = CH_UART0_RX,
1131 .end = CH_UART0_RX+1,
1132 .flags = IORESOURCE_DMA,
1136 static struct platform_device bfin_sir0_device = {
1137 .name = "bfin_sir",
1138 .id = 0,
1139 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
1140 .resource = bfin_sir0_resources,
1142 #endif
1143 #ifdef CONFIG_BFIN_SIR1
1144 static struct resource bfin_sir1_resources[] = {
1146 .start = 0xFFC02000,
1147 .end = 0xFFC020FF,
1148 .flags = IORESOURCE_MEM,
1151 .start = IRQ_UART1_RX,
1152 .end = IRQ_UART1_RX+1,
1153 .flags = IORESOURCE_IRQ,
1156 .start = CH_UART1_RX,
1157 .end = CH_UART1_RX+1,
1158 .flags = IORESOURCE_DMA,
1162 static struct platform_device bfin_sir1_device = {
1163 .name = "bfin_sir",
1164 .id = 1,
1165 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
1166 .resource = bfin_sir1_resources,
1168 #endif
1169 #endif
1171 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1172 static struct resource bfin_twi0_resource[] = {
1173 [0] = {
1174 .start = TWI0_REGBASE,
1175 .end = TWI0_REGBASE,
1176 .flags = IORESOURCE_MEM,
1178 [1] = {
1179 .start = IRQ_TWI,
1180 .end = IRQ_TWI,
1181 .flags = IORESOURCE_IRQ,
1185 static struct platform_device i2c_bfin_twi_device = {
1186 .name = "i2c-bfin-twi",
1187 .id = 0,
1188 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1189 .resource = bfin_twi0_resource,
1191 #endif
1193 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1194 #include <linux/i2c/adp5588.h>
1195 static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1196 [0] = KEY_GRAVE,
1197 [1] = KEY_1,
1198 [2] = KEY_2,
1199 [3] = KEY_3,
1200 [4] = KEY_4,
1201 [5] = KEY_5,
1202 [6] = KEY_6,
1203 [7] = KEY_7,
1204 [8] = KEY_8,
1205 [9] = KEY_9,
1206 [10] = KEY_0,
1207 [11] = KEY_MINUS,
1208 [12] = KEY_EQUAL,
1209 [13] = KEY_BACKSLASH,
1210 [15] = KEY_KP0,
1211 [16] = KEY_Q,
1212 [17] = KEY_W,
1213 [18] = KEY_E,
1214 [19] = KEY_R,
1215 [20] = KEY_T,
1216 [21] = KEY_Y,
1217 [22] = KEY_U,
1218 [23] = KEY_I,
1219 [24] = KEY_O,
1220 [25] = KEY_P,
1221 [26] = KEY_LEFTBRACE,
1222 [27] = KEY_RIGHTBRACE,
1223 [29] = KEY_KP1,
1224 [30] = KEY_KP2,
1225 [31] = KEY_KP3,
1226 [32] = KEY_A,
1227 [33] = KEY_S,
1228 [34] = KEY_D,
1229 [35] = KEY_F,
1230 [36] = KEY_G,
1231 [37] = KEY_H,
1232 [38] = KEY_J,
1233 [39] = KEY_K,
1234 [40] = KEY_L,
1235 [41] = KEY_SEMICOLON,
1236 [42] = KEY_APOSTROPHE,
1237 [43] = KEY_BACKSLASH,
1238 [45] = KEY_KP4,
1239 [46] = KEY_KP5,
1240 [47] = KEY_KP6,
1241 [48] = KEY_102ND,
1242 [49] = KEY_Z,
1243 [50] = KEY_X,
1244 [51] = KEY_C,
1245 [52] = KEY_V,
1246 [53] = KEY_B,
1247 [54] = KEY_N,
1248 [55] = KEY_M,
1249 [56] = KEY_COMMA,
1250 [57] = KEY_DOT,
1251 [58] = KEY_SLASH,
1252 [60] = KEY_KPDOT,
1253 [61] = KEY_KP7,
1254 [62] = KEY_KP8,
1255 [63] = KEY_KP9,
1256 [64] = KEY_SPACE,
1257 [65] = KEY_BACKSPACE,
1258 [66] = KEY_TAB,
1259 [67] = KEY_KPENTER,
1260 [68] = KEY_ENTER,
1261 [69] = KEY_ESC,
1262 [70] = KEY_DELETE,
1263 [74] = KEY_KPMINUS,
1264 [76] = KEY_UP,
1265 [77] = KEY_DOWN,
1266 [78] = KEY_RIGHT,
1267 [79] = KEY_LEFT,
1270 static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1271 .rows = 8,
1272 .cols = 10,
1273 .keymap = adp5588_keymap,
1274 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1275 .repeat = 0,
1277 #endif
1279 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1280 #include <linux/mfd/adp5520.h>
1283 * ADP5520/5501 Backlight Data
1286 static struct adp5520_backlight_platform_data adp5520_backlight_data = {
1287 .fade_in = ADP5520_FADE_T_1200ms,
1288 .fade_out = ADP5520_FADE_T_1200ms,
1289 .fade_led_law = ADP5520_BL_LAW_LINEAR,
1290 .en_ambl_sens = 1,
1291 .abml_filt = ADP5520_BL_AMBL_FILT_640ms,
1292 .l1_daylight_max = ADP5520_BL_CUR_mA(15),
1293 .l1_daylight_dim = ADP5520_BL_CUR_mA(0),
1294 .l2_office_max = ADP5520_BL_CUR_mA(7),
1295 .l2_office_dim = ADP5520_BL_CUR_mA(0),
1296 .l3_dark_max = ADP5520_BL_CUR_mA(3),
1297 .l3_dark_dim = ADP5520_BL_CUR_mA(0),
1298 .l2_trip = ADP5520_L2_COMP_CURR_uA(700),
1299 .l2_hyst = ADP5520_L2_COMP_CURR_uA(50),
1300 .l3_trip = ADP5520_L3_COMP_CURR_uA(80),
1301 .l3_hyst = ADP5520_L3_COMP_CURR_uA(20),
1305 * ADP5520/5501 LEDs Data
1308 static struct led_info adp5520_leds[] = {
1310 .name = "adp5520-led1",
1311 .default_trigger = "none",
1312 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
1314 #ifdef ADP5520_EN_ALL_LEDS
1316 .name = "adp5520-led2",
1317 .default_trigger = "none",
1318 .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1321 .name = "adp5520-led3",
1322 .default_trigger = "none",
1323 .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1325 #endif
1328 static struct adp5520_leds_platform_data adp5520_leds_data = {
1329 .num_leds = ARRAY_SIZE(adp5520_leds),
1330 .leds = adp5520_leds,
1331 .fade_in = ADP5520_FADE_T_600ms,
1332 .fade_out = ADP5520_FADE_T_600ms,
1333 .led_on_time = ADP5520_LED_ONT_600ms,
1337 * ADP5520 GPIO Data
1340 static struct adp5520_gpio_platform_data adp5520_gpio_data = {
1341 .gpio_start = 50,
1342 .gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1343 .gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1347 * ADP5520 Keypad Data
1350 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
1351 [ADP5520_KEY(0, 0)] = KEY_GRAVE,
1352 [ADP5520_KEY(0, 1)] = KEY_1,
1353 [ADP5520_KEY(0, 2)] = KEY_2,
1354 [ADP5520_KEY(0, 3)] = KEY_3,
1355 [ADP5520_KEY(1, 0)] = KEY_4,
1356 [ADP5520_KEY(1, 1)] = KEY_5,
1357 [ADP5520_KEY(1, 2)] = KEY_6,
1358 [ADP5520_KEY(1, 3)] = KEY_7,
1359 [ADP5520_KEY(2, 0)] = KEY_8,
1360 [ADP5520_KEY(2, 1)] = KEY_9,
1361 [ADP5520_KEY(2, 2)] = KEY_0,
1362 [ADP5520_KEY(2, 3)] = KEY_MINUS,
1363 [ADP5520_KEY(3, 0)] = KEY_EQUAL,
1364 [ADP5520_KEY(3, 1)] = KEY_BACKSLASH,
1365 [ADP5520_KEY(3, 2)] = KEY_BACKSPACE,
1366 [ADP5520_KEY(3, 3)] = KEY_ENTER,
1369 static struct adp5520_keys_platform_data adp5520_keys_data = {
1370 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
1371 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
1372 .keymap = adp5520_keymap,
1373 .keymapsize = ARRAY_SIZE(adp5520_keymap),
1374 .repeat = 0,
1378 * ADP5520/5501 Multifuction Device Init Data
1381 static struct adp5520_platform_data adp5520_pdev_data = {
1382 .backlight = &adp5520_backlight_data,
1383 .leds = &adp5520_leds_data,
1384 .gpio = &adp5520_gpio_data,
1385 .keys = &adp5520_keys_data,
1388 #endif
1390 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1391 #include <linux/i2c/adp5588.h>
1392 static struct adp5588_gpio_platform_data adp5588_gpio_data = {
1393 .gpio_start = 50,
1394 .pullup_dis_mask = 0,
1396 #endif
1398 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1399 #include <linux/i2c/adp8870.h>
1400 static struct led_info adp8870_leds[] = {
1402 .name = "adp8870-led7",
1403 .default_trigger = "none",
1404 .flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
1409 static struct adp8870_backlight_platform_data adp8870_pdata = {
1410 .bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
1411 ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6, /* 1 = Backlight 0 = Individual LED */
1412 .pwm_assign = 0, /* 1 = Enables PWM mode */
1414 .bl_fade_in = ADP8870_FADE_T_1200ms, /* Backlight Fade-In Timer */
1415 .bl_fade_out = ADP8870_FADE_T_1200ms, /* Backlight Fade-Out Timer */
1416 .bl_fade_law = ADP8870_FADE_LAW_CUBIC1, /* fade-on/fade-off transfer characteristic */
1418 .en_ambl_sens = 1, /* 1 = enable ambient light sensor */
1419 .abml_filt = ADP8870_BL_AMBL_FILT_320ms, /* Light sensor filter time */
1421 .l1_daylight_max = ADP8870_BL_CUR_mA(20), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1422 .l1_daylight_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1423 .l2_bright_max = ADP8870_BL_CUR_mA(14), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1424 .l2_bright_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1425 .l3_office_max = ADP8870_BL_CUR_mA(6), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1426 .l3_office_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1427 .l4_indoor_max = ADP8870_BL_CUR_mA(3), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1428 .l4_indor_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1429 .l5_dark_max = ADP8870_BL_CUR_mA(2), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1430 .l5_dark_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1432 .l2_trip = ADP8870_L2_COMP_CURR_uA(710), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1433 .l2_hyst = ADP8870_L2_COMP_CURR_uA(73), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1434 .l3_trip = ADP8870_L3_COMP_CURR_uA(389), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1435 .l3_hyst = ADP8870_L3_COMP_CURR_uA(54), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1436 .l4_trip = ADP8870_L4_COMP_CURR_uA(167), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1437 .l4_hyst = ADP8870_L4_COMP_CURR_uA(16), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1438 .l5_trip = ADP8870_L5_COMP_CURR_uA(43), /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1439 .l5_hyst = ADP8870_L5_COMP_CURR_uA(11), /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1441 .leds = adp8870_leds,
1442 .num_leds = ARRAY_SIZE(adp8870_leds),
1443 .led_fade_law = ADP8870_FADE_LAW_SQUARE, /* fade-on/fade-off transfer characteristic */
1444 .led_fade_in = ADP8870_FADE_T_600ms,
1445 .led_fade_out = ADP8870_FADE_T_600ms,
1446 .led_on_time = ADP8870_LED_ONT_200ms,
1448 #endif
1450 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1451 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
1453 I2C_BOARD_INFO("ad7142_captouch", 0x2C),
1454 .irq = IRQ_PG5,
1455 .platform_data = (void *)&ad7142_i2c_platform_data,
1457 #endif
1458 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1460 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1462 #endif
1463 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1465 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1466 .irq = IRQ_PG6,
1468 #endif
1469 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1471 I2C_BOARD_INFO("ad7879", 0x2F),
1472 .irq = IRQ_PG5,
1473 .platform_data = (void *)&bfin_ad7879_ts_info,
1475 #endif
1476 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1478 I2C_BOARD_INFO("adp5588-keys", 0x34),
1479 .irq = IRQ_PG0,
1480 .platform_data = (void *)&adp5588_kpad_data,
1482 #endif
1483 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1485 I2C_BOARD_INFO("pmic-adp5520", 0x32),
1486 .irq = IRQ_PG0,
1487 .platform_data = (void *)&adp5520_pdev_data,
1489 #endif
1490 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1492 I2C_BOARD_INFO("adxl34x", 0x53),
1493 .irq = IRQ_PG3,
1494 .platform_data = (void *)&adxl34x_info,
1496 #endif
1497 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1499 I2C_BOARD_INFO("adp5588-gpio", 0x34),
1500 .platform_data = (void *)&adp5588_gpio_data,
1502 #endif
1503 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1505 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1507 #endif
1508 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1510 I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
1512 #endif
1513 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1515 I2C_BOARD_INFO("adp8870", 0x2B),
1516 .platform_data = (void *)&adp8870_pdata,
1518 #endif
1519 #if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
1521 I2C_BOARD_INFO("adau1371", 0x1A),
1523 #endif
1524 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1526 I2C_BOARD_INFO("adau1761", 0x38),
1528 #endif
1531 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1532 static struct platform_device bfin_sport0_uart_device = {
1533 .name = "bfin-sport-uart",
1534 .id = 0,
1537 static struct platform_device bfin_sport1_uart_device = {
1538 .name = "bfin-sport-uart",
1539 .id = 1,
1541 #endif
1543 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1544 #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1545 /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
1547 #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1548 #define PATA_INT IRQ_PF5
1549 static struct pata_platform_info bfin_pata_platform_data = {
1550 .ioport_shift = 1,
1551 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
1554 static struct resource bfin_pata_resources[] = {
1556 .start = 0x20314020,
1557 .end = 0x2031403F,
1558 .flags = IORESOURCE_MEM,
1561 .start = 0x2031401C,
1562 .end = 0x2031401F,
1563 .flags = IORESOURCE_MEM,
1566 .start = PATA_INT,
1567 .end = PATA_INT,
1568 .flags = IORESOURCE_IRQ,
1571 #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
1572 static struct pata_platform_info bfin_pata_platform_data = {
1573 .ioport_shift = 0,
1575 /* CompactFlash Storage Card Memory Mapped Adressing
1576 * /REG = A11 = 1
1578 static struct resource bfin_pata_resources[] = {
1580 .start = 0x20211800,
1581 .end = 0x20211807,
1582 .flags = IORESOURCE_MEM,
1585 .start = 0x2021180E, /* Device Ctl */
1586 .end = 0x2021180E,
1587 .flags = IORESOURCE_MEM,
1590 #endif
1592 static struct platform_device bfin_pata_device = {
1593 .name = "pata_platform",
1594 .id = -1,
1595 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1596 .resource = bfin_pata_resources,
1597 .dev = {
1598 .platform_data = &bfin_pata_platform_data,
1601 #endif
1603 static const unsigned int cclk_vlev_datasheet[] =
1605 VRPAIR(VLEV_085, 250000000),
1606 VRPAIR(VLEV_090, 376000000),
1607 VRPAIR(VLEV_095, 426000000),
1608 VRPAIR(VLEV_100, 426000000),
1609 VRPAIR(VLEV_105, 476000000),
1610 VRPAIR(VLEV_110, 476000000),
1611 VRPAIR(VLEV_115, 476000000),
1612 VRPAIR(VLEV_120, 500000000),
1613 VRPAIR(VLEV_125, 533000000),
1614 VRPAIR(VLEV_130, 600000000),
1617 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1618 .tuple_tab = cclk_vlev_datasheet,
1619 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1620 .vr_settling_time = 25 /* us */,
1623 static struct platform_device bfin_dpmc = {
1624 .name = "bfin dpmc",
1625 .dev = {
1626 .platform_data = &bfin_dmpc_vreg_data,
1630 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1631 static struct platform_device bfin_tdm = {
1632 .name = "bfin-tdm",
1633 /* TODO: add platform data here */
1635 #endif
1637 static struct platform_device *stamp_devices[] __initdata = {
1639 &bfin_dpmc,
1641 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1642 &bfin_pcmcia_cf_device,
1643 #endif
1645 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1646 &rtc_device,
1647 #endif
1649 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1650 &sl811_hcd_device,
1651 #endif
1653 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1654 &isp1362_hcd_device,
1655 #endif
1657 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1658 &bfin_isp1760_device,
1659 #endif
1661 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1662 &smc91x_device,
1663 #endif
1665 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1666 &dm9000_device,
1667 #endif
1669 #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1670 &ax88180_device,
1671 #endif
1673 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1674 &bfin_mii_bus,
1675 &bfin_mac_device,
1676 #endif
1678 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1679 &net2272_bfin_device,
1680 #endif
1682 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1683 &bfin_spi0_device,
1684 #endif
1686 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1687 &bfin_sport_spi0_device,
1688 &bfin_sport_spi1_device,
1689 #endif
1691 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1692 &bfin_fb_device,
1693 #endif
1695 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1696 &bfin_lq035q1_device,
1697 #endif
1699 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1700 &bfin_uart_device,
1701 #endif
1703 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1704 #ifdef CONFIG_BFIN_SIR0
1705 &bfin_sir0_device,
1706 #endif
1707 #ifdef CONFIG_BFIN_SIR1
1708 &bfin_sir1_device,
1709 #endif
1710 #endif
1712 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1713 &i2c_bfin_twi_device,
1714 #endif
1716 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1717 &bfin_sport0_uart_device,
1718 &bfin_sport1_uart_device,
1719 #endif
1721 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1722 &bfin_pata_device,
1723 #endif
1725 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1726 &bfin_device_gpiokeys,
1727 #endif
1729 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1730 &bfin_async_nand_device,
1731 #endif
1733 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1734 &stamp_flash_device,
1735 #endif
1737 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1738 &bfin_tdm,
1739 #endif
1742 static int __init stamp_init(void)
1744 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1745 i2c_register_board_info(0, bfin_i2c_board_info,
1746 ARRAY_SIZE(bfin_i2c_board_info));
1747 bfin_plat_nand_init();
1748 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1749 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1751 return 0;
1754 arch_initcall(stamp_init);
1756 void native_machine_restart(char *cmd)
1758 /* workaround reboot hang when booting from SPI */
1759 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1760 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1764 * Currently the MAC address is saved in Flash by U-Boot
1766 #define FLASH_MAC 0x203f0000
1767 void bfin_get_ether_addr(char *addr)
1769 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1770 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1772 EXPORT_SYMBOL(bfin_get_ether_addr);