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

Commit c5988a33 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: pcie: register PCI driver with framework for root port"

parents 9109c6ff d0c5c4dc
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ Required properties:
  - perst-gpio: PERST GPIO specified by PCIe spec.
  - wake-gpio: WAKE GPIO specified by PCIe spec.
  - phy-status-offset: Offset from PCIe PHY base to check if PCIe PHY is up.
  - pcie_rc<PCIe index>: PCI node is a sub-node of PCIe controller node.
    node. This node holds root complex specific configurations and properties.
  - <supply-name>-supply: phandle to the regulator device tree node.
    Refer to the schematics for the corresponding voltage regulators.
    vreg-1.8-supply: phandle to the analog supply for the PCIe controller.
@@ -128,6 +130,17 @@ Optional Properties:
  - reset-names: reset signal name strings sorted in the same order as the resets
    property.

=================
Root Complex node
=================

Root complex are defined as subnodes of the PCIe controller node.

Required properties:
- reg: Array (5-cell PCI resource) of <u32>. First cell is devfn, which is
  determined by pci bus topology. Assign the other cells 0 since they are not
  used.

Example:

	pcie0: qcom,pcie@fc520000 {
@@ -304,4 +317,8 @@ Example:
		qcom,msm-bus,vectors-KBps =
				<45 512 0 0>,
				<45 512 500 800>;

		pcie_rc0: pcie_rc0 {
			reg = <0x0 0x0 0x0 0x0 0x0>;
		};
	};
+43 −0
Original line number Diff line number Diff line
@@ -649,6 +649,11 @@ struct msm_pcie_dev_t {
	struct msm_pcie_device_info   pcidev_table[MAX_DEVICE_NUM];
};

struct msm_root_dev_t {
	struct msm_pcie_dev_t *pcie_dev;
	struct pci_dev *pci_dev;
};

/* debug mask sys interface */
static int msm_pcie_debug_mask;
module_param_named(debug_mask, msm_pcie_debug_mask,
@@ -6333,6 +6338,40 @@ static int msm_pcie_remove(struct platform_device *pdev)
	return ret;
}


int msm_pci_probe(struct pci_dev *pci_dev,
		  const struct pci_device_id *device_id)
{
	struct msm_pcie_dev_t *pcie_dev = PCIE_BUS_PRIV_DATA(pci_dev->bus);
	struct msm_root_dev_t *root_dev;

	PCIE_DBG(pcie_dev, "PCIe: RC%d: PCI Probe\n", pcie_dev->rc_idx);

	if (!pci_dev->dev.of_node)
		return -ENODEV;

	root_dev = devm_kzalloc(&pci_dev->dev, sizeof(*root_dev), GFP_KERNEL);
	if (!root_dev)
		return -ENOMEM;

	root_dev->pcie_dev = pcie_dev;
	root_dev->pci_dev = pci_dev;
	dev_set_drvdata(&pci_dev->dev, root_dev);

	return 0;
}

static struct pci_device_id msm_pci_device_id[] = {
	{PCI_DEVICE(0x17cb, 0x0108)},
	{0},
};

static struct pci_driver msm_pci_driver = {
	.name = "pci-msm-rc",
	.id_table = msm_pci_device_id,
	.probe = msm_pci_probe,
};

static const struct of_device_id msm_pcie_match[] = {
	{	.compatible = "qcom,pci-msm",
	},
@@ -6416,6 +6455,10 @@ static int __init pcie_init(void)

	msm_pcie_debugfs_init();

	ret = pci_register_driver(&msm_pci_driver);
	if (ret)
		return ret;

	ret = platform_driver_register(&msm_pcie_driver);

	return ret;