mach-smdk6440.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
  2. *
  3. * Copyright (c) 2009-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/hardware/vic.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/irq.h>
  31. #include <asm/mach-types.h>
  32. #include <mach/hardware.h>
  33. #include <mach/map.h>
  34. #include <mach/regs-clock.h>
  35. #include <mach/i2c.h>
  36. #include <mach/regs-gpio.h>
  37. #include <plat/regs-serial.h>
  38. #include <plat/gpio-cfg.h>
  39. #include <plat/s5p6440.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. #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  52. S3C2410_UCON_RXILEVEL | \
  53. S3C2410_UCON_TXIRQMODE | \
  54. S3C2410_UCON_RXIRQMODE | \
  55. S3C2410_UCON_RXFIFO_TOI | \
  56. S3C2443_UCON_RXERR_IRQEN)
  57. #define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
  58. #define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  59. S3C2440_UFCON_TXTRIG16 | \
  60. S3C2410_UFCON_RXTRIG8)
  61. static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
  62. [0] = {
  63. .hwport = 0,
  64. .flags = 0,
  65. .ucon = SMDK6440_UCON_DEFAULT,
  66. .ulcon = SMDK6440_ULCON_DEFAULT,
  67. .ufcon = SMDK6440_UFCON_DEFAULT,
  68. },
  69. [1] = {
  70. .hwport = 1,
  71. .flags = 0,
  72. .ucon = SMDK6440_UCON_DEFAULT,
  73. .ulcon = SMDK6440_ULCON_DEFAULT,
  74. .ufcon = SMDK6440_UFCON_DEFAULT,
  75. },
  76. [2] = {
  77. .hwport = 2,
  78. .flags = 0,
  79. .ucon = SMDK6440_UCON_DEFAULT,
  80. .ulcon = SMDK6440_ULCON_DEFAULT,
  81. .ufcon = SMDK6440_UFCON_DEFAULT,
  82. },
  83. [3] = {
  84. .hwport = 3,
  85. .flags = 0,
  86. .ucon = SMDK6440_UCON_DEFAULT,
  87. .ulcon = SMDK6440_ULCON_DEFAULT,
  88. .ufcon = SMDK6440_UFCON_DEFAULT,
  89. },
  90. };
  91. /* Frame Buffer */
  92. static struct s3c_fb_pd_win smdk6440_fb_win0 = {
  93. .win_mode = {
  94. .left_margin = 8,
  95. .right_margin = 13,
  96. .upper_margin = 7,
  97. .lower_margin = 5,
  98. .hsync_len = 3,
  99. .vsync_len = 1,
  100. .xres = 800,
  101. .yres = 480,
  102. },
  103. .max_bpp = 32,
  104. .default_bpp = 24,
  105. };
  106. static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = {
  107. .win[0] = &smdk6440_fb_win0,
  108. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  109. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  110. .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
  111. };
  112. /* LCD power controller */
  113. static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd,
  114. unsigned int power)
  115. {
  116. int err;
  117. if (power) {
  118. err = gpio_request(S5P6440_GPN(5), "GPN");
  119. if (err) {
  120. printk(KERN_ERR "failed to request GPN for lcd reset\n");
  121. return;
  122. }
  123. gpio_direction_output(S5P6440_GPN(5), 1);
  124. gpio_set_value(S5P6440_GPN(5), 0);
  125. gpio_set_value(S5P6440_GPN(5), 1);
  126. gpio_free(S5P6440_GPN(5));
  127. }
  128. }
  129. static struct plat_lcd_data smdk6440_lcd_power_data = {
  130. .set_power = smdk6440_lte480_reset_power,
  131. };
  132. static struct platform_device smdk6440_lcd_lte480wv = {
  133. .name = "platform-lcd",
  134. .dev.parent = &s3c_device_fb.dev,
  135. .dev.platform_data = &smdk6440_lcd_power_data,
  136. };
  137. static struct platform_device *smdk6440_devices[] __initdata = {
  138. &s3c_device_adc,
  139. &s3c_device_rtc,
  140. &s3c_device_i2c0,
  141. &s3c_device_i2c1,
  142. &s3c_device_ts,
  143. &s3c_device_wdt,
  144. &samsung_asoc_dma,
  145. &s5p6440_device_iis,
  146. &s3c_device_fb,
  147. &smdk6440_lcd_lte480wv,
  148. };
  149. static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
  150. .flags = 0,
  151. .slave_addr = 0x10,
  152. .frequency = 100*1000,
  153. .sda_delay = 100,
  154. .cfg_gpio = s5p6440_i2c0_cfg_gpio,
  155. };
  156. static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
  157. .flags = 0,
  158. .bus_num = 1,
  159. .slave_addr = 0x10,
  160. .frequency = 100*1000,
  161. .sda_delay = 100,
  162. .cfg_gpio = s5p6440_i2c1_cfg_gpio,
  163. };
  164. static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
  165. { I2C_BOARD_INFO("24c08", 0x50), },
  166. { I2C_BOARD_INFO("wm8580", 0x1b), },
  167. };
  168. static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
  169. /* To be populated */
  170. };
  171. /* LCD Backlight data */
  172. static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
  173. .no = S5P6440_GPF(15),
  174. .func = S3C_GPIO_SFN(2),
  175. };
  176. static struct platform_pwm_backlight_data smdk6440_bl_data = {
  177. .pwm_id = 1,
  178. };
  179. static void __init smdk6440_map_io(void)
  180. {
  181. s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
  182. s3c24xx_init_clocks(12000000);
  183. s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
  184. s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
  185. }
  186. static void s5p6440_set_lcd_interface(void)
  187. {
  188. unsigned int cfg;
  189. /* select TFT LCD type (RGB I/F) */
  190. cfg = __raw_readl(S5P64X0_SPCON0);
  191. cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
  192. cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
  193. __raw_writel(cfg, S5P64X0_SPCON0);
  194. }
  195. static void __init smdk6440_machine_init(void)
  196. {
  197. s3c24xx_ts_set_platdata(NULL);
  198. s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
  199. s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
  200. i2c_register_board_info(0, smdk6440_i2c_devs0,
  201. ARRAY_SIZE(smdk6440_i2c_devs0));
  202. i2c_register_board_info(1, smdk6440_i2c_devs1,
  203. ARRAY_SIZE(smdk6440_i2c_devs1));
  204. samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
  205. s5p6440_set_lcd_interface();
  206. s3c_fb_set_platdata(&smdk6440_lcd_pdata);
  207. platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
  208. }
  209. MACHINE_START(SMDK6440, "SMDK6440")
  210. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  211. .atag_offset = 0x100,
  212. .init_irq = s5p6440_init_irq,
  213. .handle_irq = vic_handle_irq,
  214. .map_io = smdk6440_map_io,
  215. .init_machine = smdk6440_machine_init,
  216. .timer = &s5p_timer,
  217. MACHINE_END