aboutsummaryrefslogtreecommitdiff
path: root/drivers/ddr
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2018-01-18 17:16:09 +1300
committerStefan Roese <sr@denx.de>2018-01-19 16:30:29 +0100
commit8bddf678dbe3c766d4f1c242cda3b9e3ed9e2425 (patch)
tree79398711daa0e2f0dacbef1b99943e9519fbbaa2 /drivers/ddr
parent2efd27f76ae027deba2a1aaadeece80362ba6297 (diff)
downloadu-boot-8bddf678dbe3c766d4f1c242cda3b9e3ed9e2425.zip
u-boot-8bddf678dbe3c766d4f1c242cda3b9e3ed9e2425.tar.gz
u-boot-8bddf678dbe3c766d4f1c242cda3b9e3ed9e2425.tar.bz2
ddr: marvell: update additional ODT setting
The RD_SAMPLE_DELAY field is 5 bits so it needs to be masked with 0x1f instead of 0xf. Rather than checking the read sample delay for all DDR chip selects use the values for the chip selects that are actually configured. Finally continue searching for the max_phase value even if the current read_sample is the same as the max_read_sample. Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/ddr')
-rw-r--r--drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c b/drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c
index 56fce17..1fc173b 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c
@@ -17,7 +17,7 @@
#define VREF_MAX_INDEX 7
#define MAX_VALUE (1024 - 1)
#define MIN_VALUE (-MAX_VALUE)
-#define GET_RD_SAMPLE_DELAY(data, cs) ((data >> rd_sample_mask[cs]) & 0xf)
+#define GET_RD_SAMPLE_DELAY(data, cs) ((data >> rd_sample_mask[cs]) & 0x1f)
u32 ck_delay = (u32)-1, ck_delay_16 = (u32)-1;
u32 ca_delay;
@@ -49,7 +49,7 @@ static u32 rd_sample_mask[] = {
*/
int ddr3_tip_write_additional_odt_setting(u32 dev_num, u32 if_id)
{
- u32 cs_num = 0, max_read_sample = 0, min_read_sample = 0;
+ u32 cs_num = 0, max_cs = 0, max_read_sample = 0, min_read_sample = 0x1f;
u32 data_read[MAX_INTERFACE_NUM] = { 0 };
u32 read_sample[MAX_CS_NUM];
u32 val;
@@ -66,15 +66,19 @@ int ddr3_tip_write_additional_odt_setting(u32 dev_num, u32 if_id)
data_read, MASK_ALL_BITS));
val = data_read[if_id];
- for (cs_num = 0; cs_num < MAX_CS_NUM; cs_num++) {
+ max_cs = hws_ddr3_tip_max_cs_get();
+
+ for (cs_num = 0; cs_num < max_cs; cs_num++) {
read_sample[cs_num] = GET_RD_SAMPLE_DELAY(val, cs_num);
/* find maximum of read_samples */
if (read_sample[cs_num] >= max_read_sample) {
- if (read_sample[cs_num] == max_read_sample)
- max_phase = MIN_VALUE;
- else
+ if (read_sample[cs_num] == max_read_sample) {
+ /* search for max phase */;
+ } else {
max_read_sample = read_sample[cs_num];
+ max_phase = MIN_VALUE;
+ }
for (pup_index = 0;
pup_index < tm->num_of_bus_per_interface;
@@ -97,10 +101,12 @@ int ddr3_tip_write_additional_odt_setting(u32 dev_num, u32 if_id)
min_read_sample = read_sample[cs_num];
}
+ if (min_read_sample <= tm->interface_params[if_id].cas_l) {
+ min_read_sample = (int)tm->interface_params[if_id].cas_l;
+ }
+
min_read_sample = min_read_sample - 1;
max_read_sample = max_read_sample + 4 + (max_phase + 1) / 2 + 1;
- if (min_read_sample >= 0xf)
- min_read_sample = 0xf;
if (max_read_sample >= 0x1f)
max_read_sample = 0x1f;