|
@@ -16,6 +16,7 @@
|
|
|
#include <linux/of.h>
|
|
|
#include <linux/of_address.h>
|
|
|
#include <linux/of_graph.h>
|
|
|
+#include <linux/of_irq.h>
|
|
|
#include <linux/property.h>
|
|
|
#include <linux/etherdevice.h>
|
|
|
#include <linux/phy.h>
|
|
@@ -1229,6 +1230,31 @@ void *device_get_mac_address(struct device *dev, char *addr, int alen)
|
|
|
}
|
|
|
EXPORT_SYMBOL(device_get_mac_address);
|
|
|
|
|
|
+/**
|
|
|
+ * fwnode_irq_get - Get IRQ directly from a fwnode
|
|
|
+ * @fwnode: Pointer to the firmware node
|
|
|
+ * @index: Zero-based index of the IRQ
|
|
|
+ *
|
|
|
+ * Returns Linux IRQ number on success. Other values are determined
|
|
|
+ * accordingly to acpi_/of_ irq_get() operation.
|
|
|
+ */
|
|
|
+int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index)
|
|
|
+{
|
|
|
+ struct device_node *of_node = to_of_node(fwnode);
|
|
|
+ struct resource res;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ if (IS_ENABLED(CONFIG_OF) && of_node)
|
|
|
+ return of_irq_get(of_node, index);
|
|
|
+
|
|
|
+ ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ return res.start;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(fwnode_irq_get);
|
|
|
+
|
|
|
/**
|
|
|
* device_graph_get_next_endpoint - Get next endpoint firmware node
|
|
|
* @fwnode: Pointer to the parent firmware node
|