dm: x86: Move samus to use new driver model support
[oweals/u-boot.git] / arch / x86 / cpu / interrupts.c
index b00ddc0cb488163e5e14c1a6127ddbbb1dc8a04f..dd2819a12c79c2334f2191b498b19812308e9237 100644 (file)
  */
 
 #include <common.h>
+#include <dm.h>
 #include <asm/cache.h>
 #include <asm/control_regs.h>
+#include <asm/i8259.h>
 #include <asm/interrupt.h>
 #include <asm/io.h>
-#include <asm/processor-flags.h>
-#include <linux/compiler.h>
+#include <asm/lapic.h>
 #include <asm/msr.h>
+#include <asm/processor-flags.h>
 #include <asm/processor.h>
 #include <asm/u-boot-x86.h>
-#include <asm/i8259.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -244,6 +245,14 @@ int disable_interrupts(void)
 
 int interrupt_init(void)
 {
+       struct udevice *dev;
+       int ret;
+
+       /* Try to set up the interrupt router, but don't require one */
+       ret = uclass_first_device_err(UCLASS_IRQ, &dev);
+       if (ret && ret != -ENODEV)
+               return ret;
+
        /*
         * When running as an EFI application we are not in control of
         * interrupts and should leave them alone.
@@ -257,6 +266,8 @@ int interrupt_init(void)
        i8259_init();
 #endif
 
+       lapic_setup();
+
        /* Initialize core interrupt and exception functionality of CPU */
        cpu_init_interrupts();