aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/stargate2.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/stargate2.c')
-rw-r--r--arch/arm/mach-pxa/stargate2.c796
1 files changed, 796 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
new file mode 100644
index 000000000000..3b205b69f3fb
--- /dev/null
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -0,0 +1,796 @@
1/*
2 * linux/arch/arm/mach-pxa/stargate2.c
3 *
4 * Author: Ed C. Epp
5 * Created: Nov 05, 2002
6 * Copyright: Intel Corp.
7 *
8 * Modified 2009: Jonathan Cameron <jic23@cam.ac.uk>
9 *
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.
13 */
14
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>
27
28#include <linux/i2c/pcf857x.h>
29#include <linux/i2c/at24.h>
30#include <linux/smc91x.h>
31#include <linux/gpio.h>
32
33#include <asm/types.h>
34#include <asm/setup.h>
35#include <asm/memory.h>
36#include <asm/mach-types.h>
37#include <asm/irq.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42#include <asm/mach/flash.h>
43
44#include <mach/pxa27x.h>
45#include <plat/i2c.h>
46#include <mach/mmc.h>
47#include <mach/udc.h>
48#include <mach/pxa2xx_spi.h>
49#include <mach/pxa27x-udc.h>
50
51#include <linux/spi/spi.h>
52#include <linux/mfd/da903x.h>
53#include <linux/sht15.h>
54
55#include "devices.h"
56#include "generic.h"
57
58/* Bluetooth */
59#define SG2_BT_RESET 81
60
61/* SD */
62#define SG2_GPIO_nSD_DETECT 90
63#define SG2_SD_POWER_ENABLE 89
64
65static unsigned long stargate2_pin_config[] __initdata = {
66
67 GPIO15_nCS_1, /* SRAM */
68 /* SMC91x */
69 GPIO80_nCS_4,
70 GPIO40_GPIO, /*cable detect?*/
71 /* Device Identification for wakeup*/
72 GPIO102_GPIO,
73
74 /* Button */
75 GPIO91_GPIO | WAKEUP_ON_LEVEL_HIGH,
76
77 /* DA9030 */
78 GPIO1_GPIO,
79
80 /* Compact Flash */
81 GPIO79_PSKTSEL,
82 GPIO48_nPOE,
83 GPIO49_nPWE,
84 GPIO50_nPIOR,
85 GPIO51_nPIOW,
86 GPIO85_nPCE_1,
87 GPIO54_nPCE_2,
88 GPIO55_nPREG,
89 GPIO56_nPWAIT,
90 GPIO57_nIOIS16,
91 GPIO120_GPIO, /* Buff ctrl */
92 GPIO108_GPIO, /* Power ctrl */
93 GPIO82_GPIO, /* Reset */
94 GPIO53_GPIO, /* SG2_S0_GPIO_DETECT */
95
96 /* MMC */
97 GPIO32_MMC_CLK,
98 GPIO112_MMC_CMD,
99 GPIO92_MMC_DAT_0,
100 GPIO109_MMC_DAT_1,
101 GPIO110_MMC_DAT_2,
102 GPIO111_MMC_DAT_3,
103 GPIO90_GPIO, /* nSD detect */
104 GPIO89_GPIO, /* SD_POWER_ENABLE */
105
106 /* Bluetooth */
107 GPIO81_GPIO, /* reset */
108
109 /* cc2420 802.15.4 radio */
110 GPIO22_GPIO, /* CC_RSTN (out)*/
111 GPIO114_GPIO, /* CC_FIFO (in) */
112 GPIO116_GPIO, /* CC_CCA (in) */
113 GPIO0_GPIO, /* CC_FIFOP (in) */
114 GPIO16_GPIO, /* CCSFD (in) */
115 GPIO39_GPIO, /* CSn (out) */
116
117 /* I2C */
118 GPIO117_I2C_SCL,
119 GPIO118_I2C_SDA,
120
121 /* SSP 3 - 802.15.4 radio */
122 GPIO39_GPIO, /* chip select */
123 GPIO34_SSP3_SCLK,
124 GPIO35_SSP3_TXD,
125 GPIO41_SSP3_RXD,
126
127 /* SSP 2 */
128 GPIO11_SSP2_RXD,
129 GPIO38_SSP2_TXD,
130 GPIO36_SSP2_SCLK,
131 GPIO37_GPIO, /* chip select */
132
133 /* SSP 1 */
134 GPIO26_SSP1_RXD,
135 GPIO25_SSP1_TXD,
136 GPIO23_SSP1_SCLK,
137 GPIO24_GPIO, /* chip select */
138
139 /* BTUART */
140 GPIO42_BTUART_RXD,
141 GPIO43_BTUART_TXD,
142 GPIO44_BTUART_CTS,
143 GPIO45_BTUART_RTS,
144
145 /* STUART */
146 GPIO46_STUART_RXD,
147 GPIO47_STUART_TXD,
148
149 /* Basic sensor board */
150 GPIO96_GPIO, /* accelerometer interrupt */
151 GPIO99_GPIO, /* ADC interrupt */
152
153 /* Connector pins specified as gpios */
154 GPIO94_GPIO, /* large basic connector pin 14 */
155 GPIO10_GPIO, /* large basic connector pin 23 */
156
157 /* SHT15 */
158 GPIO100_GPIO,
159 GPIO98_GPIO,
160};
161
162/**
163 * stargate2_reset_bluetooth() reset the bluecore to ensure consistent state
164 **/
165static int stargate2_reset_bluetooth(void)
166{
167 int err;
168 err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET");
169 if (err) {
170 printk(KERN_ERR "Could not get gpio for bluetooth reset \n");
171 return err;
172 }
173 gpio_direction_output(SG2_BT_RESET, 1);
174 mdelay(5);
175 /* now reset it - 5 msec minimum */
176 gpio_set_value(SG2_BT_RESET, 0);
177 mdelay(10);
178 gpio_set_value(SG2_BT_RESET, 1);
179 gpio_free(SG2_BT_RESET);
180 return 0;
181}
182
183static struct led_info stargate2_leds[] = {
184 {
185 .name = "sg2:red",
186 .flags = DA9030_LED_RATE_ON,
187 }, {
188 .name = "sg2:blue",
189 .flags = DA9030_LED_RATE_ON,
190 }, {
191 .name = "sg2:green",
192 .flags = DA9030_LED_RATE_ON,
193 },
194};
195
196static struct sht15_platform_data platform_data_sht15 = {
197 .gpio_data = 100,
198 .gpio_sck = 98,
199};
200
201static struct platform_device sht15 = {
202 .name = "sht15",
203 .id = -1,
204 .dev = {
205 .platform_data = &platform_data_sht15,
206 },
207};
208
209static struct regulator_consumer_supply stargate2_sensor_3_con[] = {
210 {
211 .dev = &sht15.dev,
212 .supply = "vcc",
213 },
214};
215
216enum stargate2_ldos{
217 vcc_vref,
218 vcc_cc2420,
219 /* a mote connector? */
220 vcc_mica,
221 /* the CSR bluecore chip */
222 vcc_bt,
223 /* The two voltages available to sensor boards */
224 vcc_sensor_1_8,
225 vcc_sensor_3,
226 /* directly connected to the pxa27x */
227 vcc_sram_ext,
228 vcc_pxa_pll,
229 vcc_pxa_usim, /* Reference voltage for certain gpios */
230 vcc_pxa_mem,
231 vcc_pxa_flash,
232 vcc_pxa_core, /*Dc-Dc buck not yet supported */
233 vcc_lcd,
234 vcc_bb,
235 vcc_bbio, /*not sure!*/
236 vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/
237};
238
239/* The values of the various regulator constraints are obviously dependent
240 * on exactly what is wired to each ldo. Unfortunately this information is
241 * not generally available. More information has been requested from Xbow.
242 */
243static struct regulator_init_data stargate2_ldo_init_data[] = {
244 [vcc_bbio] = {
245 .constraints = { /* board default 1.8V */
246 .name = "vcc_bbio",
247 .min_uV = 1800000,
248 .max_uV = 1800000,
249 },
250 },
251 [vcc_bb] = {
252 .constraints = { /* board default 2.8V */
253 .name = "vcc_bb",
254 .min_uV = 2700000,
255 .max_uV = 3000000,
256 },
257 },
258 [vcc_pxa_flash] = {
259 .constraints = {/* default is 1.8V */
260 .name = "vcc_pxa_flash",
261 .min_uV = 1800000,
262 .max_uV = 1800000,
263 },
264 },
265 [vcc_cc2420] = { /* also vcc_io */
266 .constraints = {
267 /* board default is 2.8V */
268 .name = "vcc_cc2420",
269 .min_uV = 2700000,
270 .max_uV = 3300000,
271 },
272 },
273 [vcc_vref] = { /* Reference for what? */
274 .constraints = { /* default 1.8V */
275 .name = "vcc_vref",
276 .min_uV = 1800000,
277 .max_uV = 1800000,
278 },
279 },
280 [vcc_sram_ext] = {
281 .constraints = { /* default 2.8V */
282 .name = "vcc_sram_ext",
283 .min_uV = 2800000,
284 .max_uV = 2800000,
285 },
286 },
287 [vcc_mica] = {
288 .constraints = { /* default 2.8V */
289 .name = "vcc_mica",
290 .min_uV = 2800000,
291 .max_uV = 2800000,
292 },
293 },
294 [vcc_bt] = {
295 .constraints = { /* default 2.8V */
296 .name = "vcc_bt",
297 .min_uV = 2800000,
298 .max_uV = 2800000,
299 },
300 },
301 [vcc_lcd] = {
302 .constraints = { /* default 2.8V */
303 .name = "vcc_lcd",
304 .min_uV = 2700000,
305 .max_uV = 3300000,
306 },
307 },
308 [vcc_io] = { /* Same or higher than everything
309 * bar vccbat and vccusb */
310 .constraints = { /* default 2.8V */
311 .name = "vcc_io",
312 .min_uV = 2692000,
313 .max_uV = 3300000,
314 },
315 },
316 [vcc_sensor_1_8] = {
317 .constraints = { /* default 1.8V */
318 .name = "vcc_sensor_1_8",
319 .min_uV = 1800000,
320 .max_uV = 1800000,
321 },
322 },
323 [vcc_sensor_3] = { /* curiously default 2.8V */
324 .constraints = {
325 .name = "vcc_sensor_3",
326 .min_uV = 2800000,
327 .max_uV = 3000000,
328 },
329 .num_consumer_supplies = ARRAY_SIZE(stargate2_sensor_3_con),
330 .consumer_supplies = stargate2_sensor_3_con,
331 },
332 [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/
333 .constraints = {
334 .name = "vcc_pxa_pll",
335 .min_uV = 1170000,
336 .max_uV = 1430000,
337 },
338 },
339 [vcc_pxa_usim] = {
340 .constraints = { /* default 1.8V */
341 .name = "vcc_pxa_usim",
342 .min_uV = 1710000,
343 .max_uV = 2160000,
344 },
345 },
346 [vcc_pxa_mem] = {
347 .constraints = { /* default 1.8V */
348 .name = "vcc_pxa_mem",
349 .min_uV = 1800000,
350 .max_uV = 1800000,
351 },
352 },
353};
354
355static struct da903x_subdev_info stargate2_da9030_subdevs[] = {
356 {
357 .name = "da903x-led",
358 .id = DA9030_ID_LED_2,
359 .platform_data = &stargate2_leds[0],
360 }, {
361 .name = "da903x-led",
362 .id = DA9030_ID_LED_3,
363 .platform_data = &stargate2_leds[2],
364 }, {
365 .name = "da903x-led",
366 .id = DA9030_ID_LED_4,
367 .platform_data = &stargate2_leds[1],
368 }, {
369 .name = "da903x-regulator",
370 .id = DA9030_ID_LDO2,
371 .platform_data = &stargate2_ldo_init_data[vcc_bbio],
372 }, {
373 .name = "da903x-regulator",
374 .id = DA9030_ID_LDO3,
375 .platform_data = &stargate2_ldo_init_data[vcc_bb],
376 }, {
377 .name = "da903x-regulator",
378 .id = DA9030_ID_LDO4,
379 .platform_data = &stargate2_ldo_init_data[vcc_pxa_flash],
380 }, {
381 .name = "da903x-regulator",
382 .id = DA9030_ID_LDO5,
383 .platform_data = &stargate2_ldo_init_data[vcc_cc2420],
384 }, {
385 .name = "da903x-regulator",
386 .id = DA9030_ID_LDO6,
387 .platform_data = &stargate2_ldo_init_data[vcc_vref],
388 }, {
389 .name = "da903x-regulator",
390 .id = DA9030_ID_LDO7,
391 .platform_data = &stargate2_ldo_init_data[vcc_sram_ext],
392 }, {
393 .name = "da903x-regulator",
394 .id = DA9030_ID_LDO8,
395 .platform_data = &stargate2_ldo_init_data[vcc_mica],
396 }, {
397 .name = "da903x-regulator",
398 .id = DA9030_ID_LDO9,
399 .platform_data = &stargate2_ldo_init_data[vcc_bt],
400 }, {
401 .name = "da903x-regulator",
402 .id = DA9030_ID_LDO10,
403 .platform_data = &stargate2_ldo_init_data[vcc_sensor_1_8],
404 }, {
405 .name = "da903x-regulator",
406 .id = DA9030_ID_LDO11,
407 .platform_data = &stargate2_ldo_init_data[vcc_sensor_3],
408 }, {
409 .name = "da903x-regulator",
410 .id = DA9030_ID_LDO12,
411 .platform_data = &stargate2_ldo_init_data[vcc_lcd],
412 }, {
413 .name = "da903x-regulator",
414 .id = DA9030_ID_LDO15,
415 .platform_data = &stargate2_ldo_init_data[vcc_pxa_pll],
416 }, {
417 .name = "da903x-regulator",
418 .id = DA9030_ID_LDO17,
419 .platform_data = &stargate2_ldo_init_data[vcc_pxa_usim],
420 }, {
421 .name = "da903x-regulator", /*pxa vcc i/o and cc2420 vcc i/o */
422 .id = DA9030_ID_LDO18,
423 .platform_data = &stargate2_ldo_init_data[vcc_io],
424 }, {
425 .name = "da903x-regulator",
426 .id = DA9030_ID_LDO19,
427 .platform_data = &stargate2_ldo_init_data[vcc_pxa_mem],
428 },
429};
430
431static struct da903x_platform_data stargate2_da9030_pdata = {
432 .num_subdevs = ARRAY_SIZE(stargate2_da9030_subdevs),
433 .subdevs = stargate2_da9030_subdevs,
434};
435
436static struct resource smc91x_resources[] = {
437 [0] = {
438 .name = "smc91x-regs",
439 .start = (PXA_CS4_PHYS + 0x300),
440 .end = (PXA_CS4_PHYS + 0xfffff),
441 .flags = IORESOURCE_MEM,
442 },
443 [1] = {
444 .start = IRQ_GPIO(40),
445 .end = IRQ_GPIO(40),
446 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
447 }
448};
449
450static struct smc91x_platdata stargate2_smc91x_info = {
451 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT
452 | SMC91X_NOWAIT | SMC91X_USE_DMA,
453};
454
455static struct platform_device smc91x_device = {
456 .name = "smc91x",
457 .id = -1,
458 .num_resources = ARRAY_SIZE(smc91x_resources),
459 .resource = smc91x_resources,
460 .dev = {
461 .platform_data = &stargate2_smc91x_info,
462 },
463};
464
465
466
467static struct pxamci_platform_data stargate2_mci_platform_data;
468
469/*
470 * The card detect interrupt isn't debounced so we delay it by 250ms
471 * to give the card a chance to fully insert / eject.
472 */
473static int stargate2_mci_init(struct device *dev,
474 irq_handler_t stargate2_detect_int,
475 void *data)
476{
477 int err;
478
479 err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
480 if (err) {
481 printk(KERN_ERR "Can't get the gpio for SD power control");
482 goto return_err;
483 }
484 gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
485
486 err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
487 if (err) {
488 printk(KERN_ERR "Can't get the sd detect gpio");
489 goto free_power_en;
490 }
491 gpio_direction_input(SG2_GPIO_nSD_DETECT);
492 /* Delay to allow for full insertion */
493 stargate2_mci_platform_data.detect_delay = msecs_to_jiffies(250);
494
495 err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
496 stargate2_detect_int,
497 IRQ_TYPE_EDGE_BOTH,
498 "MMC card detect",
499 data);
500 if (err) {
501 printk(KERN_ERR "can't request MMC card detect IRQ\n");
502 goto free_nsd_detect;
503 }
504 return 0;
505
506 free_nsd_detect:
507 gpio_free(SG2_GPIO_nSD_DETECT);
508 free_power_en:
509 gpio_free(SG2_SD_POWER_ENABLE);
510 return_err:
511 return err;
512}
513
514/**
515 * stargate2_mci_setpower() - set state of mmc power supply
516 *
517 * Very simple control. Either it is on or off and is controlled by
518 * a gpio pin */
519static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
520{
521 gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd);
522}
523
524static void stargate2_mci_exit(struct device *dev, void *data)
525{
526 free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
527 gpio_free(SG2_SD_POWER_ENABLE);
528 gpio_free(SG2_GPIO_nSD_DETECT);
529}
530
531static struct pxamci_platform_data stargate2_mci_platform_data = {
532 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
533 .init = stargate2_mci_init,
534 .setpower = stargate2_mci_setpower,
535 .exit = stargate2_mci_exit,
536};
537
538static struct mtd_partition stargate2flash_partitions[] = {
539 {
540 .name = "Bootloader",
541 .size = 0x00040000,
542 .offset = 0,
543 .mask_flags = 0,
544 }, {
545 .name = "Kernel",
546 .size = 0x00200000,
547 .offset = 0x00040000,
548 .mask_flags = 0
549 }, {
550 .name = "Filesystem",
551 .size = 0x01DC0000,
552 .offset = 0x00240000,
553 .mask_flags = 0
554 },
555};
556
557static struct resource flash_resources = {
558 .start = PXA_CS0_PHYS,
559 .end = PXA_CS0_PHYS + SZ_32M - 1,
560 .flags = IORESOURCE_MEM,
561};
562
563static struct flash_platform_data stargate2_flash_data = {
564 .map_name = "cfi_probe",
565 .parts = stargate2flash_partitions,
566 .nr_parts = ARRAY_SIZE(stargate2flash_partitions),
567 .name = "PXA27xOnChipROM",
568 .width = 2,
569};
570
571static struct platform_device stargate2_flash_device = {
572 .name = "pxa2xx-flash",
573 .id = 0,
574 .dev = {
575 .platform_data = &stargate2_flash_data,
576 },
577 .resource = &flash_resources,
578 .num_resources = 1,
579};
580
581/*
582 * SRAM - The Stargate 2 has 32MB of SRAM.
583 *
584 * Here it is made available as an MTD. This will then
585 * typically have a cifs filesystem created on it to provide
586 * fast temporary storage.
587 */
588static struct resource sram_resources = {
589 .start = PXA_CS1_PHYS,
590 .end = PXA_CS1_PHYS + SZ_32M-1,
591 .flags = IORESOURCE_MEM,
592};
593
594static struct platdata_mtd_ram stargate2_sram_pdata = {
595 .mapname = "Stargate2 SRAM",
596 .bankwidth = 2,
597};
598
599static struct platform_device stargate2_sram = {
600 .name = "mtd-ram",
601 .id = 0,
602 .resource = &sram_resources,
603 .num_resources = 1,
604 .dev = {
605 .platform_data = &stargate2_sram_pdata,
606 },
607};
608
609static struct pcf857x_platform_data platform_data_pcf857x = {
610 .gpio_base = 128,
611 .n_latch = 0,
612 .setup = NULL,
613 .teardown = NULL,
614 .context = NULL,
615};
616
617static struct at24_platform_data pca9500_eeprom_pdata = {
618 .byte_len = 256,
619 .page_size = 4,
620};
621
622
623static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
624 /* Techically this a pca9500 - but it's compatible with the 8574
625 * for gpio expansion and the 24c02 for eeprom access.
626 */
627 {
628 .type = "pcf8574",
629 .addr = 0x27,
630 .platform_data = &platform_data_pcf857x,
631 }, {
632 .type = "24c02",
633 .addr = 0x57,
634 .platform_data = &pca9500_eeprom_pdata,
635 }, {
636 .type = "max1238",
637 .addr = 0x35,
638 }, { /* ITS400 Sensor board only */
639 .type = "max1363",
640 .addr = 0x34,
641 /* Through a nand gate - Also beware, on V2 sensor board the
642 * pull up resistors are missing.
643 */
644 .irq = IRQ_GPIO(99),
645 }, { /* ITS400 Sensor board only */
646 .type = "tsl2561",
647 .addr = 0x49,
648 /* Through a nand gate - Also beware, on V2 sensor board the
649 * pull up resistors are missing.
650 */
651 .irq = IRQ_GPIO(99),
652 }, { /* ITS400 Sensor board only */
653 .type = "tmp175",
654 .addr = 0x4A,
655 .irq = IRQ_GPIO(96),
656 },
657};
658
659static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
660 {
661 .type = "da9030",
662 .addr = 0x49,
663 .platform_data = &stargate2_da9030_pdata,
664 .irq = gpio_to_irq(1),
665 },
666};
667
668static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
669 .num_chipselect = 1,
670};
671
672static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
673 .num_chipselect = 1,
674};
675
676static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
677 .num_chipselect = 1,
678};
679
680/* An upcoming kernel change will scrap SFRM usage so these
681 * drivers have been moved to use gpio's via cs_control */
682static struct pxa2xx_spi_chip staccel_chip_info = {
683 .tx_threshold = 8,
684 .rx_threshold = 8,
685 .dma_burst_size = 8,
686 .timeout = 235,
687 .gpio_cs = 24,
688};
689
690static struct pxa2xx_spi_chip cc2420_info = {
691 .tx_threshold = 8,
692 .rx_threshold = 8,
693 .dma_burst_size = 8,
694 .timeout = 235,
695 .gpio_cs = 39,
696};
697
698static struct spi_board_info spi_board_info[] __initdata = {
699 {
700 .modalias = "lis3l02dq",
701 .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
702 .bus_num = 1,
703 .chip_select = 0,
704 .controller_data = &staccel_chip_info,
705 .irq = IRQ_GPIO(96),
706 }, {
707 .modalias = "cc2420",
708 .max_speed_hz = 6500000,
709 .bus_num = 3,
710 .chip_select = 0,
711 .controller_data = &cc2420_info,
712 },
713};
714
715static void sg2_udc_command(int cmd)
716{
717 switch (cmd) {
718 case PXA2XX_UDC_CMD_CONNECT:
719 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
720 break;
721 case PXA2XX_UDC_CMD_DISCONNECT:
722 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
723 break;
724 }
725}
726
727/* Board doesn't support cable detection - so always lie and say
728 * something is there.
729 */
730static int sg2_udc_detect(void)
731{
732 return 1;
733}
734
735static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = {
736 .udc_is_connected = sg2_udc_detect,
737 .udc_command = sg2_udc_command,
738};
739
740static struct platform_device *stargate2_devices[] = {
741 &stargate2_flash_device,
742 &stargate2_sram,
743 &smc91x_device,
744 &sht15,
745};
746
747static struct i2c_pxa_platform_data i2c_pwr_pdata = {
748 .fast_mode = 1,
749};
750
751static struct i2c_pxa_platform_data i2c_pdata = {
752 .fast_mode = 1,
753};
754
755static void __init stargate2_init(void)
756{
757 /* This is probably a board specific hack as this must be set
758 prior to connecting the MFP stuff up. */
759 MECR &= ~MECR_NOS;
760
761 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
762
763 /* spi chip selects */
764 gpio_direction_output(37, 0);
765 gpio_direction_output(24, 0);
766 gpio_direction_output(39, 0);
767
768 platform_add_devices(ARRAY_AND_SIZE(stargate2_devices));
769
770 pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
771 pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
772 pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
773 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
774
775 i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
776 i2c_register_board_info(1,
777 ARRAY_AND_SIZE(stargate2_pwr_i2c_board_info));
778 pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
779 pxa_set_i2c_info(&i2c_pdata);
780
781 pxa_set_mci_info(&stargate2_mci_platform_data);
782
783 pxa_set_udc_info(&stargate2_udc_info);
784
785 stargate2_reset_bluetooth();
786}
787
788MACHINE_START(STARGATE2, "Stargate 2")
789 .phys_io = 0x40000000,
790 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
791 .map_io = pxa_map_io,
792 .init_irq = pxa27x_init_irq,
793 .timer = &pxa_timer,
794 .init_machine = stargate2_init,
795 .boot_params = 0xA0000100,
796MACHINE_END