提交 11d22cc3 编写于 作者: H Hou Zhiqiang 提交者: Lorenzo Pieralisi

PCI: mobiveil: Add Header Type field check

Check the Header Type and exit from the host driver initialization if
it is not in host mode.
Signed-off-by: NHou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: NAndrew Murray <amurray@thegoodpenguin.co.uk>
上级 029dea3c
...@@ -554,6 +554,16 @@ static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie) ...@@ -554,6 +554,16 @@ static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
return mobiveil_pcie_integrated_interrupt_init(pcie); return mobiveil_pcie_integrated_interrupt_init(pcie);
} }
static bool mobiveil_pcie_is_bridge(struct mobiveil_pcie *pcie)
{
u32 header_type;
header_type = mobiveil_csr_readb(pcie, PCI_HEADER_TYPE);
header_type &= 0x7f;
return header_type == PCI_HEADER_TYPE_BRIDGE;
}
int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
{ {
struct mobiveil_root_port *rp = &pcie->rp; struct mobiveil_root_port *rp = &pcie->rp;
...@@ -569,6 +579,9 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) ...@@ -569,6 +579,9 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
return ret; return ret;
} }
if (!mobiveil_pcie_is_bridge(pcie))
return -ENODEV;
/* parse the host bridge base addresses from the device tree file */ /* parse the host bridge base addresses from the device tree file */
ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows, ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
&bridge->dma_ranges, NULL); &bridge->dma_ranges, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册