Merge branch 'lpc32xx/dts' of git://git.antcom.de/linux-2.6 into next/dt
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / arm / mach-omap2 / common.c
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
20 #include <plat/mux.h>
21 #include <plat/clock.h>
22
23 #include "soc.h"
24 #include "iomap.h"
25 #include "common.h"
26 #include "sdrc.h"
27 #include "control.h"
28
29 /* Global address base setup code */
30
31 static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
32 {
33         omap2_set_globals_tap(omap2_globals);
34         omap2_set_globals_sdrc(omap2_globals);
35         omap2_set_globals_control(omap2_globals);
36         omap2_set_globals_prcm(omap2_globals);
37 }
38
39 #if defined(CONFIG_SOC_OMAP2420)
40
41 static struct omap_globals omap242x_globals = {
42         .class  = OMAP242X_CLASS,
43         .tap    = OMAP2_L4_IO_ADDRESS(0x48014000),
44         .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
45         .sms    = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
46         .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
47         .prm    = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
48         .cm     = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
49 };
50
51 void __init omap2_set_globals_242x(void)
52 {
53         __omap2_set_globals(&omap242x_globals);
54 }
55
56 void __init omap242x_map_io(void)
57 {
58         omap242x_map_common_io();
59 }
60 #endif
61
62 #if defined(CONFIG_SOC_OMAP2430)
63
64 static struct omap_globals omap243x_globals = {
65         .class  = OMAP243X_CLASS,
66         .tap    = OMAP2_L4_IO_ADDRESS(0x4900a000),
67         .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
68         .sms    = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
69         .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
70         .prm    = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
71         .cm     = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
72 };
73
74 void __init omap2_set_globals_243x(void)
75 {
76         __omap2_set_globals(&omap243x_globals);
77 }
78
79 void __init omap243x_map_io(void)
80 {
81         omap243x_map_common_io();
82 }
83 #endif
84
85 #if defined(CONFIG_ARCH_OMAP3)
86
87 static struct omap_globals omap3_globals = {
88         .class  = OMAP343X_CLASS,
89         .tap    = OMAP2_L4_IO_ADDRESS(0x4830A000),
90         .sdrc   = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
91         .sms    = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
92         .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
93         .prm    = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
94         .cm     = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
95 };
96
97 void __init omap2_set_globals_3xxx(void)
98 {
99         __omap2_set_globals(&omap3_globals);
100 }
101
102 void __init omap3_map_io(void)
103 {
104         omap34xx_map_common_io();
105 }
106
107 /*
108  * Adjust TAP register base such that omap3_check_revision accesses the correct
109  * TI81XX register for checking device ID (it adds 0x204 to tap base while
110  * TI81XX DEVICE ID register is at offset 0x600 from control base).
111  */
112 #define TI81XX_TAP_BASE         (TI81XX_CTRL_BASE + \
113                                 TI81XX_CONTROL_DEVICE_ID - 0x204)
114
115 static struct omap_globals ti81xx_globals = {
116         .class  = OMAP343X_CLASS,
117         .tap    = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
118         .ctrl   = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
119         .prm    = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
120         .cm     = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
121 };
122
123 void __init omap2_set_globals_ti81xx(void)
124 {
125         __omap2_set_globals(&ti81xx_globals);
126 }
127
128 void __init ti81xx_map_io(void)
129 {
130         omapti81xx_map_common_io();
131 }
132 #endif
133
134 #if defined(CONFIG_SOC_AM33XX)
135 #define AM33XX_TAP_BASE         (AM33XX_CTRL_BASE + \
136                                 TI81XX_CONTROL_DEVICE_ID - 0x204)
137
138 static struct omap_globals am33xx_globals = {
139         .class  = AM335X_CLASS,
140         .tap    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
141         .ctrl   = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
142         .prm    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
143         .cm     = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
144 };
145
146 void __init omap2_set_globals_am33xx(void)
147 {
148         __omap2_set_globals(&am33xx_globals);
149 }
150
151 void __init am33xx_map_io(void)
152 {
153         omapam33xx_map_common_io();
154 }
155 #endif
156
157 #if defined(CONFIG_ARCH_OMAP4)
158 static struct omap_globals omap4_globals = {
159         .class  = OMAP443X_CLASS,
160         .tap    = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
161         .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
162         .ctrl_pad       = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
163         .prm    = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
164         .cm     = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
165         .cm2    = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
166         .prcm_mpu       = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
167 };
168
169 void __init omap2_set_globals_443x(void)
170 {
171         __omap2_set_globals(&omap4_globals);
172 }
173
174 void __init omap4_map_io(void)
175 {
176         omap44xx_map_common_io();
177 }
178 #endif
179
180 #if defined(CONFIG_SOC_OMAP5)
181 static struct omap_globals omap5_globals = {
182         .class  = OMAP54XX_CLASS,
183         .tap    = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
184         .ctrl   = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
185         .ctrl_pad       = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
186         .prm    = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
187         .cm     = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
188         .cm2    = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
189         .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
190 };
191
192 void __init omap2_set_globals_5xxx(void)
193 {
194         omap2_set_globals_tap(&omap5_globals);
195         omap2_set_globals_control(&omap5_globals);
196         omap2_set_globals_prcm(&omap5_globals);
197 }
198
199 void __init omap5_map_io(void)
200 {
201         omap5_map_common_io();
202 }
203 #endif