aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/controller
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2019-03-06 16:30:23 -0500
committerBjorn Helgaas <bhelgaas@google.com>2019-03-06 16:30:23 -0500
commitd00aaa88c33a9df2ce72a1cffd940c2338801046 (patch)
tree7e06f20cf99b48f41c0d3666e10f187014e287f9 /drivers/pci/controller
parenta8e04a7a7f547f46089c517b664138c89a11c0f2 (diff)
parentcbe3a7728c7ad4721677208e155db06f67eb57d2 (diff)
Merge branch 'remotes/lorenzo/pci/mediatek'
- Fix mediatek MMIO size computation to enable full size of available MMIO space (Honghui Zhang) - Fix mediatek DMA window size computation to allow endpoint DMA access to full DRAM address range (Honghui Zhang) * remotes/lorenzo/pci/mediatek: PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM PCI: mediatek: Fix memory mapped IO range size computation
Diffstat (limited to 'drivers/pci/controller')
-rw-r--r--drivers/pci/controller/pcie-mediatek.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index 55e471c18e8d..0b6c72804e03 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -90,6 +90,12 @@
90#define AHB2PCIE_SIZE(x) ((x) & GENMASK(4, 0)) 90#define AHB2PCIE_SIZE(x) ((x) & GENMASK(4, 0))
91#define PCIE_AXI_WINDOW0 0x448 91#define PCIE_AXI_WINDOW0 0x448
92#define WIN_ENABLE BIT(7) 92#define WIN_ENABLE BIT(7)
93/*
94 * Define PCIe to AHB window size as 2^33 to support max 8GB address space
95 * translate, support least 4GB DRAM size access from EP DMA(physical DRAM
96 * start from 0x40000000).
97 */
98#define PCIE2AHB_SIZE 0x21
93 99
94/* PCIe V2 configuration transaction header */ 100/* PCIe V2 configuration transaction header */
95#define PCIE_CFG_HEADER0 0x460 101#define PCIE_CFG_HEADER0 0x460
@@ -654,7 +660,6 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
654 struct resource *mem = &pcie->mem; 660 struct resource *mem = &pcie->mem;
655 const struct mtk_pcie_soc *soc = port->pcie->soc; 661 const struct mtk_pcie_soc *soc = port->pcie->soc;
656 u32 val; 662 u32 val;
657 size_t size;
658 int err; 663 int err;
659 664
660 /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */ 665 /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */
@@ -706,15 +711,15 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
706 mtk_pcie_enable_msi(port); 711 mtk_pcie_enable_msi(port);
707 712
708 /* Set AHB to PCIe translation windows */ 713 /* Set AHB to PCIe translation windows */
709 size = mem->end - mem->start; 714 val = lower_32_bits(mem->start) |
710 val = lower_32_bits(mem->start) | AHB2PCIE_SIZE(fls(size)); 715 AHB2PCIE_SIZE(fls(resource_size(mem)));
711 writel(val, port->base + PCIE_AHB_TRANS_BASE0_L); 716 writel(val, port->base + PCIE_AHB_TRANS_BASE0_L);
712 717
713 val = upper_32_bits(mem->start); 718 val = upper_32_bits(mem->start);
714 writel(val, port->base + PCIE_AHB_TRANS_BASE0_H); 719 writel(val, port->base + PCIE_AHB_TRANS_BASE0_H);
715 720
716 /* Set PCIe to AXI translation memory space.*/ 721 /* Set PCIe to AXI translation memory space.*/
717 val = fls(0xffffffff) | WIN_ENABLE; 722 val = PCIE2AHB_SIZE | WIN_ENABLE;
718 writel(val, port->base + PCIE_AXI_WINDOW0); 723 writel(val, port->base + PCIE_AXI_WINDOW0);
719 724
720 return 0; 725 return 0;