All of lore.kernel.org
 help / color / mirror / Atom feed
From: Becky Bruce <beckyb@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] board/tqm85xx: Create and tear down TLB for get_ram_size()
Date: Fri, 15 Jul 2011 17:25:39 -0500	[thread overview]
Message-ID: <13107687403141-git-send-email-beckyb@kernel.crashing.org> (raw)
In-Reply-To: <13107687401917-git-send-email-beckyb@kernel.crashing.org>

We need a TLB entry to call get_ram_size(); the common code
doesn't create one until *after* fixed_sdram() has determined
the size.  So we set up tlbs for the max possible size
and tear them down once we're done with get_ram_size(); the
common 85xx code will then set up a final set of tlb entries
for the *actual* detected size of ddr.

This prevents us from having TLB entries that are larger
than DDR sitting around for very long, which is not a recommended
scenario.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 board/tqc/tqm85xx/sdram.c |    7 +++++++
 include/configs/TQM85xx.h |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/board/tqc/tqm85xx/sdram.c b/board/tqc/tqm85xx/sdram.c
index 39a9e21..baf073e 100644
--- a/board/tqc/tqm85xx/sdram.c
+++ b/board/tqc/tqm85xx/sdram.c
@@ -363,6 +363,12 @@ static phys_size_t sdram_setup(int casl)
 	udelay (1000);
 #endif /* CONFIG_TQM8548 */
 
+	/*
+	 * get_ram_size() depends on having tlbs for the DDR, but they are
+	 * not yet setup because we don't know the size.  Set up a temp
+	 * mapping and delete it when done.
+	 */
+	setup_ddr_tlbs(CONFIG_SYS_DDR_EARLY_SIZE_MB);
 	for (i = 0; i < N_DDR_CS_CONF; i++) {
 		ddr->cs0_config = ddr_cs_conf[i].reg;
 
@@ -376,6 +382,7 @@ static phys_size_t sdram_setup(int casl)
 			break;
 		}
 	}
+	clear_ddr_tlbs(CONFIG_SYS_DDR_EARLY_SIZE_MB);
 
 #ifdef CONFIG_TQM8548
 	if (i < N_DDR_CS_CONF) {
diff --git a/include/configs/TQM85xx.h b/include/configs/TQM85xx.h
index b4eef28..0eadcd2 100644
--- a/include/configs/TQM85xx.h
+++ b/include/configs/TQM85xx.h
@@ -152,8 +152,10 @@
 	defined(CONFIG_TQM8548_AG) || \
 	defined(CONFIG_TQM8548_BE)
 #define CONFIG_SYS_PPC_DDR_WIMGE (MAS2_I | MAS2_G)
+#define CONFIG_SYS_DDR_EARLY_SIZE_MB	(512)
 #else
 #define CONFIG_SYS_PPC_DDR_WIMGE (0)
+#define CONFIG_SYS_DDR_EARLY_SIZE_MB	(2 * 1024)
 #endif
 
 #define CONFIG_SYS_SDRAM_BASE		CONFIG_SYS_DDR_SDRAM_BASE
-- 
1.5.6.5

  reply	other threads:[~2011-07-15 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15 22:25 [U-Boot] [PATCH 0/3] powerpc/85xx: Fix TQM8560 DDR boot issue Becky Bruce
2011-07-15 22:25 ` [U-Boot] [PATCH 1/3] powerpc/mpc85xx: Add clear_ddr_tlbs function Becky Bruce
2011-07-15 22:25   ` [U-Boot] [PATCH 2/3] board/tqm85xx: Clean up PPC_DDR_WIMGE define logic in config file Becky Bruce
2011-07-15 22:25     ` Becky Bruce [this message]
2011-07-15 23:37     ` Wolfgang Denk

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=13107687403141-git-send-email-beckyb@kernel.crashing.org \
    --to=beckyb@kernel.crashing.org \
    --cc=u-boot@lists.denx.de \
    /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.