Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c | |
3 | * | |
4 | * Copyright (C) 1993 Hamish Macdonald | |
5 | * Copyright (C) 1999 D. Jeff Dionne | |
6 | * | |
7 | * This file is subject to the terms and conditions of the GNU General Public | |
8 | * License. See the file COPYING in the main directory of this archive | |
9 | * for more details. | |
10 | * | |
11 | * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca> | |
12 | */ | |
13 | ||
14 | #include <asm/dbg.h> | |
15 | #include <stdarg.h> | |
16 | #include <linux/config.h> | |
17 | #include <linux/types.h> | |
18 | #include <linux/kernel.h> | |
19 | #include <linux/mm.h> | |
20 | #include <linux/tty.h> | |
21 | #include <linux/console.h> | |
22 | #include <linux/interrupt.h> | |
23 | #include <asm/current.h> | |
24 | ||
25 | #include <asm/setup.h> | |
26 | #include <asm/system.h> | |
27 | #include <asm/pgtable.h> | |
28 | #include <asm/irq.h> | |
29 | #include <asm/machdep.h> | |
30 | #include <asm/MC68328.h> | |
31 | ||
32 | ||
33 | void BSP_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) | |
34 | { | |
35 | ||
36 | #ifdef CONFIG_XCOPILOT_BUGS | |
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 | ||
68 | unsigned long BSP_gettimeoffset (void) | |
69 | { | |
70 | return 0; | |
71 | } | |
72 | ||
73 | void BSP_gettod (int *yearp, int *monp, int *dayp, | |
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 | { | |
103 | local_irq_disable(); | |
104 | asm volatile ("moveal #0x10c00000, %a0;\n\t" | |
105 | "moveb #0, 0xFFFFF300;\n\t" | |
106 | "moveal 0(%a0), %sp;\n\t" | |
107 | "moveal 4(%a0), %a0;\n\t" | |
108 | "jmp (%a0);"); | |
109 | } | |
110 | ||
111 | void config_BSP(char *command, int len) | |
112 | { | |
113 | printk(KERN_INFO "\n68328 support D. Jeff Dionne <jeff@uclinux.org>\n"); | |
114 | 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"); | |
116 | ||
117 | mach_sched_init = BSP_sched_init; | |
118 | mach_tick = BSP_tick; | |
119 | mach_gettimeoffset = BSP_gettimeoffset; | |
120 | mach_gettod = BSP_gettod; | |
121 | mach_hwclk = NULL; | |
122 | mach_set_clock_mmss = NULL; | |
123 | mach_reset = BSP_reset; | |
124 | *command = '\0'; | |
125 | } |