| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-h720x/cpu-h7201.c | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de> | 
 | 5 |  *               2003 Robert Schwebel <r.schwebel@pengutronix.de> | 
 | 6 |  *               2004 Sascha Hauer    <s.hauer@pengutronix.de> | 
 | 7 |  * | 
 | 8 |  * processor specific stuff for the Hynix h7201 | 
 | 9 |  * | 
 | 10 |  * This program is free software; you can redistribute it and/or modify | 
 | 11 |  * it under the terms of the GNU General Public License version 2 as | 
 | 12 |  * published by the Free Software Foundation. | 
 | 13 |  * | 
 | 14 |  */ | 
 | 15 |  | 
 | 16 | #include <linux/init.h> | 
 | 17 | #include <linux/interrupt.h> | 
 | 18 | #include <linux/module.h> | 
 | 19 | #include <asm/types.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 20 | #include <mach/hardware.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/irq.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 22 | #include <mach/irqs.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/mach/irq.h> | 
 | 24 | #include <asm/mach/time.h> | 
 | 25 | #include "common.h" | 
 | 26 | /* | 
 | 27 |  * Timer interrupt handler | 
 | 28 |  */ | 
 | 29 | static irqreturn_t | 
| Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 30 | h7201_timer_interrupt(int irq, void *dev_id) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | 	CPU_REG (TIMER_VIRT, TIMER_TOPSTAT); | 
| Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 33 | 	timer_tick(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | 	return IRQ_HANDLED; | 
 | 36 | } | 
 | 37 |  | 
 | 38 | static struct irqaction h7201_timer_irq = { | 
 | 39 | 	.name		= "h7201 Timer Tick", | 
| Bernhard Walle | b30faba | 2007-05-08 00:35:39 -0700 | [diff] [blame] | 40 | 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 
| Russell King | 09b8b5f | 2005-06-26 17:06:36 +0100 | [diff] [blame] | 41 | 	.handler	= h7201_timer_interrupt, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | }; | 
 | 43 |  | 
 | 44 | /* | 
 | 45 |  * Setup TIMER0 as system timer | 
 | 46 |  */ | 
 | 47 | void __init h7201_init_time(void) | 
 | 48 | { | 
 | 49 | 	CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH; | 
 | 50 | 	CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET; | 
 | 51 | 	CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START; | 
 | 52 | 	CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT; | 
 | 53 |  | 
 | 54 | 	setup_irq(IRQ_TIMER0, &h7201_timer_irq); | 
 | 55 | } | 
 | 56 |  | 
 | 57 | struct sys_timer h7201_timer = { | 
 | 58 | 	.init		= h7201_init_time, | 
 | 59 | 	.offset		= h720x_gettimeoffset, | 
 | 60 | }; |