]> Git Repo - u-boot.git/blobdiff - drivers/ddr/fsl/ddr2_dimm_params.c
tools: kwboot: Fix parsing UART image without data checksum
[u-boot.git] / drivers / ddr / fsl / ddr2_dimm_params.c
index d865df78a8d1f4d5e238f2db003f830cd49084d3..3b78118a9d823517c35388403ac3099b6071a5d6 100644 (file)
@@ -1,13 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright 2008 Freescale Semiconductor, Inc.
 /*
  * Copyright 2008 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * Version 2 as published by the Free Software Foundation.
  */
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
  */
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
+#include <asm/bitops.h>
 
 #include <fsl_ddr.h>
 /*
 
 #include <fsl_ddr.h>
 /*
@@ -109,22 +108,14 @@ static unsigned int byte40_table_ps[8] = {
 static unsigned int
 compute_trfc_ps_from_spd(unsigned char trctrfc_ext, unsigned char trfc)
 {
 static unsigned int
 compute_trfc_ps_from_spd(unsigned char trctrfc_ext, unsigned char trfc)
 {
-       unsigned int trfc_ps;
-
-       trfc_ps = (((trctrfc_ext & 0x1) * 256) + trfc) * 1000
+       return (((trctrfc_ext & 0x1) * 256) + trfc) * 1000
                + byte40_table_ps[(trctrfc_ext >> 1) & 0x7];
                + byte40_table_ps[(trctrfc_ext >> 1) & 0x7];
-
-       return trfc_ps;
 }
 
 static unsigned int
 compute_trc_ps_from_spd(unsigned char trctrfc_ext, unsigned char trc)
 {
 }
 
 static unsigned int
 compute_trc_ps_from_spd(unsigned char trctrfc_ext, unsigned char trc)
 {
-       unsigned int trc_ps;
-
-       trc_ps = trc * 1000 + byte40_table_ps[(trctrfc_ext >> 4) & 0x7];
-
-       return trc_ps;
+       return trc * 1000 + byte40_table_ps[(trctrfc_ext >> 4) & 0x7];
 }
 
 /*
 }
 
 /*
@@ -211,10 +202,10 @@ compute_derated_DDR2_CAS_latency(unsigned int mclk_ps)
  *
  * FIXME: use #define for the retvals
  */
  *
  * FIXME: use #define for the retvals
  */
-unsigned int
-ddr_compute_dimm_parameters(const ddr2_spd_eeprom_t *spd,
-                            dimm_params_t *pdimm,
-                            unsigned int dimm_number)
+unsigned int ddr_compute_dimm_parameters(const unsigned int ctrl_num,
+                                        const ddr2_spd_eeprom_t *spd,
+                                        dimm_params_t *pdimm,
+                                        unsigned int dimm_number)
 {
        unsigned int retval;
 
 {
        unsigned int retval;
 
@@ -279,7 +270,6 @@ ddr_compute_dimm_parameters(const ddr2_spd_eeprom_t *spd,
        pdimm->n_banks_per_sdram_device = spd->nbanks;
        pdimm->edc_config = spd->config;
        pdimm->burst_lengths_bitmask = spd->burstl;
        pdimm->n_banks_per_sdram_device = spd->nbanks;
        pdimm->edc_config = spd->config;
        pdimm->burst_lengths_bitmask = spd->burstl;
-       pdimm->row_density = spd->rank_dens;
 
        /*
         * Calculate the Maximum Data Rate based on the Minimum Cycle time.
 
        /*
         * Calculate the Maximum Data Rate based on the Minimum Cycle time.
@@ -310,8 +300,8 @@ ddr_compute_dimm_parameters(const ddr2_spd_eeprom_t *spd,
                                          & ~(1 << pdimm->caslat_x_minus_1));
 
        /* Compute CAS latencies below that defined by SPD */
                                          & ~(1 << pdimm->caslat_x_minus_1));
 
        /* Compute CAS latencies below that defined by SPD */
-       pdimm->caslat_lowest_derated
-               = compute_derated_DDR2_CAS_latency(get_memory_clk_period_ps());
+       pdimm->caslat_lowest_derated = compute_derated_DDR2_CAS_latency(
+                                       get_memory_clk_period_ps(ctrl_num));
 
        /* Compute timing parameters */
        pdimm->trcd_ps = spd->trcd * 250;
 
        /* Compute timing parameters */
        pdimm->trcd_ps = spd->trcd * 250;
This page took 0.033024 seconds and 4 git commands to generate.