Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / powerpc / lib / interrupts.c
index f7cf915759de29bdc5731561417eaf185a74f1bc..73f270002cfcd015ed64cdd7feeee13579c3b504 100644 (file)
@@ -1,52 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2000-2002
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * (C) Copyright 2003
  * Gleb Natapov <gnatapov@mrv.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <irq_func.h>
 #include <asm/processor.h>
 #include <watchdog.h>
-#ifdef CONFIG_STATUS_LED
+#ifdef CONFIG_LED_STATUS
 #include <status_led.h>
 #endif
+#include <asm/ptrace.h>
 
-#ifdef CONFIG_SHOW_ACTIVITY
-void board_show_activity (ulong) __attribute__((weak, alias("__board_show_activity")));
-
-void __board_show_activity (ulong dummy)
-{
-       return;
-}
-#endif /* CONFIG_SHOW_ACTIVITY */
-
+#ifndef CONFIG_MPC83XX_TIMER
 #ifndef CONFIG_SYS_WATCHDOG_FREQ
 #define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
 #endif
 
-extern int interrupt_init_cpu (unsigned *);
-extern void timer_interrupt_cpu (struct pt_regs *);
-
 static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
 
-static __inline__ unsigned long get_msr (void)
-{
-       unsigned long msr;
-
-       asm volatile ("mfmsr %0":"=r" (msr):);
-
-       return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
-       asm volatile ("mtmsr %0"::"r" (msr));
-}
-
 static __inline__ unsigned long get_dec (void)
 {
        unsigned long val;
@@ -62,15 +38,15 @@ static __inline__ void set_dec (unsigned long val)
        if (val)
                asm volatile ("mtdec %0"::"r" (val));
 }
+#endif /* !CONFIG_MPC83XX_TIMER */
 
-
-void enable_interrupts (void)
+void enable_interrupts(void)
 {
        set_msr (get_msr () | MSR_EE);
 }
 
 /* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
+int disable_interrupts(void)
 {
        ulong msr = get_msr ();
 
@@ -78,15 +54,11 @@ int disable_interrupts (void)
        return ((msr & MSR_EE) != 0);
 }
 
-int interrupt_init (void)
+#ifndef CONFIG_MPC83XX_TIMER
+int interrupt_init(void)
 {
-       int ret;
-
        /* call cpu specific function from $(CPU)/interrupts.c */
-       ret = interrupt_init_cpu (&decrementer_count);
-
-       if (ret)
-               return ret;
+       interrupt_init_cpu (&decrementer_count);
 
        set_dec (decrementer_count);
 
@@ -97,7 +69,7 @@ int interrupt_init (void)
 
 static volatile ulong timestamp = 0;
 
-void timer_interrupt (struct pt_regs *regs)
+void timer_interrupt(struct pt_regs *regs)
 {
        /* call cpu specific function from $(CPU)/interrupts.c */
        timer_interrupt_cpu (regs);
@@ -112,16 +84,13 @@ void timer_interrupt (struct pt_regs *regs)
                WATCHDOG_RESET ();
 #endif    /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
 
-#ifdef CONFIG_STATUS_LED
-       status_led_tick (timestamp);
-#endif /* CONFIG_STATUS_LED */
-
-#ifdef CONFIG_SHOW_ACTIVITY
-       board_show_activity (timestamp);
-#endif /* CONFIG_SHOW_ACTIVITY */
+#ifdef CONFIG_LED_STATUS
+       status_led_tick(timestamp);
+#endif /* CONFIG_LED_STATUS */
 }
 
 ulong get_timer (ulong base)
 {
        return (timestamp - base);
 }
+#endif /* !CONFIG_MPC83XX_TIMER */