From: Simon Glass Date: Sat, 21 Dec 2019 11:13:41 -0700 Subject: [PATCH v2 06/13] x86: Give each driver an IRQ type In-Reply-To: <20191221181348.48154-1-sjg@chromium.org> References: <20191221181348.48154-1-sjg@chromium.org> Message-ID: <20191221181348.48154-7-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add an IRQ type to each driver and use irq_first_device_type() to find and probe the correct one. Signed-off-by: Simon Glass --- Changes in v2: None arch/x86/cpu/apollolake/fsp_s.c | 4 ++-- arch/x86/cpu/apollolake/itss.c | 2 +- arch/x86/cpu/i386/interrupt.c | 3 ++- arch/x86/cpu/irq.c | 3 ++- drivers/pinctrl/intel/pinctrl.c | 2 +- include/irq.h | 2 ++ 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c index f8fa4dec8f..b2d9130841 100644 --- a/arch/x86/cpu/apollolake/fsp_s.c +++ b/arch/x86/cpu/apollolake/fsp_s.c @@ -535,7 +535,7 @@ int arch_fsps_preinit(void) struct udevice *itss; int ret; - ret = uclass_first_device_err(UCLASS_IRQ, &itss); + ret = irq_first_device_type(X86_IRQT_ITSS, &itss); if (ret) return log_msg_ret("no itss", ret); /* @@ -576,7 +576,7 @@ int arch_fsp_init_r(void) if (ret) return ret; - ret = uclass_first_device_err(UCLASS_IRQ, &itss); + ret = irq_first_device_type(X86_IRQT_ITSS, &itss); if (ret) return log_msg_ret("no itss", ret); /* Restore GPIO IRQ polarities back to previous settings */ diff --git a/arch/x86/cpu/apollolake/itss.c b/arch/x86/cpu/apollolake/itss.c index 8789f8e6bb..9a4d159ebf 100644 --- a/arch/x86/cpu/apollolake/itss.c +++ b/arch/x86/cpu/apollolake/itss.c @@ -199,7 +199,7 @@ static const struct irq_ops apl_itss_ops = { }; static const struct udevice_id apl_itss_ids[] = { - { .compatible = "intel,apl-itss"}, + { .compatible = "intel,apl-itss", .data = X86_IRQT_ITSS }, { } }; diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c index 78aa51a3ea..5a886fd031 100644 --- a/arch/x86/cpu/i386/interrupt.c +++ b/arch/x86/cpu/i386/interrupt.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -262,7 +263,7 @@ int interrupt_init(void) int ret; /* Try to set up the interrupt router, but don't require one */ - ret = uclass_first_device_err(UCLASS_IRQ, &dev); + ret = irq_first_device_type(X86_IRQT_BASE, &dev); if (ret && ret != -ENODEV) return ret; diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c index ed9938f7f7..bafa031082 100644 --- a/arch/x86/cpu/irq.c +++ b/arch/x86/cpu/irq.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -351,7 +352,7 @@ int irq_router_probe(struct udevice *dev) } static const struct udevice_id irq_router_ids[] = { - { .compatible = "intel,irq-router" }, + { .compatible = "intel,irq-router", .data = X86_IRQT_BASE }, { } }; diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c index 4875a3b0b5..bd58b85dd8 100644 --- a/drivers/pinctrl/intel/pinctrl.c +++ b/drivers/pinctrl/intel/pinctrl.c @@ -613,7 +613,7 @@ int intel_pinctrl_ofdata_to_platdata(struct udevice *dev, log_err("Cannot find community for pid %d\n", pplat->pid); return -EDOM; } - ret = uclass_first_device_err(UCLASS_IRQ, &priv->itss); + ret = irq_first_device_type(X86_IRQT_ITSS, &priv->itss); if (ret) return log_msg_ret("Cannot find ITSS", ret); priv->comm = comm; diff --git a/include/irq.h b/include/irq.h index 1db97b5c3f..8b4e2ecfc0 100644 --- a/include/irq.h +++ b/include/irq.h @@ -99,6 +99,8 @@ 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 -- 2.24.1.735.g03f4e72817-goog