GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-pxa / stargate2.c
bloba654d1e6b38ad11eb6420667028c8395ab10c1ae
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/pcf857x.h>
29 #include <linux/i2c/at24.h>
30 #include <linux/smc91x.h>
31 #include <linux/gpio.h>
32 #include <linux/leds.h>
34 #include <asm/types.h>
35 #include <asm/setup.h>
36 #include <asm/memory.h>
37 #include <asm/mach-types.h>
38 #include <asm/irq.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/map.h>
42 #include <asm/mach/irq.h>
43 #include <asm/mach/flash.h>
45 #include <mach/pxa27x.h>
46 #include <plat/i2c.h>
47 #include <mach/mmc.h>
48 #include <mach/udc.h>
49 #include <mach/pxa2xx_spi.h>
50 #include <mach/pxa27x-udc.h>
52 #include <linux/spi/spi.h>
53 #include <linux/mfd/da903x.h>
54 #include <linux/sht15.h>
56 #include "devices.h"
57 #include "generic.h"
59 /* Bluetooth */
60 #define SG2_BT_RESET 81
62 /* SD */
63 #define SG2_GPIO_nSD_DETECT 90
64 #define SG2_SD_POWER_ENABLE 89
66 static unsigned long sg2_im2_unified_pin_config[] __initdata = {
67 /* Device Identification for wakeup*/
68 GPIO102_GPIO,
69 /* DA9030 */
70 GPIO1_GPIO,
72 /* MMC */
73 GPIO32_MMC_CLK,
74 GPIO112_MMC_CMD,
75 GPIO92_MMC_DAT_0,
76 GPIO109_MMC_DAT_1,
77 GPIO110_MMC_DAT_2,
78 GPIO111_MMC_DAT_3,
80 /* 802.15.4 radio - driver out of mainline */
81 GPIO22_GPIO, /* CC_RSTN */
82 GPIO114_GPIO, /* CC_FIFO */
83 GPIO116_GPIO, /* CC_CCA */
84 GPIO0_GPIO, /* CC_FIFOP */
85 GPIO16_GPIO, /* CCSFD */
86 GPIO115_GPIO, /* Power enable */
88 /* I2C */
89 GPIO117_I2C_SCL,
90 GPIO118_I2C_SDA,
92 /* SSP 3 - 802.15.4 radio */
93 GPIO39_GPIO, /* Chip Select */
94 GPIO34_SSP3_SCLK,
95 GPIO35_SSP3_TXD,
96 GPIO41_SSP3_RXD,
98 /* SSP 2 to daughter boards */
99 GPIO11_SSP2_RXD,
100 GPIO38_SSP2_TXD,
101 GPIO36_SSP2_SCLK,
102 GPIO37_GPIO, /* chip select */
104 /* SSP 1 - to daughter boards */
105 GPIO24_GPIO, /* Chip Select */
106 GPIO23_SSP1_SCLK,
107 GPIO25_SSP1_TXD,
108 GPIO26_SSP1_RXD,
110 /* BTUART Basic Connector*/
111 GPIO42_BTUART_RXD,
112 GPIO43_BTUART_TXD,
113 GPIO44_BTUART_CTS,
114 GPIO45_BTUART_RTS,
116 /* STUART - IM2 via debug board not sure on SG2*/
117 GPIO46_STUART_RXD,
118 GPIO47_STUART_TXD,
120 /* Basic sensor board */
121 GPIO96_GPIO, /* accelerometer interrupt */
122 GPIO99_GPIO, /* ADC interrupt */
124 /* SHT15 */
125 GPIO100_GPIO,
126 GPIO98_GPIO,
128 /* Basic sensor board */
129 GPIO96_GPIO, /* accelerometer interrupt */
130 GPIO99_GPIO, /* ADC interrupt */
132 /* Connector pins specified as gpios */
133 GPIO94_GPIO, /* large basic connector pin 14 */
134 GPIO10_GPIO, /* large basic connector pin 23 */
137 static struct sht15_platform_data platform_data_sht15 = {
138 .gpio_data = 100,
139 .gpio_sck = 98,
142 static struct platform_device sht15 = {
143 .name = "sht15",
144 .id = -1,
145 .dev = {
146 .platform_data = &platform_data_sht15,
150 static struct regulator_consumer_supply stargate2_sensor_3_con[] = {
152 .dev = &sht15.dev,
153 .supply = "vcc",
157 enum stargate2_ldos{
158 vcc_vref,
159 vcc_cc2420,
160 /* a mote connector? */
161 vcc_mica,
162 /* the CSR bluecore chip */
163 vcc_bt,
164 /* The two voltages available to sensor boards */
165 vcc_sensor_1_8,
166 vcc_sensor_3,
167 /* directly connected to the pxa27x */
168 vcc_sram_ext,
169 vcc_pxa_pll,
170 vcc_pxa_usim, /* Reference voltage for certain gpios */
171 vcc_pxa_mem,
172 vcc_pxa_flash,
173 vcc_pxa_core, /*Dc-Dc buck not yet supported */
174 vcc_lcd,
175 vcc_bb,
176 vcc_bbio, /*not sure!*/
177 vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/
180 /* The values of the various regulator constraints are obviously dependent
181 * on exactly what is wired to each ldo. Unfortunately this information is
182 * not generally available. More information has been requested from Xbow.
184 static struct regulator_init_data stargate2_ldo_init_data[] = {
185 [vcc_bbio] = {
186 .constraints = { /* board default 1.8V */
187 .name = "vcc_bbio",
188 .min_uV = 1800000,
189 .max_uV = 1800000,
192 [vcc_bb] = {
193 .constraints = { /* board default 2.8V */
194 .name = "vcc_bb",
195 .min_uV = 2700000,
196 .max_uV = 3000000,
199 [vcc_pxa_flash] = {
200 .constraints = {/* default is 1.8V */
201 .name = "vcc_pxa_flash",
202 .min_uV = 1800000,
203 .max_uV = 1800000,
206 [vcc_cc2420] = { /* also vcc_io */
207 .constraints = {
208 /* board default is 2.8V */
209 .name = "vcc_cc2420",
210 .min_uV = 2700000,
211 .max_uV = 3300000,
214 [vcc_vref] = { /* Reference for what? */
215 .constraints = { /* default 1.8V */
216 .name = "vcc_vref",
217 .min_uV = 1800000,
218 .max_uV = 1800000,
221 [vcc_sram_ext] = {
222 .constraints = { /* default 2.8V */
223 .name = "vcc_sram_ext",
224 .min_uV = 2800000,
225 .max_uV = 2800000,
228 [vcc_mica] = {
229 .constraints = { /* default 2.8V */
230 .name = "vcc_mica",
231 .min_uV = 2800000,
232 .max_uV = 2800000,
235 [vcc_bt] = {
236 .constraints = { /* default 2.8V */
237 .name = "vcc_bt",
238 .min_uV = 2800000,
239 .max_uV = 2800000,
242 [vcc_lcd] = {
243 .constraints = { /* default 2.8V */
244 .name = "vcc_lcd",
245 .min_uV = 2700000,
246 .max_uV = 3300000,
249 [vcc_io] = { /* Same or higher than everything
250 * bar vccbat and vccusb */
251 .constraints = { /* default 2.8V */
252 .name = "vcc_io",
253 .min_uV = 2692000,
254 .max_uV = 3300000,
257 [vcc_sensor_1_8] = {
258 .constraints = { /* default 1.8V */
259 .name = "vcc_sensor_1_8",
260 .min_uV = 1800000,
261 .max_uV = 1800000,
264 [vcc_sensor_3] = { /* curiously default 2.8V */
265 .constraints = {
266 .name = "vcc_sensor_3",
267 .min_uV = 2800000,
268 .max_uV = 3000000,
270 .num_consumer_supplies = ARRAY_SIZE(stargate2_sensor_3_con),
271 .consumer_supplies = stargate2_sensor_3_con,
273 [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/
274 .constraints = {
275 .name = "vcc_pxa_pll",
276 .min_uV = 1170000,
277 .max_uV = 1430000,
280 [vcc_pxa_usim] = {
281 .constraints = { /* default 1.8V */
282 .name = "vcc_pxa_usim",
283 .min_uV = 1710000,
284 .max_uV = 2160000,
287 [vcc_pxa_mem] = {
288 .constraints = { /* default 1.8V */
289 .name = "vcc_pxa_mem",
290 .min_uV = 1800000,
291 .max_uV = 1800000,
296 static struct mtd_partition stargate2flash_partitions[] = {
298 .name = "Bootloader",
299 .size = 0x00040000,
300 .offset = 0,
301 .mask_flags = 0,
302 }, {
303 .name = "Kernel",
304 .size = 0x00200000,
305 .offset = 0x00040000,
306 .mask_flags = 0
307 }, {
308 .name = "Filesystem",
309 .size = 0x01DC0000,
310 .offset = 0x00240000,
311 .mask_flags = 0
315 static struct resource flash_resources = {
316 .start = PXA_CS0_PHYS,
317 .end = PXA_CS0_PHYS + SZ_32M - 1,
318 .flags = IORESOURCE_MEM,
321 static struct flash_platform_data stargate2_flash_data = {
322 .map_name = "cfi_probe",
323 .parts = stargate2flash_partitions,
324 .nr_parts = ARRAY_SIZE(stargate2flash_partitions),
325 .name = "PXA27xOnChipROM",
326 .width = 2,
329 static struct platform_device stargate2_flash_device = {
330 .name = "pxa2xx-flash",
331 .id = 0,
332 .dev = {
333 .platform_data = &stargate2_flash_data,
335 .resource = &flash_resources,
336 .num_resources = 1,
339 static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
340 .num_chipselect = 1,
343 static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
344 .num_chipselect = 1,
347 static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
348 .num_chipselect = 1,
351 /* An upcoming kernel change will scrap SFRM usage so these
352 * drivers have been moved to use gpio's via cs_control */
353 static struct pxa2xx_spi_chip staccel_chip_info = {
354 .tx_threshold = 8,
355 .rx_threshold = 8,
356 .dma_burst_size = 8,
357 .timeout = 235,
358 .gpio_cs = 24,
361 static struct pxa2xx_spi_chip cc2420_info = {
362 .tx_threshold = 8,
363 .rx_threshold = 8,
364 .dma_burst_size = 8,
365 .timeout = 235,
366 .gpio_cs = 39,
369 static struct spi_board_info spi_board_info[] __initdata = {
371 .modalias = "lis3l02dq",
372 .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
373 .bus_num = 1,
374 .chip_select = 0,
375 .controller_data = &staccel_chip_info,
376 .irq = IRQ_GPIO(96),
377 }, {
378 .modalias = "cc2420",
379 .max_speed_hz = 6500000,
380 .bus_num = 3,
381 .chip_select = 0,
382 .controller_data = &cc2420_info,
386 static void sg2_udc_command(int cmd)
388 switch (cmd) {
389 case PXA2XX_UDC_CMD_CONNECT:
390 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
391 break;
392 case PXA2XX_UDC_CMD_DISCONNECT:
393 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
394 break;
398 static struct i2c_pxa_platform_data i2c_pwr_pdata = {
399 .fast_mode = 1,
402 static struct i2c_pxa_platform_data i2c_pdata = {
403 .fast_mode = 1,
406 static void __init imote2_stargate2_init(void)
409 pxa2xx_mfp_config(ARRAY_AND_SIZE(sg2_im2_unified_pin_config));
411 pxa_set_ffuart_info(NULL);
412 pxa_set_btuart_info(NULL);
413 pxa_set_stuart_info(NULL);
415 pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
416 pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
417 pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
418 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
421 pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
422 pxa_set_i2c_info(&i2c_pdata);
425 #ifdef CONFIG_MACH_INTELMOTE2
426 /* As the the imote2 doesn't currently have a conventional SD slot
427 * there is no option to hotplug cards, making all this rather simple
429 static int imote2_mci_get_ro(struct device *dev)
431 return 0;
434 /* Rather simple case as hotplugging not possible */
435 static struct pxamci_platform_data imote2_mci_platform_data = {
436 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */
437 .get_ro = imote2_mci_get_ro,
438 .gpio_card_detect = -1,
439 .gpio_card_ro = -1,
440 .gpio_power = -1,
443 static struct gpio_led imote2_led_pins[] = {
445 .name = "imote2:red",
446 .gpio = 103,
447 .active_low = 1,
448 }, {
449 .name = "imote2:green",
450 .gpio = 104,
451 .active_low = 1,
452 }, {
453 .name = "imote2:blue",
454 .gpio = 105,
455 .active_low = 1,
459 static struct gpio_led_platform_data imote2_led_data = {
460 .num_leds = ARRAY_SIZE(imote2_led_pins),
461 .leds = imote2_led_pins,
464 static struct platform_device imote2_leds = {
465 .name = "leds-gpio",
466 .id = -1,
467 .dev = {
468 .platform_data = &imote2_led_data,
472 static struct da903x_subdev_info imote2_da9030_subdevs[] = {
474 .name = "da903x-regulator",
475 .id = DA9030_ID_LDO2,
476 .platform_data = &stargate2_ldo_init_data[vcc_bbio],
477 }, {
478 .name = "da903x-regulator",
479 .id = DA9030_ID_LDO3,
480 .platform_data = &stargate2_ldo_init_data[vcc_bb],
481 }, {
482 .name = "da903x-regulator",
483 .id = DA9030_ID_LDO4,
484 .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash],
485 }, {
486 .name = "da903x-regulator",
487 .id = DA9030_ID_LDO5,
488 .platform_data = &stargate2_ldo_init_data[vcc_cc2420],
489 }, {
490 .name = "da903x-regulator",
491 .id = DA9030_ID_LDO6,
492 .platform_data = &stargate2_ldo_init_data[vcc_vref],
493 }, {
494 .name = "da903x-regulator",
495 .id = DA9030_ID_LDO7,
496 .platform_data = &stargate2_ldo_init_data[vcc_sram_ext],
497 }, {
498 .name = "da903x-regulator",
499 .id = DA9030_ID_LDO8,
500 .platform_data = &stargate2_ldo_init_data[vcc_mica],
501 }, {
502 .name = "da903x-regulator",
503 .id = DA9030_ID_LDO9,
504 .platform_data = &stargate2_ldo_init_data[vcc_bt],
505 }, {
506 .name = "da903x-regulator",
507 .id = DA9030_ID_LDO10,
508 .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8],
509 }, {
510 .name = "da903x-regulator",
511 .id = DA9030_ID_LDO11,
512 .platform_data = &stargate2_ldo_init_data[vcc_sensor_3],
513 }, {
514 .name = "da903x-regulator",
515 .id = DA9030_ID_LDO12,
516 .platform_data = &stargate2_ldo_init_data[vcc_lcd],
517 }, {
518 .name = "da903x-regulator",
519 .id = DA9030_ID_LDO15,
520 .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll],
521 }, {
522 .name = "da903x-regulator",
523 .id = DA9030_ID_LDO17,
524 .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim],
525 }, {
526 .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */
527 .id = DA9030_ID_LDO18,
528 .platform_data = &stargate2_ldo_init_data[vcc_io],
529 }, {
530 .name = "da903x-regulator",
531 .id = DA9030_ID_LDO19,
532 .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem],
536 static struct da903x_platform_data imote2_da9030_pdata = {
537 .num_subdevs = ARRAY_SIZE(imote2_da9030_subdevs),
538 .subdevs = imote2_da9030_subdevs,
541 static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
543 .type = "da9030",
544 .addr = 0x49,
545 .platform_data = &imote2_da9030_pdata,
546 .irq = gpio_to_irq(1),
550 static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
551 { /* UCAM sensor board */
552 .type = "max1239",
553 .addr = 0x35,
554 }, { /* ITS400 Sensor board only */
555 .type = "max1363",
556 .addr = 0x34,
557 /* Through a nand gate - Also beware, on V2 sensor board the
558 * pull up resistors are missing.
560 .irq = IRQ_GPIO(99),
561 }, { /* ITS400 Sensor board only */
562 .type = "tsl2561",
563 .addr = 0x49,
564 /* Through a nand gate - Also beware, on V2 sensor board the
565 * pull up resistors are missing.
567 .irq = IRQ_GPIO(99),
568 }, { /* ITS400 Sensor board only */
569 .type = "tmp175",
570 .addr = 0x4A,
571 .irq = IRQ_GPIO(96),
572 }, { /* IMB400 Multimedia board */
573 .type = "wm8940",
574 .addr = 0x1A,
578 static unsigned long imote2_pin_config[] __initdata = {
580 /* Button */
581 GPIO91_GPIO,
583 /* LEDS */
584 GPIO103_GPIO, /* red led */
585 GPIO104_GPIO, /* green led */
586 GPIO105_GPIO, /* blue led */
589 static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = {
590 .udc_command = sg2_udc_command,
593 static struct platform_device *imote2_devices[] = {
594 &stargate2_flash_device,
595 &imote2_leds,
596 &sht15,
599 static void __init imote2_init(void)
601 pxa2xx_mfp_config(ARRAY_AND_SIZE(imote2_pin_config));
603 imote2_stargate2_init();
605 platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices));
607 i2c_register_board_info(0, imote2_i2c_board_info,
608 ARRAY_SIZE(imote2_i2c_board_info));
609 i2c_register_board_info(1, imote2_pwr_i2c_board_info,
610 ARRAY_SIZE(imote2_pwr_i2c_board_info));
612 pxa_set_mci_info(&imote2_mci_platform_data);
613 pxa_set_udc_info(&imote2_udc_info);
615 #endif
617 #ifdef CONFIG_MACH_STARGATE2
619 static unsigned long stargate2_pin_config[] __initdata = {
621 GPIO15_nCS_1, /* SRAM */
622 /* SMC91x */
623 GPIO80_nCS_4,
624 GPIO40_GPIO, /*cable detect?*/
626 /* Button */
627 GPIO91_GPIO | WAKEUP_ON_LEVEL_HIGH,
629 /* Compact Flash */
630 GPIO79_PSKTSEL,
631 GPIO48_nPOE,
632 GPIO49_nPWE,
633 GPIO50_nPIOR,
634 GPIO51_nPIOW,
635 GPIO85_nPCE_1,
636 GPIO54_nPCE_2,
637 GPIO55_nPREG,
638 GPIO56_nPWAIT,
639 GPIO57_nIOIS16,
640 GPIO120_GPIO, /* Buff ctrl */
641 GPIO108_GPIO, /* Power ctrl */
642 GPIO82_GPIO, /* Reset */
643 GPIO53_GPIO, /* SG2_S0_GPIO_DETECT */
645 /* MMC not shared with imote2 */
646 GPIO90_GPIO, /* nSD detect */
647 GPIO89_GPIO, /* SD_POWER_ENABLE */
649 /* Bluetooth */
650 GPIO81_GPIO, /* reset */
653 static struct resource smc91x_resources[] = {
654 [0] = {
655 .name = "smc91x-regs",
656 .start = (PXA_CS4_PHYS + 0x300),
657 .end = (PXA_CS4_PHYS + 0xfffff),
658 .flags = IORESOURCE_MEM,
660 [1] = {
661 .start = IRQ_GPIO(40),
662 .end = IRQ_GPIO(40),
663 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
667 static struct smc91x_platdata stargate2_smc91x_info = {
668 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT
669 | SMC91X_NOWAIT | SMC91X_USE_DMA,
672 static struct platform_device smc91x_device = {
673 .name = "smc91x",
674 .id = -1,
675 .num_resources = ARRAY_SIZE(smc91x_resources),
676 .resource = smc91x_resources,
677 .dev = {
678 .platform_data = &stargate2_smc91x_info,
684 * The card detect interrupt isn't debounced so we delay it by 250ms
685 * to give the card a chance to fully insert / eject.
687 static int stargate2_mci_init(struct device *dev,
688 irq_handler_t stargate2_detect_int,
689 void *data)
691 int err;
693 err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
694 if (err) {
695 printk(KERN_ERR "Can't get the gpio for SD power control");
696 goto return_err;
698 gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
700 err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
701 if (err) {
702 printk(KERN_ERR "Can't get the sd detect gpio");
703 goto free_power_en;
705 gpio_direction_input(SG2_GPIO_nSD_DETECT);
707 err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
708 stargate2_detect_int,
709 IRQ_TYPE_EDGE_BOTH,
710 "MMC card detect",
711 data);
712 if (err) {
713 printk(KERN_ERR "can't request MMC card detect IRQ\n");
714 goto free_nsd_detect;
716 return 0;
718 free_nsd_detect:
719 gpio_free(SG2_GPIO_nSD_DETECT);
720 free_power_en:
721 gpio_free(SG2_SD_POWER_ENABLE);
722 return_err:
723 return err;
727 * stargate2_mci_setpower() - set state of mmc power supply
729 * Very simple control. Either it is on or off and is controlled by
730 * a gpio pin */
731 static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
733 gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd);
736 static void stargate2_mci_exit(struct device *dev, void *data)
738 free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
739 gpio_free(SG2_SD_POWER_ENABLE);
740 gpio_free(SG2_GPIO_nSD_DETECT);
743 static struct pxamci_platform_data stargate2_mci_platform_data = {
744 .detect_delay_ms = 250,
745 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
746 .init = stargate2_mci_init,
747 .setpower = stargate2_mci_setpower,
748 .exit = stargate2_mci_exit,
753 * SRAM - The Stargate 2 has 32MB of SRAM.
755 * Here it is made available as an MTD. This will then
756 * typically have a cifs filesystem created on it to provide
757 * fast temporary storage.
759 static struct resource sram_resources = {
760 .start = PXA_CS1_PHYS,
761 .end = PXA_CS1_PHYS + SZ_32M-1,
762 .flags = IORESOURCE_MEM,
765 static struct platdata_mtd_ram stargate2_sram_pdata = {
766 .mapname = "Stargate2 SRAM",
767 .bankwidth = 2,
770 static struct platform_device stargate2_sram = {
771 .name = "mtd-ram",
772 .id = 0,
773 .resource = &sram_resources,
774 .num_resources = 1,
775 .dev = {
776 .platform_data = &stargate2_sram_pdata,
780 static struct pcf857x_platform_data platform_data_pcf857x = {
781 .gpio_base = 128,
782 .n_latch = 0,
783 .setup = NULL,
784 .teardown = NULL,
785 .context = NULL,
788 static struct at24_platform_data pca9500_eeprom_pdata = {
789 .byte_len = 256,
790 .page_size = 4,
794 * stargate2_reset_bluetooth() reset the bluecore to ensure consistent state
796 static int stargate2_reset_bluetooth(void)
798 int err;
799 err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET");
800 if (err) {
801 printk(KERN_ERR "Could not get gpio for bluetooth reset\n");
802 return err;
804 gpio_direction_output(SG2_BT_RESET, 1);
805 mdelay(5);
806 /* now reset it - 5 msec minimum */
807 gpio_set_value(SG2_BT_RESET, 0);
808 mdelay(10);
809 gpio_set_value(SG2_BT_RESET, 1);
810 gpio_free(SG2_BT_RESET);
811 return 0;
814 static struct led_info stargate2_leds[] = {
816 .name = "sg2:red",
817 .flags = DA9030_LED_RATE_ON,
818 }, {
819 .name = "sg2:blue",
820 .flags = DA9030_LED_RATE_ON,
821 }, {
822 .name = "sg2:green",
823 .flags = DA9030_LED_RATE_ON,
827 static struct da903x_subdev_info stargate2_da9030_subdevs[] = {
829 .name = "da903x-led",
830 .id = DA9030_ID_LED_2,
831 .platform_data = &stargate2_leds[0],
832 }, {
833 .name = "da903x-led",
834 .id = DA9030_ID_LED_3,
835 .platform_data = &stargate2_leds[2],
836 }, {
837 .name = "da903x-led",
838 .id = DA9030_ID_LED_4,
839 .platform_data = &stargate2_leds[1],
840 }, {
841 .name = "da903x-regulator",
842 .id = DA9030_ID_LDO2,
843 .platform_data = &stargate2_ldo_init_data[vcc_bbio],
844 }, {
845 .name = "da903x-regulator",
846 .id = DA9030_ID_LDO3,
847 .platform_data = &stargate2_ldo_init_data[vcc_bb],
848 }, {
849 .name = "da903x-regulator",
850 .id = DA9030_ID_LDO4,
851 .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash],
852 }, {
853 .name = "da903x-regulator",
854 .id = DA9030_ID_LDO5,
855 .platform_data = &stargate2_ldo_init_data[vcc_cc2420],
856 }, {
857 .name = "da903x-regulator",
858 .id = DA9030_ID_LDO6,
859 .platform_data = &stargate2_ldo_init_data[vcc_vref],
860 }, {
861 .name = "da903x-regulator",
862 .id = DA9030_ID_LDO7,
863 .platform_data = &stargate2_ldo_init_data[vcc_sram_ext],
864 }, {
865 .name = "da903x-regulator",
866 .id = DA9030_ID_LDO8,
867 .platform_data = &stargate2_ldo_init_data[vcc_mica],
868 }, {
869 .name = "da903x-regulator",
870 .id = DA9030_ID_LDO9,
871 .platform_data = &stargate2_ldo_init_data[vcc_bt],
872 }, {
873 .name = "da903x-regulator",
874 .id = DA9030_ID_LDO10,
875 .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8],
876 }, {
877 .name = "da903x-regulator",
878 .id = DA9030_ID_LDO11,
879 .platform_data = &stargate2_ldo_init_data[vcc_sensor_3],
880 }, {
881 .name = "da903x-regulator",
882 .id = DA9030_ID_LDO12,
883 .platform_data = &stargate2_ldo_init_data[vcc_lcd],
884 }, {
885 .name = "da903x-regulator",
886 .id = DA9030_ID_LDO15,
887 .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll],
888 }, {
889 .name = "da903x-regulator",
890 .id = DA9030_ID_LDO17,
891 .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim],
892 }, {
893 .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */
894 .id = DA9030_ID_LDO18,
895 .platform_data = &stargate2_ldo_init_data[vcc_io],
896 }, {
897 .name = "da903x-regulator",
898 .id = DA9030_ID_LDO19,
899 .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem],
903 static struct da903x_platform_data stargate2_da9030_pdata = {
904 .num_subdevs = ARRAY_SIZE(stargate2_da9030_subdevs),
905 .subdevs = stargate2_da9030_subdevs,
908 static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
910 .type = "da9030",
911 .addr = 0x49,
912 .platform_data = &stargate2_da9030_pdata,
913 .irq = gpio_to_irq(1),
917 static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
918 /* Techically this a pca9500 - but it's compatible with the 8574
919 * for gpio expansion and the 24c02 for eeprom access.
922 .type = "pcf8574",
923 .addr = 0x27,
924 .platform_data = &platform_data_pcf857x,
925 }, {
926 .type = "24c02",
927 .addr = 0x57,
928 .platform_data = &pca9500_eeprom_pdata,
929 }, {
930 .type = "max1238",
931 .addr = 0x35,
932 }, { /* ITS400 Sensor board only */
933 .type = "max1363",
934 .addr = 0x34,
935 /* Through a nand gate - Also beware, on V2 sensor board the
936 * pull up resistors are missing.
938 .irq = IRQ_GPIO(99),
939 }, { /* ITS400 Sensor board only */
940 .type = "tsl2561",
941 .addr = 0x49,
942 /* Through a nand gate - Also beware, on V2 sensor board the
943 * pull up resistors are missing.
945 .irq = IRQ_GPIO(99),
946 }, { /* ITS400 Sensor board only */
947 .type = "tmp175",
948 .addr = 0x4A,
949 .irq = IRQ_GPIO(96),
953 /* Board doesn't support cable detection - so always lie and say
954 * something is there.
956 static int sg2_udc_detect(void)
958 return 1;
961 static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = {
962 .udc_is_connected = sg2_udc_detect,
963 .udc_command = sg2_udc_command,
966 static struct platform_device *stargate2_devices[] = {
967 &stargate2_flash_device,
968 &stargate2_sram,
969 &smc91x_device,
970 &sht15,
973 static void __init stargate2_init(void)
975 /* This is probably a board specific hack as this must be set
976 prior to connecting the MFP stuff up. */
977 MECR &= ~MECR_NOS;
979 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
981 imote2_stargate2_init();
983 platform_add_devices(ARRAY_AND_SIZE(stargate2_devices));
985 i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
986 i2c_register_board_info(1, stargate2_pwr_i2c_board_info,
987 ARRAY_SIZE(stargate2_pwr_i2c_board_info));
989 pxa_set_mci_info(&stargate2_mci_platform_data);
991 pxa_set_udc_info(&stargate2_udc_info);
993 stargate2_reset_bluetooth();
995 #endif
997 #ifdef CONFIG_MACH_INTELMOTE2
998 MACHINE_START(INTELMOTE2, "IMOTE 2")
999 .phys_io = 0x40000000,
1000 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1001 .map_io = pxa_map_io,
1002 .init_irq = pxa27x_init_irq,
1003 .timer = &pxa_timer,
1004 .init_machine = imote2_init,
1005 .boot_params = 0xA0000100,
1006 MACHINE_END
1007 #endif
1009 #ifdef CONFIG_MACH_STARGATE2
1010 MACHINE_START(STARGATE2, "Stargate 2")
1011 .phys_io = 0x40000000,
1012 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1013 .map_io = pxa_map_io,
1014 .init_irq = pxa27x_init_irq,
1015 .timer = &pxa_timer,
1016 .init_machine = stargate2_init,
1017 .boot_params = 0xA0000100,
1018 MACHINE_END
1019 #endif