diff options
author | John Crispin <blogic@openwrt.org> | 2010-03-18 09:20:43 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2010-03-18 09:20:43 +0000 |
commit | 2a08991204a86280c323a4b6662a2674c7eec3b0 (patch) | |
tree | c71d5c11f2a5864921fcd1eb283279199975f386 /target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c | |
parent | 70209c3b339d5cced0f08b41ec9669c0bfd7b142 (diff) | |
download | upstream-2a08991204a86280c323a4b6662a2674c7eec3b0.tar.gz upstream-2a08991204a86280c323a4b6662a2674c7eec3b0.tar.bz2 upstream-2a08991204a86280c323a4b6662a2674c7eec3b0.zip |
[ifxmips] Calculate PCI BARMASK11 register value dynamicly, signed off by Ithamar R. Adema
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20262 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c')
-rw-r--r-- | target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c b/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c index e50cb3bdc9..64f37d5564 100644 --- a/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c +++ b/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c @@ -89,6 +89,17 @@ pcibios_plat_dev_init(struct pci_dev *dev) return 0; } +static u32 calc_bar11mask(void) +{ + u32 mem, bar11mask; + + /* BAR11MASK value depends on available memory on system. */ + mem = num_physpages * PAGE_SIZE; + bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) -1)) -1)) | 8; + + return bar11mask; +} + static void __init ifxmips_pci_startup(void) { @@ -138,7 +149,7 @@ ifxmips_pci_startup(void) ifxmips_w32(0x19800000, PCI_CR_FCI_ADDR_MAP6); ifxmips_w32(0x19c00000, PCI_CR_FCI_ADDR_MAP7); ifxmips_w32(0x1ae00000, PCI_CR_FCI_ADDR_MAP11hg); - ifxmips_w32(0x0e000008, PCI_CR_BAR11MASK); + ifxmips_w32(calc_bar11mask(), PCI_CR_BAR11MASK); ifxmips_w32(0, PCI_CR_PCI_ADDR_MAP11); ifxmips_w32(0, PCI_CS_BASE_ADDR1); #ifdef CONFIG_SWAP_IO_SPACE |