summaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-orion
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-12-23 16:19:56 +0100
committerNicolas Pitre <nico@fluxnic.net>2009-12-29 05:50:49 +0100
commit7788cd5557766d49343088b2edc544b186e2fe53 (patch)
treeee2cf8fa7858b149e8f8835aa2208cb5201eb586 /arch/arm/plat-orion
parentLinux 2.6.33-rc2 (diff)
downloadlinux-7788cd5557766d49343088b2edc544b186e2fe53.tar.xz
linux-7788cd5557766d49343088b2edc544b186e2fe53.zip
[ARM] Orion: fix PCIe inbound window programming when RAM size is not a power of two
The PCIe inbound window size is supposed to be a power of two. If the total amount of RAM installed in the system is not a power of two, round it up such that it is. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r--arch/arm/plat-orion/pcie.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index d41d41d78ad9..54c84a492a0f 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -133,6 +133,12 @@ static void __init orion_pcie_setup_wins(void __iomem *base,
}
/*
+ * Round up 'size' to the nearest power of two.
+ */
+ if ((size & (size - 1)) != 0)
+ size = 1 << fls(size);
+
+ /*
* Setup BAR[1] to all DRAM banks.
*/
writel(dram->cs[0].base, base + PCIE_BAR_LO_OFF(1));