z2.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. /*
  2. * linux/arch/arm/mach-pxa/z2.c
  3. *
  4. * Support for the Zipit Z2 Handheld device.
  5. *
  6. * Copyright (C) 2009-2010 Marek Vasut <marek.vasut@gmail.com>
  7. *
  8. * Based on research and code by: Ken McGuire
  9. * Based on mainstone.c as modified for the Zipit Z2.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/platform_device.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/pwm_backlight.h>
  19. #include <linux/z2_battery.h>
  20. #include <linux/dma-mapping.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/pxa2xx_spi.h>
  23. #include <linux/spi/libertas_spi.h>
  24. #include <linux/spi/lms283gf05.h>
  25. #include <linux/power_supply.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/gpio.h>
  28. #include <linux/gpio_keys.h>
  29. #include <linux/delay.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/i2c/pxa-i2c.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/mach/arch.h>
  34. #include <mach/pxa27x.h>
  35. #include <mach/mfp-pxa27x.h>
  36. #include <mach/z2.h>
  37. #include <linux/platform_data/video-pxafb.h>
  38. #include <linux/platform_data/mmc-pxamci.h>
  39. #include <linux/platform_data/keypad-pxa27x.h>
  40. #include <mach/pm.h>
  41. #include "generic.h"
  42. #include "devices.h"
  43. /******************************************************************************
  44. * Pin configuration
  45. ******************************************************************************/
  46. static unsigned long z2_pin_config[] = {
  47. /* LCD - 16bpp Active TFT */
  48. GPIO58_LCD_LDD_0,
  49. GPIO59_LCD_LDD_1,
  50. GPIO60_LCD_LDD_2,
  51. GPIO61_LCD_LDD_3,
  52. GPIO62_LCD_LDD_4,
  53. GPIO63_LCD_LDD_5,
  54. GPIO64_LCD_LDD_6,
  55. GPIO65_LCD_LDD_7,
  56. GPIO66_LCD_LDD_8,
  57. GPIO67_LCD_LDD_9,
  58. GPIO68_LCD_LDD_10,
  59. GPIO69_LCD_LDD_11,
  60. GPIO70_LCD_LDD_12,
  61. GPIO71_LCD_LDD_13,
  62. GPIO72_LCD_LDD_14,
  63. GPIO73_LCD_LDD_15,
  64. GPIO74_LCD_FCLK,
  65. GPIO75_LCD_LCLK,
  66. GPIO76_LCD_PCLK,
  67. GPIO77_LCD_BIAS,
  68. GPIO19_GPIO, /* LCD reset */
  69. GPIO88_GPIO, /* LCD chipselect */
  70. /* PWM */
  71. GPIO115_PWM1_OUT, /* Keypad Backlight */
  72. GPIO11_PWM2_OUT, /* LCD Backlight */
  73. /* MMC */
  74. GPIO32_MMC_CLK,
  75. GPIO112_MMC_CMD,
  76. GPIO92_MMC_DAT_0,
  77. GPIO109_MMC_DAT_1,
  78. GPIO110_MMC_DAT_2,
  79. GPIO111_MMC_DAT_3,
  80. GPIO96_GPIO, /* SD detect */
  81. /* STUART */
  82. GPIO46_STUART_RXD,
  83. GPIO47_STUART_TXD,
  84. /* Keypad */
  85. GPIO100_KP_MKIN_0,
  86. GPIO101_KP_MKIN_1,
  87. GPIO102_KP_MKIN_2,
  88. GPIO34_KP_MKIN_3,
  89. GPIO38_KP_MKIN_4,
  90. GPIO16_KP_MKIN_5,
  91. GPIO17_KP_MKIN_6,
  92. GPIO103_KP_MKOUT_0,
  93. GPIO104_KP_MKOUT_1,
  94. GPIO105_KP_MKOUT_2,
  95. GPIO106_KP_MKOUT_3,
  96. GPIO107_KP_MKOUT_4,
  97. GPIO108_KP_MKOUT_5,
  98. GPIO35_KP_MKOUT_6,
  99. GPIO41_KP_MKOUT_7,
  100. /* I2C */
  101. GPIO117_I2C_SCL,
  102. GPIO118_I2C_SDA,
  103. /* SSP1 */
  104. GPIO23_SSP1_SCLK, /* SSP1_SCK */
  105. GPIO25_SSP1_TXD, /* SSP1_TXD */
  106. GPIO26_SSP1_RXD, /* SSP1_RXD */
  107. /* SSP2 */
  108. GPIO22_SSP2_SCLK, /* SSP2_SCK */
  109. GPIO13_SSP2_TXD, /* SSP2_TXD */
  110. GPIO40_SSP2_RXD, /* SSP2_RXD */
  111. /* LEDs */
  112. GPIO10_GPIO, /* WiFi LED */
  113. GPIO83_GPIO, /* Charging LED */
  114. GPIO85_GPIO, /* Charged LED */
  115. /* I2S */
  116. GPIO28_I2S_BITCLK_OUT,
  117. GPIO29_I2S_SDATA_IN,
  118. GPIO30_I2S_SDATA_OUT,
  119. GPIO31_I2S_SYNC,
  120. GPIO113_I2S_SYSCLK,
  121. /* MISC */
  122. GPIO0_GPIO, /* AC power detect */
  123. GPIO1_GPIO, /* Power button */
  124. GPIO37_GPIO, /* Headphone detect */
  125. GPIO98_GPIO, /* Lid switch */
  126. GPIO14_GPIO, /* WiFi Power */
  127. GPIO24_GPIO, /* WiFi CS */
  128. GPIO36_GPIO, /* WiFi IRQ */
  129. GPIO88_GPIO, /* LCD CS */
  130. };
  131. /******************************************************************************
  132. * NOR Flash
  133. ******************************************************************************/
  134. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  135. static struct resource z2_flash_resource = {
  136. .start = PXA_CS0_PHYS,
  137. .end = PXA_CS0_PHYS + SZ_8M - 1,
  138. .flags = IORESOURCE_MEM,
  139. };
  140. static struct mtd_partition z2_flash_parts[] = {
  141. {
  142. .name = "U-Boot Bootloader",
  143. .offset = 0x0,
  144. .size = 0x40000,
  145. }, {
  146. .name = "U-Boot Environment",
  147. .offset = 0x40000,
  148. .size = 0x20000,
  149. }, {
  150. .name = "Flash",
  151. .offset = 0x60000,
  152. .size = MTDPART_SIZ_FULL,
  153. },
  154. };
  155. static struct physmap_flash_data z2_flash_data = {
  156. .width = 2,
  157. .parts = z2_flash_parts,
  158. .nr_parts = ARRAY_SIZE(z2_flash_parts),
  159. };
  160. static struct platform_device z2_flash = {
  161. .name = "physmap-flash",
  162. .id = -1,
  163. .resource = &z2_flash_resource,
  164. .num_resources = 1,
  165. .dev = {
  166. .platform_data = &z2_flash_data,
  167. },
  168. };
  169. static void __init z2_nor_init(void)
  170. {
  171. platform_device_register(&z2_flash);
  172. }
  173. #else
  174. static inline void z2_nor_init(void) {}
  175. #endif
  176. /******************************************************************************
  177. * Backlight
  178. ******************************************************************************/
  179. #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
  180. static struct platform_pwm_backlight_data z2_backlight_data[] = {
  181. [0] = {
  182. /* Keypad Backlight */
  183. .pwm_id = 1,
  184. .max_brightness = 1023,
  185. .dft_brightness = 0,
  186. .pwm_period_ns = 1260320,
  187. .enable_gpio = -1,
  188. },
  189. [1] = {
  190. /* LCD Backlight */
  191. .pwm_id = 2,
  192. .max_brightness = 1023,
  193. .dft_brightness = 512,
  194. .pwm_period_ns = 1260320,
  195. .enable_gpio = -1,
  196. },
  197. };
  198. static struct platform_device z2_backlight_devices[2] = {
  199. {
  200. .name = "pwm-backlight",
  201. .id = 0,
  202. .dev = {
  203. .platform_data = &z2_backlight_data[1],
  204. },
  205. },
  206. {
  207. .name = "pwm-backlight",
  208. .id = 1,
  209. .dev = {
  210. .platform_data = &z2_backlight_data[0],
  211. },
  212. },
  213. };
  214. static void __init z2_pwm_init(void)
  215. {
  216. platform_device_register(&z2_backlight_devices[0]);
  217. platform_device_register(&z2_backlight_devices[1]);
  218. }
  219. #else
  220. static inline void z2_pwm_init(void) {}
  221. #endif
  222. /******************************************************************************
  223. * Framebuffer
  224. ******************************************************************************/
  225. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  226. static struct pxafb_mode_info z2_lcd_modes[] = {
  227. {
  228. .pixclock = 192000,
  229. .xres = 240,
  230. .yres = 320,
  231. .bpp = 16,
  232. .left_margin = 4,
  233. .right_margin = 8,
  234. .upper_margin = 4,
  235. .lower_margin = 8,
  236. .hsync_len = 4,
  237. .vsync_len = 4,
  238. },
  239. };
  240. static struct pxafb_mach_info z2_lcd_screen = {
  241. .modes = z2_lcd_modes,
  242. .num_modes = ARRAY_SIZE(z2_lcd_modes),
  243. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW |
  244. LCD_ALTERNATE_MAPPING,
  245. };
  246. static void __init z2_lcd_init(void)
  247. {
  248. pxa_set_fb_info(NULL, &z2_lcd_screen);
  249. }
  250. #else
  251. static inline void z2_lcd_init(void) {}
  252. #endif
  253. /******************************************************************************
  254. * SD/MMC card controller
  255. ******************************************************************************/
  256. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  257. static struct pxamci_platform_data z2_mci_platform_data = {
  258. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  259. .gpio_card_detect = GPIO96_ZIPITZ2_SD_DETECT,
  260. .gpio_power = -1,
  261. .gpio_card_ro = -1,
  262. .detect_delay_ms = 200,
  263. };
  264. static void __init z2_mmc_init(void)
  265. {
  266. pxa_set_mci_info(&z2_mci_platform_data);
  267. }
  268. #else
  269. static inline void z2_mmc_init(void) {}
  270. #endif
  271. /******************************************************************************
  272. * LEDs
  273. ******************************************************************************/
  274. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  275. struct gpio_led z2_gpio_leds[] = {
  276. {
  277. .name = "z2:green:wifi",
  278. .default_trigger = "none",
  279. .gpio = GPIO10_ZIPITZ2_LED_WIFI,
  280. .active_low = 1,
  281. }, {
  282. .name = "z2:green:charged",
  283. .default_trigger = "mmc0",
  284. .gpio = GPIO85_ZIPITZ2_LED_CHARGED,
  285. .active_low = 1,
  286. }, {
  287. .name = "z2:amber:charging",
  288. .default_trigger = "Z2-charging-or-full",
  289. .gpio = GPIO83_ZIPITZ2_LED_CHARGING,
  290. .active_low = 1,
  291. },
  292. };
  293. static struct gpio_led_platform_data z2_gpio_led_info = {
  294. .leds = z2_gpio_leds,
  295. .num_leds = ARRAY_SIZE(z2_gpio_leds),
  296. };
  297. static struct platform_device z2_leds = {
  298. .name = "leds-gpio",
  299. .id = -1,
  300. .dev = {
  301. .platform_data = &z2_gpio_led_info,
  302. }
  303. };
  304. static void __init z2_leds_init(void)
  305. {
  306. platform_device_register(&z2_leds);
  307. }
  308. #else
  309. static inline void z2_leds_init(void) {}
  310. #endif
  311. /******************************************************************************
  312. * GPIO keyboard
  313. ******************************************************************************/
  314. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  315. static const unsigned int z2_matrix_keys[] = {
  316. KEY(0, 0, KEY_OPTION),
  317. KEY(1, 0, KEY_UP),
  318. KEY(2, 0, KEY_DOWN),
  319. KEY(3, 0, KEY_LEFT),
  320. KEY(4, 0, KEY_RIGHT),
  321. KEY(5, 0, KEY_END),
  322. KEY(6, 0, KEY_KPPLUS),
  323. KEY(0, 1, KEY_HOME),
  324. KEY(1, 1, KEY_Q),
  325. KEY(2, 1, KEY_I),
  326. KEY(3, 1, KEY_G),
  327. KEY(4, 1, KEY_X),
  328. KEY(5, 1, KEY_ENTER),
  329. KEY(6, 1, KEY_KPMINUS),
  330. KEY(0, 2, KEY_PAGEUP),
  331. KEY(1, 2, KEY_W),
  332. KEY(2, 2, KEY_O),
  333. KEY(3, 2, KEY_H),
  334. KEY(4, 2, KEY_C),
  335. KEY(5, 2, KEY_LEFTALT),
  336. KEY(0, 3, KEY_PAGEDOWN),
  337. KEY(1, 3, KEY_E),
  338. KEY(2, 3, KEY_P),
  339. KEY(3, 3, KEY_J),
  340. KEY(4, 3, KEY_V),
  341. KEY(5, 3, KEY_LEFTSHIFT),
  342. KEY(0, 4, KEY_ESC),
  343. KEY(1, 4, KEY_R),
  344. KEY(2, 4, KEY_A),
  345. KEY(3, 4, KEY_K),
  346. KEY(4, 4, KEY_B),
  347. KEY(5, 4, KEY_LEFTCTRL),
  348. KEY(0, 5, KEY_TAB),
  349. KEY(1, 5, KEY_T),
  350. KEY(2, 5, KEY_S),
  351. KEY(3, 5, KEY_L),
  352. KEY(4, 5, KEY_N),
  353. KEY(5, 5, KEY_SPACE),
  354. KEY(0, 6, KEY_STOPCD),
  355. KEY(1, 6, KEY_Y),
  356. KEY(2, 6, KEY_D),
  357. KEY(3, 6, KEY_BACKSPACE),
  358. KEY(4, 6, KEY_M),
  359. KEY(5, 6, KEY_COMMA),
  360. KEY(0, 7, KEY_PLAYCD),
  361. KEY(1, 7, KEY_U),
  362. KEY(2, 7, KEY_F),
  363. KEY(3, 7, KEY_Z),
  364. KEY(4, 7, KEY_SEMICOLON),
  365. KEY(5, 7, KEY_DOT),
  366. };
  367. static struct matrix_keymap_data z2_matrix_keymap_data = {
  368. .keymap = z2_matrix_keys,
  369. .keymap_size = ARRAY_SIZE(z2_matrix_keys),
  370. };
  371. static struct pxa27x_keypad_platform_data z2_keypad_platform_data = {
  372. .matrix_key_rows = 7,
  373. .matrix_key_cols = 8,
  374. .matrix_keymap_data = &z2_matrix_keymap_data,
  375. .debounce_interval = 30,
  376. };
  377. static void __init z2_mkp_init(void)
  378. {
  379. pxa_set_keypad_info(&z2_keypad_platform_data);
  380. }
  381. #else
  382. static inline void z2_mkp_init(void) {}
  383. #endif
  384. /******************************************************************************
  385. * GPIO keys
  386. ******************************************************************************/
  387. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  388. static struct gpio_keys_button z2_pxa_buttons[] = {
  389. {
  390. .code = KEY_POWER,
  391. .gpio = GPIO1_ZIPITZ2_POWER_BUTTON,
  392. .active_low = 0,
  393. .desc = "Power Button",
  394. .wakeup = 1,
  395. .type = EV_KEY,
  396. },
  397. {
  398. .code = SW_LID,
  399. .gpio = GPIO98_ZIPITZ2_LID_BUTTON,
  400. .active_low = 1,
  401. .desc = "Lid Switch",
  402. .wakeup = 0,
  403. .type = EV_SW,
  404. },
  405. };
  406. static struct gpio_keys_platform_data z2_pxa_keys_data = {
  407. .buttons = z2_pxa_buttons,
  408. .nbuttons = ARRAY_SIZE(z2_pxa_buttons),
  409. };
  410. static struct platform_device z2_pxa_keys = {
  411. .name = "gpio-keys",
  412. .id = -1,
  413. .dev = {
  414. .platform_data = &z2_pxa_keys_data,
  415. },
  416. };
  417. static void __init z2_keys_init(void)
  418. {
  419. platform_device_register(&z2_pxa_keys);
  420. }
  421. #else
  422. static inline void z2_keys_init(void) {}
  423. #endif
  424. /******************************************************************************
  425. * Battery
  426. ******************************************************************************/
  427. #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
  428. static struct z2_battery_info batt_chip_info = {
  429. .batt_I2C_bus = 0,
  430. .batt_I2C_addr = 0x55,
  431. .batt_I2C_reg = 2,
  432. .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT,
  433. .min_voltage = 3475000,
  434. .max_voltage = 4190000,
  435. .batt_div = 59,
  436. .batt_mult = 1000000,
  437. .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION,
  438. .batt_name = "Z2",
  439. };
  440. static struct i2c_board_info __initdata z2_i2c_board_info[] = {
  441. {
  442. I2C_BOARD_INFO("aer915", 0x55),
  443. .platform_data = &batt_chip_info,
  444. }, {
  445. I2C_BOARD_INFO("wm8750", 0x1b),
  446. },
  447. };
  448. static void __init z2_i2c_init(void)
  449. {
  450. pxa_set_i2c_info(NULL);
  451. i2c_register_board_info(0, ARRAY_AND_SIZE(z2_i2c_board_info));
  452. }
  453. #else
  454. static inline void z2_i2c_init(void) {}
  455. #endif
  456. /******************************************************************************
  457. * SSP Devices - WiFi and LCD control
  458. ******************************************************************************/
  459. #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
  460. /* WiFi */
  461. static int z2_lbs_spi_setup(struct spi_device *spi)
  462. {
  463. int ret = 0;
  464. ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power");
  465. if (ret)
  466. goto err;
  467. ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1);
  468. if (ret)
  469. goto err2;
  470. /* Wait until card is powered on */
  471. mdelay(180);
  472. spi->bits_per_word = 16;
  473. spi->mode = SPI_MODE_2,
  474. spi_setup(spi);
  475. return 0;
  476. err2:
  477. gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
  478. err:
  479. return ret;
  480. };
  481. static int z2_lbs_spi_teardown(struct spi_device *spi)
  482. {
  483. gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0);
  484. gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
  485. return 0;
  486. };
  487. static struct pxa2xx_spi_chip z2_lbs_chip_info = {
  488. .rx_threshold = 8,
  489. .tx_threshold = 8,
  490. .timeout = 1000,
  491. .gpio_cs = GPIO24_ZIPITZ2_WIFI_CS,
  492. };
  493. static struct libertas_spi_platform_data z2_lbs_pdata = {
  494. .use_dummy_writes = 1,
  495. .setup = z2_lbs_spi_setup,
  496. .teardown = z2_lbs_spi_teardown,
  497. };
  498. /* LCD */
  499. static struct pxa2xx_spi_chip lms283_chip_info = {
  500. .rx_threshold = 1,
  501. .tx_threshold = 1,
  502. .timeout = 64,
  503. .gpio_cs = GPIO88_ZIPITZ2_LCD_CS,
  504. };
  505. static const struct lms283gf05_pdata lms283_pdata = {
  506. .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET,
  507. };
  508. static struct spi_board_info spi_board_info[] __initdata = {
  509. {
  510. .modalias = "libertas_spi",
  511. .platform_data = &z2_lbs_pdata,
  512. .controller_data = &z2_lbs_chip_info,
  513. .irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
  514. .max_speed_hz = 13000000,
  515. .bus_num = 1,
  516. .chip_select = 0,
  517. },
  518. {
  519. .modalias = "lms283gf05",
  520. .controller_data = &lms283_chip_info,
  521. .platform_data = &lms283_pdata,
  522. .max_speed_hz = 400000,
  523. .bus_num = 2,
  524. .chip_select = 0,
  525. },
  526. };
  527. static struct pxa2xx_spi_master pxa_ssp1_master_info = {
  528. .clock_enable = CKEN_SSP,
  529. .num_chipselect = 1,
  530. .enable_dma = 1,
  531. };
  532. static struct pxa2xx_spi_master pxa_ssp2_master_info = {
  533. .clock_enable = CKEN_SSP2,
  534. .num_chipselect = 1,
  535. };
  536. static void __init z2_spi_init(void)
  537. {
  538. pxa2xx_set_spi_info(1, &pxa_ssp1_master_info);
  539. pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
  540. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  541. }
  542. #else
  543. static inline void z2_spi_init(void) {}
  544. #endif
  545. /******************************************************************************
  546. * Core power regulator
  547. ******************************************************************************/
  548. #if defined(CONFIG_REGULATOR_TPS65023) || \
  549. defined(CONFIG_REGULATOR_TPS65023_MODULE)
  550. static struct regulator_consumer_supply z2_tps65021_consumers[] = {
  551. REGULATOR_SUPPLY("vcc_core", NULL),
  552. };
  553. static struct regulator_init_data z2_tps65021_info[] = {
  554. {
  555. .constraints = {
  556. .name = "vcc_core range",
  557. .min_uV = 800000,
  558. .max_uV = 1600000,
  559. .always_on = 1,
  560. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  561. },
  562. .consumer_supplies = z2_tps65021_consumers,
  563. .num_consumer_supplies = ARRAY_SIZE(z2_tps65021_consumers),
  564. }, {
  565. .constraints = {
  566. .name = "DCDC2",
  567. .min_uV = 3300000,
  568. .max_uV = 3300000,
  569. .always_on = 1,
  570. },
  571. }, {
  572. .constraints = {
  573. .name = "DCDC3",
  574. .min_uV = 1800000,
  575. .max_uV = 1800000,
  576. .always_on = 1,
  577. },
  578. }, {
  579. .constraints = {
  580. .name = "LDO1",
  581. .min_uV = 1000000,
  582. .max_uV = 3150000,
  583. .always_on = 1,
  584. },
  585. }, {
  586. .constraints = {
  587. .name = "LDO2",
  588. .min_uV = 1050000,
  589. .max_uV = 3300000,
  590. .always_on = 1,
  591. },
  592. }
  593. };
  594. static struct i2c_board_info __initdata z2_pi2c_board_info[] = {
  595. {
  596. I2C_BOARD_INFO("tps65021", 0x48),
  597. .platform_data = &z2_tps65021_info,
  598. },
  599. };
  600. static void __init z2_pmic_init(void)
  601. {
  602. pxa27x_set_i2c_power_info(NULL);
  603. i2c_register_board_info(1, ARRAY_AND_SIZE(z2_pi2c_board_info));
  604. }
  605. #else
  606. static inline void z2_pmic_init(void) {}
  607. #endif
  608. #ifdef CONFIG_PM
  609. static void z2_power_off(void)
  610. {
  611. /* We're using deep sleep as poweroff, so clear PSPR to ensure that
  612. * bootloader will jump to its entry point in resume handler
  613. */
  614. PSPR = 0x0;
  615. local_irq_disable();
  616. pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
  617. pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
  618. }
  619. #else
  620. #define z2_power_off NULL
  621. #endif
  622. /******************************************************************************
  623. * Machine init
  624. ******************************************************************************/
  625. static void __init z2_init(void)
  626. {
  627. pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config));
  628. pxa_set_ffuart_info(NULL);
  629. pxa_set_btuart_info(NULL);
  630. pxa_set_stuart_info(NULL);
  631. z2_lcd_init();
  632. z2_mmc_init();
  633. z2_mkp_init();
  634. z2_i2c_init();
  635. z2_spi_init();
  636. z2_nor_init();
  637. z2_pwm_init();
  638. z2_leds_init();
  639. z2_keys_init();
  640. z2_pmic_init();
  641. pm_power_off = z2_power_off;
  642. }
  643. MACHINE_START(ZIPIT2, "Zipit Z2")
  644. .atag_offset = 0x100,
  645. .map_io = pxa27x_map_io,
  646. .nr_irqs = PXA_NR_IRQS,
  647. .init_irq = pxa27x_init_irq,
  648. .handle_irq = pxa27x_handle_irq,
  649. .init_time = pxa_timer_init,
  650. .init_machine = z2_init,
  651. .restart = pxa_restart,
  652. MACHINE_END