mach-goni.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. /* linux/arch/arm/mach-s5pv210/mach-goni.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/init.h>
  13. #include <linux/serial_core.h>
  14. #include <linux/fb.h>
  15. #include <linux/i2c.h>
  16. #include <linux/i2c-gpio.h>
  17. #include <linux/i2c/qt602240_ts.h>
  18. #include <linux/mfd/max8998.h>
  19. #include <linux/regulator/fixed.h>
  20. #include <linux/spi/spi.h>
  21. #include <linux/spi/spi_gpio.h>
  22. #include <linux/lcd.h>
  23. #include <linux/gpio_keys.h>
  24. #include <linux/input.h>
  25. #include <linux/gpio.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/setup.h>
  29. #include <asm/mach-types.h>
  30. #include <mach/map.h>
  31. #include <mach/regs-clock.h>
  32. #include <mach/regs-fb.h>
  33. #include <plat/gpio-cfg.h>
  34. #include <plat/regs-serial.h>
  35. #include <plat/s5pv210.h>
  36. #include <plat/devs.h>
  37. #include <plat/cpu.h>
  38. #include <plat/fb.h>
  39. #include <plat/iic.h>
  40. #include <plat/keypad.h>
  41. #include <plat/sdhci.h>
  42. #include <plat/clock.h>
  43. /* Following are default values for UCON, ULCON and UFCON UART registers */
  44. #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  45. S3C2410_UCON_RXILEVEL | \
  46. S3C2410_UCON_TXIRQMODE | \
  47. S3C2410_UCON_RXIRQMODE | \
  48. S3C2410_UCON_RXFIFO_TOI | \
  49. S3C2443_UCON_RXERR_IRQEN)
  50. #define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
  51. #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
  52. static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
  53. [0] = {
  54. .hwport = 0,
  55. .flags = 0,
  56. .ucon = GONI_UCON_DEFAULT,
  57. .ulcon = GONI_ULCON_DEFAULT,
  58. .ufcon = GONI_UFCON_DEFAULT |
  59. S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
  60. },
  61. [1] = {
  62. .hwport = 1,
  63. .flags = 0,
  64. .ucon = GONI_UCON_DEFAULT,
  65. .ulcon = GONI_ULCON_DEFAULT,
  66. .ufcon = GONI_UFCON_DEFAULT |
  67. S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
  68. },
  69. [2] = {
  70. .hwport = 2,
  71. .flags = 0,
  72. .ucon = GONI_UCON_DEFAULT,
  73. .ulcon = GONI_ULCON_DEFAULT,
  74. .ufcon = GONI_UFCON_DEFAULT |
  75. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  76. },
  77. [3] = {
  78. .hwport = 3,
  79. .flags = 0,
  80. .ucon = GONI_UCON_DEFAULT,
  81. .ulcon = GONI_ULCON_DEFAULT,
  82. .ufcon = GONI_UFCON_DEFAULT |
  83. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  84. },
  85. };
  86. /* Frame Buffer */
  87. static struct s3c_fb_pd_win goni_fb_win0 = {
  88. .win_mode = {
  89. .left_margin = 16,
  90. .right_margin = 16,
  91. .upper_margin = 2,
  92. .lower_margin = 28,
  93. .hsync_len = 2,
  94. .vsync_len = 1,
  95. .xres = 480,
  96. .yres = 800,
  97. .refresh = 55,
  98. },
  99. .max_bpp = 32,
  100. .default_bpp = 16,
  101. };
  102. static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
  103. .win[0] = &goni_fb_win0,
  104. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  105. VIDCON0_CLKSEL_LCD,
  106. .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
  107. | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  108. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  109. };
  110. static int lcd_power_on(struct lcd_device *ld, int enable)
  111. {
  112. return 1;
  113. }
  114. static int reset_lcd(struct lcd_device *ld)
  115. {
  116. static unsigned int first = 1;
  117. int reset_gpio = -1;
  118. reset_gpio = S5PV210_MP05(5);
  119. if (first) {
  120. gpio_request(reset_gpio, "MLCD_RST");
  121. first = 0;
  122. }
  123. gpio_direction_output(reset_gpio, 1);
  124. return 1;
  125. }
  126. static struct lcd_platform_data goni_lcd_platform_data = {
  127. .reset = reset_lcd,
  128. .power_on = lcd_power_on,
  129. .lcd_enabled = 0,
  130. .reset_delay = 120, /* 120ms */
  131. .power_on_delay = 25, /* 25ms */
  132. .power_off_delay = 200, /* 200ms */
  133. };
  134. #define LCD_BUS_NUM 3
  135. static struct spi_board_info spi_board_info[] __initdata = {
  136. {
  137. .modalias = "s6e63m0",
  138. .platform_data = &goni_lcd_platform_data,
  139. .max_speed_hz = 1200000,
  140. .bus_num = LCD_BUS_NUM,
  141. .chip_select = 0,
  142. .mode = SPI_MODE_3,
  143. .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
  144. },
  145. };
  146. static struct spi_gpio_platform_data lcd_spi_gpio_data = {
  147. .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
  148. .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
  149. .miso = SPI_GPIO_NO_MISO,
  150. .num_chipselect = 1,
  151. };
  152. static struct platform_device goni_spi_gpio = {
  153. .name = "spi_gpio",
  154. .id = LCD_BUS_NUM,
  155. .dev = {
  156. .parent = &s3c_device_fb.dev,
  157. .platform_data = &lcd_spi_gpio_data,
  158. },
  159. };
  160. /* KEYPAD */
  161. static uint32_t keymap[] __initdata = {
  162. /* KEY(row, col, keycode) */
  163. KEY(0, 1, KEY_MENU), /* Send */
  164. KEY(0, 2, KEY_BACK), /* End */
  165. KEY(1, 1, KEY_CONFIG), /* Half shot */
  166. KEY(1, 2, KEY_VOLUMEUP),
  167. KEY(2, 1, KEY_CAMERA), /* Full shot */
  168. KEY(2, 2, KEY_VOLUMEDOWN),
  169. };
  170. static struct matrix_keymap_data keymap_data __initdata = {
  171. .keymap = keymap,
  172. .keymap_size = ARRAY_SIZE(keymap),
  173. };
  174. static struct samsung_keypad_platdata keypad_data __initdata = {
  175. .keymap_data = &keymap_data,
  176. .rows = 3,
  177. .cols = 3,
  178. };
  179. /* Radio */
  180. static struct i2c_board_info i2c1_devs[] __initdata = {
  181. {
  182. I2C_BOARD_INFO("si470x", 0x10),
  183. },
  184. };
  185. static void __init goni_radio_init(void)
  186. {
  187. int gpio;
  188. gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
  189. gpio_request(gpio, "FM_INT");
  190. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  191. i2c1_devs[0].irq = gpio_to_irq(gpio);
  192. gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
  193. gpio_request(gpio, "FM_RST");
  194. gpio_direction_output(gpio, 1);
  195. }
  196. /* TSP */
  197. static struct qt602240_platform_data qt602240_platform_data = {
  198. .x_line = 17,
  199. .y_line = 11,
  200. .x_size = 800,
  201. .y_size = 480,
  202. .blen = 0x21,
  203. .threshold = 0x28,
  204. .voltage = 2800000, /* 2.8V */
  205. .orient = QT602240_DIAGONAL,
  206. };
  207. static struct s3c2410_platform_i2c i2c2_data __initdata = {
  208. .flags = 0,
  209. .bus_num = 2,
  210. .slave_addr = 0x10,
  211. .frequency = 400 * 1000,
  212. .sda_delay = 100,
  213. };
  214. static struct i2c_board_info i2c2_devs[] __initdata = {
  215. {
  216. I2C_BOARD_INFO("qt602240_ts", 0x4a),
  217. .platform_data = &qt602240_platform_data,
  218. },
  219. };
  220. static void __init goni_tsp_init(void)
  221. {
  222. int gpio;
  223. gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */
  224. gpio_request(gpio, "TSP_LDO_ON");
  225. gpio_direction_output(gpio, 1);
  226. gpio_export(gpio, 0);
  227. gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */
  228. gpio_request(gpio, "TSP_INT");
  229. s5p_register_gpio_interrupt(gpio);
  230. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  231. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  232. i2c2_devs[0].irq = gpio_to_irq(gpio);
  233. }
  234. /* MAX8998 regulators */
  235. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  236. static struct regulator_consumer_supply goni_ldo5_consumers[] = {
  237. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  238. };
  239. static struct regulator_init_data goni_ldo2_data = {
  240. .constraints = {
  241. .name = "VALIVE_1.1V",
  242. .min_uV = 1100000,
  243. .max_uV = 1100000,
  244. .apply_uV = 1,
  245. .always_on = 1,
  246. .state_mem = {
  247. .enabled = 1,
  248. },
  249. },
  250. };
  251. static struct regulator_init_data goni_ldo3_data = {
  252. .constraints = {
  253. .name = "VUSB/MIPI_1.1V",
  254. .min_uV = 1100000,
  255. .max_uV = 1100000,
  256. .apply_uV = 1,
  257. .always_on = 1,
  258. },
  259. };
  260. static struct regulator_init_data goni_ldo4_data = {
  261. .constraints = {
  262. .name = "VDAC_3.3V",
  263. .min_uV = 3300000,
  264. .max_uV = 3300000,
  265. .apply_uV = 1,
  266. },
  267. };
  268. static struct regulator_init_data goni_ldo5_data = {
  269. .constraints = {
  270. .name = "VTF_2.8V",
  271. .min_uV = 2800000,
  272. .max_uV = 2800000,
  273. .apply_uV = 1,
  274. },
  275. .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers),
  276. .consumer_supplies = goni_ldo5_consumers,
  277. };
  278. static struct regulator_init_data goni_ldo6_data = {
  279. .constraints = {
  280. .name = "VCC_3.3V",
  281. .min_uV = 3300000,
  282. .max_uV = 3300000,
  283. .apply_uV = 1,
  284. },
  285. };
  286. static struct regulator_init_data goni_ldo7_data = {
  287. .constraints = {
  288. .name = "VLCD_1.8V",
  289. .min_uV = 1800000,
  290. .max_uV = 1800000,
  291. .apply_uV = 1,
  292. .always_on = 1,
  293. },
  294. };
  295. static struct regulator_init_data goni_ldo8_data = {
  296. .constraints = {
  297. .name = "VUSB/VADC_3.3V",
  298. .min_uV = 3300000,
  299. .max_uV = 3300000,
  300. .apply_uV = 1,
  301. .always_on = 1,
  302. },
  303. };
  304. static struct regulator_init_data goni_ldo9_data = {
  305. .constraints = {
  306. .name = "VCC/VCAM_2.8V",
  307. .min_uV = 2800000,
  308. .max_uV = 2800000,
  309. .apply_uV = 1,
  310. .always_on = 1,
  311. },
  312. };
  313. static struct regulator_init_data goni_ldo10_data = {
  314. .constraints = {
  315. .name = "VPLL_1.1V",
  316. .min_uV = 1100000,
  317. .max_uV = 1100000,
  318. .apply_uV = 1,
  319. .boot_on = 1,
  320. },
  321. };
  322. static struct regulator_init_data goni_ldo11_data = {
  323. .constraints = {
  324. .name = "CAM_IO_2.8V",
  325. .min_uV = 2800000,
  326. .max_uV = 2800000,
  327. .apply_uV = 1,
  328. .always_on = 1,
  329. },
  330. };
  331. static struct regulator_init_data goni_ldo12_data = {
  332. .constraints = {
  333. .name = "CAM_ISP_1.2V",
  334. .min_uV = 1200000,
  335. .max_uV = 1200000,
  336. .apply_uV = 1,
  337. .always_on = 1,
  338. },
  339. };
  340. static struct regulator_init_data goni_ldo13_data = {
  341. .constraints = {
  342. .name = "CAM_A_2.8V",
  343. .min_uV = 2800000,
  344. .max_uV = 2800000,
  345. .apply_uV = 1,
  346. .always_on = 1,
  347. },
  348. };
  349. static struct regulator_init_data goni_ldo14_data = {
  350. .constraints = {
  351. .name = "CAM_CIF_1.8V",
  352. .min_uV = 1800000,
  353. .max_uV = 1800000,
  354. .apply_uV = 1,
  355. .always_on = 1,
  356. },
  357. };
  358. static struct regulator_init_data goni_ldo15_data = {
  359. .constraints = {
  360. .name = "CAM_AF_3.3V",
  361. .min_uV = 3300000,
  362. .max_uV = 3300000,
  363. .apply_uV = 1,
  364. .always_on = 1,
  365. },
  366. };
  367. static struct regulator_init_data goni_ldo16_data = {
  368. .constraints = {
  369. .name = "VMIPI_1.8V",
  370. .min_uV = 1800000,
  371. .max_uV = 1800000,
  372. .apply_uV = 1,
  373. .always_on = 1,
  374. },
  375. };
  376. static struct regulator_init_data goni_ldo17_data = {
  377. .constraints = {
  378. .name = "VCC_3.0V_LCD",
  379. .min_uV = 3000000,
  380. .max_uV = 3000000,
  381. .apply_uV = 1,
  382. .always_on = 1,
  383. },
  384. };
  385. /* BUCK */
  386. static struct regulator_consumer_supply buck1_consumer[] = {
  387. { .supply = "vddarm", },
  388. };
  389. static struct regulator_consumer_supply buck2_consumer[] = {
  390. { .supply = "vddint", },
  391. };
  392. static struct regulator_init_data goni_buck1_data = {
  393. .constraints = {
  394. .name = "VARM_1.2V",
  395. .min_uV = 1200000,
  396. .max_uV = 1200000,
  397. .apply_uV = 1,
  398. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  399. REGULATOR_CHANGE_STATUS,
  400. },
  401. .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
  402. .consumer_supplies = buck1_consumer,
  403. };
  404. static struct regulator_init_data goni_buck2_data = {
  405. .constraints = {
  406. .name = "VINT_1.2V",
  407. .min_uV = 1200000,
  408. .max_uV = 1200000,
  409. .apply_uV = 1,
  410. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  411. REGULATOR_CHANGE_STATUS,
  412. },
  413. .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
  414. .consumer_supplies = buck2_consumer,
  415. };
  416. static struct regulator_init_data goni_buck3_data = {
  417. .constraints = {
  418. .name = "VCC_1.8V",
  419. .min_uV = 1800000,
  420. .max_uV = 1800000,
  421. .apply_uV = 1,
  422. .state_mem = {
  423. .enabled = 1,
  424. },
  425. },
  426. };
  427. static struct regulator_init_data goni_buck4_data = {
  428. .constraints = {
  429. .name = "CAM_CORE_1.2V",
  430. .min_uV = 1200000,
  431. .max_uV = 1200000,
  432. .apply_uV = 1,
  433. .always_on = 1,
  434. },
  435. };
  436. static struct max8998_regulator_data goni_regulators[] = {
  437. { MAX8998_LDO2, &goni_ldo2_data },
  438. { MAX8998_LDO3, &goni_ldo3_data },
  439. { MAX8998_LDO4, &goni_ldo4_data },
  440. { MAX8998_LDO5, &goni_ldo5_data },
  441. { MAX8998_LDO6, &goni_ldo6_data },
  442. { MAX8998_LDO7, &goni_ldo7_data },
  443. { MAX8998_LDO8, &goni_ldo8_data },
  444. { MAX8998_LDO9, &goni_ldo9_data },
  445. { MAX8998_LDO10, &goni_ldo10_data },
  446. { MAX8998_LDO11, &goni_ldo11_data },
  447. { MAX8998_LDO12, &goni_ldo12_data },
  448. { MAX8998_LDO13, &goni_ldo13_data },
  449. { MAX8998_LDO14, &goni_ldo14_data },
  450. { MAX8998_LDO15, &goni_ldo15_data },
  451. { MAX8998_LDO16, &goni_ldo16_data },
  452. { MAX8998_LDO17, &goni_ldo17_data },
  453. { MAX8998_BUCK1, &goni_buck1_data },
  454. { MAX8998_BUCK2, &goni_buck2_data },
  455. { MAX8998_BUCK3, &goni_buck3_data },
  456. { MAX8998_BUCK4, &goni_buck4_data },
  457. };
  458. static struct max8998_platform_data goni_max8998_pdata = {
  459. .num_regulators = ARRAY_SIZE(goni_regulators),
  460. .regulators = goni_regulators,
  461. };
  462. #endif
  463. /* GPIO I2C PMIC */
  464. #define AP_I2C_GPIO_PMIC_BUS_4 4
  465. static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
  466. .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
  467. .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
  468. };
  469. static struct platform_device goni_i2c_gpio_pmic = {
  470. .name = "i2c-gpio",
  471. .id = AP_I2C_GPIO_PMIC_BUS_4,
  472. .dev = {
  473. .platform_data = &goni_i2c_gpio_pmic_data,
  474. },
  475. };
  476. static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
  477. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  478. {
  479. /* 0xCC when SRAD = 0 */
  480. I2C_BOARD_INFO("max8998", 0xCC >> 1),
  481. .platform_data = &goni_max8998_pdata,
  482. },
  483. #endif
  484. };
  485. /* GPIO I2C AP 1.8V */
  486. #define AP_I2C_GPIO_BUS_5 5
  487. static struct i2c_gpio_platform_data goni_i2c_gpio5_data = {
  488. .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
  489. .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
  490. };
  491. static struct platform_device goni_i2c_gpio5 = {
  492. .name = "i2c-gpio",
  493. .id = AP_I2C_GPIO_BUS_5,
  494. .dev = {
  495. .platform_data = &goni_i2c_gpio5_data,
  496. },
  497. };
  498. static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
  499. {
  500. /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
  501. I2C_BOARD_INFO("wm8994", 0x1a),
  502. },
  503. };
  504. /* PMIC Power button */
  505. static struct gpio_keys_button goni_gpio_keys_table[] = {
  506. {
  507. .code = KEY_POWER,
  508. .gpio = S5PV210_GPH2(6),
  509. .desc = "gpio-keys: KEY_POWER",
  510. .type = EV_KEY,
  511. .active_low = 1,
  512. .wakeup = 1,
  513. .debounce_interval = 1,
  514. },
  515. };
  516. static struct gpio_keys_platform_data goni_gpio_keys_data = {
  517. .buttons = goni_gpio_keys_table,
  518. .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
  519. };
  520. static struct platform_device goni_device_gpiokeys = {
  521. .name = "gpio-keys",
  522. .dev = {
  523. .platform_data = &goni_gpio_keys_data,
  524. },
  525. };
  526. static void __init goni_pmic_init(void)
  527. {
  528. /* AP_PMIC_IRQ: EINT7 */
  529. s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
  530. s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
  531. /* nPower: EINT22 */
  532. s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
  533. s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
  534. }
  535. /* MoviNAND */
  536. static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
  537. .max_width = 4,
  538. .cd_type = S3C_SDHCI_CD_PERMANENT,
  539. };
  540. /* Wireless LAN */
  541. static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
  542. .max_width = 4,
  543. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  544. /* ext_cd_{init,cleanup} callbacks will be added later */
  545. };
  546. /* External Flash */
  547. #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
  548. #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
  549. static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
  550. .max_width = 4,
  551. .cd_type = S3C_SDHCI_CD_GPIO,
  552. .ext_cd_gpio = GONI_EXT_FLASH_CD,
  553. .ext_cd_gpio_invert = 1,
  554. };
  555. static struct regulator_consumer_supply mmc2_supplies[] = {
  556. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
  557. };
  558. static struct regulator_init_data mmc2_fixed_voltage_init_data = {
  559. .constraints = {
  560. .name = "V_TF_2.8V",
  561. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  562. },
  563. .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies),
  564. .consumer_supplies = mmc2_supplies,
  565. };
  566. static struct fixed_voltage_config mmc2_fixed_voltage_config = {
  567. .supply_name = "EXT_FLASH_EN",
  568. .microvolts = 2800000,
  569. .gpio = GONI_EXT_FLASH_EN,
  570. .enable_high = true,
  571. .init_data = &mmc2_fixed_voltage_init_data,
  572. };
  573. static struct platform_device mmc2_fixed_voltage = {
  574. .name = "reg-fixed-voltage",
  575. .id = 2,
  576. .dev = {
  577. .platform_data = &mmc2_fixed_voltage_config,
  578. },
  579. };
  580. static void goni_setup_sdhci(void)
  581. {
  582. s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
  583. s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
  584. s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
  585. };
  586. static struct platform_device *goni_devices[] __initdata = {
  587. &s3c_device_fb,
  588. &s5p_device_onenand,
  589. &goni_spi_gpio,
  590. &goni_i2c_gpio_pmic,
  591. &goni_i2c_gpio5,
  592. &mmc2_fixed_voltage,
  593. &goni_device_gpiokeys,
  594. &s5p_device_fimc0,
  595. &s5p_device_fimc1,
  596. &s5p_device_fimc2,
  597. &s3c_device_hsmmc0,
  598. &s3c_device_hsmmc1,
  599. &s3c_device_hsmmc2,
  600. &s5pv210_device_iis0,
  601. &s3c_device_usb_hsotg,
  602. &samsung_device_keypad,
  603. &s3c_device_i2c1,
  604. &s3c_device_i2c2,
  605. };
  606. static void __init goni_sound_init(void)
  607. {
  608. /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
  609. * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
  610. * because it needs 24MHz clock to operate WM8994 codec.
  611. */
  612. __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
  613. }
  614. static void __init goni_map_io(void)
  615. {
  616. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  617. s3c24xx_init_clocks(24000000);
  618. s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
  619. }
  620. static void __init goni_machine_init(void)
  621. {
  622. /* Radio: call before I2C 1 registeration */
  623. goni_radio_init();
  624. /* I2C1 */
  625. s3c_i2c1_set_platdata(NULL);
  626. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  627. /* TSP: call before I2C 2 registeration */
  628. goni_tsp_init();
  629. /* I2C2 */
  630. s3c_i2c2_set_platdata(&i2c2_data);
  631. i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs));
  632. /* PMIC */
  633. goni_pmic_init();
  634. i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
  635. ARRAY_SIZE(i2c_gpio_pmic_devs));
  636. /* SDHCI */
  637. goni_setup_sdhci();
  638. /* SOUND */
  639. goni_sound_init();
  640. i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
  641. ARRAY_SIZE(i2c_gpio5_devs));
  642. /* FB */
  643. s3c_fb_set_platdata(&goni_lcd_pdata);
  644. /* SPI */
  645. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  646. /* KEYPAD */
  647. samsung_keypad_set_platdata(&keypad_data);
  648. clk_xusbxti.rate = 24000000;
  649. platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
  650. }
  651. MACHINE_START(GONI, "GONI")
  652. /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
  653. .phys_io = S3C_PA_UART & 0xfff00000,
  654. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  655. .boot_params = S5P_PA_SDRAM + 0x100,
  656. .init_irq = s5pv210_init_irq,
  657. .map_io = goni_map_io,
  658. .init_machine = goni_machine_init,
  659. .timer = &s3c24xx_timer,
  660. MACHINE_END