mach-universal_c210.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* linux/arch/arm/mach-s5pv310/mach-universal_c210.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/platform_device.h>
  10. #include <linux/serial_core.h>
  11. #include <linux/input.h>
  12. #include <linux/i2c.h>
  13. #include <linux/gpio_keys.h>
  14. #include <linux/gpio.h>
  15. #include <asm/mach/arch.h>
  16. #include <asm/mach-types.h>
  17. #include <plat/regs-serial.h>
  18. #include <plat/s5pv310.h>
  19. #include <plat/cpu.h>
  20. #include <plat/devs.h>
  21. #include <mach/map.h>
  22. /* Following are default values for UCON, ULCON and UFCON UART registers */
  23. #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  24. S3C2410_UCON_RXILEVEL | \
  25. S3C2410_UCON_TXIRQMODE | \
  26. S3C2410_UCON_RXIRQMODE | \
  27. S3C2410_UCON_RXFIFO_TOI | \
  28. S3C2443_UCON_RXERR_IRQEN)
  29. #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
  30. #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  31. S5PV210_UFCON_TXTRIG256 | \
  32. S5PV210_UFCON_RXTRIG256)
  33. static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
  34. [0] = {
  35. .hwport = 0,
  36. .ucon = UNIVERSAL_UCON_DEFAULT,
  37. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  38. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  39. },
  40. [1] = {
  41. .hwport = 1,
  42. .ucon = UNIVERSAL_UCON_DEFAULT,
  43. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  44. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  45. },
  46. [2] = {
  47. .hwport = 2,
  48. .ucon = UNIVERSAL_UCON_DEFAULT,
  49. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  50. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  51. },
  52. [3] = {
  53. .hwport = 3,
  54. .ucon = UNIVERSAL_UCON_DEFAULT,
  55. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  56. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  57. },
  58. };
  59. static struct gpio_keys_button universal_gpio_keys_tables[] = {
  60. {
  61. .code = KEY_VOLUMEUP,
  62. .gpio = S5PV310_GPX2(0), /* XEINT16 */
  63. .desc = "gpio-keys: KEY_VOLUMEUP",
  64. .type = EV_KEY,
  65. .active_low = 1,
  66. .debounce_interval = 1,
  67. }, {
  68. .code = KEY_VOLUMEDOWN,
  69. .gpio = S5PV310_GPX2(1), /* XEINT17 */
  70. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  71. .type = EV_KEY,
  72. .active_low = 1,
  73. .debounce_interval = 1,
  74. }, {
  75. .code = KEY_CONFIG,
  76. .gpio = S5PV310_GPX2(2), /* XEINT18 */
  77. .desc = "gpio-keys: KEY_CONFIG",
  78. .type = EV_KEY,
  79. .active_low = 1,
  80. .debounce_interval = 1,
  81. }, {
  82. .code = KEY_CAMERA,
  83. .gpio = S5PV310_GPX2(3), /* XEINT19 */
  84. .desc = "gpio-keys: KEY_CAMERA",
  85. .type = EV_KEY,
  86. .active_low = 1,
  87. .debounce_interval = 1,
  88. }, {
  89. .code = KEY_OK,
  90. .gpio = S5PV310_GPX3(5), /* XEINT29 */
  91. .desc = "gpio-keys: KEY_OK",
  92. .type = EV_KEY,
  93. .active_low = 1,
  94. .debounce_interval = 1,
  95. },
  96. };
  97. static struct gpio_keys_platform_data universal_gpio_keys_data = {
  98. .buttons = universal_gpio_keys_tables,
  99. .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
  100. };
  101. static struct platform_device universal_gpio_keys = {
  102. .name = "gpio-keys",
  103. .dev = {
  104. .platform_data = &universal_gpio_keys_data,
  105. },
  106. };
  107. /* I2C0 */
  108. static struct i2c_board_info i2c0_devs[] __initdata = {
  109. /* Camera, To be updated */
  110. };
  111. /* I2C1 */
  112. static struct i2c_board_info i2c1_devs[] __initdata = {
  113. /* Gyro, To be updated */
  114. };
  115. static struct platform_device *universal_devices[] __initdata = {
  116. &universal_gpio_keys,
  117. &s5p_device_onenand,
  118. };
  119. static void __init universal_map_io(void)
  120. {
  121. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  122. s3c24xx_init_clocks(24000000);
  123. s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
  124. }
  125. static void __init universal_machine_init(void)
  126. {
  127. i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
  128. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  129. /* Last */
  130. platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
  131. }
  132. MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
  133. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  134. .boot_params = S5P_PA_SDRAM + 0x100,
  135. .init_irq = s5pv310_init_irq,
  136. .map_io = universal_map_io,
  137. .init_machine = universal_machine_init,
  138. .timer = &s5pv310_timer,
  139. MACHINE_END