aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/sdram-nokia.c
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@nokia.com>2010-12-17 18:13:45 -0500
committerTony Lindgren <tony@atomide.com>2010-12-17 18:13:45 -0500
commite5f5b5422d064b7a393e39332da31af68e975f91 (patch)
tree5f30a42732858cf8d6a4886e23adc275b411f993 /arch/arm/mach-omap2/sdram-nokia.c
parentfbd208e9772005c193459d1a0575c0787ad52f69 (diff)
arm: omap: sdram-nokia: use array to list timings
Use an array to make it easier to add new values. Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/sdram-nokia.c')
-rw-r--r--arch/arm/mach-omap2/sdram-nokia.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c
index 97d16732c54d..1171451ef7f2 100644
--- a/arch/arm/mach-omap2/sdram-nokia.c
+++ b/arch/arm/mach-omap2/sdram-nokia.c
@@ -44,8 +44,6 @@ struct sdram_timings {
44 u32 tWTR; 44 u32 tWTR;
45}; 45};
46 46
47static struct omap_sdrc_params nokia_sdrc_params[4];
48
49static const struct sdram_timings nokia_166mhz_timings[] = { 47static const struct sdram_timings nokia_166mhz_timings[] = {
50 { 48 {
51 .casl = 3, 49 .casl = 3,
@@ -67,6 +65,16 @@ static const struct sdram_timings nokia_166mhz_timings[] = {
67 }, 65 },
68}; 66};
69 67
68static const struct {
69 long rate;
70 struct sdram_timings const *data;
71} nokia_timings[] = {
72 { 41500000, nokia_166mhz_timings },
73 { 83000000, nokia_166mhz_timings },
74 { 166000000, nokia_166mhz_timings },
75};
76static struct omap_sdrc_params nokia_sdrc_params[ARRAY_SIZE(nokia_timings) + 1];
77
70static unsigned long sdrc_get_fclk_period(long rate) 78static unsigned long sdrc_get_fclk_period(long rate)
71{ 79{
72 /* In picoseconds */ 80 /* In picoseconds */
@@ -212,11 +220,12 @@ static int sdrc_timings(int id, long rate,
212 220
213struct omap_sdrc_params *nokia_get_sdram_timings(void) 221struct omap_sdrc_params *nokia_get_sdram_timings(void)
214{ 222{
215 int err; 223 int err = 0;
224 int i;
216 225
217 err = sdrc_timings(0, 41500000, nokia_166mhz_timings); 226 for (i = 0; i < ARRAY_SIZE(nokia_timings); i++)
218 err |= sdrc_timings(1, 83000000, nokia_166mhz_timings); 227 err |= sdrc_timings(i, nokia_timings[i].rate,
219 err |= sdrc_timings(2, 166000000, nokia_166mhz_timings); 228 nokia_timings[i].data);
220 229
221 return &nokia_sdrc_params[0]; 230 return &nokia_sdrc_params[0];
222} 231}