OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [m68knommu/] [platform/] [5206/] [config.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/***************************************************************************/
2
 
3
/*
4
 *      linux/arch/m68knommu/platform/5206/config.c
5
 *
6
 *      Copyright (C) 1999-2000, Greg Ungerer (gerg@moreton.com.au)
7
 */
8
 
9
/***************************************************************************/
10
 
11
#include <linux/config.h>
12
#include <linux/kernel.h>
13
#include <linux/sched.h>
14
#include <linux/param.h>
15
#include <asm/irq.h>
16
#include <asm/dma.h>
17
#include <asm/traps.h>
18
#include <asm/machdep.h>
19
#include <asm/coldfire.h>
20
#include <asm/mcftimer.h>
21
#include <asm/mcfsim.h>
22
#include <asm/mcfdma.h>
23
 
24
/***************************************************************************/
25
 
26
/*
27
 *      DMA channel base address table.
28
 */
29
unsigned int   dma_base_addr[MAX_DMA_CHANNELS] = {
30
        MCF_MBAR + MCFDMA_BASE0,
31
        MCF_MBAR + MCFDMA_BASE1,
32
};
33
 
34
/***************************************************************************/
35
 
36
void coldfire_tick(void)
37
{
38
        volatile unsigned char  *timerp;
39
 
40
        /* Reset the ColdFire timer */
41
        timerp = (volatile unsigned char *) (MCF_MBAR + MCFTIMER_BASE1);
42
        timerp[MCFTIMER_TER] = MCFTIMER_TER_CAP | MCFTIMER_TER_REF;
43
}
44
 
45
/***************************************************************************/
46
 
47
void coldfire_timer_init(void (*handler)(int, void *, struct pt_regs *))
48
{
49
        volatile unsigned short *timerp;
50
        volatile unsigned char  *icrp;
51
 
52
        /* Set up TIMER 1 as poll clock */
53
        timerp = (volatile unsigned short *) (MCF_MBAR + MCFTIMER_BASE1);
54
        timerp[MCFTIMER_TMR] = MCFTIMER_TMR_DISABLE;
55
 
56
        timerp[MCFTIMER_TRR] = (unsigned short) ((MCF_CLK / 16) / HZ);
57
        timerp[MCFTIMER_TMR] = MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
58
                MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE;
59
 
60
        icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_TIMER1ICR);
61
 
62
        *icrp = MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI3;
63
        request_irq(29, handler, SA_INTERRUPT, "ColdFire Timer", NULL);
64
        mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_TIMER1);
65
}
66
 
67
/***************************************************************************/
68
 
69
/*
70
 *      Program the vector to be an auto-vectored.
71
 */
72
 
73
void mcf_autovector(unsigned int vec)
74
{
75
        volatile unsigned char  *mbar;
76
        unsigned char           icr;
77
 
78
        if ((vec >= 25) && (vec <= 31)) {
79
                vec -= 25;
80
                mbar = (volatile unsigned char *) MCF_MBAR;
81
                icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
82
                *(mbar + MCFSIM_ICR1 + vec) = icr;
83
                vec = 0x1 << (vec + 1);
84
                mcf_setimr(mcf_getimr() & ~vec);
85
        }
86
}
87
 
88
/***************************************************************************/
89
 
90
extern e_vector *_ramvec;
91
 
92
void set_evector(int vecnum, void (*handler)(void))
93
{
94
        if (vecnum >= 0 && vecnum <= 255)
95
                _ramvec[vecnum] = handler;
96
}
97
 
98
/***************************************************************************/
99
 
100
/* assembler routines */
101
asmlinkage void buserr(void);
102
asmlinkage void trap(void);
103
asmlinkage void system_call(void);
104
asmlinkage void intrhandler(void);
105
 
