summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-12-10 05:41:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-10 05:41:25 +0100
commit293e981e7452511a876431aa076c0eb256623124 (patch)
treec15e999a2f1c69cb193c5f1a1015bbc095dcd33d /include/linux
parent056196ba04574d4f8cf11d92df09eb664a3e62dd (diff)
parent5451508c4ff5d8f1d0c115963508b2ca7120141a (diff)
downloadbarebox-293e981e7452511a876431aa076c0eb256623124.tar.gz
barebox-293e981e7452511a876431aa076c0eb256623124.tar.xz
Merge branch 'for-next/pci'
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mod_devicetable.h1
-rw-r--r--include/linux/pci.h34
2 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d8125214a0..1fbb3dc5c1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -15,6 +15,7 @@ struct pci_device_id {
__u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
__u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
__u32 class, class_mask; /* (class,subclass,prog-if) triplet */
+ unsigned long driver_data; /* Data private to the driver */
};
#define SPI_NAME_SIZE 32
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d92d70b6bd..c742570e36 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -115,6 +115,17 @@ struct pci_dev {
};
#define to_pci_dev(d) container_of(d, struct pci_dev, dev)
+#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
+#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
+#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
+#define pci_resource_len(dev,bar) \
+ ((pci_resource_start((dev), (bar)) == 0 && \
+ pci_resource_end((dev), (bar)) == \
+ pci_resource_start((dev), (bar))) ? 0 : \
+ \
+ (pci_resource_end((dev), (bar)) - \
+ pci_resource_start((dev), (bar)) + 1))
+
enum {
PCI_BUS_RESOURCE_IO = 0,
PCI_BUS_RESOURCE_MEM = 1,
@@ -211,6 +222,20 @@ struct pci_driver {
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
/**
+ * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem
+ * @vend: the 16 bit PCI Vendor ID
+ * @dev: the 16 bit PCI Device ID
+ * @subvend: the 16 bit PCI Subvendor ID
+ * @subdev: the 16 bit PCI Subdevice ID
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific device with subsystem information.
+ */
+#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \
+ .vendor = (vend), .device = (dev), \
+ .subvendor = (subvend), .subdevice = (subdev)
+
+/**
* PCI_DEVICE_CLASS - macro used to describe a specific pci device class
* @dev_class: the class, subclass, prog-if triple for this device
* @dev_class_mask: the class mask for this device
@@ -350,4 +375,13 @@ enum pci_fixup_pass {
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
+#ifdef CONFIG_PCI
+const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
+ struct pci_dev *dev);
+#else
+static inline const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
+ struct pci_dev *dev)
+{ return NULL; }
+#endif
+
#endif /* LINUX_PCI_H */