diff options
author | Hou Zhiqiang <Zhiqiang.Hou@nxp.com> | 2020-02-13 12:06:40 +0800 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2020-02-21 11:53:22 +0000 |
commit | 11d22cc395ca1b9ff78255edaee3bf258515ad72 (patch) | |
tree | 4858a093a4a95eb0c7f91aa9c444b0a27e0ddc0c /drivers/pci | |
parent | 029dea3cdc67690736e35b78c9d8ed6da1c9ec98 (diff) | |
download | linux-11d22cc395ca1b9ff78255edaee3bf258515ad72.tar.bz2 |
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: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c index 209e75d24e3b..a94be264240f 100644 --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c @@ -554,6 +554,16 @@ static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *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) { struct mobiveil_root_port *rp = &pcie->rp; @@ -569,6 +579,9 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) return ret; } + if (!mobiveil_pcie_is_bridge(pcie)) + return -ENODEV; + /* parse the host bridge base addresses from the device tree file */ ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows, &bridge->dma_ranges, NULL); |