diff options
Diffstat (limited to 'arch/arm/mach-omap2/sdrc.c')
-rw-r--r-- | arch/arm/mach-omap2/sdrc.c | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index 9e3bd4fa7810..4c65f5628b39 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c | |||
@@ -23,13 +23,13 @@ | |||
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | 25 | ||
26 | #include <mach/common.h> | 26 | #include <plat/common.h> |
27 | #include <mach/clock.h> | 27 | #include <plat/clock.h> |
28 | #include <mach/sram.h> | 28 | #include <plat/sram.h> |
29 | 29 | ||
30 | #include "prm.h" | 30 | #include "prm.h" |
31 | 31 | ||
32 | #include <mach/sdrc.h> | 32 | #include <plat/sdrc.h> |
33 | #include "sdrc.h" | 33 | #include "sdrc.h" |
34 | 34 | ||
35 | static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; | 35 | static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; |
@@ -37,12 +37,38 @@ static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; | |||
37 | void __iomem *omap2_sdrc_base; | 37 | void __iomem *omap2_sdrc_base; |
38 | void __iomem *omap2_sms_base; | 38 | void __iomem *omap2_sms_base; |
39 | 39 | ||
40 | struct omap2_sms_regs { | ||
41 | u32 sms_sysconfig; | ||
42 | }; | ||
43 | |||
44 | static struct omap2_sms_regs sms_context; | ||
45 | |||
40 | /* SDRC_POWER register bits */ | 46 | /* SDRC_POWER register bits */ |
41 | #define SDRC_POWER_EXTCLKDIS_SHIFT 3 | 47 | #define SDRC_POWER_EXTCLKDIS_SHIFT 3 |
42 | #define SDRC_POWER_PWDENA_SHIFT 2 | 48 | #define SDRC_POWER_PWDENA_SHIFT 2 |
43 | #define SDRC_POWER_PAGEPOLICY_SHIFT 0 | 49 | #define SDRC_POWER_PAGEPOLICY_SHIFT 0 |
44 | 50 | ||
45 | /** | 51 | /** |
52 | * omap2_sms_save_context - Save SMS registers | ||
53 | * | ||
54 | * Save SMS registers that need to be restored after off mode. | ||
55 | */ | ||
56 | void omap2_sms_save_context(void) | ||
57 | { | ||
58 | sms_context.sms_sysconfig = sms_read_reg(SMS_SYSCONFIG); | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * omap2_sms_restore_context - Restore SMS registers | ||
63 | * | ||
64 | * Restore SMS registers that need to be Restored after off mode. | ||
65 | */ | ||
66 | void omap2_sms_restore_context(void) | ||
67 | { | ||
68 | sms_write_reg(sms_context.sms_sysconfig, SMS_SYSCONFIG); | ||
69 | } | ||
70 | |||
71 | /** | ||
46 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate | 72 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate |
47 | * @r: SDRC clock rate (in Hz) | 73 | * @r: SDRC clock rate (in Hz) |
48 | * @sdrc_cs0: chip select 0 ram timings ** | 74 | * @sdrc_cs0: chip select 0 ram timings ** |
@@ -93,8 +119,15 @@ int omap2_sdrc_get_params(unsigned long r, | |||
93 | 119 | ||
94 | void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) | 120 | void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) |
95 | { | 121 | { |
96 | omap2_sdrc_base = omap2_globals->sdrc; | 122 | /* Static mapping, never released */ |
97 | omap2_sms_base = omap2_globals->sms; | 123 | if (omap2_globals->sdrc) { |
124 | omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K); | ||
125 | WARN_ON(!omap2_sdrc_base); | ||
126 | } | ||
127 | if (omap2_globals->sms) { | ||
128 | omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K); | ||
129 | WARN_ON(!omap2_sms_base); | ||
130 | } | ||
98 | } | 131 | } |
99 | 132 | ||
100 | /** | 133 | /** |
@@ -132,4 +165,21 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, | |||
132 | l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | | 165 | l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | |
133 | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); | 166 | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); |
134 | sdrc_write_reg(l, SDRC_POWER); | 167 | sdrc_write_reg(l, SDRC_POWER); |
168 | omap2_sms_save_context(); | ||
135 | } | 169 | } |
170 | |||
171 | void omap2_sms_write_rot_control(u32 val, unsigned ctx) | ||
172 | { | ||
173 | sms_write_reg(val, SMS_ROT_CONTROL(ctx)); | ||
174 | } | ||
175 | |||
176 | void omap2_sms_write_rot_size(u32 val, unsigned ctx) | ||
177 | { | ||
178 | sms_write_reg(val, SMS_ROT_SIZE(ctx)); | ||
179 | } | ||
180 | |||
181 | void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx) | ||
182 | { | ||
183 | sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx)); | ||
184 | } | ||
185 | |||