2005-04-17 02:20:36 +04:00
/*
* linux / arch / arm / mach - h720x / cpu - h7201 . c
*
* Copyright ( C ) 2003 Thomas Gleixner < tglx @ linutronix . de >
* 2003 Robert Schwebel < r . schwebel @ pengutronix . de >
* 2004 Sascha Hauer < s . hauer @ pengutronix . de >
*
* processor specific stuff for the Hynix h7201
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation .
*
*/
# include <linux/init.h>
# include <linux/interrupt.h>
# include <linux/module.h>
# include <asm/types.h>
2008-08-05 19:14:15 +04:00
# include <mach/hardware.h>
2005-04-17 02:20:36 +04:00
# include <asm/irq.h>
2008-08-05 19:14:15 +04:00
# include <mach/irqs.h>
2005-04-17 02:20:36 +04:00
# include <asm/mach/irq.h>
# include <asm/mach/time.h>
# include "common.h"
/*
* Timer interrupt handler
*/
static irqreturn_t
2006-10-06 21:53:39 +04:00
h7201_timer_interrupt ( int irq , void * dev_id )
2005-04-17 02:20:36 +04:00
{
CPU_REG ( TIMER_VIRT , TIMER_TOPSTAT ) ;
2006-10-06 21:53:39 +04:00
timer_tick ( ) ;
2005-04-17 02:20:36 +04:00
return IRQ_HANDLED ;
}
static struct irqaction h7201_timer_irq = {
. name = " h7201 Timer Tick " ,
2007-05-08 11:35:39 +04:00
. flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL ,
2005-06-26 20:06:36 +04:00
. handler = h7201_timer_interrupt ,
2005-04-17 02:20:36 +04:00
} ;
/*
* Setup TIMER0 as system timer
*/
2012-11-08 23:40:59 +04:00
void __init h7201_timer_init ( void )
2005-04-17 02:20:36 +04:00
{
2012-11-08 22:51:58 +04:00
arch_gettimeoffset = h720x_gettimeoffset ;
2005-04-17 02:20:36 +04:00
CPU_REG ( TIMER_VIRT , TM0_PERIOD ) = LATCH ;
CPU_REG ( TIMER_VIRT , TM0_CTRL ) = TM_RESET ;
CPU_REG ( TIMER_VIRT , TM0_CTRL ) = TM_REPEAT | TM_START ;
CPU_REG ( TIMER_VIRT , TIMER_TOPCTRL ) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT ;
setup_irq ( IRQ_TIMER0 , & h7201_timer_irq ) ;
}