mach-smdk6450.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/list.h>
  14. #include <linux/timer.h>
  15. #include <linux/delay.h>
  16. #include <linux/init.h>
  17. #include <linux/i2c.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/io.h>
  21. #include <linux/module.h>
  22. #include <linux/clk.h>
  23. #include <linux/gpio.h>
  24. #include <linux/pwm_backlight.h>
  25. #include <linux/fb.h>
  26. #include <linux/mmc/host.h>
  27. #include <video/platform_lcd.h>
  28. #include <asm/hardware/vic.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/map.h>
  31. #include <asm/irq.h>
  32. #include <asm/mach-types.h>
  33. #include <mach/hardware.h>
  34. #include <mach/map.h>
  35. #include <mach/regs-clock.h>
  36. #include <mach/i2c.h>
  37. #include <mach/regs-gpio.h>
  38. #include <plat/regs-serial.h>
  39. #include <plat/gpio-cfg.h>
  40. #include <plat/clock.h>
  41. #include <plat/devs.h>
  42. #include <plat/cpu.h>
  43. #include <plat/iic.h>
  44. #include <plat/pll.h>
  45. #include <plat/adc.h>
  46. #include <plat/ts.h>
  47. #include <plat/s5p-time.h>
  48. #include <plat/backlight.h>
  49. #include <plat/fb.h>
  50. #include <plat/regs-fb.h>
  51. #include <plat/sdhci.h>
  52. #include "common.h"
  53. #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  54. S3C2410_UCON_RXILEVEL | \
  55. S3C2410_UCON_TXIRQMODE | \
  56. S3C2410_UCON_RXIRQMODE | \
  57. S3C2410_UCON_RXFIFO_TOI | \
  58. S3C2443_UCON_RXERR_IRQEN)
  59. #define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
  60. #define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  61. S3C2440_UFCON_TXTRIG16 | \
  62. S3C2410_UFCON_RXTRIG8)
  63. static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
  64. [0] = {
  65. .hwport = 0,
  66. .flags = 0,
  67. .ucon = SMDK6450_UCON_DEFAULT,
  68. .ulcon = SMDK6450_ULCON_DEFAULT,
  69. .ufcon = SMDK6450_UFCON_DEFAULT,
  70. },
  71. [1] = {
  72. .hwport = 1,
  73. .flags = 0,
  74. .ucon = SMDK6450_UCON_DEFAULT,
  75. .ulcon = SMDK6450_ULCON_DEFAULT,
  76. .ufcon = SMDK6450_UFCON_DEFAULT,
  77. },
  78. [2] = {
  79. .hwport = 2,
  80. .flags = 0,
  81. .ucon = SMDK6450_UCON_DEFAULT,
  82. .ulcon = SMDK6450_ULCON_DEFAULT,
  83. .ufcon = SMDK6450_UFCON_DEFAULT,
  84. },
  85. [3] = {
  86. .hwport = 3,
  87. .flags = 0,
  88. .ucon = SMDK6450_UCON_DEFAULT,
  89. .ulcon = SMDK6450_ULCON_DEFAULT,
  90. .ufcon = SMDK6450_UFCON_DEFAULT,
  91. },
  92. #if CONFIG_SERIAL_SAMSUNG_UARTS > 4
  93. [4] = {
  94. .hwport = 4,
  95. .flags = 0,
  96. .ucon = SMDK6450_UCON_DEFAULT,
  97. .ulcon = SMDK6450_ULCON_DEFAULT,
  98. .ufcon = SMDK6450_UFCON_DEFAULT,
  99. },
  100. #endif
  101. #if CONFIG_SERIAL_SAMSUNG_UARTS > 5
  102. [5] = {
  103. .hwport = 5,
  104. .flags = 0,
  105. .ucon = SMDK6450_UCON_DEFAULT,
  106. .ulcon = SMDK6450_ULCON_DEFAULT,
  107. .ufcon = SMDK6450_UFCON_DEFAULT,
  108. },
  109. #endif
  110. };
  111. /* Frame Buffer */
  112. static struct s3c_fb_pd_win smdk6450_fb_win0 = {
  113. .win_mode = {
  114. .left_margin = 8,
  115. .right_margin = 13,
  116. .upper_margin = 7,
  117. .lower_margin = 5,
  118. .hsync_len = 3,
  119. .vsync_len = 1,
  120. .xres = 800,
  121. .yres = 480,
  122. },
  123. .max_bpp = 32,
  124. .default_bpp = 24,
  125. };
  126. static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
  127. .win[0] = &smdk6450_fb_win0,
  128. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  129. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  130. .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
  131. };
  132. /* LCD power controller */
  133. static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
  134. unsigned int power)
  135. {
  136. int err;
  137. if (power) {
  138. err = gpio_request(S5P6450_GPN(5), "GPN");
  139. if (err) {
  140. printk(KERN_ERR "failed to request GPN for lcd reset\n");
  141. return;
  142. }
  143. gpio_direction_output(S5P6450_GPN(5), 1);
  144. gpio_set_value(S5P6450_GPN(5), 0);
  145. gpio_set_value(S5P6450_GPN(5), 1);
  146. gpio_free(S5P6450_GPN(5));
  147. }
  148. }
  149. static struct plat_lcd_data smdk6450_lcd_power_data = {
  150. .set_power = smdk6450_lte480_reset_power,
  151. };
  152. static struct platform_device smdk6450_lcd_lte480wv = {
  153. .name = "platform-lcd",
  154. .dev.parent = &s3c_device_fb.dev,
  155. .dev.platform_data = &smdk6450_lcd_power_data,
  156. };
  157. static struct platform_device *smdk6450_devices[] __initdata = {
  158. &s3c_device_adc,
  159. &s3c_device_rtc,
  160. &s3c_device_i2c0,
  161. &s3c_device_i2c1,
  162. &s3c_device_ts,
  163. &s3c_device_wdt,
  164. &samsung_asoc_dma,
  165. &s5p6450_device_iis0,
  166. &s3c_device_fb,
  167. &smdk6450_lcd_lte480wv,
  168. &s3c_device_hsmmc0,
  169. &s3c_device_hsmmc1,
  170. &s3c_device_hsmmc2,
  171. /* s5p6450_device_spi0 will be added */
  172. };
  173. static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = {
  174. .cd_type = S3C_SDHCI_CD_NONE,
  175. };
  176. static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = {
  177. .cd_type = S3C_SDHCI_CD_NONE,
  178. #if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
  179. .max_width = 8,
  180. .host_caps = MMC_CAP_8_BIT_DATA,
  181. #endif
  182. };
  183. static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = {
  184. .cd_type = S3C_SDHCI_CD_NONE,
  185. };
  186. static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
  187. .flags = 0,
  188. .slave_addr = 0x10,
  189. .frequency = 100*1000,
  190. .sda_delay = 100,
  191. .cfg_gpio = s5p6450_i2c0_cfg_gpio,
  192. };
  193. static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
  194. .flags = 0,
  195. .bus_num = 1,
  196. .slave_addr = 0x10,
  197. .frequency = 100*1000,
  198. .sda_delay = 100,
  199. .cfg_gpio = s5p6450_i2c1_cfg_gpio,
  200. };
  201. static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
  202. { I2C_BOARD_INFO("wm8580", 0x1b), },
  203. { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
  204. };
  205. static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
  206. { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
  207. };
  208. /* LCD Backlight data */
  209. static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
  210. .no = S5P6450_GPF(15),
  211. .func = S3C_GPIO_SFN(2),
  212. };
  213. static struct platform_pwm_backlight_data smdk6450_bl_data = {
  214. .pwm_id = 1,
  215. };
  216. static void __init smdk6450_map_io(void)
  217. {
  218. s5p64x0_init_io(NULL, 0);
  219. s3c24xx_init_clocks(19200000);
  220. s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
  221. s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
  222. }
  223. static void s5p6450_set_lcd_interface(void)
  224. {
  225. unsigned int cfg;
  226. /* select TFT LCD type (RGB I/F) */
  227. cfg = __raw_readl(S5P64X0_SPCON0);
  228. cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
  229. cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
  230. __raw_writel(cfg, S5P64X0_SPCON0);
  231. }
  232. static void __init smdk6450_machine_init(void)
  233. {
  234. s3c24xx_ts_set_platdata(NULL);
  235. s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
  236. s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
  237. i2c_register_board_info(0, smdk6450_i2c_devs0,
  238. ARRAY_SIZE(smdk6450_i2c_devs0));
  239. i2c_register_board_info(1, smdk6450_i2c_devs1,
  240. ARRAY_SIZE(smdk6450_i2c_devs1));
  241. samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
  242. s5p6450_set_lcd_interface();
  243. s3c_fb_set_platdata(&smdk6450_lcd_pdata);
  244. s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata);
  245. s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata);
  246. s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata);
  247. platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
  248. }
  249. MACHINE_START(SMDK6450, "SMDK6450")
  250. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  251. .atag_offset = 0x100,
  252. .init_irq = s5p6450_init_irq,
  253. .handle_irq = vic_handle_irq,
  254. .map_io = smdk6450_map_io,
  255. .init_machine = smdk6450_machine_init,
  256. .timer = &s5p_timer,
  257. .restart = s5p64x0_restart,
  258. MACHINE_END