]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - arch/avr32/cpu/interrupts.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / arch / avr32 / cpu / interrupts.c
index 6681e13b9393d604584f86542526d9d4a99b7639..4a03e19e33e383e4573bf1c8e498aba1a7b2d59a 100644 (file)
@@ -1,23 +1,7 @@
 /*
  * Copyright (C) 2004-2006 Atmel Corporation
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <div64.h>
@@ -46,7 +30,7 @@ static unsigned long tb_factor;
 
 unsigned long get_tbclk(void)
 {
-       return gd->cpu_hz;
+       return gd->arch.cpu_hz;
 }
 
 unsigned long long get_ticks(void)
@@ -107,7 +91,7 @@ static int set_interrupt_handler(unsigned int nr, void (*handler)(void),
        return 0;
 }
 
-void timer_init(void)
+int timer_init(void)
 {
        extern void timer_interrupt_handler(void);
        u64 tmp;
@@ -115,13 +99,14 @@ void timer_init(void)
        sysreg_write(COUNT, 0);
 
        tmp = (u64)CONFIG_SYS_HZ << 32;
-       tmp += gd->cpu_hz / 2;
-       do_div(tmp, gd->cpu_hz);
+       tmp += gd->arch.cpu_hz / 2;
+       do_div(tmp, gd->arch.cpu_hz);
        tb_factor = (u32)tmp;
 
        if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
-               return;
+               return -EINVAL;
 
        /* For all practical purposes, this gives us an overflow interrupt */
        sysreg_write(COMPARE, 0xffffffff);
+       return 0;
 }