Commit 32826368 authored by Lad Prabhakar's avatar Lad Prabhakar Committed by Lorenzo Pieralisi

PCI: rcar: Fix calculating mask for PCIEPAMR register

The mask value was calculated incorrectly for PCIEPAMR register if the
size was less than 128 bytes. Fix this issue by adding a check on size.

Link: https://lore.kernel.org/r/1588854799-13710-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.comSigned-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
parent 78a0d7f2
...@@ -76,7 +76,10 @@ void rcar_pcie_set_outbound(struct rcar_pcie *pcie, int win, ...@@ -76,7 +76,10 @@ void rcar_pcie_set_outbound(struct rcar_pcie *pcie, int win,
* keeps things pretty simple. * keeps things pretty simple.
*/ */
size = resource_size(res); size = resource_size(res);
mask = (roundup_pow_of_two(size) / SZ_128) - 1; if (size > 128)
mask = (roundup_pow_of_two(size) / SZ_128) - 1;
else
mask = 0x0;
rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
if (res->flags & IORESOURCE_IO) if (res->flags & IORESOURCE_IO)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment