Skip to content

Commit

Permalink
[ARM] Orion: fix PCIe inbound window programming when RAM size is not…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Lennert Buytenhek authored and Nicolas Pitre committed Dec 29, 2009
1 parent 6b7b284 commit 7788cd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/arm/plat-orion/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ static void __init orion_pcie_setup_wins(void __iomem *base,
size += cs->size;
}

/*
* 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.
*/
Expand Down

0 comments on commit 7788cd5

Please sign in to comment.