mach-smdkv310.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* linux/arch/arm/mach-s5pv310/mach-smdkv310.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/serial_core.h>
  11. #include <linux/gpio.h>
  12. #include <linux/mmc/host.h>
  13. #include <linux/platform_device.h>
  14. #include <asm/mach/arch.h>
  15. #include <asm/mach-types.h>
  16. #include <plat/regs-serial.h>
  17. #include <plat/s5pv310.h>
  18. #include <plat/cpu.h>
  19. #include <plat/devs.h>
  20. #include <plat/sdhci.h>
  21. #include <mach/map.h>
  22. /* Following are default values for UCON, ULCON and UFCON UART registers */
  23. #define SMDKV310_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 SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
  30. #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  31. S5PV210_UFCON_TXTRIG4 | \
  32. S5PV210_UFCON_RXTRIG4)
  33. static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
  34. [0] = {
  35. .hwport = 0,
  36. .flags = 0,
  37. .ucon = SMDKV310_UCON_DEFAULT,
  38. .ulcon = SMDKV310_ULCON_DEFAULT,
  39. .ufcon = SMDKV310_UFCON_DEFAULT,
  40. },
  41. [1] = {
  42. .hwport = 1,
  43. .flags = 0,
  44. .ucon = SMDKV310_UCON_DEFAULT,
  45. .ulcon = SMDKV310_ULCON_DEFAULT,
  46. .ufcon = SMDKV310_UFCON_DEFAULT,
  47. },
  48. [2] = {
  49. .hwport = 2,
  50. .flags = 0,
  51. .ucon = SMDKV310_UCON_DEFAULT,
  52. .ulcon = SMDKV310_ULCON_DEFAULT,
  53. .ufcon = SMDKV310_UFCON_DEFAULT,
  54. },
  55. [3] = {
  56. .hwport = 3,
  57. .flags = 0,
  58. .ucon = SMDKV310_UCON_DEFAULT,
  59. .ulcon = SMDKV310_ULCON_DEFAULT,
  60. .ufcon = SMDKV310_UFCON_DEFAULT,
  61. },
  62. };
  63. static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
  64. .cd_type = S3C_SDHCI_CD_GPIO,
  65. .ext_cd_gpio = S5PV310_GPK0(2),
  66. .ext_cd_gpio_invert = 1,
  67. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  68. #ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT
  69. .max_width = 8,
  70. .host_caps = MMC_CAP_8_BIT_DATA,
  71. #endif
  72. };
  73. static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
  74. .cd_type = S3C_SDHCI_CD_GPIO,
  75. .ext_cd_gpio = S5PV310_GPK0(2),
  76. .ext_cd_gpio_invert = 1,
  77. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  78. };
  79. static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
  80. .cd_type = S3C_SDHCI_CD_GPIO,
  81. .ext_cd_gpio = S5PV310_GPK2(2),
  82. .ext_cd_gpio_invert = 1,
  83. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  84. #ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT
  85. .max_width = 8,
  86. .host_caps = MMC_CAP_8_BIT_DATA,
  87. #endif
  88. };
  89. static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
  90. .cd_type = S3C_SDHCI_CD_GPIO,
  91. .ext_cd_gpio = S5PV310_GPK2(2),
  92. .ext_cd_gpio_invert = 1,
  93. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  94. };
  95. static struct platform_device *smdkv310_devices[] __initdata = {
  96. &s3c_device_hsmmc0,
  97. &s3c_device_hsmmc1,
  98. &s3c_device_hsmmc2,
  99. &s3c_device_hsmmc3,
  100. &s3c_device_rtc,
  101. &s3c_device_wdt,
  102. };
  103. static void __init smdkv310_map_io(void)
  104. {
  105. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  106. s3c24xx_init_clocks(24000000);
  107. s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
  108. }
  109. static void __init smdkv310_machine_init(void)
  110. {
  111. s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
  112. s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
  113. s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
  114. s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
  115. platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
  116. }
  117. MACHINE_START(SMDKV310, "SMDKV310")
  118. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  119. /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
  120. .phys_io = S3C_PA_UART & 0xfff00000,
  121. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  122. .boot_params = S5P_PA_SDRAM + 0x100,
  123. .init_irq = s5pv310_init_irq,
  124. .map_io = smdkv310_map_io,
  125. .init_machine = smdkv310_machine_init,
  126. .timer = &s5pv310_timer,
  127. MACHINE_END