blob: af40d2a12d373ac98d923ab71015e015bdd5b774 [file] [log] [blame]
Jonathan Cameron4036e1d2009-05-16 18:20:39 +00001/*
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
Jonathan Cameron4036e1d2009-05-16 18:20:39 +0000467/*
468 * The card detect interrupt isn't debounced so we delay it by 250ms
469 * to give the card a chance to fully insert / eject.
470 */
471static int stargate2_mci_init(struct device *dev,
472 irq_handler_t stargate2_detect_int,
473 void *data)
474{
475 int err;
476
477 err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
478 if (err) {
479 printk(KERN_ERR "Can't get the gpio for SD power control");
480 goto return_err;
481 }
482 gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
483
484 err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
485 if (err) {
486 printk(KERN_ERR "Can't get the sd detect gpio");
487 goto free_power_en;
488 }
489 gpio_direction_input(SG2_GPIO_nSD_DETECT);
Jonathan Cameron4036e1d2009-05-16 18:20:39 +0000490
491 err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
492 stargate2_detect_int,
493 IRQ_TYPE_EDGE_BOTH,
494 "MMC card detect",
495 data);
496 if (err) {
497 printk(KERN_ERR "can't request MMC card detect IRQ\n");
498 goto free_nsd_detect;
499 }
500 return 0;
501
502 free_nsd_detect:
503 gpio_free(SG2_GPIO_nSD_DETECT);
504 free_power_en:
505 gpio_free(SG2_SD_POWER_ENABLE);
506 return_err:
507 return err;
508}
509
510/**
511 * stargate2_mci_setpower() - set state of mmc power supply
512 *
513 * Very simple control. Either it is on or off and is controlled by
514 * a gpio pin */
515static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
516{
517 gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd);
518}
519
520static void stargate2_mci_exit(struct device *dev, void *data)
521{
522 free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
523 gpio_free(SG2_SD_POWER_ENABLE);
524 gpio_free(SG2_GPIO_nSD_DETECT);
525}
526
527static struct pxamci_platform_data stargate2_mci_platform_data = {
Eric Miaof97cab22010-04-14 07:00:42 +0800528 .detect_delay_ms = 250,
Jonathan Cameron4036e1d2009-05-16 18:20:39 +0000529 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
530 .init = stargate2_mci_init,
531 .setpower = stargate2_mci_setpower,
532 .exit = stargate2_mci_exit,
533};
534
535static struct mtd_partition stargate2flash_partitions[] = {
536 {
537 .name = "Bootloader",
538 .size = 0x00040000,
539 .offset = 0,
540 .mask_flags = 0,
541 }, {
542 .name = "Kernel",
543 .size = 0x00200000,
544 .offset = 0x00040000,
545 .mask_flags = 0
546 }, {
547 .name = "Filesystem",
548 .size = 0x01DC0000,
549 .offset = 0x00240000,
550 .mask_flags = 0
551 },
552};
553
554static struct resource flash_resources = {
555 .start = PXA_CS0_PHYS,
556 .end = PXA_CS0_PHYS + SZ_32M - 1,
557 .flags = IORESOURCE_MEM,
558};
559
560static struct flash_platform_data stargate2_flash_data = {
561 .map_name = "cfi_probe",
562 .parts = stargate2flash_partitions,
563 .nr_parts = ARRAY_SIZE(stargate2flash_partitions),
564 .name = "PXA27xOnChipROM",
565 .width = 2,
566};
567
568static struct platform_device stargate2_flash_device = {
569 .name = "pxa2xx-flash",
570 .id = 0,
571 .dev = {
572 .platform_data = &stargate2_flash_data,
573 },
574 .resource = &flash_resources,
575 .num_resources = 1,
576};
577
578/*
579 * SRAM - The Stargate 2 has 32MB of SRAM.
580 *
581 * Here it is made available as an MTD. This will then
582 * typically have a cifs filesystem created on it to provide
583 * fast temporary storage.
584 */
585static struct resource sram_resources = {
586 .start = PXA_CS1_PHYS,
587 .end = PXA_CS1_PHYS + SZ_32M-1,
588 .flags = IORESOURCE_MEM,
589};
590
591static struct platdata_mtd_ram stargate2_sram_pdata = {
592 .mapname = "Stargate2 SRAM",
593 .bankwidth = 2,
594};
595
596static struct platform_device stargate2_sram = {
597 .name = "mtd-ram",
598 .id = 0,
599 .resource = &sram_resources,
600 .num_resources = 1,
601 .dev = {
602 .platform_data = &stargate2_sram_pdata,
603 },
604};
605
606static struct pcf857x_platform_data platform_data_pcf857x = {
607 .gpio_base = 128,
608 .n_latch = 0,
609 .setup = NULL,
610 .teardown = NULL,
611 .context = NULL,
612};
613
614static struct at24_platform_data pca9500_eeprom_pdata = {
615 .byte_len = 256,
616 .page_size = 4,
617};
618
619
620static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
621 /* Techically this a pca9500 - but it's compatible with the 8574
622 * for gpio expansion and the 24c02 for eeprom access.
623 */
624 {
625 .type = "pcf8574",
626 .addr = 0x27,
627 .platform_data = &platform_data_pcf857x,
628 }, {
629 .type = "24c02",
630 .addr = 0x57,
631 .platform_data = &pca9500_eeprom_pdata,
632 }, {
633 .type = "max1238",
634 .addr = 0x35,
635 }, { /* ITS400 Sensor board only */
636 .type = "max1363",
637 .addr = 0x34,
638 /* Through a nand gate - Also beware, on V2 sensor board the
639 * pull up resistors are missing.
640 */
641 .irq = IRQ_GPIO(99),
642 }, { /* ITS400 Sensor board only */
643 .type = "tsl2561",
644 .addr = 0x49,
645 /* Through a nand gate - Also beware, on V2 sensor board the
646 * pull up resistors are missing.
647 */
648 .irq = IRQ_GPIO(99),
649 }, { /* ITS400 Sensor board only */
650 .type = "tmp175",
651 .addr = 0x4A,
652 .irq = IRQ_GPIO(96),
653 },
654};
655
656static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
657 {
658 .type = "da9030",
659 .addr = 0x49,
660 .platform_data = &stargate2_da9030_pdata,
661 .irq = gpio_to_irq(1),
662 },
663};
664
665static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
666 .num_chipselect = 1,
667};
668
669static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
670 .num_chipselect = 1,
671};
672
673static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
674 .num_chipselect = 1,
675};
676
677/* An upcoming kernel change will scrap SFRM usage so these
678 * drivers have been moved to use gpio's via cs_control */
679static struct pxa2xx_spi_chip staccel_chip_info = {
680 .tx_threshold = 8,
681 .rx_threshold = 8,
682 .dma_burst_size = 8,
683 .timeout = 235,
684 .gpio_cs = 24,
685};
686
687static struct pxa2xx_spi_chip cc2420_info = {
688 .tx_threshold = 8,
689 .rx_threshold = 8,
690 .dma_burst_size = 8,
691 .timeout = 235,
692 .gpio_cs = 39,
693};
694
695static struct spi_board_info spi_board_info[] __initdata = {
696 {
697 .modalias = "lis3l02dq",
698 .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
699 .bus_num = 1,
700 .chip_select = 0,
701 .controller_data = &staccel_chip_info,
702 .irq = IRQ_GPIO(96),
703 }, {
704 .modalias = "cc2420",
705 .max_speed_hz = 6500000,
706 .bus_num = 3,
707 .chip_select = 0,
708 .controller_data = &cc2420_info,
709 },
710};
711
712static void sg2_udc_command(int cmd)
713{
714 switch (cmd) {
715 case PXA2XX_UDC_CMD_CONNECT:
716 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
717 break;
718 case PXA2XX_UDC_CMD_DISCONNECT:
719 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
720 break;
721 }
722}
723
724/* Board doesn't support cable detection - so always lie and say
725 * something is there.
726 */
727static int sg2_udc_detect(void)
728{
729 return 1;
730}
731
732static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = {
733 .udc_is_connected = sg2_udc_detect,
734 .udc_command = sg2_udc_command,
735};
736
737static struct platform_device *stargate2_devices[] = {
738 &stargate2_flash_device,
739 &stargate2_sram,
740 &smc91x_device,
741 &sht15,
742};
743
744static struct i2c_pxa_platform_data i2c_pwr_pdata = {
745 .fast_mode = 1,
746};
747
748static struct i2c_pxa_platform_data i2c_pdata = {
749 .fast_mode = 1,
750};
751
752static void __init stargate2_init(void)
753{
754 /* This is probably a board specific hack as this must be set
755 prior to connecting the MFP stuff up. */
756 MECR &= ~MECR_NOS;
757
758 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
759
Russell Kingcc155c62009-11-09 13:34:08 +0800760 pxa_set_ffuart_info(NULL);
761 pxa_set_btuart_info(NULL);
762 pxa_set_stuart_info(NULL);
763
Jonathan Cameron4036e1d2009-05-16 18:20:39 +0000764 platform_add_devices(ARRAY_AND_SIZE(stargate2_devices));
765
766 pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
767 pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
768 pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
769 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
770
771 i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
772 i2c_register_board_info(1,
773 ARRAY_AND_SIZE(stargate2_pwr_i2c_board_info));
774 pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
775 pxa_set_i2c_info(&i2c_pdata);
776
777 pxa_set_mci_info(&stargate2_mci_platform_data);
778
779 pxa_set_udc_info(&stargate2_udc_info);
780
781 stargate2_reset_bluetooth();
782}
783
784MACHINE_START(STARGATE2, "Stargate 2")
785 .phys_io = 0x40000000,
786 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
787 .map_io = pxa_map_io,
788 .init_irq = pxa27x_init_irq,
789 .timer = &pxa_timer,
790 .init_machine = stargate2_init,
791 .boot_params = 0xA0000100,
792MACHINE_END