@@ -221,6 +221,13 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie)
{
u32 value, pab_ctrl, type;
struct resource_entry *win;
+ int i;
+
+ /* Disable all inbound/outbound windows */
+ for (i = 0; i < pcie->apio_wins; i++)
+ mobiveil_pcie_disable_ob_win(pcie, i);
+ for (i = 0; i < pcie->ppio_wins; i++)
+ mobiveil_pcie_disable_ib_win(pcie, i);
/* setup bus numbers */
value = csr_readl(pcie, PCI_PRIMARY_BUS);
@@ -226,3 +226,21 @@ int mobiveil_bringup_link(struct mobiveil_pcie *pcie)
return -ETIMEDOUT;
}
+
+void mobiveil_pcie_disable_ib_win(struct mobiveil_pcie *pci, int win_num)
+{
+ u32 val;
+
+ val = csr_readl(pci, PAB_PEX_AMAP_CTRL(win_num));
+ val &= ~(1 << AMAP_CTRL_EN_SHIFT);
+ csr_writel(pci, val, PAB_PEX_AMAP_CTRL(win_num));
+}
+
+void mobiveil_pcie_disable_ob_win(struct mobiveil_pcie *pci, int win_num)
+{
+ u32 val;
+
+ val = csr_readl(pci, PAB_AXI_AMAP_CTRL(win_num));
+ val &= ~(1 << WIN_ENABLE_SHIFT);
+ csr_writel(pci, val, PAB_AXI_AMAP_CTRL(win_num));
+}
@@ -171,6 +171,8 @@ void program_ob_windows(struct mobiveil_pcie *pcie, int win_num, u64 cpu_addr,
u64 pci_addr, u32 type, u64 size);
void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, u64 cpu_addr,
u64 pci_addr, u32 type, u64 size);
+void mobiveil_pcie_disable_ob_win(struct mobiveil_pcie *pci, int win_num);
+void mobiveil_pcie_disable_ib_win(struct mobiveil_pcie *pci, int win_num);
u32 csr_read(struct mobiveil_pcie *pcie, u32 off, size_t size);
void csr_write(struct mobiveil_pcie *pcie, u32 val, u32 off, size_t size);