Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dce1b10e authored by Tony Truong's avatar Tony Truong Committed by Gerrit - the friendly Code Review server
Browse files

switch: qcom: enable PCI device and set BME



During the PCI probe for each port, enable its PCI device so that
it's ready for its driver. Also, set the bus master so that
any traffic from downstream can be forward to upstream.

Add PCI remove to handle the clean up.

Change-Id: I959ab50ebba2b4351590f83e8e1b780a670ca730
Signed-off-by: default avatarTony Truong <truong@codeaurora.org>
parent 5ad3313b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -288,6 +288,12 @@ static int switch_qcom_config_errata(struct pci_dev *pdev)
	return 0;
}

static void switch_qcom_pci_remove(struct pci_dev *pdev)
{
	pci_clear_master(pdev);
	pci_disable_device(pdev);
}

static int switch_qcom_pci_probe(struct pci_dev *pdev,
			const struct pci_device_id *id)
{
@@ -297,6 +303,14 @@ static int switch_qcom_pci_probe(struct pci_dev *pdev,
	if (ret)
		return ret;

	ret = pci_enable_device(pdev);
	if (ret) {
		dev_err(&pdev->dev, "failed to enable PCIe device\n");
		return ret;
	}

	pci_set_master(pdev);

	return 0;
}

@@ -304,6 +318,7 @@ static struct pci_driver switch_qcom_pci_driver = {
	.name		= "pcie-qcom-switch",
	.id_table	= switch_qcom_pci_tbl,
	.probe		= switch_qcom_pci_probe,
	.remove		= switch_qcom_pci_remove,
};

static int __init switch_qcom_pci_init(void)