summaryrefslogtreecommitdiff
path: root/board/freescale/corenet_ds/ddr.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2011-01-24 23:36:17 -0600
committerKumar Gala <galak@kernel.crashing.org>2011-04-04 09:24:40 -0500
commit5cfbc458d4957a186d1433cf1c14e8f4e6d4431f (patch)
tree96bc8fc9e7b5208e681cfee684724efb20b1af2b /board/freescale/corenet_ds/ddr.c
parentaa8d3fb8f4d383e7371f8f678ca3db1ca7d0ae32 (diff)
downloadu-boot-imx-5cfbc458d4957a186d1433cf1c14e8f4e6d4431f.zip
u-boot-imx-5cfbc458d4957a186d1433cf1c14e8f4e6d4431f.tar.gz
u-boot-imx-5cfbc458d4957a186d1433cf1c14e8f4e6d4431f.tar.bz2
powerpc/85xx: Remove DATARATE_*_MHZ defines in static ddr init
Rather than having #defines DATARATE_*_MHZ, lets just match what we do on the SPD code and convert the DDR frequency into MHZ and just compare with a constant. Based on patch from Poonam Aggrwal. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'board/freescale/corenet_ds/ddr.c')
-rw-r--r--board/freescale/corenet_ds/ddr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/board/freescale/corenet_ds/ddr.c b/board/freescale/corenet_ds/ddr.c
index 07b950f..844eb1d 100644
--- a/board/freescale/corenet_ds/ddr.c
+++ b/board/freescale/corenet_ds/ddr.c
@@ -31,19 +31,21 @@ extern fixed_ddr_parm_t fixed_ddr_parm_1[];
phys_size_t fixed_sdram(void)
{
int i;
- sys_info_t sysinfo;
char buf[32];
fsl_ddr_cfg_regs_t ddr_cfg_regs;
phys_size_t ddr_size;
unsigned int lawbar1_target_id;
+ ulong ddr_freq, ddr_freq_mhz;
+
+ ddr_freq = get_ddr_freq(0);
+ ddr_freq_mhz = ddr_freq / 1000000;
- get_sys_info(&sysinfo);
printf("Configuring DDR for %s MT/s data rate\n",
- strmhz(buf, sysinfo.freqDDRBus));
+ strmhz(buf, ddr_freq));
for (i = 0; fixed_ddr_parm_0[i].max_freq > 0; i++) {
- if ((sysinfo.freqDDRBus > fixed_ddr_parm_0[i].min_freq) &&
- (sysinfo.freqDDRBus <= fixed_ddr_parm_0[i].max_freq)) {
+ if ((ddr_freq_mhz > fixed_ddr_parm_0[i].min_freq) &&
+ (ddr_freq_mhz <= fixed_ddr_parm_0[i].max_freq)) {
memcpy(&ddr_cfg_regs,
fixed_ddr_parm_0[i].ddr_settings,
sizeof(ddr_cfg_regs));
@@ -53,7 +55,7 @@ phys_size_t fixed_sdram(void)
if (fixed_ddr_parm_0[i].max_freq == 0)
panic("Unsupported DDR data rate %s MT/s data rate\n",
- strmhz(buf, sysinfo.freqDDRBus));
+ strmhz(buf, ddr_freq));
ddr_size = (phys_size_t) CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
ddr_cfg_regs.ddr_cdr1 = DDR_CDR1_DHC_EN;