Commit cb3ca564 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/controller/cadence-j721e'

- Add config guards to fix build error when sg2042 is a module but j721e is
  built-in (Siddharth Vadapalli)

* pci/controller/cadence-j721e:
  PCI: j721e: Add config guards for Cadence Host and Endpoint library APIs
parents 9a821739 4b361b1e
Loading
Loading
Loading
Loading
+25 −16
Original line number Diff line number Diff line
@@ -620,9 +620,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
			gpiod_set_value_cansleep(pcie->reset_gpio, 1);
		}

		if (IS_ENABLED(CONFIG_PCI_J721E_HOST)) {
			ret = cdns_pcie_host_setup(rc);
			if (ret < 0)
				goto err_pcie_setup;
		}

		break;
	case PCI_MODE_EP:
@@ -632,9 +634,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
			goto err_get_sync;
		}

		if (IS_ENABLED(CONFIG_PCI_J721E_EP)) {
			ret = cdns_pcie_ep_setup(ep);
			if (ret < 0)
				goto err_pcie_setup;
		}

		break;
	}
@@ -659,10 +663,11 @@ static void j721e_pcie_remove(struct platform_device *pdev)
	struct cdns_pcie_ep *ep;
	struct cdns_pcie_rc *rc;

	if (pcie->mode == PCI_MODE_RC) {
	if (IS_ENABLED(CONFIG_PCI_J721E_HOST) &&
	    pcie->mode == PCI_MODE_RC) {
		rc = container_of(cdns_pcie, struct cdns_pcie_rc, pcie);
		cdns_pcie_host_disable(rc);
	} else {
	} else if (IS_ENABLED(CONFIG_PCI_J721E_EP)) {
		ep = container_of(cdns_pcie, struct cdns_pcie_ep, pcie);
		cdns_pcie_ep_disable(ep);
	}
@@ -728,11 +733,13 @@ static int j721e_pcie_resume_noirq(struct device *dev)
			gpiod_set_value_cansleep(pcie->reset_gpio, 1);
		}

		if (IS_ENABLED(CONFIG_PCI_J721E_HOST)) {
			ret = cdns_pcie_host_link_setup(rc);
			if (ret < 0) {
				clk_disable_unprepare(pcie->refclk);
				return ret;
			}
		}

		/*
		 * Reset internal status of BARs to force reinitialization in
@@ -741,12 +748,14 @@ static int j721e_pcie_resume_noirq(struct device *dev)
		for (enum cdns_pcie_rp_bar bar = RP_BAR0; bar <= RP_NO_BAR; bar++)
			rc->avail_ib_bar[bar] = true;

		if (IS_ENABLED(CONFIG_PCI_J721E_HOST)) {
			ret = cdns_pcie_host_init(rc);
			if (ret) {
				clk_disable_unprepare(pcie->refclk);
				return ret;
			}
		}
	}

	return 0;
}