mach-smdk6440.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach-types.h>
  29. #include <mach/hardware.h>
  30. #include <mach/map.h>
  31. #include <mach/regs-clock.h>
  32. #include <mach/i2c.h>
  33. #include <mach/regs-gpio.h>
  34. #include <plat/regs-serial.h>
  35. #include <plat/gpio-cfg.h>
  36. #include <plat/s5p6440.h>
  37. #include <plat/clock.h>
  38. #include <plat/devs.h>
  39. #include <plat/cpu.h>
  40. #include <plat/iic.h>
  41. #include <plat/pll.h>
  42. #include <plat/adc.h>
  43. #include <plat/ts.h>
  44. #include <plat/s5p-time.h>
  45. #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  46. S3C2410_UCON_RXILEVEL | \
  47. S3C2410_UCON_TXIRQMODE | \
  48. S3C2410_UCON_RXIRQMODE | \
  49. S3C2410_UCON_RXFIFO_TOI | \
  50. S3C2443_UCON_RXERR_IRQEN)
  51. #define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
  52. #define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  53. S3C2440_UFCON_TXTRIG16 | \
  54. S3C2410_UFCON_RXTRIG8)
  55. static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
  56. [0] = {
  57. .hwport = 0,
  58. .flags = 0,
  59. .ucon = SMDK6440_UCON_DEFAULT,
  60. .ulcon = SMDK6440_ULCON_DEFAULT,
  61. .ufcon = SMDK6440_UFCON_DEFAULT,
  62. },
  63. [1] = {
  64. .hwport = 1,
  65. .flags = 0,
  66. .ucon = SMDK6440_UCON_DEFAULT,
  67. .ulcon = SMDK6440_ULCON_DEFAULT,
  68. .ufcon = SMDK6440_UFCON_DEFAULT,
  69. },
  70. [2] = {
  71. .hwport = 2,
  72. .flags = 0,
  73. .ucon = SMDK6440_UCON_DEFAULT,
  74. .ulcon = SMDK6440_ULCON_DEFAULT,
  75. .ufcon = SMDK6440_UFCON_DEFAULT,
  76. },
  77. [3] = {
  78. .hwport = 3,
  79. .flags = 0,
  80. .ucon = SMDK6440_UCON_DEFAULT,
  81. .ulcon = SMDK6440_ULCON_DEFAULT,
  82. .ufcon = SMDK6440_UFCON_DEFAULT,
  83. },
  84. };
  85. static int smdk6440_backlight_init(struct device *dev)
  86. {
  87. int ret;
  88. ret = gpio_request(S5P6440_GPF(15), "Backlight");
  89. if (ret) {
  90. printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
  91. return ret;
  92. }
  93. /* Configure GPIO pin with S5P6440_GPF15_PWM_TOUT1 */
  94. s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_SFN(2));
  95. return 0;
  96. }
  97. static void smdk6440_backlight_exit(struct device *dev)
  98. {
  99. s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_OUTPUT);
  100. gpio_free(S5P6440_GPF(15));
  101. }
  102. static struct platform_pwm_backlight_data smdk6440_backlight_data = {
  103. .pwm_id = 1,
  104. .max_brightness = 255,
  105. .dft_brightness = 255,
  106. .pwm_period_ns = 78770,
  107. .init = smdk6440_backlight_init,
  108. .exit = smdk6440_backlight_exit,
  109. };
  110. static struct platform_device smdk6440_backlight_device = {
  111. .name = "pwm-backlight",
  112. .dev = {
  113. .parent = &s3c_device_timer[1].dev,
  114. .platform_data = &smdk6440_backlight_data,
  115. },
  116. };
  117. static struct platform_device *smdk6440_devices[] __initdata = {
  118. &s3c_device_adc,
  119. &s3c_device_rtc,
  120. &s3c_device_i2c0,
  121. &s3c_device_i2c1,
  122. &s3c_device_ts,
  123. &s3c_device_wdt,
  124. &samsung_asoc_dma,
  125. &s5p6440_device_iis,
  126. &s3c_device_timer[1],
  127. &smdk6440_backlight_device,
  128. };
  129. static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
  130. .flags = 0,
  131. .slave_addr = 0x10,
  132. .frequency = 100*1000,
  133. .sda_delay = 100,
  134. .cfg_gpio = s5p6440_i2c0_cfg_gpio,
  135. };
  136. static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
  137. .flags = 0,
  138. .bus_num = 1,
  139. .slave_addr = 0x10,
  140. .frequency = 100*1000,
  141. .sda_delay = 100,
  142. .cfg_gpio = s5p6440_i2c1_cfg_gpio,
  143. };
  144. static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
  145. { I2C_BOARD_INFO("24c08", 0x50), },
  146. { I2C_BOARD_INFO("wm8580", 0x1b), },
  147. };
  148. static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
  149. /* To be populated */
  150. };
  151. static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
  152. .delay = 10000,
  153. .presc = 49,
  154. .oversampling_shift = 2,
  155. };
  156. static void __init smdk6440_map_io(void)
  157. {
  158. s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
  159. s3c24xx_init_clocks(12000000);
  160. s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
  161. s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
  162. }
  163. static void __init smdk6440_machine_init(void)
  164. {
  165. s3c24xx_ts_set_platdata(&s3c_ts_platform);
  166. s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
  167. s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
  168. i2c_register_board_info(0, smdk6440_i2c_devs0,
  169. ARRAY_SIZE(smdk6440_i2c_devs0));
  170. i2c_register_board_info(1, smdk6440_i2c_devs1,
  171. ARRAY_SIZE(smdk6440_i2c_devs1));
  172. platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
  173. }
  174. MACHINE_START(SMDK6440, "SMDK6440")
  175. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  176. .boot_params = S5P64X0_PA_SDRAM + 0x100,
  177. .init_irq = s5p6440_init_irq,
  178. .map_io = smdk6440_map_io,
  179. .init_machine = smdk6440_machine_init,
  180. .timer = &s5p_timer,
  181. MACHINE_END