diff options
author | Greg Ungerer <gerg@snapgear.com> | 2005-09-08 19:32:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-08 20:27:36 -0400 |
commit | ee721126cae77e66efb470d38cf971ed7b0c506b (patch) | |
tree | 1e877930c8301ee7d6149ab5768a745cf0e99a58 /arch/m68knommu | |
parent | 8c2b58ce716112cbba167b0abcb9558c118b8c9a (diff) |
[PATCH] m68knommu: extract common timer code for 68328 processor
Rework the 68x328 configuration and setup code. All 68x328 varient
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>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r-- | arch/m68knommu/platform/68328/config.c | 94 |
1 files changed, 21 insertions, 73 deletions
diff --git a/arch/m68knommu/platform/68328/config.c b/arch/m68knommu/platform/68328/config.c index fd7c93f86481..bcfa5d7fe1e2 100644 --- a/arch/m68knommu/platform/68328/config.c +++ b/arch/m68knommu/platform/68328/config.c | |||
@@ -1,5 +1,7 @@ | |||
1 | /***************************************************************************/ | ||
2 | |||
1 | /* | 3 | /* |
2 | * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c | 4 | * linux/arch/m68knommu/platform/68328/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 |
@@ -11,6 +13,8 @@ | |||
11 | * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca> | 13 | * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca> |
12 | */ | 14 | */ |
13 | 15 | ||
16 | /***************************************************************************/ | ||
17 | |||
14 | #include <asm/dbg.h> | 18 | #include <asm/dbg.h> |
15 | #include <stdarg.h> | 19 | #include <stdarg.h> |
16 | #include <linux/config.h> | 20 | #include <linux/config.h> |
@@ -29,76 +33,16 @@ | |||
29 | #include <asm/machdep.h> | 33 | #include <asm/machdep.h> |
30 | #include <asm/MC68328.h> | 34 | #include <asm/MC68328.h> |
31 | 35 | ||
36 | /***************************************************************************/ | ||
32 | 37 | ||
33 | void BSP_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) | 38 | void m68328_timer_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *)); |
34 | { | 39 | void m68328_timer_tick(void); |
35 | 40 | unsigned long m68328_timer_gettimeoffset(void); | |
36 | #ifdef CONFIG_XCOPILOT_BUGS | 41 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); |
37 | /* | ||
38 | * The only thing I know is that CLK32 is not available on Xcopilot | ||
39 | * I have little idea about what frequency SYSCLK has on Xcopilot. | ||
40 | * The values for prescaler and compare registers were simply | ||
41 | * taken from the original source | ||
42 | */ | ||
43 | |||
44 | /* Restart mode, Enable int, SYSCLK, Enable timer */ | ||
45 | TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_SYSCLK | TCTL_TEN; | ||
46 | /* Set prescaler */ | ||
47 | TPRER2 = 2; | ||
48 | /* Set compare register */ | ||
49 | TCMP2 = 0xd7e4; | ||
50 | #else | ||
51 | /* Restart mode, Enable int, 32KHz, Enable timer */ | ||
52 | TCTL2 = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN; | ||
53 | /* Set prescaler (Divide 32KHz by 32)*/ | ||
54 | TPRER2 = 31; | ||
55 | /* Set compare register 32Khz / 32 / 10 = 100 */ | ||
56 | TCMP2 = 10; | ||
57 | #endif | ||
58 | |||
59 | request_irq(TMR2_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL); | ||
60 | } | ||
61 | |||
62 | void BSP_tick(void) | ||
63 | { | ||
64 | /* Reset Timer2 */ | ||
65 | TSTAT2 &= 0; | ||
66 | } | ||
67 | 42 | ||
68 | unsigned long BSP_gettimeoffset (void) | 43 | /***************************************************************************/ |
69 | { | ||
70 | return 0; | ||
71 | } | ||
72 | 44 | ||
73 | void BSP_gettod (int *yearp, int *monp, int *dayp, | 45 | void m68328_reset (void) |
74 | int *hourp, int *minp, int *secp) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | int BSP_hwclk(int op, struct hwclk_time *t) | ||
79 | { | ||
80 | if (!op) { | ||
81 | /* read */ | ||
82 | } else { | ||
83 | /* write */ | ||
84 | } | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | int BSP_set_clock_mmss (unsigned long nowtime) | ||
89 | { | ||
90 | #if 0 | ||
91 | short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; | ||
92 | |||
93 | tod->second1 = real_seconds / 10; | ||
94 | tod->second2 = real_seconds % 10; | ||
95 | tod->minute1 = real_minutes / 10; | ||
96 | tod->minute2 = real_minutes % 10; | ||
97 | #endif | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | void BSP_reset (void) | ||
102 | { | 46 | { |
103 | local_irq_disable(); | 47 | local_irq_disable(); |
104 | asm volatile ("moveal #0x10c00000, %a0;\n\t" | 48 | asm volatile ("moveal #0x10c00000, %a0;\n\t" |
@@ -108,18 +52,22 @@ void BSP_reset (void) | |||
108 | "jmp (%a0);"); | 52 | "jmp (%a0);"); |
109 | } | 53 | } |
110 | 54 | ||
55 | /***************************************************************************/ | ||
56 | |||
111 | void config_BSP(char *command, int len) | 57 | void config_BSP(char *command, int len) |
112 | { | 58 | { |
113 | printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n"); | 59 | printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n"); |
114 | printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); | 60 | printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); |
115 | printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); | 61 | printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); |
116 | 62 | ||
117 | mach_sched_init = BSP_sched_init; | 63 | mach_sched_init = m68328_timer_init; |
118 | mach_tick = BSP_tick; | 64 | mach_tick = m68328_timer_tick; |
119 | mach_gettimeoffset = BSP_gettimeoffset; | 65 | mach_gettimeoffset = m68328_timer_gettimeoffset; |
120 | mach_gettod = BSP_gettod; | 66 | mach_gettod = m68328_timer_gettod; |
121 | mach_hwclk = NULL; | 67 | mach_hwclk = NULL; |
122 | mach_set_clock_mmss = NULL; | 68 | mach_set_clock_mmss = NULL; |
123 | mach_reset = BSP_reset; | 69 | mach_reset = m68328_reset; |
124 | *command = '\0'; | 70 | *command = '\0'; |
125 | } | 71 | } |
72 | |||
73 | /***************************************************************************/ | ||