mach-crag6410.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. /* linux/arch/arm/mach-s3c64xx/mach-crag6410.c
  2. *
  3. * Copyright 2011 Wolfson Microelectronics plc
  4. * Mark Brown <broonie@opensource.wolfsonmicro.com>
  5. *
  6. * Copyright 2011 Simtec Electronics
  7. * Ben Dooks <ben@simtec.co.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/list.h>
  15. #include <linux/serial_core.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/fb.h>
  18. #include <linux/io.h>
  19. #include <linux/init.h>
  20. #include <linux/gpio.h>
  21. #include <linux/delay.h>
  22. #include <linux/regulator/machine.h>
  23. #include <linux/regulator/fixed.h>
  24. #include <linux/pwm_backlight.h>
  25. #include <linux/dm9000.h>
  26. #include <linux/gpio_keys.h>
  27. #include <linux/basic_mmio_gpio.h>
  28. #include <linux/spi/spi.h>
  29. #include <linux/i2c/pca953x.h>
  30. #include <video/platform_lcd.h>
  31. #include <linux/mfd/wm831x/core.h>
  32. #include <linux/mfd/wm831x/pdata.h>
  33. #include <linux/mfd/wm831x/irq.h>
  34. #include <linux/mfd/wm831x/gpio.h>
  35. #include <sound/wm1250-ev1.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach-types.h>
  38. #include <mach/hardware.h>
  39. #include <mach/map.h>
  40. #include <mach/regs-sys.h>
  41. #include <mach/regs-gpio.h>
  42. #include <mach/regs-modem.h>
  43. #include <mach/crag6410.h>
  44. #include <mach/regs-gpio-memport.h>
  45. #include <plat/s3c6410.h>
  46. #include <plat/regs-serial.h>
  47. #include <plat/regs-fb-v4.h>
  48. #include <plat/fb.h>
  49. #include <plat/sdhci.h>
  50. #include <plat/gpio-cfg.h>
  51. #include <plat/s3c64xx-spi.h>
  52. #include <plat/keypad.h>
  53. #include <plat/clock.h>
  54. #include <plat/devs.h>
  55. #include <plat/cpu.h>
  56. #include <plat/adc.h>
  57. #include <plat/iic.h>
  58. #include <plat/pm.h>
  59. /* serial port setup */
  60. #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
  61. #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
  62. #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
  63. static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
  64. [0] = {
  65. .hwport = 0,
  66. .flags = 0,
  67. .ucon = UCON,
  68. .ulcon = ULCON,
  69. .ufcon = UFCON,
  70. },
  71. [1] = {
  72. .hwport = 1,
  73. .flags = 0,
  74. .ucon = UCON,
  75. .ulcon = ULCON,
  76. .ufcon = UFCON,
  77. },
  78. [2] = {
  79. .hwport = 2,
  80. .flags = 0,
  81. .ucon = UCON,
  82. .ulcon = ULCON,
  83. .ufcon = UFCON,
  84. },
  85. [3] = {
  86. .hwport = 3,
  87. .flags = 0,
  88. .ucon = UCON,
  89. .ulcon = ULCON,
  90. .ufcon = UFCON,
  91. },
  92. };
  93. static struct platform_pwm_backlight_data crag6410_backlight_data = {
  94. .pwm_id = 0,
  95. .max_brightness = 1000,
  96. .dft_brightness = 600,
  97. .pwm_period_ns = 100000, /* about 1kHz */
  98. };
  99. static struct platform_device crag6410_backlight_device = {
  100. .name = "pwm-backlight",
  101. .id = -1,
  102. .dev = {
  103. .parent = &s3c_device_timer[0].dev,
  104. .platform_data = &crag6410_backlight_data,
  105. },
  106. };
  107. static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
  108. {
  109. pr_debug("%s: setting power %d\n", __func__, power);
  110. if (power) {
  111. gpio_set_value(S3C64XX_GPB(0), 1);
  112. msleep(1);
  113. s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
  114. } else {
  115. gpio_direction_output(S3C64XX_GPF(14), 0);
  116. gpio_set_value(S3C64XX_GPB(0), 0);
  117. }
  118. }
  119. static struct platform_device crag6410_lcd_powerdev = {
  120. .name = "platform-lcd",
  121. .id = -1,
  122. .dev.parent = &s3c_device_fb.dev,
  123. .dev.platform_data = &(struct plat_lcd_data) {
  124. .set_power = crag6410_lcd_power_set,
  125. },
  126. };
  127. /* 640x480 URT */
  128. static struct s3c_fb_pd_win crag6410_fb_win0 = {
  129. /* this is to ensure we use win0 */
  130. .win_mode = {
  131. .left_margin = 150,
  132. .right_margin = 80,
  133. .upper_margin = 40,
  134. .lower_margin = 5,
  135. .hsync_len = 40,
  136. .vsync_len = 5,
  137. .xres = 640,
  138. .yres = 480,
  139. },
  140. .max_bpp = 32,
  141. .default_bpp = 16,
  142. .virtual_y = 480 * 2,
  143. .virtual_x = 640,
  144. };
  145. /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
  146. static struct s3c_fb_platdata crag6410_lcd_pdata __initdata = {
  147. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  148. .win[0] = &crag6410_fb_win0,
  149. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  150. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  151. };
  152. /* 2x6 keypad */
  153. static uint32_t crag6410_keymap[] __initdata = {
  154. /* KEY(row, col, keycode) */
  155. KEY(0, 0, KEY_VOLUMEUP),
  156. KEY(0, 1, KEY_HOME),
  157. KEY(0, 2, KEY_VOLUMEDOWN),
  158. KEY(0, 3, KEY_HELP),
  159. KEY(0, 4, KEY_MENU),
  160. KEY(0, 5, KEY_MEDIA),
  161. KEY(1, 0, 232),
  162. KEY(1, 1, KEY_DOWN),
  163. KEY(1, 2, KEY_LEFT),
  164. KEY(1, 3, KEY_UP),
  165. KEY(1, 4, KEY_RIGHT),
  166. KEY(1, 5, KEY_CAMERA),
  167. };
  168. static struct matrix_keymap_data crag6410_keymap_data __initdata = {
  169. .keymap = crag6410_keymap,
  170. .keymap_size = ARRAY_SIZE(crag6410_keymap),
  171. };
  172. static struct samsung_keypad_platdata crag6410_keypad_data __initdata = {
  173. .keymap_data = &crag6410_keymap_data,
  174. .rows = 2,
  175. .cols = 6,
  176. };
  177. static struct gpio_keys_button crag6410_gpio_keys[] = {
  178. [0] = {
  179. .code = KEY_SUSPEND,
  180. .gpio = S3C64XX_GPL(10), /* EINT 18 */
  181. .type = EV_KEY,
  182. .wakeup = 1,
  183. .active_low = 1,
  184. },
  185. [1] = {
  186. .code = SW_FRONT_PROXIMITY,
  187. .gpio = S3C64XX_GPN(11), /* EINT 11 */
  188. .type = EV_SW,
  189. },
  190. };
  191. static struct gpio_keys_platform_data crag6410_gpio_keydata = {
  192. .buttons = crag6410_gpio_keys,
  193. .nbuttons = ARRAY_SIZE(crag6410_gpio_keys),
  194. };
  195. static struct platform_device crag6410_gpio_keydev = {
  196. .name = "gpio-keys",
  197. .id = 0,
  198. .dev.platform_data = &crag6410_gpio_keydata,
  199. };
  200. static struct resource crag6410_dm9k_resource[] = {
  201. [0] = {
  202. .start = S3C64XX_PA_XM0CSN5,
  203. .end = S3C64XX_PA_XM0CSN5 + 1,
  204. .flags = IORESOURCE_MEM,
  205. },
  206. [1] = {
  207. .start = S3C64XX_PA_XM0CSN5 + (1 << 8),
  208. .end = S3C64XX_PA_XM0CSN5 + (1 << 8) + 1,
  209. .flags = IORESOURCE_MEM,
  210. },
  211. [2] = {
  212. .start = S3C_EINT(17),
  213. .end = S3C_EINT(17),
  214. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  215. },
  216. };
  217. static struct dm9000_plat_data mini6410_dm9k_pdata = {
  218. .flags = DM9000_PLATF_16BITONLY,
  219. };
  220. static struct platform_device crag6410_dm9k_device = {
  221. .name = "dm9000",
  222. .id = -1,
  223. .num_resources = ARRAY_SIZE(crag6410_dm9k_resource),
  224. .resource = crag6410_dm9k_resource,
  225. .dev.platform_data = &mini6410_dm9k_pdata,
  226. };
  227. static struct resource crag6410_mmgpio_resource[] = {
  228. [0] = {
  229. .start = S3C64XX_PA_XM0CSN4 + 1,
  230. .end = S3C64XX_PA_XM0CSN4 + 1,
  231. .flags = IORESOURCE_MEM,
  232. },
  233. };
  234. static struct platform_device crag6410_mmgpio = {
  235. .name = "basic-mmio-gpio",
  236. .id = -1,
  237. .resource = crag6410_mmgpio_resource,
  238. .num_resources = ARRAY_SIZE(crag6410_mmgpio_resource),
  239. .dev.platform_data = &(struct bgpio_pdata) {
  240. .base = -1,
  241. },
  242. };
  243. static struct platform_device speyside_device = {
  244. .name = "speyside",
  245. .id = -1,
  246. };
  247. static struct platform_device lowland_device = {
  248. .name = "lowland",
  249. .id = -1,
  250. };
  251. static struct platform_device speyside_wm8962_device = {
  252. .name = "speyside-wm8962",
  253. .id = -1,
  254. };
  255. static struct platform_device littlemill_device = {
  256. .name = "littlemill",
  257. .id = -1,
  258. };
  259. static struct regulator_consumer_supply wallvdd_consumers[] = {
  260. REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
  261. REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
  262. REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
  263. REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
  264. };
  265. static struct regulator_init_data wallvdd_data = {
  266. .constraints = {
  267. .always_on = 1,
  268. },
  269. .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
  270. .consumer_supplies = wallvdd_consumers,
  271. };
  272. static struct fixed_voltage_config wallvdd_pdata = {
  273. .supply_name = "WALLVDD",
  274. .microvolts = 5000000,
  275. .init_data = &wallvdd_data,
  276. .gpio = -EINVAL,
  277. };
  278. static struct platform_device wallvdd_device = {
  279. .name = "reg-fixed-voltage",
  280. .id = -1,
  281. .dev = {
  282. .platform_data = &wallvdd_pdata,
  283. },
  284. };
  285. static struct platform_device *crag6410_devices[] __initdata = {
  286. &s3c_device_hsmmc0,
  287. &s3c_device_hsmmc1,
  288. &s3c_device_hsmmc2,
  289. &s3c_device_i2c0,
  290. &s3c_device_i2c1,
  291. &s3c_device_fb,
  292. &s3c_device_ohci,
  293. &s3c_device_usb_hsotg,
  294. &s3c_device_timer[0],
  295. &s3c64xx_device_iis0,
  296. &s3c64xx_device_iis1,
  297. &samsung_asoc_dma,
  298. &samsung_device_keypad,
  299. &crag6410_gpio_keydev,
  300. &crag6410_dm9k_device,
  301. &s3c64xx_device_spi0,
  302. &crag6410_mmgpio,
  303. &crag6410_lcd_powerdev,
  304. &crag6410_backlight_device,
  305. &speyside_device,
  306. &speyside_wm8962_device,
  307. &littlemill_device,
  308. &lowland_device,
  309. &wallvdd_device,
  310. };
  311. static struct pca953x_platform_data crag6410_pca_data = {
  312. .gpio_base = PCA935X_GPIO_BASE,
  313. .irq_base = 0,
  314. };
  315. /* VDDARM is controlled by DVS1 connected to GPK(0) */
  316. static struct wm831x_buckv_pdata vddarm_pdata = {
  317. .dvs_control_src = 1,
  318. .dvs_gpio = S3C64XX_GPK(0),
  319. };
  320. static struct regulator_consumer_supply vddarm_consumers[] __initdata = {
  321. REGULATOR_SUPPLY("vddarm", NULL),
  322. };
  323. static struct regulator_init_data vddarm __initdata = {
  324. .constraints = {
  325. .name = "VDDARM",
  326. .min_uV = 1000000,
  327. .max_uV = 1300000,
  328. .always_on = 1,
  329. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  330. },
  331. .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
  332. .consumer_supplies = vddarm_consumers,
  333. .supply_regulator = "WALLVDD",
  334. .driver_data = &vddarm_pdata,
  335. };
  336. static struct regulator_init_data vddint __initdata = {
  337. .constraints = {
  338. .name = "VDDINT",
  339. .min_uV = 1000000,
  340. .max_uV = 1200000,
  341. .always_on = 1,
  342. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  343. },
  344. };
  345. static struct regulator_init_data vddmem __initdata = {
  346. .constraints = {
  347. .name = "VDDMEM",
  348. .always_on = 1,
  349. },
  350. };
  351. static struct regulator_init_data vddsys __initdata = {
  352. .constraints = {
  353. .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
  354. .always_on = 1,
  355. },
  356. };
  357. static struct regulator_consumer_supply vddmmc_consumers[] __initdata = {
  358. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  359. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
  360. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
  361. };
  362. static struct regulator_init_data vddmmc __initdata = {
  363. .constraints = {
  364. .name = "VDDMMC,UH",
  365. .always_on = 1,
  366. },
  367. .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
  368. .consumer_supplies = vddmmc_consumers,
  369. .supply_regulator = "WALLVDD",
  370. };
  371. static struct regulator_init_data vddotgi __initdata = {
  372. .constraints = {
  373. .name = "VDDOTGi",
  374. .always_on = 1,
  375. },
  376. .supply_regulator = "WALLVDD",
  377. };
  378. static struct regulator_init_data vddotg __initdata = {
  379. .constraints = {
  380. .name = "VDDOTG",
  381. .always_on = 1,
  382. },
  383. .supply_regulator = "WALLVDD",
  384. };
  385. static struct regulator_init_data vddhi __initdata = {
  386. .constraints = {
  387. .name = "VDDHI",
  388. .always_on = 1,
  389. },
  390. .supply_regulator = "WALLVDD",
  391. };
  392. static struct regulator_init_data vddadc __initdata = {
  393. .constraints = {
  394. .name = "VDDADC,VDDDAC",
  395. .always_on = 1,
  396. },
  397. .supply_regulator = "WALLVDD",
  398. };
  399. static struct regulator_init_data vddmem0 __initdata = {
  400. .constraints = {
  401. .name = "VDDMEM0",
  402. .always_on = 1,
  403. },
  404. .supply_regulator = "WALLVDD",
  405. };
  406. static struct regulator_init_data vddpll __initdata = {
  407. .constraints = {
  408. .name = "VDDPLL",
  409. .always_on = 1,
  410. },
  411. .supply_regulator = "WALLVDD",
  412. };
  413. static struct regulator_init_data vddlcd __initdata = {
  414. .constraints = {
  415. .name = "VDDLCD",
  416. .always_on = 1,
  417. },
  418. .supply_regulator = "WALLVDD",
  419. };
  420. static struct regulator_init_data vddalive __initdata = {
  421. .constraints = {
  422. .name = "VDDALIVE",
  423. .always_on = 1,
  424. },
  425. .supply_regulator = "WALLVDD",
  426. };
  427. static struct wm831x_backup_pdata banff_backup_pdata __initdata = {
  428. .charger_enable = 1,
  429. .vlim = 2500, /* mV */
  430. .ilim = 200, /* uA */
  431. };
  432. static struct wm831x_status_pdata banff_red_led __initdata = {
  433. .name = "banff:red:",
  434. .default_src = WM831X_STATUS_MANUAL,
  435. };
  436. static struct wm831x_status_pdata banff_green_led __initdata = {
  437. .name = "banff:green:",
  438. .default_src = WM831X_STATUS_MANUAL,
  439. };
  440. static struct wm831x_touch_pdata touch_pdata __initdata = {
  441. .data_irq = S3C_EINT(26),
  442. .pd_irq = S3C_EINT(27),
  443. };
  444. static struct wm831x_pdata crag_pmic_pdata __initdata = {
  445. .wm831x_num = 1,
  446. .irq_base = BANFF_PMIC_IRQ_BASE,
  447. .gpio_base = BANFF_PMIC_GPIO_BASE,
  448. .soft_shutdown = true,
  449. .backup = &banff_backup_pdata,
  450. .gpio_defaults = {
  451. /* GPIO5: DVS1_REQ - CMOS, DBVDD, active high */
  452. [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
  453. /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
  454. [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
  455. /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
  456. [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
  457. },
  458. .dcdc = {
  459. &vddarm, /* DCDC1 */
  460. &vddint, /* DCDC2 */
  461. &vddmem, /* DCDC3 */
  462. },
  463. .ldo = {
  464. &vddsys, /* LDO1 */
  465. &vddmmc, /* LDO2 */
  466. NULL, /* LDO3 */
  467. &vddotgi, /* LDO4 */
  468. &vddotg, /* LDO5 */
  469. &vddhi, /* LDO6 */
  470. &vddadc, /* LDO7 */
  471. &vddmem0, /* LDO8 */
  472. &vddpll, /* LDO9 */
  473. &vddlcd, /* LDO10 */
  474. &vddalive, /* LDO11 */
  475. },
  476. .status = {
  477. &banff_green_led,
  478. &banff_red_led,
  479. },
  480. .touch = &touch_pdata,
  481. };
  482. static struct i2c_board_info i2c_devs0[] __initdata = {
  483. { I2C_BOARD_INFO("24c08", 0x50), },
  484. { I2C_BOARD_INFO("tca6408", 0x20),
  485. .platform_data = &crag6410_pca_data,
  486. },
  487. { I2C_BOARD_INFO("wm8312", 0x34),
  488. .platform_data = &crag_pmic_pdata,
  489. .irq = S3C_EINT(23),
  490. },
  491. };
  492. static struct s3c2410_platform_i2c i2c0_pdata = {
  493. .frequency = 400000,
  494. };
  495. static struct regulator_init_data pvdd_1v2 __initdata = {
  496. .constraints = {
  497. .name = "PVDD_1V2",
  498. .always_on = 1,
  499. },
  500. };
  501. static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
  502. REGULATOR_SUPPLY("LDOVDD", "1-001a"),
  503. REGULATOR_SUPPLY("PLLVDD", "1-001a"),
  504. REGULATOR_SUPPLY("DBVDD", "1-001a"),
  505. REGULATOR_SUPPLY("DBVDD1", "1-001a"),
  506. REGULATOR_SUPPLY("DBVDD2", "1-001a"),
  507. REGULATOR_SUPPLY("DBVDD3", "1-001a"),
  508. REGULATOR_SUPPLY("CPVDD", "1-001a"),
  509. REGULATOR_SUPPLY("AVDD2", "1-001a"),
  510. REGULATOR_SUPPLY("DCVDD", "1-001a"),
  511. REGULATOR_SUPPLY("AVDD", "1-001a"),
  512. };
  513. static struct regulator_init_data pvdd_1v8 __initdata = {
  514. .constraints = {
  515. .name = "PVDD_1V8",
  516. .always_on = 1,
  517. },
  518. .consumer_supplies = pvdd_1v8_consumers,
  519. .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
  520. };
  521. static struct regulator_consumer_supply pvdd_3v3_consumers[] __initdata = {
  522. REGULATOR_SUPPLY("MICVDD", "1-001a"),
  523. REGULATOR_SUPPLY("AVDD1", "1-001a"),
  524. };
  525. static struct regulator_init_data pvdd_3v3 __initdata = {
  526. .constraints = {
  527. .name = "PVDD_3V3",
  528. .always_on = 1,
  529. },
  530. .consumer_supplies = pvdd_3v3_consumers,
  531. .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
  532. };
  533. static struct wm831x_pdata glenfarclas_pmic_pdata __initdata = {
  534. .wm831x_num = 2,
  535. .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
  536. .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
  537. .soft_shutdown = true,
  538. .gpio_defaults = {
  539. /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
  540. [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  541. [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  542. [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  543. },
  544. .dcdc = {
  545. &pvdd_1v2, /* DCDC1 */
  546. &pvdd_1v8, /* DCDC2 */
  547. &pvdd_3v3, /* DCDC3 */
  548. },
  549. .disable_touch = true,
  550. };
  551. static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
  552. .gpios = {
  553. [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
  554. [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
  555. [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
  556. [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
  557. [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
  558. },
  559. };
  560. static struct i2c_board_info i2c_devs1[] __initdata = {
  561. { I2C_BOARD_INFO("wm8311", 0x34),
  562. .irq = S3C_EINT(0),
  563. .platform_data = &glenfarclas_pmic_pdata },
  564. { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
  565. { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
  566. { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
  567. { I2C_BOARD_INFO("wm1250-ev1", 0x27),
  568. .platform_data = &wm1250_ev1_pdata },
  569. };
  570. static struct s3c2410_platform_i2c i2c1_pdata = {
  571. .frequency = 400000,
  572. .bus_num = 1,
  573. };
  574. static void __init crag6410_map_io(void)
  575. {
  576. s3c64xx_init_io(NULL, 0);
  577. s3c24xx_init_clocks(12000000);
  578. s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
  579. /* LCD type and Bypass set by bootloader */
  580. }
  581. static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
  582. .max_width = 4,
  583. .cd_type = S3C_SDHCI_CD_PERMANENT,
  584. };
  585. static struct s3c_sdhci_platdata crag6410_hsmmc1_pdata = {
  586. .max_width = 4,
  587. .cd_type = S3C_SDHCI_CD_GPIO,
  588. .ext_cd_gpio = S3C64XX_GPF(11),
  589. };
  590. static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
  591. {
  592. /* Set all the necessary GPG pins to special-function 2 */
  593. s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
  594. /* force card-detected for prototype 0 */
  595. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
  596. }
  597. static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
  598. .max_width = 4,
  599. .cd_type = S3C_SDHCI_CD_INTERNAL,
  600. .cfg_gpio = crag6410_cfg_sdhci0,
  601. };
  602. static void __init crag6410_machine_init(void)
  603. {
  604. /* Open drain IRQs need pullups */
  605. s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
  606. s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
  607. gpio_request(S3C64XX_GPB(0), "LCD power");
  608. gpio_direction_output(S3C64XX_GPB(0), 0);
  609. gpio_request(S3C64XX_GPF(14), "LCD PWM");
  610. gpio_direction_output(S3C64XX_GPF(14), 0); /* turn off */
  611. gpio_request(S3C64XX_GPB(1), "SD power");
  612. gpio_direction_output(S3C64XX_GPB(1), 0);
  613. gpio_request(S3C64XX_GPF(10), "nRESETSEL");
  614. gpio_direction_output(S3C64XX_GPF(10), 1);
  615. s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
  616. s3c_sdhci1_set_platdata(&crag6410_hsmmc1_pdata);
  617. s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
  618. s3c_i2c0_set_platdata(&i2c0_pdata);
  619. s3c_i2c1_set_platdata(&i2c1_pdata);
  620. s3c_fb_set_platdata(&crag6410_lcd_pdata);
  621. i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
  622. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  623. samsung_keypad_set_platdata(&crag6410_keypad_data);
  624. platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
  625. regulator_has_full_constraints();
  626. s3c_pm_init();
  627. }
  628. MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
  629. /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
  630. .atag_offset = 0x100,
  631. .init_irq = s3c6410_init_irq,
  632. .map_io = crag6410_map_io,
  633. .init_machine = crag6410_machine_init,
  634. .timer = &s3c24xx_timer,
  635. MACHINE_END