diff mbox

[U-Boot,v3] powerpc/mpc85xx: Fix DDR TLB mapping leftover

Message ID 1417548069-32512-1-git-send-email-yorksun@freescale.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

York Sun Dec. 2, 2014, 7:21 p.m. UTC
Commit f29f804a93e87c17670607641d120f431a3b0633 generalized the TLB
mapping function, but made the DDR mapping leftover size to zero,
causing the message not printed.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Alexander Graf <agraf@suse.de>
CC: Scott Wood <scottwood@freescale.com>
---
Change log
 v3: Add checking for memsize > CONFIG_MAX_MEM_MAPPED for print_size
 v2: Fix unnecessary parentheses

 arch/powerpc/cpu/mpc85xx/tlb.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

York Sun Dec. 16, 2014, 5:18 p.m. UTC | #1
On 12/02/2014 11:21 AM, York Sun wrote:
> Commit f29f804a93e87c17670607641d120f431a3b0633 generalized the TLB
> mapping function, but made the DDR mapping leftover size to zero,
> causing the message not printed.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> CC: Alexander Graf <agraf@suse.de>
> CC: Scott Wood <scottwood@freescale.com>
> ---
> Change log
>  v3: Add checking for memsize > CONFIG_MAX_MEM_MAPPED for print_size
>  v2: Fix unnecessary parentheses
> 

Applied to u-boot-mpc85xx master, awaiting upstream.

York
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c
index 4adba95..8e0508f 100644
--- a/arch/powerpc/cpu/mpc85xx/tlb.c
+++ b/arch/powerpc/cpu/mpc85xx/tlb.c
@@ -299,12 +299,16 @@  unsigned int setup_ddr_tlbs_phys(phys_addr_t p_addr,
 {
 	unsigned int ram_tlb_address = (unsigned int)CONFIG_SYS_DDR_SDRAM_BASE;
 	u64 memsize = (u64)memsize_in_meg << 20;
+	u64 size;
 
-	memsize = min(memsize, (u64)CONFIG_MAX_MEM_MAPPED);
-	memsize = tlb_map_range(ram_tlb_address, p_addr, memsize, TLB_MAP_RAM);
+	size = min(memsize, (u64)CONFIG_MAX_MEM_MAPPED);
+	size = tlb_map_range(ram_tlb_address, p_addr, size, TLB_MAP_RAM);
 
-	if (memsize)
-		print_size(memsize, " left unmapped\n");
+	if (size || memsize > CONFIG_MAX_MEM_MAPPED) {
+		print_size(memsize > CONFIG_MAX_MEM_MAPPED ?
+			   memsize - CONFIG_MAX_MEM_MAPPED + size : size,
+			   " left unmapped\n");
+	}
 
 	return memsize_in_meg;
 }