ramips: fix Netgear R6220 package selection
[oweals/openwrt.git] / target / linux / lantiq / patches-4.9 / 0154-lantiq-pci-bar11mask-fix.patch
1 --- a/arch/mips/pci/pci-lantiq.c
2 +++ b/arch/mips/pci/pci-lantiq.c
3 @@ -61,6 +61,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 @@ -86,8 +88,8 @@ static inline u32 ltq_calc_bar11mask(voi
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  }