From: Ladislav Michl <ladis@linux-mips.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org, 张忠山 <zzs213@126.com>
Subject: Re: maybe bug in common/ddr_spd.c
Date: Thu, 11 Apr 2019 10:03:38 +0200 [thread overview]
Message-ID: <20190411080338.GA15306@lenoch> (raw)
In-Reply-To: <20190410164937.GA2467@lenoch>
On Wed, Apr 10, 2019 at 06:49:38PM +0200, Ladislav Michl wrote:
> On Wed, Apr 10, 2019 at 08:26:40AM +0200, Sascha Hauer wrote:
> > On Tue, Apr 09, 2019 at 05:56:53PM +0800, 张忠山 wrote:
> > > Maybe this is a bug, I'm not sure
> > >
> > > -----------------------------------8<-----------------------------
> > > From 55509f359abbb1f5c24e9f0c2b9cff167f62ae4d Mon Sep 17 00:00:00 2001
> > > From: =?UTF-8?q?=E5=BC=A0=E5=BF=A0=E5=B1=B1?= <zzs213@126.com>
> > > Date: Mon, 8 Apr 2019 14:34:00 +0800
> > > Subject: [PATCH] bugfix: check ddr mod_ranks
> > > MIME-Version: 1.0
> > > Content-Type: text/plain; charset=UTF-8
> > > Content-Transfer-Encoding: 8bit
> > >
> > > Signed-off-by: 张忠山 <zzs213@126.com>
> > > ---
> > > common/ddr_spd.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/common/ddr_spd.c b/common/ddr_spd.c
> > > index ec343ef5a..277d418e9 100644
> > > --- a/common/ddr_spd.c
> > > +++ b/common/ddr_spd.c
> > > @@ -253,7 +253,7 @@ void ddr_spd_print(uint8_t *record)
> > > printf("Error module type\n");
> > >
> > > printf("%-48s ", "DRAM Package ");
> > > - if ((s->mod_ranks & 0x10) == 1)
> > > + if ((s->mod_ranks & 0x10) != 0)
> >
> > For sure this is buggy. Applied, thanks
>
> I know it is too late already, but isn't
> if (s->mod_ranks & 0x10)
> a bit more usual fix?
Hmm, actually there's some more comparsion worth verifying as shown
bellow:
diff --git a/common/ddr_spd.c b/common/ddr_spd.c
index 0ba5eacea..7c9abeead 100644
--- a/common/ddr_spd.c
+++ b/common/ddr_spd.c
@@ -256,7 +256,7 @@ void ddr_spd_print(uint8_t *record)
ctime = ddr2_sdram_ctime(s->clk_cycle);
ddrclk = 2 * (100000 / ctime);
tbits = (s->res_7 << 8) + (s->dataw);
- if ((s->config & 0x03) == 1)
+ if (s->config & 0x01)
tbits = tbits - 8;
pcclk = ddrclk * tbits / 8;
@@ -325,7 +325,7 @@ void ddr_spd_print(uint8_t *record)
printf("Error module type\n");
printf("%-48s ", "DRAM Package ");
- if ((s->mod_ranks & 0x10) == 1)
+ if (s->mod_ranks & 0x10)
printf("Stack\n");
else
printf("Planar\n");
@@ -341,7 +341,7 @@ void ddr_spd_print(uint8_t *record)
if (parity == 0)
printf("No Parity\n");
- if ((parity & 0x03) == 0x01)
+ if (parity & 0x01)
printf("Data Parity\n");
if (parity & 0x02)
printf("Data ECC\n");
@@ -349,7 +349,7 @@ void ddr_spd_print(uint8_t *record)
if (parity & 0x04)
printf("Address/Command Parity\n");
- if ((s->refresh >> 7) == 1)
+ if (s->refresh & 0x80)
ref = "- Self Refresh";
else
ref = " ";
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2019-04-11 8:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 9:56 张忠山
2019-04-10 6:26 ` Sascha Hauer
2019-04-10 16:49 ` Ladislav Michl
2019-04-11 8:03 ` Ladislav Michl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190411080338.GA15306@lenoch \
--to=ladis@linux-mips.org \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=zzs213@126.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox