leakageCurrentVariance.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. /* linux/arch/arm/mach-s3c64xx/mach-smdk6410.c
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/timer.h>
  18. #include <linux/init.h>
  19. #include <linux/input.h>
  20. #include <linux/serial_core.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/io.h>
  23. #include <linux/i2c.h>
  24. #include <linux/leds.h>
  25. #include <linux/fb.h>
  26. #include <linux/gpio.h>
  27. #include <linux/delay.h>
  28. #include <linux/smsc911x.h>
  29. #include <linux/regulator/fixed.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/pwm_backlight.h>
  32. #include <linux/platform_data/s3c-hsotg.h>
  33. #ifdef CONFIG_SMDK6410_WM1190_EV1
  34. #include <linux/mfd/wm8350/core.h>
  35. #include <linux/mfd/wm8350/pmic.h>
  36. #endif
  37. #ifdef CONFIG_SMDK6410_WM1192_EV1
  38. #include <linux/mfd/wm831x/core.h>
  39. #include <linux/mfd/wm831x/pdata.h>
  40. #endif
  41. #include <video/platform_lcd.h>
  42. #include <video/samsung_fimd.h>
  43. #include <asm/hardware/vic.h>
  44. #include <asm/mach/arch.h>
  45. #include <asm/mach/map.h>
  46. #include <asm/mach/irq.h>
  47. #include <mach/hardware.h>
  48. #include <mach/map.h>
  49. #include <asm/irq.h>
  50. #include <asm/mach-types.h>
  51. #include <plat/regs-serial.h>
  52. #include <mach/regs-modem.h>
  53. #include <mach/regs-gpio.h>
  54. #include <mach/regs-sys.h>
  55. #include <mach/regs-srom.h>
  56. #include <linux/platform_data/ata-samsung_cf.h>
  57. #include <linux/platform_data/i2c-s3c2410.h>
  58. #include <plat/fb.h>
  59. #include <plat/gpio-cfg.h>
  60. #include <plat/clock.h>
  61. #include <plat/devs.h>
  62. #include <plat/cpu.h>
  63. #include <plat/adc.h>
  64. #include <linux/platform_data/touchscreen-s3c2410.h>
  65. #include <plat/keypad.h>
  66. #include <plat/backlight.h>
  67. #include "common.h"
  68. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  69. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  70. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  71. static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
  72. [0] = {
  73. .hwport = 0,
  74. .flags = 0,
  75. .ucon = UCON,
  76. .ulcon = ULCON,
  77. .ufcon = UFCON,
  78. },
  79. [1] = {
  80. .hwport = 1,
  81. .flags = 0,
  82. .ucon = UCON,
  83. .ulcon = ULCON,
  84. .ufcon = UFCON,
  85. },
  86. [2] = {
  87. .hwport = 2,
  88. .flags = 0,
  89. .ucon = UCON,
  90. .ulcon = ULCON,
  91. .ufcon = UFCON,
  92. },
  93. [3] = {
  94. .hwport = 3,
  95. .flags = 0,
  96. .ucon = UCON,
  97. .ulcon = ULCON,
  98. .ufcon = UFCON,
  99. },
  100. };
  101. /* framebuffer and LCD setup. */
  102. /* GPF15 = LCD backlight control
  103. * GPF13 => Panel power
  104. * GPN5 = LCD nRESET signal
  105. * PWM_TOUT1 => backlight brightness
  106. */
  107. static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
  108. unsigned int power)
  109. {
  110. if (power) {
  111. gpio_direction_output(S3C64XX_GPF(13), 1);
  112. /* fire nRESET on power up */
  113. gpio_direction_output(S3C64XX_GPN(5), 0);
  114. msleep(10);
  115. gpio_direction_output(S3C64XX_GPN(5), 1);
  116. msleep(1);
  117. } else {
  118. gpio_direction_output(S3C64XX_GPF(13), 0);
  119. }
  120. }
  121. static struct plat_lcd_data smdk6410_lcd_power_data = {
  122. .set_power = smdk6410_lcd_power_set,
  123. };
  124. static struct platform_device smdk6410_lcd_powerdev = {
  125. .name = "platform-lcd",
  126. .dev.parent = &s3c_device_fb.dev,
  127. .dev.platform_data = &smdk6410_lcd_power_data,
  128. };
  129. static struct s3c_fb_pd_win smdk6410_fb_win0 = {
  130. .max_bpp = 32,
  131. .default_bpp = 16,
  132. .xres = 800,
  133. .yres = 480,
  134. .virtual_y = 480 * 2,
  135. .virtual_x = 800,
  136. };
  137. static struct fb_videomode smdk6410_lcd_timing = {
  138. .left_margin = 8,
  139. .right_margin = 13,
  140. .upper_margin = 7,
  141. .lower_margin = 5,
  142. .hsync_len = 3,
  143. .vsync_len = 1,
  144. .xres = 800,
  145. .yres = 480,
  146. };
  147. /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
  148. static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
  149. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  150. .vtiming = &smdk6410_lcd_timing,
  151. .win[0] = &smdk6410_fb_win0,
  152. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  153. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  154. };
  155. /*
  156. * Configuring Ethernet on SMDK6410
  157. *
  158. * Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
  159. * The constant address below corresponds to nCS1
  160. *
  161. * 1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
  162. * 2) CFG6 needs to be switched to "LAN9115" side
  163. */
  164. static struct resource smdk6410_smsc911x_resources[] = {
  165. [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, SZ_64K),
  166. [1] = DEFINE_RES_NAMED(S3C_EINT(10), 1, NULL, IORESOURCE_IRQ \
  167. | IRQ_TYPE_LEVEL_LOW),
  168. };
  169. static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
  170. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  171. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  172. .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
  173. .phy_interface = PHY_INTERFACE_MODE_MII,
  174. };
  175. static struct platform_device smdk6410_smsc911x = {
  176. .name = "smsc911x",
  177. .id = -1,
  178. .num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
  179. .resource = &smdk6410_smsc911x_resources[0],
  180. .dev = {
  181. .platform_data = &smdk6410_smsc911x_pdata,
  182. },
  183. };
  184. #ifdef CONFIG_REGULATOR
  185. static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] __initdata = {
  186. REGULATOR_SUPPLY("PVDD", "0-001b"),
  187. REGULATOR_SUPPLY("AVDD", "0-001b"),
  188. };
  189. static struct regulator_init_data smdk6410_b_pwr_5v_data = {
  190. .constraints = {
  191. .always_on = 1,
  192. },
  193. .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
  194. .consumer_supplies = smdk6410_b_pwr_5v_consumers,
  195. };
  196. static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
  197. .supply_name = "B_PWR_5V",
  198. .microvolts = 5000000,
  199. .init_data = &smdk6410_b_pwr_5v_data,
  200. .gpio = -EINVAL,
  201. };
  202. static struct platform_device smdk6410_b_pwr_5v = {
  203. .name = "reg-fixed-voltage",
  204. .id = -1,
  205. .dev = {
  206. .platform_data = &smdk6410_b_pwr_5v_pdata,
  207. },
  208. };
  209. #endif
  210. static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
  211. .setup_gpio = s3c64xx_ide_setup_gpio,
  212. };
  213. static uint32_t smdk6410_keymap[] __initdata = {
  214. /* KEY(row, col, keycode) */
  215. KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
  216. KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
  217. KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
  218. KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
  219. };
  220. static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
  221. .keymap = smdk6410_keymap,
  222. .keymap_size = ARRAY_SIZE(smdk6410_keymap),
  223. };
  224. static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
  225. .keymap_data = &smdk6410_keymap_data,
  226. .rows = 2,
  227. .cols = 8,
  228. };
  229. static struct map_desc smdk6410_iodesc[] = {};
  230. static struct platform_device *smdk6410_devices[] __initdata = {
  231. #ifdef CONFIG_SMDK6410_SD_CH0
  232. &s3c_device_hsmmc0,
  233. #endif
  234. #ifdef CONFIG_SMDK6410_SD_CH1
  235. &s3c_device_hsmmc1,
  236. #endif
  237. &s3c_device_i2c0,
  238. &s3c_device_i2c1,
  239. &s3c_device_fb,
  240. &s3c_device_ohci,
  241. &s3c_device_usb_hsotg,
  242. &s3c64xx_device_iisv4,
  243. &samsung_device_keypad,
  244. #ifdef CONFIG_REGULATOR
  245. &smdk6410_b_pwr_5v,
  246. #endif
  247. &smdk6410_lcd_powerdev,
  248. &smdk6410_smsc911x,
  249. &s3c_device_adc,
  250. &s3c_device_cfcon,
  251. &s3c_device_rtc,
  252. &s3c_device_ts,
  253. &s3c_device_wdt,
  254. };
  255. #ifdef CONFIG_REGULATOR
  256. /* ARM core */
  257. static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
  258. REGULATOR_SUPPLY("vddarm", NULL),
  259. };
  260. /* VDDARM, BUCK1 on J5 */
  261. static struct regulator_init_data smdk6410_vddarm = {
  262. .constraints = {
  263. .name = "PVDD_ARM",
  264. .min_uV = 1000000,
  265. .max_uV = 1300000,
  266. .always_on = 1,
  267. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  268. },
  269. .num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
  270. .consumer_supplies = smdk6410_vddarm_consumers,
  271. };
  272. /* VDD_INT, BUCK2 on J5 */
  273. static struct regulator_init_data smdk6410_vddint = {
  274. .constraints = {
  275. .name = "PVDD_INT",
  276. .min_uV = 1000000,
  277. .max_uV = 1200000,
  278. .always_on = 1,
  279. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  280. },
  281. };
  282. /* VDD_HI, LDO3 on J5 */
  283. static struct regulator_init_data smdk6410_vddhi = {
  284. .constraints = {
  285. .name = "PVDD_HI",
  286. .always_on = 1,
  287. },
  288. };
  289. /* VDD_PLL, LDO2 on J5 */
  290. static struct regulator_init_data smdk6410_vddpll = {
  291. .constraints = {
  292. .name = "PVDD_PLL",
  293. .always_on = 1,
  294. },
  295. };
  296. /* VDD_UH_MMC, LDO5 on J5 */
  297. static struct regulator_init_data smdk6410_vdduh_mmc = {
  298. .constraints = {
  299. .name = "PVDD_UH+PVDD_MMC",
  300. .always_on = 1,
  301. },
  302. };
  303. /* VCCM3BT, LDO8 on J5 */
  304. static struct regulator_init_data smdk6410_vccmc3bt = {
  305. .constraints = {
  306. .name = "PVCCM3BT",
  307. .always_on = 1,
  308. },
  309. };
  310. /* VCCM2MTV, LDO11 on J5 */
  311. static struct regulator_init_data smdk6410_vccm2mtv = {
  312. .constraints = {
  313. .name = "PVCCM2MTV",
  314. .always_on = 1,
  315. },
  316. };
  317. /* VDD_LCD, LDO12 on J5 */
  318. static struct regulator_init_data smdk6410_vddlcd = {
  319. .constraints = {
  320. .name = "PVDD_LCD",
  321. .always_on = 1,
  322. },
  323. };
  324. /* VDD_OTGI, LDO9 on J5 */
  325. static struct regulator_init_data smdk6410_vddotgi = {
  326. .constraints = {
  327. .name = "PVDD_OTGI",
  328. .always_on = 1,
  329. },
  330. };
  331. /* VDD_OTG, LDO14 on J5 */
  332. static struct regulator_init_data smdk6410_vddotg = {
  333. .constraints = {
  334. .name = "PVDD_OTG",
  335. .always_on = 1,
  336. },
  337. };
  338. /* VDD_ALIVE, LDO15 on J5 */
  339. static struct regulator_init_data smdk6410_vddalive = {
  340. .constraints = {
  341. .name = "PVDD_ALIVE",
  342. .always_on = 1,
  343. },
  344. };
  345. /* VDD_AUDIO, VLDO_AUDIO on J5 */
  346. static struct regulator_init_data smdk6410_vddaudio = {
  347. .constraints = {
  348. .name = "PVDD_AUDIO",
  349. .always_on = 1,
  350. },
  351. };
  352. #endif
  353. #ifdef CONFIG_SMDK6410_WM1190_EV1
  354. /* S3C64xx internal logic & PLL */
  355. static struct regulator_init_data wm8350_dcdc1_data = {
  356. .constraints = {
  357. .name = "PVDD_INT+PVDD_PLL",
  358. .min_uV = 1200000,
  359. .max_uV = 1200000,
  360. .always_on = 1,
  361. .apply_uV = 1,
  362. },
  363. };
  364. /* Memory */
  365. static struct regulator_init_data wm8350_dcdc3_data = {
  366. .constraints = {
  367. .name = "PVDD_MEM",
  368. .min_uV = 1800000,
  369. .max_uV = 1800000,
  370. .always_on = 1,
  371. .state_mem = {
  372. .uV = 1800000,
  373. .mode = REGULATOR_MODE_NORMAL,
  374. .enabled = 1,
  375. },
  376. .initial_state = PM_SUSPEND_MEM,
  377. },
  378. };
  379. /* USB, EXT, PCM, ADC/DAC, USB, MMC */
  380. static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
  381. REGULATOR_SUPPLY("DVDD", "0-001b"),
  382. };
  383. static struct regulator_init_data wm8350_dcdc4_data = {
  384. .constraints = {
  385. .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
  386. .min_uV = 3000000,
  387. .max_uV = 3000000,
  388. .always_on = 1,
  389. },
  390. .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
  391. .consumer_supplies = wm8350_dcdc4_consumers,
  392. };
  393. /* OTGi/1190-EV1 HPVDD & AVDD */
  394. static struct regulator_init_data wm8350_ldo4_data = {
  395. .constraints = {
  396. .name = "PVDD_OTGI+HPVDD+AVDD",
  397. .min_uV = 1200000,
  398. .max_uV = 1200000,
  399. .apply_uV = 1,
  400. .always_on = 1,
  401. },
  402. };