All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentine Barshak <vbarshak@ru.mvista.com>
To: linuxppc-dev@ozlabs.org
Cc: lebon@lebon.org.ua
Subject: [PATCH] PowerPC 440EPx/GRx fix memory size calculation
Date: Tue, 10 Mar 2009 22:50:13 +0300	[thread overview]
Message-ID: <20090310195013.GA27835@ru.mvista.com> (raw)
In-Reply-To: <49B58779.9040905@lebon.org.ua>

I was just going to submit a patch for that too.
Indeed, the denali_fixup_memsize() miscalculated a couple of address
field widths. We were lucky to eventually get the right result,
because the effect of the first error was killed by the other one.
According to the AMCC 440EPX/GRX user manual,
the Chip Select width is always fixed at 1 bit no matter
what is actually read from register DDR_10.
The workaround is to use a predefined chipselect value for 440EPx/GRx.
Also, setting the REDUC bit (REDUC = 1) enables 32-bit data path.
If REDUC = 0, full data path of 64 bits is used.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Mikhail Zolotaryov <lebon@lebon.org.ua>


--- a/arch/powerpc/boot/4xx.c	2008-04-26 02:18:34.000000000 +0400
+++ b/arch/powerpc/boot/4xx.c	2008-10-26 01:40:27.000000000 +0400
@@ -173,15 +173,20 @@ void ibm4xx_denali_fixup_memsize(void)
 	max_col = DDR_GET_VAL(val, DDR_MAX_COL_REG, DDR_MAX_COL_REG_SHIFT);
 	max_row = DDR_GET_VAL(val, DDR_MAX_ROW_REG, DDR_MAX_ROW_REG_SHIFT);
 
-	/* get CS value */
-	val = SDRAM0_READ(DDR0_10);
-
-	val = DDR_GET_VAL(val, DDR_CS_MAP, DDR_CS_MAP_SHIFT);
-	cs = 0;
-	while (val) {
-		if (val & 0x1)
-			cs++;
-		val = val >> 1;
+	/* 440EPx/GRx chipselect always fixed at 1 bit */
+	if ((mfpvr() & 0xf0000ff0) == 0x200008D0)
+		cs = 1;
+	else {
+		/* get CS value */
+		val = SDRAM0_READ(DDR0_10);
+		val = DDR_GET_VAL(val, DDR_CS_MAP, DDR_CS_MAP_SHIFT);
+
+		cs = 0;
+		while (val) {
+			if (val & 0x1)
+				cs++;
+			val = val >> 1;
+		}
 	}
 
 	if (!cs)
@@ -192,7 +197,7 @@ void ibm4xx_denali_fixup_memsize(void)
 	/* get data path bytes */
 	val = SDRAM0_READ(DDR0_14);
 
-	if (DDR_GET_VAL(val, DDR_REDUC, DDR_REDUC_SHIFT))
+	if (!DDR_GET_VAL(val, DDR_REDUC, DDR_REDUC_SHIFT))
 		dpath = 8; /* 64 bits */
 	else
 		dpath = 4; /* 32 bits */

  reply	other threads:[~2009-03-10 20:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-09 16:21 [PATCH] powerpc 4xx: DDR0_14[REDUC] decoded incorrectly Mikhail Zolotaryov
2009-03-09 16:21 ` Mikhail Zolotaryov
2009-03-09 17:12 ` Josh Boyer
2009-03-09 17:12   ` Josh Boyer
2009-03-09 21:17   ` Mikhail Zolotaryov
2009-03-09 21:17     ` Mikhail Zolotaryov
2009-03-10 19:50     ` Valentine Barshak [this message]
2009-03-10 20:57       ` [PATCH] PowerPC 440EPx/GRx fix memory size calculation Mikhail Zolotaryov
2009-03-11  1:40         ` Valentine
2009-03-11  2:26           ` Benjamin Herrenschmidt
2009-03-11  8:24             ` Mikhail Zolotaryov
2009-03-11  8:29           ` Mikhail Zolotaryov
2009-03-11 10:37       ` Josh Boyer
2009-03-11 19:06         ` Valentine Barshak
2009-03-11 21:57           ` Josh Boyer
2009-03-11 22:08             ` Valentine
2009-03-11 23:07               ` Josh Boyer
2009-03-12  6:02           ` Stefan Roese
2009-03-12  7:32             ` Benjamin Herrenschmidt
2009-03-12  8:05               ` Stefan Roese
2009-03-12  8:12                 ` Benjamin Herrenschmidt
2009-03-12  8:24                   ` Stefan Roese
2009-03-12  8:45                     ` Mikhail Zolotaryov
2009-03-12 10:45                     ` Josh Boyer
2009-03-12 11:02                       ` Stefan Roese
2009-03-13 23:01             ` Feng Kan

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=20090310195013.GA27835@ru.mvista.com \
    --to=vbarshak@ru.mvista.com \
    --cc=lebon@lebon.org.ua \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.