Skip to content

Commit 13f8f3d

Browse files
Richard Zhubjorn-helgaas
authored andcommitted
PCI: imx6: Set PCIE_DBI_RO_WR_EN before writing DBI registers
The PCIE_DBI_RO_WR_EN bit should be set when write some DBI registers. To make sure that the DBI registers are writable, set the PCIE_DBI_RO_WR_EN properly when writing the DBI registers. Link: https://lore.kernel.org/r/1652866528-13220-1-git-send-email-hongxing.zhu@nxp.com Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 835a345 commit 13f8f3d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,12 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
830830
* started in Gen2 mode, there is a possibility the devices on the
831831
* bus will not be detected at all. This happens with PCIe switches.
832832
*/
833+
dw_pcie_dbi_ro_wr_en(pci);
833834
tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
834835
tmp &= ~PCI_EXP_LNKCAP_SLS;
835836
tmp |= PCI_EXP_LNKCAP_SLS_2_5GB;
836837
dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
838+
dw_pcie_dbi_ro_wr_dis(pci);
837839

838840
/* Start LTSSM. */
839841
imx6_pcie_ltssm_enable(dev);
@@ -844,6 +846,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
844846

845847
if (pci->link_gen == 2) {
846848
/* Allow Gen2 mode after the link is up. */
849+
dw_pcie_dbi_ro_wr_en(pci);
847850
tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
848851
tmp &= ~PCI_EXP_LNKCAP_SLS;
849852
tmp |= PCI_EXP_LNKCAP_SLS_5_0GB;
@@ -856,6 +859,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
856859
tmp = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL);
857860
tmp |= PORT_LOGIC_SPEED_CHANGE;
858861
dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp);
862+
dw_pcie_dbi_ro_wr_dis(pci);
859863

860864
if (imx6_pcie->drvdata->flags &
861865
IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE) {

0 commit comments

Comments
 (0)