aboutsummaryrefslogtreecommitdiff
path: root/include/irq.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-02-06 09:54:57 -0700
committerBin Meng <bmeng.cn@gmail.com>2020-02-07 22:44:59 +0800
commitba876079714db52887cab9f068ea1136de4cc107 (patch)
tree70cf6a9a0ec4967e081728f6b29974116a1ff3ba /include/irq.h
parente130294045c16018c0ef8a0c20497a503d65505a (diff)
downloadu-boot-ba876079714db52887cab9f068ea1136de4cc107.zip
u-boot-ba876079714db52887cab9f068ea1136de4cc107.tar.gz
u-boot-ba876079714db52887cab9f068ea1136de4cc107.tar.bz2
dm: irq: Add support for interrupt controller types
There can be different types of interrupt controllers in a system and some drivers may need to distinguish between these. In general this can be handled using the device tree by adding the interrupt information to device nodes. However on x86 devices we have interrupt controllers which are not tied to any particular device and not really used in U-Boot. These still need to be inited, so a convenient method is to give each controller a type and allow a particular controller type to be probed. Add support for this in sandbox along with a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: remove the new bland line at EOF of test/dm/irq.c] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/irq.h')
-rw-r--r--include/irq.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/irq.h b/include/irq.h
index 01ded64..8b4e2ec 100644
--- a/include/irq.h
+++ b/include/irq.h
@@ -8,6 +8,17 @@
#ifndef __irq_H
#define __irq_H
+/*
+ * Interrupt controller types available. You can find a particular one with
+ * irq_first_device_type()
+ */
+enum irq_dev_t {
+ X86_IRQT_BASE, /* Base controller */
+ X86_IRQT_ITSS, /* ITSS controller, e.g. on APL */
+ X86_IRQT_ACPI_GPE, /* ACPI General-Purpose Events controller */
+ SANDBOX_IRQT_BASE, /* Sandbox testing */
+};
+
/**
* struct irq_ops - Operations for the IRQ
*/
@@ -85,4 +96,16 @@ int irq_snapshot_polarities(struct udevice *dev);
*/
int irq_restore_polarities(struct udevice *dev);
+/**
+ * irq_first_device_type() - Get a particular interrupt controller
+ *
+ * On success this returns an activated interrupt device.
+ *
+ * @type: Type to find
+ * @devp: Returns the device, if found
+ * @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to
+ * probe
+ */
+int irq_first_device_type(enum irq_dev_t type, struct udevice **devp);
+
#endif