提交 b169ef17 编写于 作者: M Marek Vasut

pci: renesas: Make map address and mask power of two on Gen3

Both the map address and mask must be power of two per documentation,
adjust the code accordingly.
Signed-off-by: NMarek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
上级 b9616d8f
......@@ -23,6 +23,7 @@
#include <pci.h>
#include <wait_bit.h>
#include <linux/bitops.h>
#include <linux/log2.h>
#define PCIECAR 0x000010
#define PCIECCTLR 0x000018
......@@ -347,10 +348,12 @@ static int rcar_gen3_pcie_probe(struct udevice *dev)
if (hose->regions[i].phys_start == 0)
continue;
mask = (hose->regions[i].size - 1) & ~0xf;
mask = (roundup_pow_of_two(hose->regions[i].size) - 1) & ~0xf;
mask |= LAR_ENABLE;
writel(hose->regions[i].phys_start, priv->regs + PCIEPRAR(0));
writel(hose->regions[i].phys_start, priv->regs + PCIELAR(0));
writel(rounddown_pow_of_two(hose->regions[i].phys_start),
priv->regs + PCIEPRAR(0));
writel(rounddown_pow_of_two(hose->regions[i].phys_start),
priv->regs + PCIELAR(0));
writel(mask, priv->regs + PCIELAMR(0));
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册