mach-smdk4x12.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. /*
  2. * linux/arch/arm/mach-exynos4/mach-smdk4x12.c
  3. *
  4. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/i2c.h>
  13. #include <linux/input.h>
  14. #include <linux/io.h>
  15. #include <linux/lcd.h>
  16. #include <linux/mfd/max8997.h>
  17. #include <linux/mmc/host.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/pwm.h>
  20. #include <linux/pwm_backlight.h>
  21. #include <linux/regulator/machine.h>
  22. #include <linux/serial_core.h>
  23. #include <linux/platform_data/i2c-s3c2410.h>
  24. #include <linux/platform_data/s3c-hsotg.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach-types.h>
  27. #include <video/samsung_fimd.h>
  28. #include <plat/backlight.h>
  29. #include <plat/clock.h>
  30. #include <plat/cpu.h>
  31. #include <plat/devs.h>
  32. #include <plat/fb.h>
  33. #include <plat/gpio-cfg.h>
  34. #include <plat/keypad.h>
  35. #include <plat/mfc.h>
  36. #include <plat/regs-serial.h>
  37. #include <plat/sdhci.h>
  38. #include <mach/map.h>
  39. #include <drm/exynos_drm.h>
  40. #include "common.h"
  41. /* Following are default values for UCON, ULCON and UFCON UART registers */
  42. #define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  43. S3C2410_UCON_RXILEVEL | \
  44. S3C2410_UCON_TXIRQMODE | \
  45. S3C2410_UCON_RXIRQMODE | \
  46. S3C2410_UCON_RXFIFO_TOI | \
  47. S3C2443_UCON_RXERR_IRQEN)
  48. #define SMDK4X12_ULCON_DEFAULT S3C2410_LCON_CS8
  49. #define SMDK4X12_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  50. S5PV210_UFCON_TXTRIG4 | \
  51. S5PV210_UFCON_RXTRIG4)
  52. static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = {
  53. [0] = {
  54. .hwport = 0,
  55. .flags = 0,
  56. .ucon = SMDK4X12_UCON_DEFAULT,
  57. .ulcon = SMDK4X12_ULCON_DEFAULT,
  58. .ufcon = SMDK4X12_UFCON_DEFAULT,
  59. },
  60. [1] = {
  61. .hwport = 1,
  62. .flags = 0,
  63. .ucon = SMDK4X12_UCON_DEFAULT,
  64. .ulcon = SMDK4X12_ULCON_DEFAULT,
  65. .ufcon = SMDK4X12_UFCON_DEFAULT,
  66. },
  67. [2] = {
  68. .hwport = 2,
  69. .flags = 0,
  70. .ucon = SMDK4X12_UCON_DEFAULT,
  71. .ulcon = SMDK4X12_ULCON_DEFAULT,
  72. .ufcon = SMDK4X12_UFCON_DEFAULT,
  73. },
  74. [3] = {
  75. .hwport = 3,
  76. .flags = 0,
  77. .ucon = SMDK4X12_UCON_DEFAULT,
  78. .ulcon = SMDK4X12_ULCON_DEFAULT,
  79. .ufcon = SMDK4X12_UFCON_DEFAULT,
  80. },
  81. };
  82. static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
  83. .cd_type = S3C_SDHCI_CD_INTERNAL,
  84. #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
  85. .max_width = 8,
  86. .host_caps = MMC_CAP_8_BIT_DATA,
  87. #endif
  88. };
  89. static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = {
  90. .cd_type = S3C_SDHCI_CD_INTERNAL,
  91. };
  92. static struct regulator_consumer_supply max8997_buck1 =
  93. REGULATOR_SUPPLY("vdd_arm", NULL);
  94. static struct regulator_consumer_supply max8997_buck2 =
  95. REGULATOR_SUPPLY("vdd_int", NULL);
  96. static struct regulator_consumer_supply max8997_buck3 =
  97. REGULATOR_SUPPLY("vdd_g3d", NULL);
  98. static struct regulator_init_data max8997_buck1_data = {
  99. .constraints = {
  100. .name = "VDD_ARM_SMDK4X12",
  101. .min_uV = 925000,
  102. .max_uV = 1350000,
  103. .always_on = 1,
  104. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  105. .state_mem = {
  106. .disabled = 1,
  107. },
  108. },
  109. .num_consumer_supplies = 1,
  110. .consumer_supplies = &max8997_buck1,
  111. };
  112. static struct regulator_init_data max8997_buck2_data = {
  113. .constraints = {
  114. .name = "VDD_INT_SMDK4X12",
  115. .min_uV = 950000,
  116. .max_uV = 1150000,
  117. .always_on = 1,
  118. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  119. .state_mem = {
  120. .disabled = 1,
  121. },
  122. },
  123. .num_consumer_supplies = 1,
  124. .consumer_supplies = &max8997_buck2,
  125. };
  126. static struct regulator_init_data max8997_buck3_data = {
  127. .constraints = {
  128. .name = "VDD_G3D_SMDK4X12",
  129. .min_uV = 950000,
  130. .max_uV = 1150000,
  131. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  132. REGULATOR_CHANGE_STATUS,
  133. .state_mem = {
  134. .disabled = 1,
  135. },
  136. },
  137. .num_consumer_supplies = 1,
  138. .consumer_supplies = &max8997_buck3,
  139. };
  140. static struct max8997_regulator_data smdk4x12_max8997_regulators[] = {
  141. { MAX8997_BUCK1, &max8997_buck1_data },
  142. { MAX8997_BUCK2, &max8997_buck2_data },
  143. { MAX8997_BUCK3, &max8997_buck3_data },
  144. };
  145. static struct max8997_platform_data smdk4x12_max8997_pdata = {
  146. .num_regulators = ARRAY_SIZE(smdk4x12_max8997_regulators),
  147. .regulators = smdk4x12_max8997_regulators,
  148. .buck1_voltage[0] = 1100000, /* 1.1V */
  149. .buck1_voltage[1] = 1100000, /* 1.1V */
  150. .buck1_voltage[2] = 1100000, /* 1.1V */
  151. .buck1_voltage[3] = 1100000, /* 1.1V */
  152. .buck1_voltage[4] = 1100000, /* 1.1V */
  153. .buck1_voltage[5] = 1100000, /* 1.1V */
  154. .buck1_voltage[6] = 1000000, /* 1.0V */
  155. .buck1_voltage[7] = 950000, /* 0.95V */
  156. .buck2_voltage[0] = 1100000, /* 1.1V */
  157. .buck2_voltage[1] = 1000000, /* 1.0V */
  158. .buck2_voltage[2] = 950000, /* 0.95V */
  159. .buck2_voltage[3] = 900000, /* 0.9V */
  160. .buck2_voltage[4] = 1100000, /* 1.1V */
  161. .buck2_voltage[5] = 1000000, /* 1.0V */
  162. .buck2_voltage[6] = 950000, /* 0.95V */
  163. .buck2_voltage[7] = 900000, /* 0.9V */
  164. .buck5_voltage[0] = 1100000, /* 1.1V */
  165. .buck5_voltage[1] = 1100000, /* 1.1V */
  166. .buck5_voltage[2] = 1100000, /* 1.1V */
  167. .buck5_voltage[3] = 1100000, /* 1.1V */
  168. .buck5_voltage[4] = 1100000, /* 1.1V */
  169. .buck5_voltage[5] = 1100000, /* 1.1V */
  170. .buck5_voltage[6] = 1100000, /* 1.1V */
  171. .buck5_voltage[7] = 1100000, /* 1.1V */
  172. };
  173. static struct i2c_board_info smdk4x12_i2c_devs0[] __initdata = {
  174. {
  175. I2C_BOARD_INFO("max8997", 0x66),
  176. .platform_data = &smdk4x12_max8997_pdata,
  177. }
  178. };
  179. static struct i2c_board_info smdk4x12_i2c_devs1[] __initdata = {
  180. { I2C_BOARD_INFO("wm8994", 0x1a), }
  181. };
  182. static struct i2c_board_info smdk4x12_i2c_devs3[] __initdata = {
  183. /* nothing here yet */
  184. };
  185. static struct i2c_board_info smdk4x12_i2c_devs7[] __initdata = {
  186. /* nothing here yet */
  187. };
  188. static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
  189. .no = EXYNOS4_GPD0(1),
  190. .func = S3C_GPIO_SFN(2),
  191. };
  192. static struct platform_pwm_backlight_data smdk4x12_bl_data = {
  193. .pwm_id = 1,
  194. .pwm_period_ns = 1000,
  195. };
  196. static struct pwm_lookup smdk4x12_pwm_lookup[] = {
  197. PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL),
  198. };
  199. static uint32_t smdk4x12_keymap[] __initdata = {
  200. /* KEY(row, col, keycode) */
  201. KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3),
  202. KEY(1, 6, KEY_4), KEY(1, 7, KEY_5),
  203. KEY(2, 5, KEY_D), KEY(2, 6, KEY_A), KEY(2, 7, KEY_B),
  204. KEY(0, 7, KEY_E), KEY(0, 5, KEY_C)
  205. };
  206. static struct matrix_keymap_data smdk4x12_keymap_data __initdata = {
  207. .keymap = smdk4x12_keymap,
  208. .keymap_size = ARRAY_SIZE(smdk4x12_keymap),
  209. };
  210. static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = {
  211. .keymap_data = &smdk4x12_keymap_data,
  212. .rows = 3,
  213. .cols = 8,
  214. };
  215. #ifdef CONFIG_DRM_EXYNOS_FIMD
  216. static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
  217. .panel = {
  218. .timing = {
  219. .left_margin = 8,
  220. .right_margin = 8,
  221. .upper_margin = 6,
  222. .lower_margin = 6,
  223. .hsync_len = 6,
  224. .vsync_len = 4,
  225. .xres = 480,
  226. .yres = 800,
  227. },
  228. },
  229. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  230. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  231. .default_win = 0,
  232. .bpp = 32,
  233. };
  234. #else
  235. static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
  236. .xres = 480,
  237. .yres = 800,
  238. .virtual_x = 480,
  239. .virtual_y = 800 * 2,
  240. .max_bpp = 32,
  241. .default_bpp = 24,
  242. };
  243. static struct fb_videomode smdk4x12_lcd_timing = {
  244. .left_margin = 8,
  245. .right_margin = 8,
  246. .upper_margin = 6,
  247. .lower_margin = 6,
  248. .hsync_len = 6,
  249. .vsync_len = 4,
  250. .xres = 480,
  251. .yres = 800,
  252. };
  253. static struct s3c_fb_platdata smdk4x12_lcd_pdata __initdata = {
  254. .win[0] = &smdk4x12_fb_win0,
  255. .vtiming = &smdk4x12_lcd_timing,
  256. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  257. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  258. .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
  259. };
  260. #endif
  261. /* USB OTG */
  262. static struct s3c_hsotg_plat smdk4x12_hsotg_pdata;
  263. static struct platform_device *smdk4x12_devices[] __initdata = {
  264. &s3c_device_hsmmc2,
  265. &s3c_device_hsmmc3,
  266. &s3c_device_i2c0,
  267. &s3c_device_i2c1,
  268. &s3c_device_i2c3,
  269. &s3c_device_i2c7,
  270. &s3c_device_rtc,
  271. &s3c_device_usb_hsotg,
  272. &s3c_device_wdt,
  273. &s5p_device_fimc0,
  274. &s5p_device_fimc1,
  275. &s5p_device_fimc2,
  276. &s5p_device_fimc3,
  277. &s5p_device_fimc_md,
  278. &s5p_device_fimd0,
  279. &s5p_device_mfc,
  280. &s5p_device_mfc_l,
  281. &s5p_device_mfc_r,
  282. &samsung_device_keypad,
  283. };
  284. static void __init smdk4x12_map_io(void)
  285. {
  286. exynos_init_io(NULL, 0);
  287. s3c24xx_init_clocks(clk_xusbxti.rate);
  288. s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
  289. }
  290. static void __init smdk4x12_reserve(void)
  291. {
  292. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  293. }
  294. static void __init smdk4x12_machine_init(void)
  295. {
  296. s3c_i2c0_set_platdata(NULL);
  297. i2c_register_board_info(0, smdk4x12_i2c_devs0,
  298. ARRAY_SIZE(smdk4x12_i2c_devs0));
  299. s3c_i2c1_set_platdata(NULL);
  300. i2c_register_board_info(1, smdk4x12_i2c_devs1,
  301. ARRAY_SIZE(smdk4x12_i2c_devs1));
  302. s3c_i2c3_set_platdata(NULL);
  303. i2c_register_board_info(3, smdk4x12_i2c_devs3,
  304. ARRAY_SIZE(smdk4x12_i2c_devs3));
  305. s3c_i2c7_set_platdata(NULL);
  306. i2c_register_board_info(7, smdk4x12_i2c_devs7,
  307. ARRAY_SIZE(smdk4x12_i2c_devs7));
  308. samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data);
  309. pwm_add_table(smdk4x12_pwm_lookup, ARRAY_SIZE(smdk4x12_pwm_lookup));
  310. samsung_keypad_set_platdata(&smdk4x12_keypad_data);
  311. s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata);
  312. s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);
  313. s3c_hsotg_set_platdata(&smdk4x12_hsotg_pdata);
  314. #ifdef CONFIG_DRM_EXYNOS_FIMD
  315. s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
  316. exynos4_fimd0_gpio_setup_24bpp();
  317. #else
  318. s5p_fimd0_set_platdata(&smdk4x12_lcd_pdata);
  319. #endif
  320. platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices));
  321. }
  322. MACHINE_START(SMDK4212, "SMDK4212")
  323. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  324. .atag_offset = 0x100,
  325. .smp = smp_ops(exynos_smp_ops),
  326. .init_irq = exynos4_init_irq,
  327. .map_io = smdk4x12_map_io,
  328. .init_machine = smdk4x12_machine_init,
  329. .init_time = exynos4_timer_init,
  330. .restart = exynos4_restart,
  331. .reserve = &smdk4x12_reserve,
  332. MACHINE_END
  333. MACHINE_START(SMDK4412, "SMDK4412")
  334. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  335. /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
  336. .atag_offset = 0x100,
  337. .smp = smp_ops(exynos_smp_ops),
  338. .init_irq = exynos4_init_irq,
  339. .map_io = smdk4x12_map_io,
  340. .init_machine = smdk4x12_machine_init,
  341. .init_late = exynos_init_late,
  342. .init_time = exynos4_timer_init,
  343. .restart = exynos4_restart,
  344. .reserve = &smdk4x12_reserve,
  345. MACHINE_END