106
void coldfire_trap_init(void)
107
{
108
        int i;
109
 
110
#ifndef ENABLE_dBUG
111
        mcf_setimr(MCFSIM_IMR_MASKALL);
112
#endif
113
 
114
        /*
115
         *      There is a common trap handler and common interrupt
116
         *      handler that handle almost every vector. We treat
117
         *      the system call and bus error special, they get their
118
         *      own first level handlers.
119
         */
120
#ifndef ENABLE_dBUG
121
        for (i = 3; (i <= 23); i++)
122
                _ramvec[i] = trap;
123
        for (i = 33; (i <= 63); i++)
124
                _ramvec[i] = trap;
125
#endif
126
 
127
        for (i = 24; (i <= 30); i++)
128
                _ramvec[i] = intrhandler;
129
#ifndef ENABLE_dBUG
130
        _ramvec[31] = intrhandler;  // Disables the IRQ7 button
131
#endif
132
 
133
        for (i = 64; (i < 255); i++)
134
                _ramvec[i] = intrhandler;
135
        _ramvec[255] = 0;
136
 
137
        _ramvec[2] = buserr;
138
        _ramvec[32] = system_call;
139
}
140
 
141
/***************************************************************************/
142
 
143
/*
144
 *      Generic dumping code. Used for panic and debug.
145
 */
146
 
147
void dump(struct pt_regs *fp)
148
{
149
        extern unsigned int sw_usp, sw_ksp;
150
        unsigned long   *sp;
151
        unsigned char   *tp;
152
        int             i;
153
 
154
        printk("\nCURRENT PROCESS:\n\n");
155
        printk("COMM=%s PID=%d\n", current->comm, current->pid);
156
        printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
157
                (int) current->mm->start_code,
158
                (int) current->mm->end_code,
159
                (int) current->mm->start_data,
160
                (int) current->mm->end_data,
161
                (int) current->mm->end_data,
162
                (int) current->mm->brk);
163
        printk("USER-STACK=%08x  KERNEL-STACK=%08x\n\n",
164
                (int) current->mm->start_stack,
165
                (int) current->kernel_stack_page);
166
 
167
        printk("PC: %08lx\n", fp->pc);
168
        printk("SR: %08lx    SP: %08lx\n", (long) fp->sr, (long) fp);
169
        printk("d0: %08lx    d1: %08lx    d2: %08lx    d3: %08lx\n",
170
                fp->d0, fp->d1, fp->d2, fp->d3);
171
        printk("d4: %08lx    d5: %08lx    a0: %08lx    a1: %08lx\n",
172
                fp->d4, fp->d5, fp->a0, fp->a1);
173
        printk("\nUSP: %08x   KSP: %08x   TRAPFRAME: %08x\n",
174
                sw_usp, sw_ksp, (unsigned int) fp);
175
 
176
        printk("\nCODE:");
177
        tp = ((unsigned char *) fp->pc) - 0x20;
178
        for (sp = (unsigned long *) tp, i = 0; (i < 0x40);  i += 4) {
179
                if ((i % 0x10) == 0)
180
                        printk("\n%08x: ", (int) (tp + i));
181
                printk("%08x ", (int) *sp++);
182
        }
183
        printk("\n");
184
 
185
        printk("\nKERNEL STACK:");
186
        tp = ((unsigned char *) fp) - 0x40;
187
        for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
188
                if ((i % 0x10) == 0)
189
                        printk("\n%08x: ", (int) (tp + i));
190
                printk("%08x ", (int) *sp++);
191
        }
192
        printk("\n");
193
        if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
194
                printk("(Possibly corrupted stack page??)\n");
195
        printk("\n");
196
 
197
#if 1
198
        printk("\nUSER STACK:");
199
        tp = (unsigned char *) sw_usp;
200
        for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {
201
                if ((i % 0x10) == 0)
202
                        printk("\n%08x: ", (int) (tp + i));
203
                printk("%08x ", (int) *sp++);
204
        }
205
        printk("\n\n");
206
#endif
207
}
208
 
209
/***************************************************************************/
210
 
211
void config_BSP(char *commandp, int size)
212
{
213
        memset(commandp, 0, size);
214
        mach_sched_init = coldfire_timer_init;
215
        mach_tick = coldfire_tick;
216
        mach_trap_init = coldfire_trap_init;
217
}
218
 
219
/***************************************************************************/

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.