aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2005-09-08 19:32:14 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-08 20:27:37 -0400
commit03981f2427c767cfcd917cb51197c43fe68ba5db (patch)
treee41794daea2cd8029b79312ee40fc8bc7b96bf64
parentd9b9d5ddb827dc36cc1f7214f5818640e1bc22d5 (diff)
[PATCH] m68knommu: extract common timer code for 68EZ328 processor
Rework the 68x328 configuration and setup code. All 68x328 varients share the same timer hardware. So extract that into its own file, instead of keeping copies in each processors setup code. Signed-off-by: Greg Ungerer <gerg@uclinux.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/m68knommu/platform/68EZ328/config.c80
1 files changed, 21 insertions, 59 deletions
diff --git a/arch/m68knommu/platform/68EZ328/config.c b/arch/m68knommu/platform/68EZ328/config.c
index c21971971ff5..d8d56e5de310 100644
--- a/arch/m68knommu/platform/68EZ328/config.c
+++ b/arch/m68knommu/platform/68EZ328/config.c
@@ -1,5 +1,7 @@
1/***************************************************************************/
2
1/* 3/*
2 * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c 4 * linux/arch/m68knommu/platform/68EZ328/config.c
3 * 5 *
4 * Copyright (C) 1993 Hamish Macdonald 6 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne 7 * Copyright (C) 1999 D. Jeff Dionne
@@ -9,6 +11,8 @@
9 * for more details. 11 * for more details.
10 */ 12 */
11 13
14/***************************************************************************/
15
12#include <stdarg.h> 16#include <stdarg.h>
13#include <linux/config.h> 17#include <linux/config.h>
14#include <linux/types.h> 18#include <linux/types.h>
@@ -20,68 +24,22 @@
20#include <asm/setup.h> 24#include <asm/setup.h>
21#include <asm/system.h> 25#include <asm/system.h>
22#include <asm/pgtable.h> 26#include <asm/pgtable.h>
23#include <asm/irq.h>
24#include <asm/machdep.h> 27#include <asm/machdep.h>
25#include <asm/MC68EZ328.h> 28#include <asm/MC68EZ328.h>
26#ifdef CONFIG_UCSIMM 29#ifdef CONFIG_UCSIMM
27#include <asm/bootstd.h> 30#include <asm/bootstd.h>
28#endif 31#endif
29#ifdef CONFIG_PILOT
30#include "PalmV/romfs.h"
31#endif
32
33void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
34{
35 /* Restart mode, Enable int, 32KHz, Enable timer */
36 TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
37 /* Set prescaler (Divide 32KHz by 32)*/
38 TPRER = 31;
39 /* Set compare register 32Khz / 32 / 10 = 100 */
40 TCMP = 10;
41
42 request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
43}
44
45void BSP_tick(void)
46{
47 /* Reset Timer1 */
48 TSTAT &= 0;
49}
50
51unsigned long BSP_gettimeoffset (void)
52{
53 return 0;
54}
55 32
56void BSP_gettod (int *yearp, int *monp, int *dayp, 33/***************************************************************************/
57 int *hourp, int *minp, int *secp)
58{
59}
60 34
61int BSP_hwclk(int op, struct hwclk_time *t) 35void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *));
62{ 36void m68328_timer_tick(void);
63 if (!op) { 37unsigned long m68328_timer_gettimeoffset(void);
64 /* read */ 38void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec);
65 } else {
66 /* write */
67 }
68 return 0;
69}
70 39
71int BSP_set_clock_mmss (unsigned long nowtime) 40/***************************************************************************/
72{
73#if 0
74 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
75 41
76 tod->second1 = real_seconds / 10; 42void m68ez328_reset(void)
77 tod->second2 = real_seconds % 10;
78 tod->minute1 = real_minutes / 10;
79 tod->minute2 = real_minutes % 10;
80#endif
81 return 0;
82}
83
84void BSP_reset (void)
85{ 43{
86 local_irq_disable(); 44 local_irq_disable();
87 asm volatile (" 45 asm volatile ("
@@ -93,6 +51,8 @@ void BSP_reset (void)
93 "); 51 ");
94} 52}
95 53
54/***************************************************************************/
55
96unsigned char *cs8900a_hwaddr; 56unsigned char *cs8900a_hwaddr;
97static int errno; 57static int errno;
98 58
@@ -119,11 +79,13 @@ void config_BSP(char *command, int len)
119 else command[0] = 0; 79 else command[0] = 0;
120#endif 80#endif
121 81
122 mach_sched_init = BSP_sched_init; 82 mach_sched_init = m68328_timer_init;
123 mach_tick = BSP_tick; 83 mach_tick = m68328_timer_tick;
124 mach_gettimeoffset = BSP_gettimeoffset; 84 mach_gettimeoffset = m68328_timer_gettimeoffset;
125 mach_gettod = BSP_gettod; 85 mach_gettod = m68328_timer_gettod;
126 mach_hwclk = NULL; 86 mach_hwclk = NULL;
127 mach_set_clock_mmss = NULL; 87 mach_set_clock_mmss = NULL;
128 mach_reset = BSP_reset; 88 mach_reset = m68ez328_reset;
129} 89}
90
91/***************************************************************************/