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>
This commit is contained in:
parent
fbd208e977
commit
e5f5b5422d
|
@ -44,8 +44,6 @@ struct sdram_timings {
|
||||||
u32 tWTR;
|
u32 tWTR;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct omap_sdrc_params nokia_sdrc_params[4];
|
|
||||||
|
|
||||||
static const struct sdram_timings nokia_166mhz_timings[] = {
|
static const struct sdram_timings nokia_166mhz_timings[] = {
|
||||||
{
|
{
|
||||||
.casl = 3,
|
.casl = 3,
|
||||||
|
@ -67,6 +65,16 @@ static const struct sdram_timings nokia_166mhz_timings[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
long rate;
|
||||||
|
struct sdram_timings const *data;
|
||||||
|
} nokia_timings[] = {
|
||||||
|
{ 41500000, nokia_166mhz_timings },
|
||||||
|
{ 83000000, nokia_166mhz_timings },
|
||||||
|
{ 166000000, nokia_166mhz_timings },
|
||||||
|
};
|
||||||
|
static struct omap_sdrc_params nokia_sdrc_params[ARRAY_SIZE(nokia_timings) + 1];
|
||||||
|
|
||||||
static unsigned long sdrc_get_fclk_period(long rate)
|
static unsigned long sdrc_get_fclk_period(long rate)
|
||||||
{
|
{
|
||||||
/* In picoseconds */
|
/* In picoseconds */
|
||||||
|
@ -212,11 +220,12 @@ static int sdrc_timings(int id, long rate,
|
||||||
|
|
||||||
struct omap_sdrc_params *nokia_get_sdram_timings(void)
|
struct omap_sdrc_params *nokia_get_sdram_timings(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
err = sdrc_timings(0, 41500000, nokia_166mhz_timings);
|
for (i = 0; i < ARRAY_SIZE(nokia_timings); i++)
|
||||||
err |= sdrc_timings(1, 83000000, nokia_166mhz_timings);
|
err |= sdrc_timings(i, nokia_timings[i].rate,
|
||||||
err |= sdrc_timings(2, 166000000, nokia_166mhz_timings);
|
nokia_timings[i].data);
|
||||||
|
|
||||||
return &nokia_sdrc_params[0];
|
return &nokia_sdrc_params[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue