diff options
Diffstat (limited to 'arch/arm/mach-omap2/sdrc.c')
-rw-r--r-- | arch/arm/mach-omap2/sdrc.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index 2a30060cb4b7..2045441e8385 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c | |||
@@ -37,6 +37,10 @@ static struct omap_sdrc_params *sdrc_init_params; | |||
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 | /* SDRC_POWER register bits */ | ||
41 | #define SDRC_POWER_EXTCLKDIS_SHIFT 3 | ||
42 | #define SDRC_POWER_PWDENA_SHIFT 2 | ||
43 | #define SDRC_POWER_PAGEPOLICY_SHIFT 0 | ||
40 | 44 | ||
41 | /** | 45 | /** |
42 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate | 46 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate |
@@ -56,9 +60,12 @@ struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r) | |||
56 | { | 60 | { |
57 | struct omap_sdrc_params *sp; | 61 | struct omap_sdrc_params *sp; |
58 | 62 | ||
63 | if (!sdrc_init_params) | ||
64 | return NULL; | ||
65 | |||
59 | sp = sdrc_init_params; | 66 | sp = sdrc_init_params; |
60 | 67 | ||
61 | while (sp->rate != r) | 68 | while (sp->rate && sp->rate != r) |
62 | sp++; | 69 | sp++; |
63 | 70 | ||
64 | if (!sp->rate) | 71 | if (!sp->rate) |
@@ -74,7 +81,14 @@ void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) | |||
74 | omap2_sms_base = omap2_globals->sms; | 81 | omap2_sms_base = omap2_globals->sms; |
75 | } | 82 | } |
76 | 83 | ||
77 | /* turn on smart idle modes for SDRAM scheduler and controller */ | 84 | /** |
85 | * omap2_sdrc_init - initialize SMS, SDRC devices on boot | ||
86 | * @sp: pointer to a null-terminated list of struct omap_sdrc_params | ||
87 | * | ||
88 | * Turn on smart idle modes for SDRAM scheduler and controller. | ||
89 | * Program a known-good configuration for the SDRC to deal with buggy | ||
90 | * bootloaders. | ||
91 | */ | ||
78 | void __init omap2_sdrc_init(struct omap_sdrc_params *sp) | 92 | void __init omap2_sdrc_init(struct omap_sdrc_params *sp) |
79 | { | 93 | { |
80 | u32 l; | 94 | u32 l; |
@@ -90,4 +104,10 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp) | |||
90 | sdrc_write_reg(l, SDRC_SYSCONFIG); | 104 | sdrc_write_reg(l, SDRC_SYSCONFIG); |
91 | 105 | ||
92 | sdrc_init_params = sp; | 106 | sdrc_init_params = sp; |
107 | |||
108 | /* XXX Enable SRFRONIDLEREQ here also? */ | ||
109 | l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | | ||
110 | (1 << SDRC_POWER_PWDENA_SHIFT) | | ||
111 | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); | ||
112 | sdrc_write_reg(l, SDRC_POWER); | ||
93 | } | 113 | } |