common.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * linux/arch/arm/mach-omap2/common.c
  3. *
  4. * Code common to all OMAP2+ machines.
  5. *
  6. * Copyright (C) 2009 Texas Instruments
  7. * Copyright (C) 2010 Nokia Corporation
  8. * Tony Lindgren <tony@atomide.com>
  9. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/clk.h>
  18. #include <linux/io.h>
  19. #include <plat/common.h>
  20. #include <plat/board.h>
  21. #include <plat/mux.h>
  22. #include <plat/clock.h>
  23. #include "sdrc.h"
  24. #include "control.h"
  25. /* Global address base setup code */
  26. #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
  27. static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
  28. {
  29. omap2_set_globals_tap(omap2_globals);
  30. omap2_set_globals_sdrc(omap2_globals);
  31. omap2_set_globals_control(omap2_globals);
  32. omap2_set_globals_prcm(omap2_globals);
  33. }
  34. #endif
  35. #if defined(CONFIG_SOC_OMAP2420)
  36. static struct omap_globals omap242x_globals = {
  37. .class = OMAP242X_CLASS,
  38. .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
  39. .sdrc = OMAP2420_SDRC_BASE,
  40. .sms = OMAP2420_SMS_BASE,
  41. .ctrl = OMAP242X_CTRL_BASE,
  42. .prm = OMAP2420_PRM_BASE,
  43. .cm = OMAP2420_CM_BASE,
  44. .uart1_phys = OMAP2_UART1_BASE,
  45. .uart2_phys = OMAP2_UART2_BASE,
  46. .uart3_phys = OMAP2_UART3_BASE,
  47. };
  48. void __init omap2_set_globals_242x(void)
  49. {
  50. __omap2_set_globals(&omap242x_globals);
  51. }
  52. #endif
  53. #if defined(CONFIG_SOC_OMAP2430)
  54. static struct omap_globals omap243x_globals = {
  55. .class = OMAP243X_CLASS,
  56. .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
  57. .sdrc = OMAP243X_SDRC_BASE,
  58. .sms = OMAP243X_SMS_BASE,
  59. .ctrl = OMAP243X_CTRL_BASE,
  60. .prm = OMAP2430_PRM_BASE,
  61. .cm = OMAP2430_CM_BASE,
  62. .uart1_phys = OMAP2_UART1_BASE,
  63. .uart2_phys = OMAP2_UART2_BASE,
  64. .uart3_phys = OMAP2_UART3_BASE,
  65. };
  66. void __init omap2_set_globals_243x(void)
  67. {
  68. __omap2_set_globals(&omap243x_globals);
  69. }
  70. #endif
  71. #if defined(CONFIG_ARCH_OMAP3)
  72. static struct omap_globals omap3_globals = {
  73. .class = OMAP343X_CLASS,
  74. .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
  75. .sdrc = OMAP343X_SDRC_BASE,
  76. .sms = OMAP343X_SMS_BASE,
  77. .ctrl = OMAP343X_CTRL_BASE,
  78. .prm = OMAP3430_PRM_BASE,
  79. .cm = OMAP3430_CM_BASE,
  80. .uart1_phys = OMAP3_UART1_BASE,
  81. .uart2_phys = OMAP3_UART2_BASE,
  82. .uart3_phys = OMAP3_UART3_BASE,
  83. .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
  84. };
  85. void __init omap2_set_globals_3xxx(void)
  86. {
  87. __omap2_set_globals(&omap3_globals);
  88. }
  89. void __init omap3_map_io(void)
  90. {
  91. omap2_set_globals_3xxx();
  92. omap34xx_map_common_io();
  93. }
  94. /*
  95. * Adjust TAP register base such that omap3_check_revision accesses the correct
  96. * TI816X register for checking device ID (it adds 0x204 to tap base while
  97. * TI816X DEVICE ID register is at offset 0x600 from control base).
  98. */
  99. #define TI816X_TAP_BASE (TI816X_CTRL_BASE + \
  100. TI816X_CONTROL_DEVICE_ID - 0x204)
  101. static struct omap_globals ti816x_globals = {
  102. .class = OMAP343X_CLASS,
  103. .tap = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
  104. .ctrl = TI816X_CTRL_BASE,
  105. .prm = TI816X_PRCM_BASE,
  106. .cm = TI816X_PRCM_BASE,
  107. };
  108. void __init omap2_set_globals_ti816x(void)
  109. {
  110. __omap2_set_globals(&ti816x_globals);
  111. }
  112. #endif
  113. #if defined(CONFIG_ARCH_OMAP4)
  114. static struct omap_globals omap4_globals = {
  115. .class = OMAP443X_CLASS,
  116. .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  117. .ctrl = OMAP443X_SCM_BASE,
  118. .ctrl_pad = OMAP443X_CTRL_BASE,
  119. .prm = OMAP4430_PRM_BASE,
  120. .cm = OMAP4430_CM_BASE,
  121. .cm2 = OMAP4430_CM2_BASE,
  122. .uart1_phys = OMAP4_UART1_BASE,
  123. .uart2_phys = OMAP4_UART2_BASE,
  124. .uart3_phys = OMAP4_UART3_BASE,
  125. .uart4_phys = OMAP4_UART4_BASE,
  126. };
  127. void __init omap2_set_globals_443x(void)
  128. {
  129. omap2_set_globals_tap(&omap4_globals);
  130. omap2_set_globals_control(&omap4_globals);
  131. omap2_set_globals_prcm(&omap4_globals);
  132. }
  133. #endif