mach-smdk6410.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /* linux/arch/arm/mach-s3c6410/mach-smdk6410.c
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/timer.h>
  18. #include <linux/init.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/i2c.h>
  23. #include <linux/fb.h>
  24. #include <linux/gpio.h>
  25. #include <linux/delay.h>
  26. #include <video/platform_lcd.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/irq.h>
  30. #include <mach/hardware.h>
  31. #include <mach/regs-fb.h>
  32. #include <mach/map.h>
  33. #include <asm/irq.h>
  34. #include <asm/mach-types.h>
  35. #include <plat/regs-serial.h>
  36. #include <plat/iic.h>
  37. #include <plat/fb.h>
  38. #include <plat/s3c6410.h>
  39. #include <plat/clock.h>
  40. #include <plat/devs.h>
  41. #include <plat/cpu.h>
  42. #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
  43. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  44. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  45. static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
  46. [0] = {
  47. .hwport = 0,
  48. .flags = 0,
  49. .ucon = 0x3c5,
  50. .ulcon = 0x03,
  51. .ufcon = 0x51,
  52. },
  53. [1] = {
  54. .hwport = 1,
  55. .flags = 0,
  56. .ucon = 0x3c5,
  57. .ulcon = 0x03,
  58. .ufcon = 0x51,
  59. },
  60. };
  61. /* framebuffer and LCD setup. */
  62. /* GPF15 = LCD backlight control
  63. * GPF13 => Panel power
  64. * GPN5 = LCD nRESET signal
  65. * PWM_TOUT1 => backlight brightness
  66. */
  67. static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
  68. unsigned int power)
  69. {
  70. if (power) {
  71. gpio_direction_output(S3C64XX_GPF(13), 1);
  72. gpio_direction_output(S3C64XX_GPF(15), 1);
  73. /* fire nRESET on power up */
  74. gpio_direction_output(S3C64XX_GPN(5), 0);
  75. msleep(10);
  76. gpio_direction_output(S3C64XX_GPN(5), 1);
  77. msleep(1);
  78. } else {
  79. gpio_direction_output(S3C64XX_GPF(15), 0);
  80. gpio_direction_output(S3C64XX_GPF(13), 0);
  81. }
  82. }
  83. static struct plat_lcd_data smdk6410_lcd_power_data = {
  84. .set_power = smdk6410_lcd_power_set,
  85. };
  86. static struct platform_device smdk6410_lcd_powerdev = {
  87. .name = "platform-lcd",
  88. .dev.parent = &s3c_device_fb.dev,
  89. .dev.platform_data = &smdk6410_lcd_power_data,
  90. };
  91. static struct s3c_fb_pd_win smdk6410_fb_win0 = {
  92. /* this is to ensure we use win0 */
  93. .win_mode = {
  94. .pixclock = 41094,
  95. .left_margin = 8,
  96. .right_margin = 13,
  97. .upper_margin = 7,
  98. .lower_margin = 5,
  99. .hsync_len = 3,
  100. .vsync_len = 1,
  101. .xres = 800,
  102. .yres = 480,
  103. },
  104. .max_bpp = 32,
  105. .default_bpp = 16,
  106. };
  107. /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
  108. static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
  109. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  110. .win[0] = &smdk6410_fb_win0,
  111. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  112. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  113. };
  114. static struct map_desc smdk6410_iodesc[] = {};
  115. static struct platform_device *smdk6410_devices[] __initdata = {
  116. #ifdef CONFIG_SMDK6410_SD_CH0
  117. &s3c_device_hsmmc0,
  118. #endif
  119. #ifdef CONFIG_SMDK6410_SD_CH1
  120. &s3c_device_hsmmc1,
  121. #endif
  122. &s3c_device_i2c0,
  123. &s3c_device_i2c1,
  124. &s3c_device_fb,
  125. &smdk6410_lcd_powerdev,
  126. };
  127. static struct i2c_board_info i2c_devs0[] __initdata = {
  128. { I2C_BOARD_INFO("24c08", 0x50), },
  129. { I2C_BOARD_INFO("wm8580", 0x1b), },
  130. };
  131. static struct i2c_board_info i2c_devs1[] __initdata = {
  132. { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
  133. };
  134. static void __init smdk6410_map_io(void)
  135. {
  136. s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
  137. s3c24xx_init_clocks(12000000);
  138. s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
  139. }
  140. static void __init smdk6410_machine_init(void)
  141. {
  142. s3c_i2c0_set_platdata(NULL);
  143. s3c_i2c1_set_platdata(NULL);
  144. s3c_fb_set_platdata(&smdk6410_lcd_pdata);
  145. gpio_request(S3C64XX_GPN(5), "LCD power");
  146. gpio_request(S3C64XX_GPF(13), "LCD power");
  147. gpio_request(S3C64XX_GPF(15), "LCD power");
  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. platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
  151. }
  152. MACHINE_START(SMDK6410, "SMDK6410")
  153. /* Maintainer: Ben Dooks <ben@fluff.org> */
  154. .phys_io = S3C_PA_UART & 0xfff00000,
  155. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  156. .boot_params = S3C64XX_PA_SDRAM + 0x100,
  157. .init_irq = s3c6410_init_irq,
  158. .map_io = smdk6410_map_io,
  159. .init_machine = smdk6410_machine_init,
  160. .timer = &s3c24xx_timer,
  161. MACHINE_END