mach-crag6410.c 18 KB

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