patch-2.4.0-test12 linux/arch/arm/kernel/dec21285.c

Next file: linux/arch/arm/kernel/dma-arc.c
Previous file: linux/arch/arm/kernel/bios32.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test11/linux/arch/arm/kernel/dec21285.c linux/arch/arm/kernel/dec21285.c
@@ -258,17 +258,21 @@
 void __init dc21285_init(struct arm_pci_sysdata *sysdata)
 {
 	unsigned long cntl;
-	unsigned int mem_size;
+	unsigned int mem_size, mem_mask;
 	unsigned int pci_cmd = PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
 				PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
 	int cfn_mode;
 
+	mem_size = (unsigned int)high_memory - PAGE_OFFSET;
+	for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1)
+		if (mem_mask >= mem_size)
+			break;		
+
 	/*
 	 * These registers need to be set up whether we're the
 	 * central function or not.
 	 */
-	mem_size = (unsigned int)high_memory - PAGE_OFFSET;
-	*CSR_SDRAMBASEMASK    = (mem_size - 1) & 0x0ffc0000;
+	*CSR_SDRAMBASEMASK    = (mem_mask - 1) & 0x0ffc0000;
 	*CSR_SDRAMBASEOFFSET  = 0;
 	*CSR_ROMBASEMASK      = 0x80000000;
 	*CSR_CSRBASEMASK      = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)