mach-crag6410.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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_consumer_supply vddint_consumers[] __initdata = {
  337. REGULATOR_SUPPLY("vddint", NULL),
  338. };
  339. static struct regulator_init_data vddint __initdata = {
  340. .constraints = {
  341. .name = "VDDINT",
  342. .min_uV = 1000000,
  343. .max_uV = 1200000,
  344. .always_on = 1,
  345. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  346. },
  347. .num_consumer_supplies = ARRAY_SIZE(vddint_consumers),
  348. .consumer_supplies = vddint_consumers,
  349. .supply_regulator = "WALLVDD",
  350. };
  351. static struct regulator_init_data vddmem __initdata = {
  352. .constraints = {
  353. .name = "VDDMEM",
  354. .always_on = 1,
  355. },
  356. };
  357. static struct regulator_init_data vddsys __initdata = {
  358. .constraints = {
  359. .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
  360. .always_on = 1,
  361. },
  362. };
  363. static struct regulator_consumer_supply vddmmc_consumers[] __initdata = {
  364. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  365. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
  366. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
  367. };
  368. static struct regulator_init_data vddmmc __initdata = {
  369. .constraints = {
  370. .name = "VDDMMC,UH",
  371. .always_on = 1,
  372. },
  373. .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
  374. .consumer_supplies = vddmmc_consumers,
  375. .supply_regulator = "WALLVDD",
  376. };
  377. static struct regulator_init_data vddotgi __initdata = {
  378. .constraints = {
  379. .name = "VDDOTGi",
  380. .always_on = 1,
  381. },
  382. .supply_regulator = "WALLVDD",
  383. };
  384. static struct regulator_init_data vddotg __initdata = {
  385. .constraints = {
  386. .name = "VDDOTG",
  387. .always_on = 1,
  388. },
  389. .supply_regulator = "WALLVDD",
  390. };
  391. static struct regulator_init_data vddhi __initdata = {
  392. .constraints = {
  393. .name = "VDDHI",
  394. .always_on = 1,
  395. },
  396. .supply_regulator = "WALLVDD",
  397. };
  398. static struct regulator_init_data vddadc __initdata = {
  399. .constraints = {
  400. .name = "VDDADC,VDDDAC",
  401. .always_on = 1,
  402. },
  403. .supply_regulator = "WALLVDD",
  404. };
  405. static struct regulator_init_data vddmem0 __initdata = {
  406. .constraints = {
  407. .name = "VDDMEM0",
  408. .always_on = 1,
  409. },
  410. .supply_regulator = "WALLVDD",
  411. };
  412. static struct regulator_init_data vddpll __initdata = {
  413. .constraints = {
  414. .name = "VDDPLL",
  415. .always_on = 1,
  416. },
  417. .supply_regulator = "WALLVDD",
  418. };
  419. static struct regulator_init_data vddlcd __initdata = {
  420. .constraints = {
  421. .name = "VDDLCD",
  422. .always_on = 1,
  423. },
  424. .supply_regulator = "WALLVDD",
  425. };
  426. static struct regulator_init_data vddalive __initdata = {
  427. .constraints = {
  428. .name = "VDDALIVE",
  429. .always_on = 1,
  430. },
  431. .supply_regulator = "WALLVDD",
  432. };
  433. static struct wm831x_backup_pdata banff_backup_pdata __initdata = {
  434. .charger_enable = 1,
  435. .vlim = 2500, /* mV */
  436. .ilim = 200, /* uA */
  437. };
  438. static struct wm831x_status_pdata banff_red_led __initdata = {
  439. .name = "banff:red:",
  440. .default_src = WM831X_STATUS_MANUAL,
  441. };
  442. static struct wm831x_status_pdata banff_green_led __initdata = {
  443. .name = "banff:green:",
  444. .default_src = WM831X_STATUS_MANUAL,
  445. };
  446. static struct wm831x_touch_pdata touch_pdata __initdata = {
  447. .data_irq = S3C_EINT(26),
  448. .pd_irq = S3C_EINT(27),
  449. };
  450. static struct wm831x_pdata crag_pmic_pdata __initdata = {
  451. .wm831x_num = 1,
  452. .irq_base = BANFF_PMIC_IRQ_BASE,
  453. .gpio_base = BANFF_PMIC_GPIO_BASE,
  454. .soft_shutdown = true,
  455. .backup = &banff_backup_pdata,
  456. .gpio_defaults = {
  457. /* GPIO5: DVS1_REQ - CMOS, DBVDD, active high */
  458. [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
  459. /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
  460. [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
  461. /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
  462. [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
  463. },
  464. .dcdc = {
  465. &vddarm, /* DCDC1 */
  466. &vddint, /* DCDC2 */
  467. &vddmem, /* DCDC3 */
  468. },
  469. .ldo = {
  470. &vddsys, /* LDO1 */
  471. &vddmmc, /* LDO2 */
  472. NULL, /* LDO3 */
  473. &vddotgi, /* LDO4 */
  474. &vddotg, /* LDO5 */
  475. &vddhi, /* LDO6 */
  476. &vddadc, /* LDO7 */
  477. &vddmem0, /* LDO8 */
  478. &vddpll, /* LDO9 */
  479. &vddlcd, /* LDO10 */
  480. &vddalive, /* LDO11 */
  481. },
  482. .status = {
  483. &banff_green_led,
  484. &banff_red_led,
  485. },
  486. .touch = &touch_pdata,
  487. };
  488. static struct i2c_board_info i2c_devs0[] __initdata = {
  489. { I2C_BOARD_INFO("24c08", 0x50), },
  490. { I2C_BOARD_INFO("tca6408", 0x20),
  491. .platform_data = &crag6410_pca_data,
  492. },
  493. { I2C_BOARD_INFO("wm8312", 0x34),
  494. .platform_data = &crag_pmic_pdata,
  495. .irq = S3C_EINT(23),
  496. },
  497. };
  498. static struct s3c2410_platform_i2c i2c0_pdata = {
  499. .frequency = 400000,
  500. };
  501. static struct regulator_init_data pvdd_1v2 __initdata = {
  502. .constraints = {
  503. .name = "PVDD_1V2",
  504. .always_on = 1,
  505. },
  506. };
  507. static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
  508. REGULATOR_SUPPLY("LDOVDD", "1-001a"),
  509. REGULATOR_SUPPLY("PLLVDD", "1-001a"),
  510. REGULATOR_SUPPLY("DBVDD", "1-001a"),
  511. REGULATOR_SUPPLY("DBVDD1", "1-001a"),
  512. REGULATOR_SUPPLY("DBVDD2", "1-001a"),
  513. REGULATOR_SUPPLY("DBVDD3", "1-001a"),
  514. REGULATOR_SUPPLY("CPVDD", "1-001a"),
  515. REGULATOR_SUPPLY("AVDD2", "1-001a"),
  516. REGULATOR_SUPPLY("DCVDD", "1-001a"),
  517. REGULATOR_SUPPLY("AVDD", "1-001a"),
  518. };
  519. static struct regulator_init_data pvdd_1v8 __initdata = {
  520. .constraints = {
  521. .name = "PVDD_1V8",
  522. .always_on = 1,
  523. },
  524. .consumer_supplies = pvdd_1v8_consumers,
  525. .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
  526. };
  527. static struct regulator_consumer_supply pvdd_3v3_consumers[] __initdata = {
  528. REGULATOR_SUPPLY("MICVDD", "1-001a"),
  529. REGULATOR_SUPPLY("AVDD1", "1-001a"),
  530. };
  531. static struct regulator_init_data pvdd_3v3 __initdata = {
  532. .constraints = {
  533. .name = "PVDD_3V3",
  534. .always_on = 1,
  535. },
  536. .consumer_supplies = pvdd_3v3_consumers,
  537. .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
  538. };
  539. static struct wm831x_pdata glenfarclas_pmic_pdata __initdata = {
  540. .wm831x_num = 2,
  541. .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
  542. .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
  543. .soft_shutdown = true,
  544. .gpio_defaults = {
  545. /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
  546. [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  547. [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  548. [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
  549. },
  550. .dcdc = {
  551. &pvdd_1v2, /* DCDC1 */
  552. &pvdd_1v8, /* DCDC2 */
  553. &pvdd_3v3, /* DCDC3 */
  554. },
  555. .disable_touch = true,
  556. };
  557. static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
  558. .gpios = {
  559. [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
  560. [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
  561. [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
  562. [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
  563. [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
  564. },
  565. };
  566. static struct i2c_board_info i2c_devs1[] __initdata = {
  567. { I2C_BOARD_INFO("wm8311", 0x34),
  568. .irq = S3C_EINT(0),
  569. .platform_data = &glenfarclas_pmic_pdata },
  570. { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
  571. { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
  572. { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
  573. { I2C_BOARD_INFO("wm1250-ev1", 0x27),
  574. .platform_data = &wm1250_ev1_pdata },
  575. };
  576. static struct s3c2410_platform_i2c i2c1_pdata = {
  577. .frequency = 400000,
  578. .bus_num = 1,
  579. };
  580. static void __init crag6410_map_io(void)
  581. {
  582. s3c64xx_init_io(NULL, 0);
  583. s3c24xx_init_clocks(12000000);
  584. s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
  585. /* LCD type and Bypass set by bootloader */
  586. }
  587. static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
  588. .max_width = 4,
  589. .cd_type = S3C_SDHCI_CD_PERMANENT,
  590. };
  591. static struct s3c_sdhci_platdata crag6410_hsmmc1_pdata = {
  592. .max_width = 4,
  593. .cd_type = S3C_SDHCI_CD_GPIO,
  594. .ext_cd_gpio = S3C64XX_GPF(11),
  595. };
  596. static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
  597. {
  598. /* Set all the necessary GPG pins to special-function 2 */
  599. s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
  600. /* force card-detected for prototype 0 */
  601. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
  602. }
  603. static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
  604. .max_width = 4,
  605. .cd_type = S3C_SDHCI_CD_INTERNAL,
  606. .cfg_gpio = crag6410_cfg_sdhci0,
  607. };
  608. static void __init crag6410_machine_init(void)
  609. {
  610. /* Open drain IRQs need pullups */
  611. s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
  612. s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
  613. gpio_request(S3C64XX_GPB(0), "LCD power");
  614. gpio_direction_output(S3C64XX_GPB(0), 0);
  615. gpio_request(S3C64XX_GPF(14), "LCD PWM");
  616. gpio_direction_output(S3C64XX_GPF(14), 0); /* turn off */
  617. gpio_request(S3C64XX_GPB(1), "SD power");
  618. gpio_direction_output(S3C64XX_GPB(1), 0);
  619. gpio_request(S3C64XX_GPF(10), "nRESETSEL");
  620. gpio_direction_output(S3C64XX_GPF(10), 1);
  621. s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
  622. s3c_sdhci1_set_platdata(&crag6410_hsmmc1_pdata);
  623. s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
  624. s3c_i2c0_set_platdata(&i2c0_pdata);
  625. s3c_i2c1_set_platdata(&i2c1_pdata);
  626. s3c_fb_set_platdata(&crag6410_lcd_pdata);
  627. i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
  628. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  629. samsung_keypad_set_platdata(&crag6410_keypad_data);
  630. platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
  631. regulator_has_full_constraints();
  632. s3c_pm_init();
  633. }
  634. MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
  635. /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
  636. .atag_offset = 0x100,
  637. .init_irq = s3c6410_init_irq,
  638. .map_io = crag6410_map_io,
  639. .init_machine = crag6410_machine_init,
  640. .timer = &s3c24xx_timer,
  641. MACHINE_END