public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/10] arm: mvebu: Flush caches and disable MMU only on A38x
Date: Thu, 23 Jul 2015 10:26:14 +0200	[thread overview]
Message-ID: <1437639980-16286-4-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1437639980-16286-1-git-send-email-sr@denx.de>

Only with disabled MMU its possible to switch the base register address
on Armada 38x. Without this the SDRAM located at >= 0x4000.0000 is also
not accessible, as its still locked to cache.

So to fully release / unlock this area from cache, we need to first
flush all caches, then disable the MMU and disable the L2 cache.

On Armada XP this does not seem to be needed. Even worse, with this
code added, I sometimes see strange input charactes loss from the
console.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
---
 arch/arm/mach-mvebu/cpu.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 7335620..23c2a97 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -183,13 +183,25 @@ static void set_cbar(u32 addr)
 int arch_cpu_init(void)
 {
 #ifndef CONFIG_SPL_BUILD
-	/*
-	 * Only with disabled MMU its possible to switch the base
-	 * register address on Armada 38x. Without this the SDRAM
-	 * located at >= 0x4000.0000 is also not accessible, as its
-	 * still locked to cache.
-	 */
-	mmu_disable();
+	if (mvebu_soc_family() == MVEBU_SOC_A38X) {
+		struct pl310_regs *const pl310 =
+			(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
+
+		/*
+		 * Only with disabled MMU its possible to switch the base
+		 * register address on Armada 38x. Without this the SDRAM
+		 * located at >= 0x4000.0000 is also not accessible, as its
+		 * still locked to cache.
+		 *
+		 * So to fully release / unlock this area from cache, we need
+		 * to first flush all caches, then disable the MMU and
+		 * disable the L2 cache.
+		 */
+		icache_disable();
+		dcache_disable();
+		mmu_disable();
+		clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
+	}
 #endif
 
 	/* Linux expects the internal registers to be at 0xf1000000 */
-- 
2.4.6

  parent reply	other threads:[~2015-07-23  8:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23  8:26 [U-Boot] [PATCH 01/10] arm: marvell: Increase MAXARGS to 32 Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 02/10] arm: mvebu: Change MBUS base addresses and sizes Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 03/10] arm: mvebu: Setup the MBUS bridge registers Stefan Roese
2015-07-23  8:26 ` Stefan Roese [this message]
2015-07-23  8:26 ` [U-Boot] [PATCH 05/10] arm: mvebu: Disable MBUS error propagation Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 06/10] mtd: nand: Add mvebu (PXA / AXP / A38x) NAND device driver Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 07/10] arm: mvebu: Enable NAND controller on MVEBU SoC's Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 08/10] arm: mvebu: Enable NAND on db-mv784mp-gp Stefan Roese
2015-07-23  8:26 ` [U-Boot] [PATCH 09/10] arm: mvebu: Enable USB EHCI support on Armada XP Stefan Roese
2015-07-23  8:38   ` Marek Vasut
2015-07-23  8:26 ` [U-Boot] [PATCH 10/10] arm: mvebu: db-mv785mp-gp: Add USB/EHCI support Stefan Roese

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=1437639980-16286-4-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox