mach-smdk6450.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 <video/platform_lcd.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/irq.h>
  30. #include <asm/mach-types.h>
  31. #include <mach/hardware.h>
  32. #include <mach/map.h>
  33. #include <mach/regs-clock.h>
  34. #include <mach/i2c.h>
  35. #include <mach/regs-gpio.h>
  36. #include <plat/regs-serial.h>
  37. #include <plat/gpio-cfg.h>
  38. #include <plat/s5p6450.h>
  39. #include <plat/clock.h>
  40. #include <plat/devs.h>
  41. #include <plat/cpu.h>
  42. #include <plat/iic.h>
  43. #include <plat/pll.h>
  44. #include <plat/adc.h>
  45. #include <plat/ts.h>
  46. #include <plat/s5p-time.h>
  47. #include <plat/backlight.h>
  48. #include <plat/fb.h>
  49. #include <plat/regs-fb.h>
  50. #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  51. S3C2410_UCON_RXILEVEL | \
  52. S3C2410_UCON_TXIRQMODE | \
  53. S3C2410_UCON_RXIRQMODE | \
  54. S3C2410_UCON_RXFIFO_TOI | \
  55. S3C2443_UCON_RXERR_IRQEN)
  56. #define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
  57. #define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  58. S3C2440_UFCON_TXTRIG16 | \
  59. S3C2410_UFCON_RXTRIG8)
  60. static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
  61. [0] = {
  62. .hwport = 0,
  63. .flags = 0,
  64. .ucon = SMDK6450_UCON_DEFAULT,
  65. .ulcon = SMDK6450_ULCON_DEFAULT,
  66. .ufcon = SMDK6450_UFCON_DEFAULT,
  67. },
  68. [1] = {
  69. .hwport = 1,
  70. .flags = 0,
  71. .ucon = SMDK6450_UCON_DEFAULT,
  72. .ulcon = SMDK6450_ULCON_DEFAULT,
  73. .ufcon = SMDK6450_UFCON_DEFAULT,
  74. },
  75. [2] = {
  76. .hwport = 2,
  77. .flags = 0,
  78. .ucon = SMDK6450_UCON_DEFAULT,
  79. .ulcon = SMDK6450_ULCON_DEFAULT,
  80. .ufcon = SMDK6450_UFCON_DEFAULT,
  81. },
  82. [3] = {
  83. .hwport = 3,
  84. .flags = 0,
  85. .ucon = SMDK6450_UCON_DEFAULT,
  86. .ulcon = SMDK6450_ULCON_DEFAULT,
  87. .ufcon = SMDK6450_UFCON_DEFAULT,
  88. },
  89. #if CONFIG_SERIAL_SAMSUNG_UARTS > 4
  90. [4] = {
  91. .hwport = 4,
  92. .flags = 0,
  93. .ucon = SMDK6450_UCON_DEFAULT,
  94. .ulcon = SMDK6450_ULCON_DEFAULT,
  95. .ufcon = SMDK6450_UFCON_DEFAULT,
  96. },
  97. #endif
  98. #if CONFIG_SERIAL_SAMSUNG_UARTS > 5
  99. [5] = {
  100. .hwport = 5,
  101. .flags = 0,
  102. .ucon = SMDK6450_UCON_DEFAULT,
  103. .ulcon = SMDK6450_ULCON_DEFAULT,
  104. .ufcon = SMDK6450_UFCON_DEFAULT,
  105. },
  106. #endif
  107. };
  108. /* Frame Buffer */
  109. static struct s3c_fb_pd_win smdk6450_fb_win0 = {
  110. .win_mode = {
  111. .left_margin = 8,
  112. .right_margin = 13,
  113. .upper_margin = 7,
  114. .lower_margin = 5,
  115. .hsync_len = 3,
  116. .vsync_len = 1,
  117. .xres = 800,
  118. .yres = 480,
  119. },
  120. .max_bpp = 32,
  121. .default_bpp = 24,
  122. };
  123. static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
  124. .win[0] = &smdk6450_fb_win0,
  125. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  126. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  127. .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
  128. };
  129. /* LCD power controller */
  130. static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
  131. unsigned int power)
  132. {
  133. int err;
  134. if (power) {
  135. err = gpio_request(S5P6450_GPN(5), "GPN");
  136. if (err) {
  137. printk(KERN_ERR "failed to request GPN for lcd reset\n");
  138. return;
  139. }
  140. gpio_direction_output(S5P6450_GPN(5), 1);
  141. gpio_set_value(S5P6450_GPN(5), 0);
  142. gpio_set_value(S5P6450_GPN(5), 1);
  143. gpio_free(S5P6450_GPN(5));
  144. }
  145. }
  146. static struct plat_lcd_data smdk6450_lcd_power_data = {
  147. .set_power = smdk6450_lte480_reset_power,
  148. };
  149. static struct platform_device smdk6450_lcd_lte480wv = {
  150. .name = "platform-lcd",
  151. .dev.parent = &s3c_device_fb.dev,
  152. .dev.platform_data = &smdk6450_lcd_power_data,
  153. };
  154. static struct platform_device *smdk6450_devices[] __initdata = {
  155. &s3c_device_adc,
  156. &s3c_device_rtc,
  157. &s3c_device_i2c0,
  158. &s3c_device_i2c1,
  159. &s3c_device_ts,
  160. &s3c_device_wdt,
  161. &samsung_asoc_dma,
  162. &s5p6450_device_iis0,
  163. &s3c_device_fb,
  164. &smdk6450_lcd_lte480wv,
  165. /* s5p6450_device_spi0 will be added */
  166. };
  167. static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
  168. .flags = 0,
  169. .slave_addr = 0x10,
  170. .frequency = 100*1000,
  171. .sda_delay = 100,
  172. .cfg_gpio = s5p6450_i2c0_cfg_gpio,
  173. };
  174. static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
  175. .flags = 0,
  176. .bus_num = 1,
  177. .slave_addr = 0x10,
  178. .frequency = 100*1000,
  179. .sda_delay = 100,
  180. .cfg_gpio = s5p6450_i2c1_cfg_gpio,
  181. };
  182. static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
  183. { I2C_BOARD_INFO("wm8580", 0x1b), },
  184. { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
  185. };
  186. static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
  187. { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
  188. };
  189. /* LCD Backlight data */
  190. static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
  191. .no = S5P6450_GPF(15),
  192. .func = S3C_GPIO_SFN(2),
  193. };
  194. static struct platform_pwm_backlight_data smdk6450_bl_data = {
  195. .pwm_id = 1,
  196. };
  197. static void __init smdk6450_map_io(void)
  198. {
  199. s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
  200. s3c24xx_init_clocks(19200000);
  201. s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
  202. s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
  203. }
  204. static void s5p6450_set_lcd_interface(void)
  205. {
  206. unsigned int cfg;
  207. /* select TFT LCD type (RGB I/F) */
  208. cfg = __raw_readl(S5P64X0_SPCON0);
  209. cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
  210. cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
  211. __raw_writel(cfg, S5P64X0_SPCON0);
  212. }
  213. static void __init smdk6450_machine_init(void)
  214. {
  215. s3c24xx_ts_set_platdata(NULL);
  216. s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
  217. s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
  218. i2c_register_board_info(0, smdk6450_i2c_devs0,
  219. ARRAY_SIZE(smdk6450_i2c_devs0));
  220. i2c_register_board_info(1, smdk6450_i2c_devs1,
  221. ARRAY_SIZE(smdk6450_i2c_devs1));
  222. samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
  223. s5p6450_set_lcd_interface();
  224. s3c_fb_set_platdata(&smdk6450_lcd_pdata);
  225. platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
  226. }
  227. MACHINE_START(SMDK6450, "SMDK6450")
  228. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  229. .atag_offset = 0x100,
  230. .init_irq = s5p6450_init_irq,
  231. .map_io = smdk6450_map_io,
  232. .init_machine = smdk6450_machine_init,
  233. .timer = &s5p_timer,
  234. MACHINE_END