mach-smdk6450.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
  2. *
  3. * Copyright (c) 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/s5p6450.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. #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  45. S3C2410_UCON_RXILEVEL | \
  46. S3C2410_UCON_TXIRQMODE | \
  47. S3C2410_UCON_RXIRQMODE | \
  48. S3C2410_UCON_RXFIFO_TOI | \
  49. S3C2443_UCON_RXERR_IRQEN)
  50. #define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
  51. #define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  52. S3C2440_UFCON_TXTRIG16 | \
  53. S3C2410_UFCON_RXTRIG8)
  54. static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
  55. [0] = {
  56. .hwport = 0,
  57. .flags = 0,
  58. .ucon = SMDK6450_UCON_DEFAULT,
  59. .ulcon = SMDK6450_ULCON_DEFAULT,
  60. .ufcon = SMDK6450_UFCON_DEFAULT,
  61. },
  62. [1] = {
  63. .hwport = 1,
  64. .flags = 0,
  65. .ucon = SMDK6450_UCON_DEFAULT,
  66. .ulcon = SMDK6450_ULCON_DEFAULT,
  67. .ufcon = SMDK6450_UFCON_DEFAULT,
  68. },
  69. [2] = {
  70. .hwport = 2,
  71. .flags = 0,
  72. .ucon = SMDK6450_UCON_DEFAULT,
  73. .ulcon = SMDK6450_ULCON_DEFAULT,
  74. .ufcon = SMDK6450_UFCON_DEFAULT,
  75. },
  76. [3] = {
  77. .hwport = 3,
  78. .flags = 0,
  79. .ucon = SMDK6450_UCON_DEFAULT,
  80. .ulcon = SMDK6450_ULCON_DEFAULT,
  81. .ufcon = SMDK6450_UFCON_DEFAULT,
  82. },
  83. #if CONFIG_SERIAL_SAMSUNG_UARTS > 4
  84. [4] = {
  85. .hwport = 4,
  86. .flags = 0,
  87. .ucon = SMDK6450_UCON_DEFAULT,
  88. .ulcon = SMDK6450_ULCON_DEFAULT,
  89. .ufcon = SMDK6450_UFCON_DEFAULT,
  90. },
  91. #endif
  92. #if CONFIG_SERIAL_SAMSUNG_UARTS > 5
  93. [5] = {
  94. .hwport = 5,
  95. .flags = 0,
  96. .ucon = SMDK6450_UCON_DEFAULT,
  97. .ulcon = SMDK6450_ULCON_DEFAULT,
  98. .ufcon = SMDK6450_UFCON_DEFAULT,
  99. },
  100. #endif
  101. };
  102. static int smdk6450_backlight_init(struct device *dev)
  103. {
  104. int ret;
  105. ret = gpio_request(S5P6450_GPF(15), "Backlight");
  106. if (ret) {
  107. printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
  108. return ret;
  109. }
  110. /* Configure GPIO pin with S5P6450_GPF15_PWM_TOUT1 */
  111. s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_SFN(2));
  112. return 0;
  113. }
  114. static void smdk6450_backlight_exit(struct device *dev)
  115. {
  116. s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_OUTPUT);
  117. gpio_free(S5P6450_GPF(15));
  118. }
  119. static struct platform_pwm_backlight_data smdk6450_backlight_data = {
  120. .pwm_id = 1,
  121. .max_brightness = 255,
  122. .dft_brightness = 255,
  123. .pwm_period_ns = 78770,
  124. .init = smdk6450_backlight_init,
  125. .exit = smdk6450_backlight_exit,
  126. };
  127. static struct platform_device smdk6450_backlight_device = {
  128. .name = "pwm-backlight",
  129. .dev = {
  130. .parent = &s3c_device_timer[1].dev,
  131. .platform_data = &smdk6450_backlight_data,
  132. },
  133. };
  134. static struct platform_device *smdk6450_devices[] __initdata = {
  135. &s3c_device_adc,
  136. &s3c_device_rtc,
  137. &s3c_device_i2c0,
  138. &s3c_device_i2c1,
  139. &s3c_device_ts,
  140. &s3c_device_wdt,
  141. &samsung_asoc_dma,
  142. &s5p6450_device_iis0,
  143. &s3c_device_timer[1],
  144. &smdk6450_backlight_device,
  145. /* s5p6450_device_spi0 will be added */
  146. };
  147. static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
  148. .flags = 0,
  149. .slave_addr = 0x10,
  150. .frequency = 100*1000,
  151. .sda_delay = 100,
  152. .cfg_gpio = s5p6450_i2c0_cfg_gpio,
  153. };
  154. static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
  155. .flags = 0,
  156. .bus_num = 1,
  157. .slave_addr = 0x10,
  158. .frequency = 100*1000,
  159. .sda_delay = 100,
  160. .cfg_gpio = s5p6450_i2c1_cfg_gpio,
  161. };
  162. static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
  163. { I2C_BOARD_INFO("wm8580", 0x1b), },
  164. { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
  165. };
  166. static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
  167. { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
  168. };
  169. static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
  170. .delay = 10000,
  171. .presc = 49,
  172. .oversampling_shift = 2,
  173. };
  174. static void __init smdk6450_map_io(void)
  175. {
  176. s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
  177. s3c24xx_init_clocks(19200000);
  178. s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
  179. }
  180. static void __init smdk6450_machine_init(void)
  181. {
  182. s3c24xx_ts_set_platdata(&s3c_ts_platform);
  183. s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
  184. s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
  185. i2c_register_board_info(0, smdk6450_i2c_devs0,
  186. ARRAY_SIZE(smdk6450_i2c_devs0));
  187. i2c_register_board_info(1, smdk6450_i2c_devs1,
  188. ARRAY_SIZE(smdk6450_i2c_devs1));
  189. platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
  190. }
  191. MACHINE_START(SMDK6450, "SMDK6450")
  192. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  193. .boot_params = S5P64X0_PA_SDRAM + 0x100,
  194. .init_irq = s5p6450_init_irq,
  195. .map_io = smdk6450_map_io,
  196. .init_machine = smdk6450_machine_init,
  197. .timer = &s3c24xx_timer,
  198. MACHINE_END