mach-crag6410.c 20 KB

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