aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2006-06-25 20:33:10 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 20:43:33 -0400
commitb671b653da35cd38897c7b19e9baed64e7a9e1a1 (patch)
tree1be02e974a212499302d02514af5e82ea122377d /arch/m68knommu
parent2082b477dc7e9d5b3f773a36aae2dbc55b4263c2 (diff)
[PATCH] m68knommu: read/write register access for PIT timer
Modify the m68knommu/ColdFire PIT timer code to use register offsets with raw_read/raw_write access, instead of a mapped struct. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/platform/5307/pit.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/5307/pit.c
index 323f2677e49d..ef174748825f 100644
--- a/arch/m68knommu/platform/5307/pit.c
+++ b/arch/m68knommu/platform/5307/pit.c
@@ -1,11 +1,11 @@
1/***************************************************************************/ 1/***************************************************************************/
2 2
3/* 3/*
4 * pit.c -- Motorola ColdFire PIT timer. Currently this type of 4 * pit.c -- Freescale ColdFire PIT timer. Currently this type of
5 * hardware timer only exists in the Motorola ColdFire 5 * hardware timer only exists in the Freescale ColdFire
6 * 5270/5271, 5282 and other CPUs. 6 * 5270/5271, 5282 and other CPUs.
7 * 7 *
8 * Copyright (C) 1999-2004, Greg Ungerer (gerg@snapgear.com) 8 * Copyright (C) 1999-2006, Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com) 9 * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com)
10 * 10 *
11 */ 11 */
@@ -18,6 +18,7 @@
18#include <linux/param.h> 18#include <linux/param.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <asm/io.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22#include <asm/coldfire.h> 23#include <asm/coldfire.h>
23#include <asm/mcfpit.h> 24#include <asm/mcfpit.h>
@@ -25,13 +26,20 @@
25 26
26/***************************************************************************/ 27/***************************************************************************/
27 28
29/*
30 * By default use timer1 as the system clock timer.
31 */
32#define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a))
33
34/***************************************************************************/
35
28void coldfire_pit_tick(void) 36void coldfire_pit_tick(void)
29{ 37{
30 volatile struct mcfpit *tp; 38 unsigned short pcsr;
31 39
32 /* Reset the ColdFire timer */ 40 /* Reset the ColdFire timer */
33 tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1); 41 pcsr = __raw_readw(TA(MCFPIT_PCSR));
34 tp->pcsr |= MCFPIT_PCSR_PIF; 42 __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));
35} 43}
36 44
37/***************************************************************************/ 45/***************************************************************************/
@@ -40,7 +48,6 @@ void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *))
40{ 48{
41 volatile unsigned char *icrp; 49 volatile unsigned char *icrp;
42 volatile unsigned long *imrp; 50 volatile unsigned long *imrp;
43 volatile struct mcfpit *tp;
44 51
45 request_irq(MCFINT_VECBASE + MCFINT_PIT1, handler, SA_INTERRUPT, 52 request_irq(MCFINT_VECBASE + MCFINT_PIT1, handler, SA_INTERRUPT,
46 "ColdFire Timer", NULL); 53 "ColdFire Timer", NULL);
@@ -53,27 +60,23 @@ void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *))
53 *imrp &= ~MCFPIT_IMR_IBIT; 60 *imrp &= ~MCFPIT_IMR_IBIT;
54 61
55 /* Set up PIT timer 1 as poll clock */ 62 /* Set up PIT timer 1 as poll clock */
56 tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1); 63 __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
57 tp->pcsr = MCFPIT_PCSR_DISABLE; 64 __raw_writew(((MCF_CLK / 2) / 64) / HZ, TA(MCFPIT_PMR));
58 65 __raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW |
59 tp->pmr = ((MCF_CLK / 2) / 64) / HZ; 66 MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
60 tp->pcsr = MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW |
61 MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64;
62} 67}
63 68
64/***************************************************************************/ 69/***************************************************************************/
65 70
66unsigned long coldfire_pit_offset(void) 71unsigned long coldfire_pit_offset(void)
67{ 72{
68 volatile struct mcfpit *tp;
69 volatile unsigned long *ipr; 73 volatile unsigned long *ipr;
70 unsigned long pmr, pcntr, offset; 74 unsigned long pmr, pcntr, offset;
71 75
72 tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1);
73 ipr = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR); 76 ipr = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR);
74 77
75 pmr = *(&tp->pmr); 78 pmr = __raw_readw(TA(MCFPIT_PMR));
76 pcntr = *(&tp->pcntr); 79 pcntr = __raw_readw(TA(MCFPIT_PCNTR));
77 80
78 /* 81 /*
79 * If we are still in the first half of the upcount and a 82 * If we are still in the first half of the upcount and a