mach-crag6410.c 21 KB

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