0f564c4d575f6c1f420621c6482ebeef3ab606d6
[openwrt/openwrt.git] / target / linux / lantiq / patches-4.4 / 0154-lantiq-pci-bar11mask-fix.patch
1 --- a/arch/mips/pci/pci-lantiq.c
2 +++ b/arch/mips/pci/pci-lantiq.c
3 @@ -62,6 +62,8 @@
4 #define ltq_pci_cfg_w32(x, y) ltq_w32((x), ltq_pci_mapped_cfg + (y))
5 #define ltq_pci_cfg_r32(x) ltq_r32(ltq_pci_mapped_cfg + (x))
6
7 +extern u32 max_low_pfn;
8 +
9 __iomem void *ltq_pci_mapped_cfg;
10 static __iomem void *ltq_pci_membase;
11
12 @@ -87,8 +89,8 @@
13 u32 mem, bar11mask;
14
15 /* BAR11MASK value depends on available memory on system. */
16 - mem = get_num_physpages() * PAGE_SIZE;
17 - bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8;
18 + mem = max_low_pfn << PAGE_SHIFT;
19 + bar11mask = ((-roundup_pow_of_two(mem)) & 0x0F000000) | 8;
20
21 return bar11mask;
22 }