Commit 1195c103 authored by Minghuan Lian's avatar Minghuan Lian Committed by Bjorn Helgaas

PCI: layerscape: Fix MSG TLP drop setting

Some kinds of Layerscape PCIe controllers will forward the received message
TLPs to system application address space, which could corrupt system memory
or lead to a system hang.  Enable MSG_DROP to fix this issue.
Signed-off-by: default avatarMinghuan Lian <Minghuan.Lian@nxp.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 79e3f4a8
...@@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_pcie *pcie) ...@@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_pcie *pcie)
iowrite16(PCI_CLASS_BRIDGE_PCI, pcie->dbi + PCI_CLASS_DEVICE); iowrite16(PCI_CLASS_BRIDGE_PCI, pcie->dbi + PCI_CLASS_DEVICE);
} }
/* Drop MSG TLP except for Vendor MSG */
static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie)
{
u32 val;
val = ioread32(pcie->dbi + PCIE_STRFMR1);
val &= 0xDFFFFFFF;
iowrite32(val, pcie->dbi + PCIE_STRFMR1);
}
static int ls1021_pcie_link_up(struct pcie_port *pp) static int ls1021_pcie_link_up(struct pcie_port *pp)
{ {
u32 state; u32 state;
...@@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pcie_port *pp) ...@@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pcie_port *pp)
static void ls1021_pcie_host_init(struct pcie_port *pp) static void ls1021_pcie_host_init(struct pcie_port *pp)
{ {
struct ls_pcie *pcie = to_ls_pcie(pp); struct ls_pcie *pcie = to_ls_pcie(pp);
u32 val, index[2]; u32 index[2];
pcie->scfg = syscon_regmap_lookup_by_phandle(pp->dev->of_node, pcie->scfg = syscon_regmap_lookup_by_phandle(pp->dev->of_node,
"fsl,pcie-scfg"); "fsl,pcie-scfg");
...@@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct pcie_port *pp) ...@@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)
dw_pcie_setup_rc(pp); dw_pcie_setup_rc(pp);
/* ls_pcie_drop_msg_tlp(pcie);
* LS1021A Workaround for internal TKT228622
* to fix the INTx hang issue
*/
val = ioread32(pcie->dbi + PCIE_STRFMR1);
val &= 0xffff;
iowrite32(val, pcie->dbi + PCIE_STRFMR1);
} }
static int ls_pcie_link_up(struct pcie_port *pp) static int ls_pcie_link_up(struct pcie_port *pp)
...@@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pcie_port *pp) ...@@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pcie_port *pp)
iowrite32(1, pcie->dbi + PCIE_DBI_RO_WR_EN); iowrite32(1, pcie->dbi + PCIE_DBI_RO_WR_EN);
ls_pcie_fix_class(pcie); ls_pcie_fix_class(pcie);
ls_pcie_clear_multifunction(pcie); ls_pcie_clear_multifunction(pcie);
ls_pcie_drop_msg_tlp(pcie);
iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN); iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN);
} }
......
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