All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next: 3.16] MIPS: BCM47XX: Slightly clean memory detection
@ 2014-04-19 10:49 Rafał Miłecki
  2014-05-30  8:45 ` Rafał Miłecki
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-04-19 10:49 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle; +Cc: Hauke Mehrtens, Rafał Miłecki

Patch was tested on devices with 64 MiB and 256 MiB of RAM.
It documents every part nicely and drops this hacky part of code:
max = off | ((128 << 20) - 1);

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 arch/mips/bcm47xx/prom.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 0af808d..1a03a2f 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -69,15 +69,18 @@ static __init void prom_init_mem(void)
 	 * BCM47XX uses 128MB for addressing the ram, if the system contains
 	 * less that that amount of ram it remaps the ram more often into the
 	 * available space.
-	 * Accessing memory after 128MB will cause an exception.
-	 * max contains the biggest possible address supported by the platform.
-	 * If the method wants to try something above we assume 128MB ram.
 	 */
-	off = (unsigned long)prom_init;
-	max = off | ((128 << 20) - 1);
-	for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
-		if ((off + mem) > max) {
-			mem = (128 << 20);
+
+	/* Physical address, without mapping to any kernel segment */
+	off = CPHYSADDR((unsigned long)prom_init);
+
+	/* Accessing memory after 128 MiB will cause an exception */
+	max = 128 << 20;
+
+	for (mem = 1 << 20; mem < max; mem += 1 << 20) {
+		/* Loop condition may be not enough, off may be over 1 MiB */
+		if (off + mem >= max) {
+			mem = max;
 			printk(KERN_DEBUG "assume 128MB RAM\n");
 			break;
 		}
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next: 3.16] MIPS: BCM47XX: Slightly clean memory detection
  2014-04-19 10:49 [PATCH][next: 3.16] MIPS: BCM47XX: Slightly clean memory detection Rafał Miłecki
@ 2014-05-30  8:45 ` Rafał Miłecki
  2014-05-30  9:05   ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-05-30  8:45 UTC (permalink / raw)
  To: linux-mips@linux-mips.org, Ralf Baechle
  Cc: Hauke Mehrtens, Rafał Miłecki

On 19 April 2014 12:49, Rafał Miłecki <zajec5@gmail.com> wrote:
> Patch was tested on devices with 64 MiB and 256 MiB of RAM.
> It documents every part nicely and drops this hacky part of code:
> max = off | ((128 << 20) - 1);

I can't see this patch in any git tree. Am I missing some, or was this
patch forgotten?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next: 3.16] MIPS: BCM47XX: Slightly clean memory detection
  2014-05-30  8:45 ` Rafał Miłecki
@ 2014-05-30  9:05   ` Ralf Baechle
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2014-05-30  9:05 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-mips@linux-mips.org, Hauke Mehrtens

On Fri, May 30, 2014 at 10:45:41AM +0200, Rafał Miłecki wrote:

> On 19 April 2014 12:49, Rafał Miłecki <zajec5@gmail.com> wrote:
> > Patch was tested on devices with 64 MiB and 256 MiB of RAM.
> > It documents every part nicely and drops this hacky part of code:
> > max = off | ((128 << 20) - 1);
> 
> I can't see this patch in any git tree. Am I missing some, or was this
> patch forgotten?

Nope - if it's in patchwork it's not forgotten.  Just slightly burried.
Really, patchwork is the ledger.  If a patch is there, don't resend or
I will hate you ;-)  If it's not there but should be, enquire.  If it's
marked "Accepted" but doesn't show up anywhere - enquire.

  Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-30  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-19 10:49 [PATCH][next: 3.16] MIPS: BCM47XX: Slightly clean memory detection Rafał Miłecki
2014-05-30  8:45 ` Rafał Miłecki
2014-05-30  9:05   ` Ralf Baechle

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.