MLK-15343-3 PCI: imx: enable the DBI_RO_WR_EN of PCIEB
authorRichard Zhu <hongxing.zhu@nxp.com>
Mon, 14 Jan 2019 08:41:21 +0000 (14:11 +0530)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
The DBI_RO_WR_EN of PCIEB should be asserted,
otherwise the CLASS_DEVICE can't be configured
correctly, then PCIEB RC doesn't work at all.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
drivers/pci/controller/dwc/pci-imx6.c

index ed58b91..780f7db 100644 (file)
@@ -126,6 +126,9 @@ struct imx6_pcie {
 #define PCIE_LINK_WIDTH_SPEED_CONTROL  0x80C
 #define PORT_LOGIC_SPEED_CHANGE                (0x1 << 17)
 
+#define PCIE_MISC_CTRL                 (PL_OFFSET + 0x1BC)
+#define PCIE_MISC_DBI_RO_WR_EN         BIT(0)
+
 /* PHY registers (not memory-mapped) */
 #define PCIE_PHY_RX_ASIC_OUT 0x100D
 #define PCIE_PHY_RX_ASIC_OUT_VALID     (1 << 0)
@@ -1293,6 +1296,12 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
        else
                pp->cpu_addr_offset = 0;
 
+       if (imx6_pcie->variant == IMX8QM) {
+               if (dw_pcie_readl_dbi(pci, PCIE_MISC_CTRL) == 0)
+                       dw_pcie_writel_dbi(pci, PCIE_MISC_CTRL,
+                                       PCIE_MISC_DBI_RO_WR_EN);
+       }
+
        dw_pcie_setup_rc(pp);
        ret = imx6_pcie_establish_link(imx6_pcie);
        if (ret < 0)