]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
powerpc/fsl-pci: Better ATMU setup for 85xx/86xx
authorTrent Piepho <tpiepho@freescale.com>
Wed, 7 Jan 2009 04:37:53 +0000 (22:37 -0600)
committerKumar Gala <galak@kernel.crashing.org>
Wed, 7 Jan 2009 21:32:54 +0000 (15:32 -0600)
commita097a78c1e6e4030fcef3bcab6351b6001662335
treea53b0476cf04414fdd6af19025a428305157051e
parentfdd4e8152f5f0d6d500b35515265e425acdfd203
powerpc/fsl-pci: Better ATMU setup for 85xx/86xx

The code that sets up the outbound ATMU windows, which is used to map CPU
physical addresses into PCI bus addresses where BARs will be mapped, didn't
work so well.

For one, it leaked the ioremap() of the ATMU registers.  Another small bug
was the high 20 bits of the PCI bus address were left as zero.  It's legal
for prefetchable memory regions to be above 32 bits, so the high 20 bits
might not be zero.

Mainly, it couldn't handle ranges that were not a power of two in size or
were not naturally aligned.  The ATMU windows have these requirements (size
& alignment), but the code didn't bother to check if the ranges it was
programming met them.  If they didn't, the windows would silently be
programmed incorrectly.

This new code can handle ranges which are not power of two sized nor
naturally aligned.  It simply splits the ranges into multiple valid ATMU
windows.  As there are only four windows, pooly aligned or sized ranges
(which didn't even work before) may run out of windows.  In this case an
error is printed and an effort is made to disable the unmapped resources.

An improvement that could be made would be to make use of the default
outbound window.  Iff hose->pci_mem_offset is zero, then it's possible that
some or all of the ranges might not need an outbound window and could just
use the default window.

The default ATMU window can support a pci_mem_offset less than zero too,
but pci_mem_offset is unsigned.  One could say the abilities allowed a
powerpc pci_controller is neither subset nor a superset of the abilities of
a Freescale PCIe controller.  Thankfully, the most useful bits are in the
intersection of the two abilities.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/sysdev/fsl_pci.c