Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / arm / mach-pxa / stargate2.c
blobb0656e158d90409f249cc4a6965483bb68e1dc52
1 /*
2 * linux/arch/arm/mach-pxa/stargate2.c
4 * Author: Ed C. Epp
5 * Created: Nov 05, 2002
6 * Copyright: Intel Corp.
8 * Modified 2009: Jonathan Cameron <jic23@cam.ac.uk>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/init.h>
16 #include <linux/device.h>
17 #include <linux/interrupt.h>
18 #include <linux/sched.h>
19 #include <linux/bitops.h>
20 #include <linux/fb.h>
21 #include <linux/delay.h>
22 #include <linux/platform_device.h>
23 #include <linux/regulator/machine.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/plat-ram.h>
26 #include <linux/mtd/partitions.h>
28 #include <linux/i2c/pxa-i2c.h>
29 #include <linux/i2c/pcf857x.h>
30 #include <linux/i2c/at24.h>
31 #include <linux/smc91x.h>
32 #include <linux/gpio.h>
33 #include <linux/leds.h>
35 #include <asm/types.h>
36 #include <asm/setup.h>
37 #include <asm/memory.h>
38 #include <asm/mach-types.h>
39 #include <asm/irq.h>
41 #include <asm/mach/arch.h>
42 #include <asm/mach/map.h>
43 #include <asm/mach/irq.h>
44 #include <asm/mach/flash.h>
46 #include <mach/pxa27x.h>
47 #include <mach/mmc.h>
48 #include <mach/udc.h>
49 #include <mach/pxa27x-udc.h>
50 #include <mach/smemc.h>
52 #include <linux/spi/spi.h>
53 #include <linux/spi/pxa2xx_spi.h>
54 #include <linux/mfd/da903x.h>
55 #include <linux/sht15.h>
57 #include "devices.h"
58 #include "generic.h"
60 #define STARGATE_NR_IRQS (IRQ_BOARD_START + 8)
62 /* Bluetooth */
63 #define SG2_BT_RESET 81
65 /* SD */
66 #define SG2_GPIO_nSD_DETECT 90
67 #define SG2_SD_POWER_ENABLE 89
69 static unsigned long sg2_im2_unified_pin_config[] __initdata = {
70 /* Device Identification for wakeup*/
71 GPIO102_GPIO,
72 /* DA9030 */
73 GPIO1_GPIO,
75 /* MMC */
76 GPIO32_MMC_CLK,
77 GPIO112_MMC_CMD,
78 GPIO92_MMC_DAT_0,
79 GPIO109_MMC_DAT_1,
80 GPIO110_MMC_DAT_2,
81 GPIO111_MMC_DAT_3,
83 /* 802.15.4 radio - driver out of mainline */
84 GPIO22_GPIO, /* CC_RSTN */
85 GPIO114_GPIO, /* CC_FIFO */
86 GPIO116_GPIO, /* CC_CCA */
87 GPIO0_GPIO, /* CC_FIFOP */
88 GPIO16_GPIO, /* CCSFD */
89 GPIO115_GPIO, /* Power enable */
91 /* I2C */
92 GPIO117_I2C_SCL,
93 GPIO118_I2C_SDA,
95 /* SSP 3 - 802.15.4 radio */
96 GPIO39_GPIO, /* Chip Select */
97 GPIO34_SSP3_SCLK,
98 GPIO35_SSP3_TXD,
99 GPIO41_SSP3_RXD,
101 /* SSP 2 to daughter boards */
102 GPIO11_SSP2_RXD,
103 GPIO38_SSP2_TXD,
104 GPIO36_SSP2_SCLK,
105 GPIO37_GPIO, /* chip select */
107 /* SSP 1 - to daughter boards */
108 GPIO24_GPIO, /* Chip Select */
109 GPIO23_SSP1_SCLK,
110 GPIO25_SSP1_TXD,
111 GPIO26_SSP1_RXD,
113 /* BTUART Basic Connector*/
114 GPIO42_BTUART_RXD,
115 GPIO43_BTUART_TXD,
116 GPIO44_BTUART_CTS,
117 GPIO45_BTUART_RTS,
119 /* STUART - IM2 via debug board not sure on SG2*/
120 GPIO46_STUART_RXD,
121 GPIO47_STUART_TXD,
123 /* Basic sensor board */
124 GPIO96_GPIO, /* accelerometer interrupt */
125 GPIO99_GPIO, /* ADC interrupt */
127 /* SHT15 */
128 GPIO100_GPIO,
129 GPIO98_GPIO,
131 /* Basic sensor board */
132 GPIO96_GPIO, /* accelerometer interrupt */
133 GPIO99_GPIO, /* ADC interrupt */
135 /* Connector pins specified as gpios */
136 GPIO94_GPIO, /* large basic connector pin 14 */
137 GPIO10_GPIO, /* large basic connector pin 23 */
140 static struct sht15_platform_data platform_data_sht15 = {
141 .gpio_data = 100,
142 .gpio_sck = 98,
145 static struct platform_device sht15 = {
146 .name = "sht15",
147 .id = -1,
148 .dev = {
149 .platform_data = &platform_data_sht15,
153 static struct regulator_consumer_supply stargate2_sensor_3_con[] = {
155 .dev = &sht15.dev,
156 .supply = "vcc",
160 enum stargate2_ldos{
161 vcc_vref,
162 vcc_cc2420,
163 /* a mote connector? */
164 vcc_mica,
165 /* the CSR bluecore chip */
166 vcc_bt,
167 /* The two voltages available to sensor boards */
168 vcc_sensor_1_8,
169 vcc_sensor_3,
170 /* directly connected to the pxa27x */
171 vcc_sram_ext,
172 vcc_pxa_pll,
173 vcc_pxa_usim, /* Reference voltage for certain gpios */
174 vcc_pxa_mem,
175 vcc_pxa_flash,
176 vcc_pxa_core, /*Dc-Dc buck not yet supported */
177 vcc_lcd,
178 vcc_bb,
179 vcc_bbio, /*not sure!*/
180 vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/
183 /* The values of the various regulator constraints are obviously dependent
184 * on exactly what is wired to each ldo. Unfortunately this information is
185 * not generally available. More information has been requested from Xbow.
187 static struct regulator_init_data stargate2_ldo_init_data[] = {
188 [vcc_bbio] = {
189 .constraints = { /* board default 1.8V */
190 .name = "vcc_bbio",
191 .min_uV = 1800000,
192 .max_uV = 1800000,
195 [vcc_bb] = {
196 .constraints = { /* board default 2.8V */
197 .name = "vcc_bb",
198 .min_uV = 2700000,
199 .max_uV = 3000000,
202 [vcc_pxa_flash] = {
203 .constraints = {/* default is 1.8V */
204 .name = "vcc_pxa_flash",
205 .min_uV = 1800000,
206 .max_uV = 1800000,
209 [vcc_cc2420] = { /* also vcc_io */
210 .constraints = {
211 /* board default is 2.8V */
212 .name = "vcc_cc2420",
213 .min_uV = 2700000,
214 .max_uV = 3300000,
217 [vcc_vref] = { /* Reference for what? */
218 .constraints = { /* default 1.8V */
219 .name = "vcc_vref",
220 .min_uV = 1800000,
221 .max_uV = 1800000,
224 [vcc_sram_ext] = {
225 .constraints = { /* default 2.8V */
226 .name = "vcc_sram_ext",
227 .min_uV = 2800000,
228 .max_uV = 2800000,
231 [vcc_mica] = {
232 .constraints = { /* default 2.8V */
233 .name = "vcc_mica",
234 .min_uV = 2800000,
235 .max_uV = 2800000,
238 [vcc_bt] = {
239 .constraints = { /* default 2.8V */
240 .name = "vcc_bt",
241 .min_uV = 2800000,
242 .max_uV = 2800000,
245 [vcc_lcd] = {
246 .constraints = { /* default 2.8V */
247 .name = "vcc_lcd",
248 .min_uV = 2700000,
249 .max_uV = 3300000,
252 [vcc_io] = { /* Same or higher than everything
253 * bar vccbat and vccusb */
254 .constraints = { /* default 2.8V */
255 .name = "vcc_io",
256 .min_uV = 2692000,
257 .max_uV = 3300000,
260 [vcc_sensor_1_8] = {
261 .constraints = { /* default 1.8V */
262 .name = "vcc_sensor_1_8",
263 .min_uV = 1800000,
264 .max_uV = 1800000,
267 [vcc_sensor_3] = { /* curiously default 2.8V */
268 .constraints = {
269 .name = "vcc_sensor_3",
270 .min_uV = 2800000,
271 .max_uV = 3000000,
273 .num_consumer_supplies = ARRAY_SIZE(stargate2_sensor_3_con),
274 .consumer_supplies = stargate2_sensor_3_con,
276 [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/
277 .constraints = {
278 .name = "vcc_pxa_pll",
279 .min_uV = 1170000,
280 .max_uV = 1430000,
283 [vcc_pxa_usim] = {
284 .constraints = { /* default 1.8V */
285 .name = "vcc_pxa_usim",
286 .min_uV = 1710000,
287 .max_uV = 2160000,
290 [vcc_pxa_mem] = {
291 .constraints = { /* default 1.8V */
292 .name = "vcc_pxa_mem",
293 .min_uV = 1800000,
294 .max_uV = 1800000,
299 static struct mtd_partition stargate2flash_partitions[] = {
301 .name = "Bootloader",
302 .size = 0x00040000,
303 .offset = 0,
304 .mask_flags = 0,
305 }, {
306 .name = "Kernel",
307 .size = 0x00200000,
308 .offset = 0x00040000,
309 .mask_flags = 0
310 }, {
311 .name = "Filesystem",
312 .size = 0x01DC0000,
313 .offset = 0x00240000,
314 .mask_flags = 0
318 static struct resource flash_resources = {
319 .start = PXA_CS0_PHYS,
320 .end = PXA_CS0_PHYS + SZ_32M - 1,
321 .flags = IORESOURCE_MEM,
324 static struct flash_platform_data stargate2_flash_data = {
325 .map_name = "cfi_probe",
326 .parts = stargate2flash_partitions,
327 .nr_parts = ARRAY_SIZE(stargate2flash_partitions),
328 .name = "PXA27xOnChipROM",
329 .width = 2,
332 static struct platform_device stargate2_flash_device = {
333 .name = "pxa2xx-flash",
334 .id = 0,
335 .dev = {
336 .platform_data = &stargate2_flash_data,
338 .resource = &flash_resources,
339 .num_resources = 1,
342 static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
343 .num_chipselect = 1,
346 static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
347 .num_chipselect = 1,
350 static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
351 .num_chipselect = 1,
354 /* An upcoming kernel change will scrap SFRM usage so these
355 * drivers have been moved to use gpio's via cs_control */
356 static struct pxa2xx_spi_chip staccel_chip_info = {
357 .tx_threshold = 8,
358 .rx_threshold = 8,
359 .dma_burst_size = 8,
360 .timeout = 235,
361 .gpio_cs = 24,
364 static struct pxa2xx_spi_chip cc2420_info = {
365 .tx_threshold = 8,
366 .rx_threshold = 8,
367 .dma_burst_size = 8,
368 .timeout = 235,
369 .gpio_cs = 39,
372 static struct spi_board_info spi_board_info[] __initdata = {
374 .modalias = "lis3l02dq",
375 .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
376 .bus_num = 1,
377 .chip_select = 0,
378 .controller_data = &staccel_chip_info,
379 .irq = PXA_GPIO_TO_IRQ(96),
380 }, {
381 .modalias = "cc2420",
382 .max_speed_hz = 6500000,
383 .bus_num = 3,
384 .chip_select = 0,
385 .controller_data = &cc2420_info,
389 static void sg2_udc_command(int cmd)
391 switch (cmd) {
392 case PXA2XX_UDC_CMD_CONNECT:
393 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
394 break;
395 case PXA2XX_UDC_CMD_DISCONNECT:
396 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
397 break;
401 static struct i2c_pxa_platform_data i2c_pwr_pdata = {
402 .fast_mode = 1,
405 static struct i2c_pxa_platform_data i2c_pdata = {
406 .fast_mode = 1,
409 static void __init imote2_stargate2_init(void)
412 pxa2xx_mfp_config(ARRAY_AND_SIZE(sg2_im2_unified_pin_config));
414 pxa_set_ffuart_info(NULL);
415 pxa_set_btuart_info(NULL);
416 pxa_set_stuart_info(NULL);
418 pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
419 pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
420 pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
421 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
424 pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
425 pxa_set_i2c_info(&i2c_pdata);
428 #ifdef CONFIG_MACH_INTELMOTE2
429 /* As the the imote2 doesn't currently have a conventional SD slot
430 * there is no option to hotplug cards, making all this rather simple
432 static int imote2_mci_get_ro(struct device *dev)
434 return 0;
437 /* Rather simple case as hotplugging not possible */
438 static struct pxamci_platform_data imote2_mci_platform_data = {
439 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */
440 .get_ro = imote2_mci_get_ro,
441 .gpio_card_detect = -1,
442 .gpio_card_ro = -1,
443 .gpio_power = -1,
446 static struct gpio_led imote2_led_pins[] = {
448 .name = "imote2:red",
449 .gpio = 103,
450 .active_low = 1,
451 }, {
452 .name = "imote2:green",
453 .gpio = 104,
454 .active_low = 1,
455 }, {
456 .name = "imote2:blue",
457 .gpio = 105,
458 .active_low = 1,
462 static struct gpio_led_platform_data imote2_led_data = {
463 .num_leds = ARRAY_SIZE(imote2_led_pins),
464 .leds = imote2_led_pins,
467 static struct platform_device imote2_leds = {
468 .name = "leds-gpio",
469 .id = -1,
470 .dev = {
471 .platform_data = &imote2_led_data,
475 static struct da903x_subdev_info imote2_da9030_subdevs[] = {
477 .name = "da903x-regulator",
478 .id = DA9030_ID_LDO2,
479 .platform_data = &stargate2_ldo_init_data[vcc_bbio],
480 }, {
481 .name = "da903x-regulator",
482 .id = DA9030_ID_LDO3,
483 .platform_data = &stargate2_ldo_init_data[vcc_bb],
484 }, {
485 .name = "da903x-regulator",
486 .id = DA9030_ID_LDO4,
487 .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash],
488 }, {
489 .name = "da903x-regulator",
490 .id = DA9030_ID_LDO5,
491 .platform_data = &stargate2_ldo_init_data[vcc_cc2420],
492 }, {
493 .name = "da903x-regulator",
494 .id = DA9030_ID_LDO6,
495 .platform_data = &stargate2_ldo_init_data[vcc_vref],
496 }, {
497 .name = "da903x-regulator",
498 .id = DA9030_ID_LDO7,
499 .platform_data = &stargate2_ldo_init_data[vcc_sram_ext],
500 }, {
501 .name = "da903x-regulator",
502 .id = DA9030_ID_LDO8,
503 .platform_data = &stargate2_ldo_init_data[vcc_mica],
504 }, {
505 .name = "da903x-regulator",
506 .id = DA9030_ID_LDO9,
507 .platform_data = &stargate2_ldo_init_data[vcc_bt],
508 }, {
509 .name = "da903x-regulator",
510 .id = DA9030_ID_LDO10,
511 .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8],
512 }, {
513 .name = "da903x-regulator",
514 .id = DA9030_ID_LDO11,
515 .platform_data = &stargate2_ldo_init_data[vcc_sensor_3],
516 }, {
517 .name = "da903x-regulator",
518 .id = DA9030_ID_LDO12,
519 .platform_data = &stargate2_ldo_init_data[vcc_lcd],
520 }, {
521 .name = "da903x-regulator",
522 .id = DA9030_ID_LDO15,
523 .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll],
524 }, {
525 .name = "da903x-regulator",
526 .id = DA9030_ID_LDO17,
527 .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim],
528 }, {
529 .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */
530 .id = DA9030_ID_LDO18,
531 .platform_data = &stargate2_ldo_init_data[vcc_io],
532 }, {
533 .name = "da903x-regulator",
534 .id = DA9030_ID_LDO19,
535 .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem],
539 static struct da903x_platform_data imote2_da9030_pdata = {
540 .num_subdevs = ARRAY_SIZE(imote2_da9030_subdevs),
541 .subdevs = imote2_da9030_subdevs,
544 static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
546 .type = "da9030",
547 .addr = 0x49,
548 .platform_data = &imote2_da9030_pdata,
549 .irq = PXA_GPIO_TO_IRQ(1),
553 static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
554 { /* UCAM sensor board */
555 .type = "max1239",
556 .addr = 0x35,
557 }, { /* ITS400 Sensor board only */
558 .type = "max1363",
559 .addr = 0x34,
560 /* Through a nand gate - Also beware, on V2 sensor board the
561 * pull up resistors are missing.
563 .irq = PXA_GPIO_TO_IRQ(99),
564 }, { /* ITS400 Sensor board only */
565 .type = "tsl2561",
566 .addr = 0x49,
567 /* Through a nand gate - Also beware, on V2 sensor board the
568 * pull up resistors are missing.
570 .irq = PXA_GPIO_TO_IRQ(99),
571 }, { /* ITS400 Sensor board only */
572 .type = "tmp175",
573 .addr = 0x4A,
574 .irq = PXA_GPIO_TO_IRQ(96),
575 }, { /* IMB400 Multimedia board */
576 .type = "wm8940",
577 .addr = 0x1A,
581 static unsigned long imote2_pin_config[] __initdata = {
583 /* Button */
584 GPIO91_GPIO,
586 /* LEDS */
587 GPIO103_GPIO, /* red led */
588 GPIO104_GPIO, /* green led */
589 GPIO105_GPIO, /* blue led */
592 static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = {
593 .udc_command = sg2_udc_command,
596 static struct platform_device imote2_audio_device = {
597 .name = "imote2-audio",
598 .id = -1,
601 static struct platform_device *imote2_devices[] = {
602 &stargate2_flash_device,
603 &imote2_leds,
604 &sht15,
605 &imote2_audio_device,
608 static void __init imote2_init(void)
610 pxa2xx_mfp_config(ARRAY_AND_SIZE(imote2_pin_config));
612 imote2_stargate2_init();
614 platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices));
616 i2c_register_board_info(0, imote2_i2c_board_info,
617 ARRAY_SIZE(imote2_i2c_board_info));
618 i2c_register_board_info(1, imote2_pwr_i2c_board_info,
619 ARRAY_SIZE(imote2_pwr_i2c_board_info));
621 pxa_set_mci_info(&imote2_mci_platform_data);
622 pxa_set_udc_info(&imote2_udc_info);
624 #endif
626 #ifdef CONFIG_MACH_STARGATE2
628 static unsigned long stargate2_pin_config[] __initdata = {
630 GPIO15_nCS_1, /* SRAM */
631 /* SMC91x */
632 GPIO80_nCS_4,
633 GPIO40_GPIO, /*cable detect?*/
635 /* Button */
636 GPIO91_GPIO | WAKEUP_ON_LEVEL_HIGH,
638 /* Compact Flash */
639 GPIO79_PSKTSEL,
640 GPIO48_nPOE,
641 GPIO49_nPWE,
642 GPIO50_nPIOR,
643 GPIO51_nPIOW,
644 GPIO85_nPCE_1,
645 GPIO54_nPCE_2,
646 GPIO55_nPREG,
647 GPIO56_nPWAIT,
648 GPIO57_nIOIS16,
649 GPIO120_GPIO, /* Buff ctrl */
650 GPIO108_GPIO, /* Power ctrl */
651 GPIO82_GPIO, /* Reset */
652 GPIO53_GPIO, /* SG2_S0_GPIO_DETECT */
654 /* MMC not shared with imote2 */
655 GPIO90_GPIO, /* nSD detect */
656 GPIO89_GPIO, /* SD_POWER_ENABLE */
658 /* Bluetooth */
659 GPIO81_GPIO, /* reset */
662 static struct resource smc91x_resources[] = {
663 [0] = {
664 .name = "smc91x-regs",
665 .start = (PXA_CS4_PHYS + 0x300),
666 .end = (PXA_CS4_PHYS + 0xfffff),
667 .flags = IORESOURCE_MEM,
669 [1] = {
670 .start = PXA_GPIO_TO_IRQ(40),
671 .end = PXA_GPIO_TO_IRQ(40),
672 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
676 static struct smc91x_platdata stargate2_smc91x_info = {
677 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT
678 | SMC91X_NOWAIT | SMC91X_USE_DMA,
681 static struct platform_device smc91x_device = {
682 .name = "smc91x",
683 .id = -1,
684 .num_resources = ARRAY_SIZE(smc91x_resources),
685 .resource = smc91x_resources,
686 .dev = {
687 .platform_data = &stargate2_smc91x_info,
693 * The card detect interrupt isn't debounced so we delay it by 250ms
694 * to give the card a chance to fully insert / eject.
696 static int stargate2_mci_init(struct device *dev,
697 irq_handler_t stargate2_detect_int,
698 void *data)
700 int err;
702 err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
703 if (err) {
704 printk(KERN_ERR "Can't get the gpio for SD power control");
705 goto return_err;
707 gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
709 err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
710 if (err) {
711 printk(KERN_ERR "Can't get the sd detect gpio");
712 goto free_power_en;
714 gpio_direction_input(SG2_GPIO_nSD_DETECT);
716 err = request_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT),
717 stargate2_detect_int,
718 IRQ_TYPE_EDGE_BOTH,
719 "MMC card detect",
720 data);
721 if (err) {
722 printk(KERN_ERR "can't request MMC card detect IRQ\n");
723 goto free_nsd_detect;
725 return 0;
727 free_nsd_detect:
728 gpio_free(SG2_GPIO_nSD_DETECT);
729 free_power_en:
730 gpio_free(SG2_SD_POWER_ENABLE);
731 return_err:
732 return err;
736 * stargate2_mci_setpower() - set state of mmc power supply
738 * Very simple control. Either it is on or off and is controlled by
739 * a gpio pin */
740 static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
742 gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd);
745 static void stargate2_mci_exit(struct device *dev, void *data)
747 free_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT), data);
748 gpio_free(SG2_SD_POWER_ENABLE);
749 gpio_free(SG2_GPIO_nSD_DETECT);
752 static struct pxamci_platform_data stargate2_mci_platform_data = {
753 .detect_delay_ms = 250,
754 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
755 .init = stargate2_mci_init,
756 .setpower = stargate2_mci_setpower,
757 .exit = stargate2_mci_exit,
762 * SRAM - The Stargate 2 has 32MB of SRAM.
764 * Here it is made available as an MTD. This will then
765 * typically have a cifs filesystem created on it to provide
766 * fast temporary storage.
768 static struct resource sram_resources = {
769 .start = PXA_CS1_PHYS,
770 .end = PXA_CS1_PHYS + SZ_32M-1,
771 .flags = IORESOURCE_MEM,
774 static struct platdata_mtd_ram stargate2_sram_pdata = {
775 .mapname = "Stargate2 SRAM",
776 .bankwidth = 2,
779 static struct platform_device stargate2_sram = {
780 .name = "mtd-ram",
781 .id = 0,
782 .resource = &sram_resources,
783 .num_resources = 1,
784 .dev = {
785 .platform_data = &stargate2_sram_pdata,
789 static struct pcf857x_platform_data platform_data_pcf857x = {
790 .gpio_base = 128,
791 .n_latch = 0,
792 .setup = NULL,
793 .teardown = NULL,
794 .context = NULL,
797 static struct at24_platform_data pca9500_eeprom_pdata = {
798 .byte_len = 256,
799 .page_size = 4,
803 * stargate2_reset_bluetooth() reset the bluecore to ensure consistent state
805 static int stargate2_reset_bluetooth(void)
807 int err;
808 err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET");
809 if (err) {
810 printk(KERN_ERR "Could not get gpio for bluetooth reset\n");
811 return err;
813 gpio_direction_output(SG2_BT_RESET, 1);
814 mdelay(5);
815 /* now reset it - 5 msec minimum */
816 gpio_set_value(SG2_BT_RESET, 0);
817 mdelay(10);
818 gpio_set_value(SG2_BT_RESET, 1);
819 gpio_free(SG2_BT_RESET);
820 return 0;
823 static struct led_info stargate2_leds[] = {
825 .name = "sg2:red",
826 .flags = DA9030_LED_RATE_ON,
827 }, {
828 .name = "sg2:blue",
829 .flags = DA9030_LED_RATE_ON,
830 }, {
831 .name = "sg2:green",
832 .flags = DA9030_LED_RATE_ON,
836 static struct da903x_subdev_info stargate2_da9030_subdevs[] = {
838 .name = "da903x-led",
839 .id = DA9030_ID_LED_2,
840 .platform_data = &stargate2_leds[0],
841 }, {
842 .name = "da903x-led",
843 .id = DA9030_ID_LED_3,
844 .platform_data = &stargate2_leds[2],
845 }, {
846 .name = "da903x-led",
847 .id = DA9030_ID_LED_4,
848 .platform_data = &stargate2_leds[1],
849 }, {
850 .name = "da903x-regulator",
851 .id = DA9030_ID_LDO2,
852 .platform_data = &stargate2_ldo_init_data[vcc_bbio],
853 }, {
854 .name = "da903x-regulator",
855 .id = DA9030_ID_LDO3,
856 .platform_data = &stargate2_ldo_init_data[vcc_bb],
857 }, {
858 .name = "da903x-regulator",
859 .id = DA9030_ID_LDO4,
860 .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash],
861 }, {
862 .name = "da903x-regulator",
863 .id = DA9030_ID_LDO5,
864 .platform_data = &stargate2_ldo_init_data[vcc_cc2420],
865 }, {
866 .name = "da903x-regulator",
867 .id = DA9030_ID_LDO6,
868 .platform_data = &stargate2_ldo_init_data[vcc_vref],
869 }, {
870 .name = "da903x-regulator",
871 .id = DA9030_ID_LDO7,
872 .platform_data = &stargate2_ldo_init_data[vcc_sram_ext],
873 }, {
874 .name = "da903x-regulator",
875 .id = DA9030_ID_LDO8,
876 .platform_data = &stargate2_ldo_init_data[vcc_mica],
877 }, {
878 .name = "da903x-regulator",
879 .id = DA9030_ID_LDO9,
880 .platform_data = &stargate2_ldo_init_data[vcc_bt],
881 }, {
882 .name = "da903x-regulator",
883 .id = DA9030_ID_LDO10,
884 .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8],
885 }, {
886 .name = "da903x-regulator",
887 .id = DA9030_ID_LDO11,
888 .platform_data = &stargate2_ldo_init_data[vcc_sensor_3],
889 }, {
890 .name = "da903x-regulator",
891 .id = DA9030_ID_LDO12,
892 .platform_data = &stargate2_ldo_init_data[vcc_lcd],
893 }, {
894 .name = "da903x-regulator",
895 .id = DA9030_ID_LDO15,
896 .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll],
897 }, {
898 .name = "da903x-regulator",
899 .id = DA9030_ID_LDO17,
900 .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim],
901 }, {
902 .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */
903 .id = DA9030_ID_LDO18,
904 .platform_data = &stargate2_ldo_init_data[vcc_io],
905 }, {
906 .name = "da903x-regulator",
907 .id = DA9030_ID_LDO19,
908 .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem],
912 static struct da903x_platform_data stargate2_da9030_pdata = {
913 .num_subdevs = ARRAY_SIZE(stargate2_da9030_subdevs),
914 .subdevs = stargate2_da9030_subdevs,
917 static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
919 .type = "da9030",
920 .addr = 0x49,
921 .platform_data = &stargate2_da9030_pdata,
922 .irq = PXA_GPIO_TO_IRQ(1),
926 static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
927 /* Techically this a pca9500 - but it's compatible with the 8574
928 * for gpio expansion and the 24c02 for eeprom access.
931 .type = "pcf8574",
932 .addr = 0x27,
933 .platform_data = &platform_data_pcf857x,
934 }, {
935 .type = "24c02",
936 .addr = 0x57,
937 .platform_data = &pca9500_eeprom_pdata,
938 }, {
939 .type = "max1238",
940 .addr = 0x35,
941 }, { /* ITS400 Sensor board only */
942 .type = "max1363",
943 .addr = 0x34,
944 /* Through a nand gate - Also beware, on V2 sensor board the
945 * pull up resistors are missing.
947 .irq = PXA_GPIO_TO_IRQ(99),
948 }, { /* ITS400 Sensor board only */
949 .type = "tsl2561",
950 .addr = 0x49,
951 /* Through a nand gate - Also beware, on V2 sensor board the
952 * pull up resistors are missing.
954 .irq = PXA_GPIO_TO_IRQ(99),
955 }, { /* ITS400 Sensor board only */
956 .type = "tmp175",
957 .addr = 0x4A,
958 .irq = PXA_GPIO_TO_IRQ(96),
962 /* Board doesn't support cable detection - so always lie and say
963 * something is there.
965 static int sg2_udc_detect(void)
967 return 1;
970 static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = {
971 .udc_is_connected = sg2_udc_detect,
972 .udc_command = sg2_udc_command,
975 static struct platform_device *stargate2_devices[] = {
976 &stargate2_flash_device,
977 &stargate2_sram,
978 &smc91x_device,
979 &sht15,
982 static void __init stargate2_init(void)
984 /* This is probably a board specific hack as this must be set
985 prior to connecting the MFP stuff up. */
986 __raw_writel(__raw_readl(MECR) & ~MECR_NOS, MECR);
988 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
990 imote2_stargate2_init();
992 platform_add_devices(ARRAY_AND_SIZE(stargate2_devices));
994 i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
995 i2c_register_board_info(1, stargate2_pwr_i2c_board_info,
996 ARRAY_SIZE(stargate2_pwr_i2c_board_info));
998 pxa_set_mci_info(&stargate2_mci_platform_data);
1000 pxa_set_udc_info(&stargate2_udc_info);
1002 stargate2_reset_bluetooth();
1004 #endif
1006 #ifdef CONFIG_MACH_INTELMOTE2
1007 MACHINE_START(INTELMOTE2, "IMOTE 2")
1008 .map_io = pxa27x_map_io,
1009 .init_irq = pxa27x_init_irq,
1010 .handle_irq = pxa27x_handle_irq,
1011 .timer = &pxa_timer,
1012 .init_machine = imote2_init,
1013 .atag_offset = 0x100,
1014 .restart = pxa_restart,
1015 MACHINE_END
1016 #endif
1018 #ifdef CONFIG_MACH_STARGATE2
1019 MACHINE_START(STARGATE2, "Stargate 2")
1020 .map_io = pxa27x_map_io,
1021 .nr_irqs = STARGATE_NR_IRQS,
1022 .init_irq = pxa27x_init_irq,
1023 .handle_irq = pxa27x_handle_irq,
1024 .timer = &pxa_timer,
1025 .init_machine = stargate2_init,
1026 .atag_offset = 0x100,
1027 .restart = pxa_restart,
1028 MACHINE_END
1029 #endif