stargate2.c 18 KB

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