[U-Boot] [PATCH v3 1/8] dm: x86: Create a driver for x86 interrupts

Simon Glass sjg at chromium.org
Wed Jan 20 05:32:25 CET 2016


It seems likely that at some point we will want a generic interrupt uclass.
But this is a big undertaking as it involves unifying code across multiple
architectures.

As a first step, create a simple IRQ uclass and a driver for x86. This can
be generalised later as required.

Adjust pirq_init() to probe this driver, which has the effect of creating
routing tables and setting up the interrupt routing. This is a start
towards making interrupts fit better with driver model.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/irq.c     | 25 +++++++++++++++++++++++++
 include/dm/uclass-id.h |  1 +
 2 files changed, 26 insertions(+)

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index 205405b..9b699cf 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
 #include <malloc.h>
@@ -232,6 +233,13 @@ static int create_pirq_routing_table(void)
 
 int pirq_init(void)
 {
+	struct udevice *dev;
+
+	return uclass_first_device(UCLASS_IRQ, &dev);
+}
+
+int irq_router_probe(struct udevice *dev)
+{
 	int ret;
 
 	cpu_irq_init();
@@ -255,3 +263,20 @@ u32 write_pirq_routing_table(u32 addr)
 
 	return copy_pirq_routing_table(addr, pirq_routing_table);
 }
+
+static const struct udevice_id irq_router_ids[] = {
+	{ .compatible = "intel,irq-router" },
+	{ }
+};
+
+U_BOOT_DRIVER(irq_router_drv) = {
+	.name		= "intel_irq",
+	.id		= UCLASS_IRQ,
+	.of_match	= irq_router_ids,
+	.probe		= irq_router_probe,
+};
+
+UCLASS_DRIVER(irq) = {
+	.id		= UCLASS_IRQ,
+	.name		= "irq",
+};
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 27fa0b6..ef145af 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -37,6 +37,7 @@ enum uclass_id {
 	UCLASS_I2C_EEPROM,	/* I2C EEPROM device */
 	UCLASS_I2C_GENERIC,	/* Generic I2C device */
 	UCLASS_I2C_MUX,		/* I2C multiplexer */
+	UCLASS_IRQ,		/* Interrupt controller */
 	UCLASS_KEYBOARD,	/* Keyboard input device */
 	UCLASS_LED,		/* Light-emitting diode (LED) */
 	UCLASS_LPC,		/* x86 'low pin count' interface */
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list