stargate2.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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. static struct pxamci_platform_data stargate2_mci_platform_data;
  427. /*
  428. * The card detect interrupt isn't debounced so we delay it by 250ms
  429. * to give the card a chance to fully insert / eject.
  430. */
  431. static int stargate2_mci_init(struct device *dev,
  432. irq_handler_t stargate2_detect_int,
  433. void *data)
  434. {
  435. int err;
  436. err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
  437. if (err) {
  438. printk(KERN_ERR "Can't get the gpio for SD power control");
  439. goto return_err;
  440. }
  441. gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
  442. err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
  443. if (err) {
  444. printk(KERN_ERR "Can't get the sd detect gpio");
  445. goto free_power_en;
  446. }
  447. gpio_direction_input(SG2_GPIO_nSD_DETECT);
  448. /* Delay to allow for full insertion */
  449. stargate2_mci_platform_data.detect_delay = msecs_to_jiffies(250);
  450. err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
  451. stargate2_detect_int,
  452. IRQ_TYPE_EDGE_BOTH,
  453. "MMC card detect",
  454. data);
  455. if (err) {
  456. printk(KERN_ERR "can't request MMC card detect IRQ\n");
  457. goto free_nsd_detect;
  458. }
  459. return 0;
  460. free_nsd_detect:
  461. gpio_free(SG2_GPIO_nSD_DETECT);
  462. free_power_en:
  463. gpio_free(SG2_SD_POWER_ENABLE);
  464. return_err:
  465. return err;
  466. }
  467. /**
  468. * stargate2_mci_setpower() - set state of mmc power supply
  469. *
  470. * Very simple control. Either it is on or off and is controlled by
  471. * a gpio pin */
  472. static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
  473. {
  474. gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd);
  475. }
  476. static void stargate2_mci_exit(struct device *dev, void *data)
  477. {
  478. free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
  479. gpio_free(SG2_SD_POWER_ENABLE);
  480. gpio_free(SG2_GPIO_nSD_DETECT);
  481. }
  482. static struct pxamci_platform_data stargate2_mci_platform_data = {
  483. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  484. .init = stargate2_mci_init,
  485. .setpower = stargate2_mci_setpower,
  486. .exit = stargate2_mci_exit,
  487. };
  488. static struct mtd_partition stargate2flash_partitions[] = {
  489. {
  490. .name = "Bootloader",
  491. .size = 0x00040000,
  492. .offset = 0,
  493. .mask_flags = 0,
  494. }, {
  495. .name = "Kernel",
  496. .size = 0x00200000,
  497. .offset = 0x00040000,
  498. .mask_flags = 0
  499. }, {
  500. .name = "Filesystem",
  501. .size = 0x01DC0000,
  502. .offset = 0x00240000,
  503. .mask_flags = 0
  504. },
  505. };
  506. static struct resource flash_resources = {
  507. .start = PXA_CS0_PHYS,
  508. .end = PXA_CS0_PHYS + SZ_32M - 1,
  509. .flags = IORESOURCE_MEM,
  510. };
  511. static struct flash_platform_data stargate2_flash_data = {
  512. .map_name = "cfi_probe",
  513. .parts = stargate2flash_partitions,
  514. .nr_parts = ARRAY_SIZE(stargate2flash_partitions),
  515. .name = "PXA27xOnChipROM",
  516. .width = 2,
  517. };
  518. static struct platform_device stargate2_flash_device = {
  519. .name = "pxa2xx-flash",
  520. .id = 0,
  521. .dev = {
  522. .platform_data = &stargate2_flash_data,
  523. },
  524. .resource = &flash_resources,
  525. .num_resources = 1,
  526. };
  527. /*
  528. * SRAM - The Stargate 2 has 32MB of SRAM.
  529. *
  530. * Here it is made available as an MTD. This will then
  531. * typically have a cifs filesystem created on it to provide
  532. * fast temporary storage.
  533. */
  534. static struct resource sram_resources = {
  535. .start = PXA_CS1_PHYS,
  536. .end = PXA_CS1_PHYS + SZ_32M-1,
  537. .flags = IORESOURCE_MEM,
  538. };
  539. static struct platdata_mtd_ram stargate2_sram_pdata = {
  540. .mapname = "Stargate2 SRAM",
  541. .bankwidth = 2,
  542. };
  543. static struct platform_device stargate2_sram = {
  544. .name = "mtd-ram",
  545. .id = 0,
  546. .resource = &sram_resources,
  547. .num_resources = 1,
  548. .dev = {
  549. .platform_data = &stargate2_sram_pdata,
  550. },
  551. };
  552. static struct pcf857x_platform_data platform_data_pcf857x = {
  553. .gpio_base = 128,
  554. .n_latch = 0,
  555. .setup = NULL,
  556. .teardown = NULL,
  557. .context = NULL,
  558. };
  559. static struct at24_platform_data pca9500_eeprom_pdata = {
  560. .byte_len = 256,
  561. .page_size = 4,
  562. };
  563. static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
  564. /* Techically this a pca9500 - but it's compatible with the 8574
  565. * for gpio expansion and the 24c02 for eeprom access.
  566. */
  567. {
  568. .type = "pcf8574",
  569. .addr = 0x27,
  570. .platform_data = &platform_data_pcf857x,
  571. }, {
  572. .type = "24c02",
  573. .addr = 0x57,
  574. .platform_data = &pca9500_eeprom_pdata,
  575. }, {
  576. .type = "max1238",
  577. .addr = 0x35,
  578. }, { /* ITS400 Sensor board only */
  579. .type = "max1363",
  580. .addr = 0x34,
  581. /* Through a nand gate - Also beware, on V2 sensor board the
  582. * pull up resistors are missing.
  583. */
  584. .irq = IRQ_GPIO(99),
  585. }, { /* ITS400 Sensor board only */
  586. .type = "tsl2561",
  587. .addr = 0x49,
  588. /* Through a nand gate - Also beware, on V2 sensor board the
  589. * pull up resistors are missing.
  590. */
  591. .irq = IRQ_GPIO(99),
  592. }, { /* ITS400 Sensor board only */
  593. .type = "tmp175",
  594. .addr = 0x4A,
  595. .irq = IRQ_GPIO(96),
  596. },
  597. };
  598. static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
  599. {
  600. .type = "da9030",
  601. .addr = 0x49,
  602. .platform_data = &stargate2_da9030_pdata,
  603. .irq = gpio_to_irq(1),
  604. },
  605. };
  606. static struct pxa2xx_spi_master pxa_ssp_master_0_info = {
  607. .num_chipselect = 1,
  608. };
  609. static struct pxa2xx_spi_master pxa_ssp_master_1_info = {
  610. .num_chipselect = 1,
  611. };
  612. static struct pxa2xx_spi_master pxa_ssp_master_2_info = {
  613. .num_chipselect = 1,
  614. };
  615. /* An upcoming kernel change will scrap SFRM usage so these
  616. * drivers have been moved to use gpio's via cs_control */
  617. static struct pxa2xx_spi_chip staccel_chip_info = {
  618. .tx_threshold = 8,
  619. .rx_threshold = 8,
  620. .dma_burst_size = 8,
  621. .timeout = 235,
  622. .gpio_cs = 24,
  623. };
  624. static struct pxa2xx_spi_chip cc2420_info = {
  625. .tx_threshold = 8,
  626. .rx_threshold = 8,
  627. .dma_burst_size = 8,
  628. .timeout = 235,
  629. .gpio_cs = 39,
  630. };
  631. static struct spi_board_info spi_board_info[] __initdata = {
  632. {
  633. .modalias = "lis3l02dq",
  634. .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
  635. .bus_num = 1,
  636. .chip_select = 0,
  637. .controller_data = &staccel_chip_info,
  638. .irq = IRQ_GPIO(96),
  639. }, {
  640. .modalias = "cc2420",
  641. .max_speed_hz = 6500000,
  642. .bus_num = 3,
  643. .chip_select = 0,
  644. .controller_data = &cc2420_info,
  645. },
  646. };
  647. static void sg2_udc_command(int cmd)
  648. {
  649. switch (cmd) {
  650. case PXA2XX_UDC_CMD_CONNECT:
  651. UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
  652. break;
  653. case PXA2XX_UDC_CMD_DISCONNECT:
  654. UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
  655. break;
  656. }
  657. }
  658. /* Board doesn't support cable detection - so always lie and say
  659. * something is there.
  660. */
  661. static int sg2_udc_detect(void)
  662. {
  663. return 1;
  664. }
  665. static struct pxa2xx_udc_mach_info stargate2_udc_info __initdata = {
  666. .udc_is_connected = sg2_udc_detect,
  667. .udc_command = sg2_udc_command,
  668. };
  669. static struct platform_device *stargate2_devices[] = {
  670. &stargate2_flash_device,
  671. &stargate2_sram,
  672. &smc91x_device,
  673. &sht15,
  674. };
  675. static struct i2c_pxa_platform_data i2c_pwr_pdata = {
  676. .fast_mode = 1,
  677. };
  678. static struct i2c_pxa_platform_data i2c_pdata = {
  679. .fast_mode = 1,
  680. };
  681. static void __init stargate2_init(void)
  682. {
  683. /* This is probably a board specific hack as this must be set
  684. prior to connecting the MFP stuff up. */
  685. MECR &= ~MECR_NOS;
  686. pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
  687. /* spi chip selects */
  688. gpio_direction_output(37, 0);
  689. gpio_direction_output(24, 0);
  690. gpio_direction_output(39, 0);
  691. platform_add_devices(ARRAY_AND_SIZE(stargate2_devices));
  692. pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
  693. pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
  694. pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);
  695. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  696. i2c_register_board_info(0, ARRAY_AND_SIZE(stargate2_i2c_board_info));
  697. i2c_register_board_info(1,
  698. ARRAY_AND_SIZE(stargate2_pwr_i2c_board_info));
  699. pxa27x_set_i2c_power_info(&i2c_pwr_pdata);
  700. pxa_set_i2c_info(&i2c_pdata);
  701. pxa_set_mci_info(&stargate2_mci_platform_data);
  702. pxa_set_udc_info(&stargate2_udc_info);
  703. stargate2_reset_bluetooth();
  704. }
  705. MACHINE_START(STARGATE2, "Stargate 2")
  706. .phys_io = 0x40000000,
  707. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  708. .map_io = pxa_map_io,
  709. .init_irq = pxa27x_init_irq,
  710. .timer = &pxa_timer,
  711. .init_machine = stargate2_init,
  712. .boot_params = 0xA0000100,
  713. MACHINE_END