Commit 2ba24842 authored by Hou Zhiqiang's avatar Hou Zhiqiang Committed by Lorenzo Pieralisi

PCI: mobiveil: Move the host initialization into a function

Move the host initialization related operations into a new
function so that it can be reused by other platform
PCIe host drivers integrating the Mobiveil GPEX.
Signed-off-by: default avatarHou Zhiqiang <Zhiqiang.Hou@nxp.com>
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: default avatarAndrew Murray <amurray@thegoodpenguin.co.uk>
parent 1f442218
...@@ -873,27 +873,15 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie) ...@@ -873,27 +873,15 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie)
return 0; return 0;
} }
static int mobiveil_pcie_probe(struct platform_device *pdev) static int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
{ {
struct mobiveil_pcie *pcie; struct mobiveil_root_port *rp = &pcie->rp;
struct pci_host_bridge *bridge = rp->bridge;
struct device *dev = &pcie->pdev->dev;
struct pci_bus *bus; struct pci_bus *bus;
struct pci_bus *child; struct pci_bus *child;
struct pci_host_bridge *bridge;
struct device *dev = &pdev->dev;
struct mobiveil_root_port *rp;
int ret; int ret;
/* allocate the PCIe port */
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
return -ENOMEM;
pcie = pci_host_bridge_priv(bridge);
rp = &pcie->rp;
rp->bridge = bridge;
pcie->pdev = pdev;
ret = mobiveil_pcie_parse_dt(pcie); ret = mobiveil_pcie_parse_dt(pcie);
if (ret) { if (ret) {
dev_err(dev, "Parsing DT failed, ret: %x\n", ret); dev_err(dev, "Parsing DT failed, ret: %x\n", ret);
...@@ -956,6 +944,25 @@ static int mobiveil_pcie_probe(struct platform_device *pdev) ...@@ -956,6 +944,25 @@ static int mobiveil_pcie_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int mobiveil_pcie_probe(struct platform_device *pdev)
{
struct mobiveil_pcie *pcie;
struct pci_host_bridge *bridge;
struct device *dev = &pdev->dev;
/* allocate the PCIe port */
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
return -ENOMEM;
pcie = pci_host_bridge_priv(bridge);
pcie->rp.bridge = bridge;
pcie->pdev = pdev;
return mobiveil_pcie_host_probe(pcie);
}
static const struct of_device_id mobiveil_pcie_of_match[] = { static const struct of_device_id mobiveil_pcie_of_match[] = {
{.compatible = "mbvl,gpex40-pcie",}, {.compatible = "mbvl,gpex40-pcie",},
{}, {},
......
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