mach-smdkc100.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /* linux/arch/arm/mach-s5pc100/mach-smdkc100.c
  2. *
  3. * Copyright 2009 Samsung Electronics Co.
  4. * Author: Byungho Min <bhmin@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. */
  11. #include <linux/kernel.h>
  12. #include <linux/types.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/list.h>
  15. #include <linux/timer.h>
  16. #include <linux/init.h>
  17. #include <linux/serial_core.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/io.h>
  20. #include <linux/gpio.h>
  21. #include <linux/i2c.h>
  22. #include <linux/fb.h>
  23. #include <linux/delay.h>
  24. #include <linux/input.h>
  25. #include <linux/pwm_backlight.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <mach/map.h>
  29. #include <mach/regs-gpio.h>
  30. #include <video/platform_lcd.h>
  31. #include <video/samsung_fimd.h>
  32. #include <asm/irq.h>
  33. #include <asm/mach-types.h>
  34. #include <plat/regs-serial.h>
  35. #include <plat/gpio-cfg.h>
  36. #include <plat/clock.h>
  37. #include <plat/devs.h>
  38. #include <plat/cpu.h>
  39. #include <plat/fb.h>
  40. #include <linux/platform_data/i2c-s3c2410.h>
  41. #include <linux/platform_data/ata-samsung_cf.h>
  42. #include <plat/adc.h>
  43. #include <plat/keypad.h>
  44. #include <linux/platform_data/touchscreen-s3c2410.h>
  45. #include <linux/platform_data/asoc-s3c.h>
  46. #include <plat/backlight.h>
  47. #include "common.h"
  48. /* Following are default values for UCON, ULCON and UFCON UART registers */
  49. #define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  50. S3C2410_UCON_RXILEVEL | \
  51. S3C2410_UCON_TXIRQMODE | \
  52. S3C2410_UCON_RXIRQMODE | \
  53. S3C2410_UCON_RXFIFO_TOI | \
  54. S3C2443_UCON_RXERR_IRQEN)
  55. #define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
  56. #define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  57. S3C2440_UFCON_RXTRIG8 | \
  58. S3C2440_UFCON_TXTRIG16)
  59. static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
  60. [0] = {
  61. .hwport = 0,
  62. .flags = 0,
  63. .ucon = SMDKC100_UCON_DEFAULT,
  64. .ulcon = SMDKC100_ULCON_DEFAULT,
  65. .ufcon = SMDKC100_UFCON_DEFAULT,
  66. },
  67. [1] = {
  68. .hwport = 1,
  69. .flags = 0,
  70. .ucon = SMDKC100_UCON_DEFAULT,
  71. .ulcon = SMDKC100_ULCON_DEFAULT,
  72. .ufcon = SMDKC100_UFCON_DEFAULT,
  73. },
  74. [2] = {
  75. .hwport = 2,
  76. .flags = 0,
  77. .ucon = SMDKC100_UCON_DEFAULT,
  78. .ulcon = SMDKC100_ULCON_DEFAULT,
  79. .ufcon = SMDKC100_UFCON_DEFAULT,
  80. },
  81. [3] = {
  82. .hwport = 3,
  83. .flags = 0,
  84. .ucon = SMDKC100_UCON_DEFAULT,
  85. .ulcon = SMDKC100_ULCON_DEFAULT,
  86. .ufcon = SMDKC100_UFCON_DEFAULT,
  87. },
  88. };
  89. /* I2C0 */
  90. static struct i2c_board_info i2c_devs0[] __initdata = {
  91. {I2C_BOARD_INFO("wm8580", 0x1b),},
  92. };
  93. /* I2C1 */
  94. static struct i2c_board_info i2c_devs1[] __initdata = {
  95. };
  96. /* LCD power controller */
  97. static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
  98. unsigned int power)
  99. {
  100. if (power) {
  101. /* module reset */
  102. gpio_direction_output(S5PC100_GPH0(6), 1);
  103. mdelay(100);
  104. gpio_direction_output(S5PC100_GPH0(6), 0);
  105. mdelay(10);
  106. gpio_direction_output(S5PC100_GPH0(6), 1);
  107. mdelay(10);
  108. }
  109. }
  110. static struct plat_lcd_data smdkc100_lcd_power_data = {
  111. .set_power = smdkc100_lcd_power_set,
  112. };
  113. static struct platform_device smdkc100_lcd_powerdev = {
  114. .name = "platform-lcd",
  115. .dev.parent = &s3c_device_fb.dev,
  116. .dev.platform_data = &smdkc100_lcd_power_data,
  117. };
  118. /* Frame Buffer */
  119. static struct s3c_fb_pd_win smdkc100_fb_win0 = {
  120. .max_bpp = 32,
  121. .default_bpp = 16,
  122. .xres = 800,
  123. .yres = 480,
  124. };
  125. static struct fb_videomode smdkc100_lcd_timing = {
  126. .left_margin = 8,
  127. .right_margin = 13,
  128. .upper_margin = 7,
  129. .lower_margin = 5,
  130. .hsync_len = 3,
  131. .vsync_len = 1,
  132. .xres = 800,
  133. .yres = 480,
  134. .refresh = 80,
  135. };
  136. static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
  137. .win[0] = &smdkc100_fb_win0,
  138. .vtiming = &smdkc100_lcd_timing,
  139. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  140. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  141. .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
  142. };
  143. static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
  144. .setup_gpio = s5pc100_ide_setup_gpio,
  145. };
  146. static uint32_t smdkc100_keymap[] __initdata = {
  147. /* KEY(row, col, keycode) */
  148. KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
  149. KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
  150. KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
  151. KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
  152. };
  153. static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
  154. .keymap = smdkc100_keymap,
  155. .keymap_size = ARRAY_SIZE(smdkc100_keymap),
  156. };
  157. static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
  158. .keymap_data = &smdkc100_keymap_data,
  159. .rows = 2,
  160. .cols = 8,
  161. };
  162. static struct platform_device *smdkc100_devices[] __initdata = {
  163. &s3c_device_adc,
  164. &s3c_device_cfcon,
  165. &s3c_device_i2c0,
  166. &s3c_device_i2c1,
  167. &s3c_device_fb,
  168. &s3c_device_hsmmc0,
  169. &s3c_device_hsmmc1,
  170. &s3c_device_hsmmc2,
  171. &s3c_device_ts,
  172. &s3c_device_wdt,
  173. &smdkc100_lcd_powerdev,
  174. &s5pc100_device_iis0,
  175. &samsung_device_keypad,
  176. &s5pc100_device_ac97,
  177. &s3c_device_rtc,
  178. &s5p_device_fimc0,
  179. &s5p_device_fimc1,
  180. &s5p_device_fimc2,
  181. &s5pc100_device_spdif,
  182. };
  183. /* LCD Backlight data */
  184. static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = {
  185. .no = S5PC100_GPD(0),
  186. .func = S3C_GPIO_SFN(2),
  187. };
  188. static struct platform_pwm_backlight_data smdkc100_bl_data = {
  189. .pwm_id = 0,
  190. };
  191. static void __init smdkc100_map_io(void)
  192. {
  193. s5pc100_init_io(NULL, 0);
  194. s3c24xx_init_clocks(12000000);
  195. s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
  196. }
  197. static void __init smdkc100_machine_init(void)
  198. {
  199. s3c24xx_ts_set_platdata(NULL);
  200. /* I2C */
  201. s3c_i2c0_set_platdata(NULL);
  202. s3c_i2c1_set_platdata(NULL);
  203. i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
  204. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  205. s3c_fb_set_platdata(&smdkc100_lcd_pdata);
  206. s3c_ide_set_platdata(&smdkc100_ide_pdata);
  207. samsung_keypad_set_platdata(&smdkc100_keypad_data);
  208. s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
  209. /* LCD init */
  210. gpio_request(S5PC100_GPH0(6), "GPH0");
  211. smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
  212. samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data);
  213. platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
  214. }
  215. MACHINE_START(SMDKC100, "SMDKC100")
  216. /* Maintainer: Byungho Min <bhmin@samsung.com> */
  217. .atag_offset = 0x100,
  218. .init_irq = s5pc100_init_irq,
  219. .map_io = smdkc100_map_io,
  220. .init_machine = smdkc100_machine_init,
  221. .init_time = s3c24xx_timer_init,
  222. .restart = s5pc100_restart,
  223. MACHINE_END