mach-smdkc100.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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/regs-gpio.h>
  34. #include <plat/clock.h>
  35. #include <plat/devs.h>
  36. #include <plat/cpu.h>
  37. #include <plat/s5pc100.h>
  38. #include <plat/fb.h>
  39. #include <plat/iic.h>
  40. #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
  41. #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
  42. #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
  43. static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
  44. [0] = {
  45. .hwport = 0,
  46. .flags = 0,
  47. .ucon = 0x3c5,
  48. .ulcon = 0x03,
  49. .ufcon = 0x51,
  50. },
  51. [1] = {
  52. .hwport = 1,
  53. .flags = 0,
  54. .ucon = 0x3c5,
  55. .ulcon = 0x03,
  56. .ufcon = 0x51,
  57. },
  58. [2] = {
  59. .hwport = 2,
  60. .flags = 0,
  61. .ucon = 0x3c5,
  62. .ulcon = 0x03,
  63. .ufcon = 0x51,
  64. },
  65. [3] = {
  66. .hwport = 3,
  67. .flags = 0,
  68. .ucon = 0x3c5,
  69. .ulcon = 0x03,
  70. .ufcon = 0x51,
  71. },
  72. };
  73. /* I2C0 */
  74. static struct i2c_board_info i2c_devs0[] __initdata = {
  75. };
  76. /* I2C1 */
  77. static struct i2c_board_info i2c_devs1[] __initdata = {
  78. };
  79. /* LCD power controller */
  80. static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
  81. unsigned int power)
  82. {
  83. /* backlight */
  84. gpio_direction_output(S5PC100_GPD(0), power);
  85. if (power) {
  86. /* module reset */
  87. gpio_direction_output(S5PC100_GPH0(6), 1);
  88. mdelay(100);
  89. gpio_direction_output(S5PC100_GPH0(6), 0);
  90. mdelay(10);
  91. gpio_direction_output(S5PC100_GPH0(6), 1);
  92. mdelay(10);
  93. }
  94. }
  95. static struct plat_lcd_data smdkc100_lcd_power_data = {
  96. .set_power = smdkc100_lcd_power_set,
  97. };
  98. static struct platform_device smdkc100_lcd_powerdev = {
  99. .name = "platform-lcd",
  100. .dev.parent = &s3c_device_fb.dev,
  101. .dev.platform_data = &smdkc100_lcd_power_data,
  102. };
  103. /* Frame Buffer */
  104. static struct s3c_fb_pd_win smdkc100_fb_win0 = {
  105. /* this is to ensure we use win0 */
  106. .win_mode = {
  107. .refresh = 70,
  108. .pixclock = (8+13+3+800)*(7+5+1+480),
  109. .left_margin = 8,
  110. .right_margin = 13,
  111. .upper_margin = 7,
  112. .lower_margin = 5,
  113. .hsync_len = 3,
  114. .vsync_len = 1,
  115. .xres = 800,
  116. .yres = 480,
  117. },
  118. .max_bpp = 32,
  119. .default_bpp = 16,
  120. };
  121. static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
  122. .win[0] = &smdkc100_fb_win0,
  123. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  124. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  125. .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
  126. };
  127. static struct map_desc smdkc100_iodesc[] = {};
  128. static struct platform_device *smdkc100_devices[] __initdata = {
  129. &s3c_device_i2c0,
  130. &s3c_device_i2c1,
  131. &s3c_device_fb,
  132. &s3c_device_hsmmc0,
  133. &s3c_device_hsmmc1,
  134. &s3c_device_hsmmc2,
  135. &smdkc100_lcd_powerdev,
  136. };
  137. static void __init smdkc100_map_io(void)
  138. {
  139. s5pc1xx_init_io(smdkc100_iodesc, ARRAY_SIZE(smdkc100_iodesc));
  140. s3c24xx_init_clocks(12000000);
  141. s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
  142. }
  143. static void __init smdkc100_machine_init(void)
  144. {
  145. /* I2C */
  146. s3c_i2c0_set_platdata(NULL);
  147. s3c_i2c1_set_platdata(NULL);
  148. i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
  149. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  150. s3c_fb_set_platdata(&smdkc100_lcd_pdata);
  151. /* LCD init */
  152. gpio_request(S5PC100_GPD(0), "GPD");
  153. gpio_request(S5PC100_GPH0(6), "GPH0");
  154. smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
  155. platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
  156. }
  157. MACHINE_START(SMDKC100, "SMDKC100")
  158. /* Maintainer: Byungho Min <bhmin@samsung.com> */
  159. .phys_io = S5PC100_PA_UART & 0xfff00000,
  160. .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc,
  161. .boot_params = S5PC100_PA_SDRAM + 0x100,
  162. .init_irq = s5pc100_init_irq,
  163. .map_io = smdkc100_map_io,
  164. .init_machine = smdkc100_machine_init,
  165. .timer = &s3c24xx_timer,
  166. MACHINE_END