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

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

Merge "pci/of: expand match PCI devices to OF nodes"

parents 01c50ba1 d4001297
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@

		pcie0_rp: pcie0_rp {
			reg = <0 0 0 0 0>;
			pci-ids = "17cb:010c";
		};
	};

+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
	mhi_0: qcom,mhi@0 {
		reg = <0 0 0 0 0 >;

		pci-ids = "17cb:0305", "17cb:0306";

		/* controller specific configuration */
		qcom,smmu-cfg = <0x3>;

@@ -548,6 +550,8 @@
	mhi_1: qcom,mhi@0 {
		reg = <0 0 0 0 0 >;

		pci-ids = "17cb:0305", "17cb:0306";

		/* controller specific configuration */
		qcom,smmu-cfg = <0x3>;
		qcom,msm-bus,name = "mhi";
+2 −0
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@

		pcie_rc0: pcie_rc0 {
			reg = <0 0 0 0 0>;
			pci-ids = "17cb:0108";
		};
	};

@@ -556,6 +557,7 @@

		pcie_rc1: pcie_rc1 {
			reg = <0 0 0 0 0>;
			pci-ids = "17cb:0108";
		};
	};

+20 −3
Original line number Diff line number Diff line
@@ -8,6 +8,20 @@
#include <linux/of_pci.h>
#include <linux/slab.h>

static inline bool __of_pci_pci_compare_id(struct device_node *node,
					struct pci_dev *dev)
{
	char dev_id_str[10];

	scnprintf(dev_id_str, sizeof(dev_id_str), "%04x:%04x", dev->vendor,
		dev->device);

	if (of_property_match_string(node, "pci-ids", dev_id_str) < 0)
		return false;

	return true;
}

static inline int __of_pci_pci_compare(struct device_node *node,
				       unsigned int data)
{
@@ -20,14 +34,17 @@ static inline int __of_pci_pci_compare(struct device_node *node,
	return devfn == data;
}

struct device_node *of_pci_find_child_device(struct device_node *parent,
					     unsigned int devfn)
struct device_node *of_pci_find_child_device(struct pci_dev *dev)
{
	struct device_node *node, *node2;
	struct device_node *parent = dev->bus->dev.of_node;
	unsigned int devfn = dev->devfn;

	for_each_child_of_node(parent, node) {
		if (__of_pci_pci_compare(node, devfn))
			if (__of_pci_pci_compare_id(node, dev))
				return node;

		/*
		 * Some OFs create a parent node "multifunc-device" as
		 * a fake root for all functions of a multi-function
+1 −2
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@ void pci_set_of_node(struct pci_dev *dev)
{
	if (!dev->bus->dev.of_node)
		return;
	dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node,
						    dev->devfn);
	dev->dev.of_node = of_pci_find_child_device(dev);

	if (dev->dev.of_node)
		of_reserved_mem_device_init_by_idx(&dev->dev, dev->dev.of_node,
Loading