mach-smdkc100.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 <asm/mach/arch.h>
  25. #include <asm/mach/map.h>
  26. #include <mach/map.h>
  27. #include <mach/regs-fb.h>
  28. #include <video/platform_lcd.h>
  29. #include <asm/irq.h>
  30. #include <asm/mach-types.h>
  31. #include <plat/regs-serial.h>
  32. #include <plat/gpio-cfg.h>
  33. #include <plat/clock.h>
  34. #include <plat/devs.h>
  35. #include <plat/cpu.h>
  36. #include <plat/s5pc100.h>
  37. #include <plat/fb.h>
  38. #include <plat/iic.h>
  39. #include <plat/ata.h>
  40. #include <plat/adc.h>
  41. #include <plat/ts.h>
  42. /* Following are default values for UCON, ULCON and UFCON UART registers */
  43. #define S5PC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  44. S3C2410_UCON_RXILEVEL | \
  45. S3C2410_UCON_TXIRQMODE | \
  46. S3C2410_UCON_RXIRQMODE | \
  47. S3C2410_UCON_RXFIFO_TOI | \
  48. S3C2443_UCON_RXERR_IRQEN)
  49. #define S5PC100_ULCON_DEFAULT S3C2410_LCON_CS8
  50. #define S5PC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  51. S3C2440_UFCON_RXTRIG8 | \
  52. S3C2440_UFCON_TXTRIG16)
  53. static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
  54. [0] = {
  55. .hwport = 0,
  56. .flags = 0,
  57. .ucon = S5PC100_UCON_DEFAULT,
  58. .ulcon = S5PC100_ULCON_DEFAULT,
  59. .ufcon = S5PC100_UFCON_DEFAULT,
  60. },
  61. [1] = {
  62. .hwport = 1,
  63. .flags = 0,
  64. .ucon = S5PC100_UCON_DEFAULT,
  65. .ulcon = S5PC100_ULCON_DEFAULT,
  66. .ufcon = S5PC100_UFCON_DEFAULT,
  67. },
  68. [2] = {
  69. .hwport = 2,
  70. .flags = 0,
  71. .ucon = S5PC100_UCON_DEFAULT,
  72. .ulcon = S5PC100_ULCON_DEFAULT,
  73. .ufcon = S5PC100_UFCON_DEFAULT,
  74. },
  75. [3] = {
  76. .hwport = 3,
  77. .flags = 0,
  78. .ucon = S5PC100_UCON_DEFAULT,
  79. .ulcon = S5PC100_ULCON_DEFAULT,
  80. .ufcon = S5PC100_UFCON_DEFAULT,
  81. },
  82. };
  83. /* I2C0 */
  84. static struct i2c_board_info i2c_devs0[] __initdata = {
  85. };
  86. /* I2C1 */
  87. static struct i2c_board_info i2c_devs1[] __initdata = {
  88. };
  89. /* LCD power controller */
  90. static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
  91. unsigned int power)
  92. {
  93. /* backlight */
  94. gpio_direction_output(S5PC100_GPD(0), power);
  95. if (power) {
  96. /* module reset */
  97. gpio_direction_output(S5PC100_GPH0(6), 1);
  98. mdelay(100);
  99. gpio_direction_output(S5PC100_GPH0(6), 0);
  100. mdelay(10);
  101. gpio_direction_output(S5PC100_GPH0(6), 1);
  102. mdelay(10);
  103. }
  104. }
  105. static struct plat_lcd_data smdkc100_lcd_power_data = {
  106. .set_power = smdkc100_lcd_power_set,
  107. };
  108. static struct platform_device smdkc100_lcd_powerdev = {
  109. .name = "platform-lcd",
  110. .dev.parent = &s3c_device_fb.dev,
  111. .dev.platform_data = &smdkc100_lcd_power_data,
  112. };
  113. /* Frame Buffer */
  114. static struct s3c_fb_pd_win smdkc100_fb_win0 = {
  115. /* this is to ensure we use win0 */
  116. .win_mode = {
  117. .pixclock = 1000000000000ULL / ((8+13+3+800)*(7+5+1+480)*80),
  118. .left_margin = 8,
  119. .right_margin = 13,
  120. .upper_margin = 7,
  121. .lower_margin = 5,
  122. .hsync_len = 3,
  123. .vsync_len = 1,
  124. .xres = 800,
  125. .yres = 480,
  126. },
  127. .max_bpp = 32,
  128. .default_bpp = 16,
  129. };
  130. static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
  131. .win[0] = &smdkc100_fb_win0,
  132. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  133. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  134. .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
  135. };
  136. static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
  137. .setup_gpio = s5pc100_ide_setup_gpio,
  138. };
  139. static struct platform_device *smdkc100_devices[] __initdata = {
  140. &s3c_device_adc,
  141. &s3c_device_cfcon,
  142. &s3c_device_i2c0,
  143. &s3c_device_i2c1,
  144. &s3c_device_fb,
  145. &s3c_device_hsmmc0,
  146. &s3c_device_hsmmc1,
  147. &s3c_device_hsmmc2,
  148. &s3c_device_ts,
  149. &s3c_device_wdt,
  150. &smdkc100_lcd_powerdev,
  151. &s5pc100_device_iis0,
  152. &s5pc100_device_ac97,
  153. };
  154. static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
  155. .delay = 10000,
  156. .presc = 49,
  157. .oversampling_shift = 2,
  158. };
  159. static void __init smdkc100_map_io(void)
  160. {
  161. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  162. s3c24xx_init_clocks(12000000);
  163. s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
  164. }
  165. static void __init smdkc100_machine_init(void)
  166. {
  167. s3c24xx_ts_set_platdata(&s3c_ts_platform);
  168. /* I2C */
  169. s3c_i2c0_set_platdata(NULL);
  170. s3c_i2c1_set_platdata(NULL);
  171. i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
  172. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  173. s3c_fb_set_platdata(&smdkc100_lcd_pdata);
  174. s3c_ide_set_platdata(&smdkc100_ide_pdata);
  175. /* LCD init */
  176. gpio_request(S5PC100_GPD(0), "GPD");
  177. gpio_request(S5PC100_GPH0(6), "GPH0");
  178. smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
  179. platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
  180. }
  181. MACHINE_START(SMDKC100, "SMDKC100")
  182. /* Maintainer: Byungho Min <bhmin@samsung.com> */
  183. .phys_io = S3C_PA_UART & 0xfff00000,
  184. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  185. .boot_params = S5P_PA_SDRAM + 0x100,
  186. .init_irq = s5pc100_init_irq,
  187. .map_io = smdkc100_map_io,
  188. .init_machine = smdkc100_machine_init,
  189. .timer = &s3c24xx_timer,
  190. MACHINE_END