common.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 "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 = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
  40. .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
  41. .ctrl = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
  42. .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
  43. .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
  44. };
  45. void __init omap2_set_globals_242x(void)
  46. {
  47. __omap2_set_globals(&omap242x_globals);
  48. }
  49. void __init omap242x_map_io(void)
  50. {
  51. omap242x_map_common_io();
  52. }
  53. #endif
  54. #if defined(CONFIG_SOC_OMAP2430)
  55. static struct omap_globals omap243x_globals = {
  56. .class = OMAP243X_CLASS,
  57. .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
  58. .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  59. .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
  60. .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
  61. .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
  62. .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
  63. };
  64. void __init omap2_set_globals_243x(void)
  65. {
  66. __omap2_set_globals(&omap243x_globals);
  67. }
  68. void __init omap243x_map_io(void)
  69. {
  70. omap243x_map_common_io();
  71. }
  72. #endif
  73. #if defined(CONFIG_ARCH_OMAP3)
  74. static struct omap_globals omap3_globals = {
  75. .class = OMAP343X_CLASS,
  76. .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
  77. .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  78. .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
  79. .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
  80. .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
  81. .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
  82. };
  83. void __init omap2_set_globals_3xxx(void)
  84. {
  85. __omap2_set_globals(&omap3_globals);
  86. }
  87. void __init omap3_map_io(void)
  88. {
  89. omap34xx_map_common_io();
  90. }
  91. /*
  92. * Adjust TAP register base such that omap3_check_revision accesses the correct
  93. * TI81XX register for checking device ID (it adds 0x204 to tap base while
  94. * TI81XX DEVICE ID register is at offset 0x600 from control base).
  95. */
  96. #define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
  97. TI81XX_CONTROL_DEVICE_ID - 0x204)
  98. static struct omap_globals ti81xx_globals = {
  99. .class = OMAP343X_CLASS,
  100. .tap = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
  101. .ctrl = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  102. .prm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
  103. .cm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
  104. };
  105. void __init omap2_set_globals_ti81xx(void)
  106. {
  107. __omap2_set_globals(&ti81xx_globals);
  108. }
  109. void __init ti81xx_map_io(void)
  110. {
  111. omapti81xx_map_common_io();
  112. }
  113. #define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
  114. TI81XX_CONTROL_DEVICE_ID - 0x204)
  115. static struct omap_globals am33xx_globals = {
  116. .class = AM335X_CLASS,
  117. .tap = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
  118. .ctrl = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  119. .prm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
  120. .cm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
  121. };
  122. void __init omap2_set_globals_am33xx(void)
  123. {
  124. __omap2_set_globals(&am33xx_globals);
  125. }
  126. void __init am33xx_map_io(void)
  127. {
  128. omapam33xx_map_common_io();
  129. }
  130. #endif
  131. #if defined(CONFIG_ARCH_OMAP4)
  132. static struct omap_globals omap4_globals = {
  133. .class = OMAP443X_CLASS,
  134. .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  135. .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  136. .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
  137. .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
  138. .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  139. .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
  140. };
  141. void __init omap2_set_globals_443x(void)
  142. {
  143. omap2_set_globals_tap(&omap4_globals);
  144. omap2_set_globals_control(&omap4_globals);
  145. omap2_set_globals_prcm(&omap4_globals);
  146. }
  147. void __init omap4_map_io(void)
  148. {
  149. omap44xx_map_common_io();
  150. }
  151. #endif