vserver 1.9.5.x5
[linux-2.6.git] / arch / m68knommu / platform / 5272 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5272/config.c
5  *
6  *      Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7  *      Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
8  */
9
10 /***************************************************************************/
11
12 #include <linux/config.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/param.h>
16 #include <linux/init.h>
17 #include <linux/interrupt.h>
18 #include <asm/irq.h>
19 #include <asm/dma.h>
20 #include <asm/traps.h>
21 #include <asm/machdep.h>
22 #include <asm/coldfire.h>
23 #include <asm/mcftimer.h>
24 #include <asm/mcfsim.h>
25 #include <asm/mcfdma.h>
26
27 /***************************************************************************/
28
29 void coldfire_tick(void);
30 void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
31 unsigned long coldfire_timer_offset(void);
32 void coldfire_trap_init(void);
33 void coldfire_reset(void);
34
35 extern unsigned int mcf_timervector;
36 extern unsigned int mcf_profilevector;
37 extern unsigned int mcf_timerlevel;
38
39 /***************************************************************************/
40
41 /*
42  *      DMA channel base address table.
43  */
44 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
45         MCF_MBAR + MCFDMA_BASE0,
46 };
47
48 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
49
50 /***************************************************************************/
51
52 void mcf_disableall(void)
53 {
54         volatile unsigned long  *icrp;
55
56         icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
57         icrp[0] = 0x88888888;
58         icrp[1] = 0x88888888;
59         icrp[2] = 0x88888888;
60         icrp[3] = 0x88888888;
61 }
62
63 /***************************************************************************/
64
65 void mcf_autovector(unsigned int vec)
66 {
67         /* Everything is auto-vectored on the 5272 */
68 }
69
70 /***************************************************************************/
71
72 void mcf_settimericr(int timer, int level)
73 {
74         volatile unsigned long *icrp;
75
76         if ((timer >= 1 ) && (timer <= 4)) {
77                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
78                 *icrp = (0x8 | level) << ((4 - timer) * 4);
79         }
80 }
81
82 /***************************************************************************/
83
84 int mcf_timerirqpending(int timer)
85 {
86         volatile unsigned long *icrp;
87
88         if ((timer >= 1 ) && (timer <= 4)) {
89                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
90                 return (*icrp & (0x8 << ((4 - timer) * 4)));
91         }
92         return 0;
93 }
94
95 /***************************************************************************/
96
97 void config_BSP(char *commandp, int size)
98 {
99 #if 0
100         volatile unsigned long  *pivrp;
101
102         /* Set base of device vectors to be 64 */
103         pivrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PIVR);
104         *pivrp = 0x40;
105 #endif
106
107         mcf_disableall();
108
109 #if defined(CONFIG_BOOTPARAM)
110         strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
111         commandp[size-1] = 0;
112 #elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
113         /* Copy command line from FLASH to local buffer... */
114         memcpy(commandp, (char *) 0xf0004000, size);
115         commandp[size-1] = 0;
116 #elif defined(CONFIG_MTD_KeyTechnology)
117         /* Copy command line from FLASH to local buffer... */
118         memcpy(commandp, (char *) 0xffe06000, size);
119         commandp[size-1] = 0;
120 #elif defined(CONFIG_CANCam)
121         /* Copy command line from FLASH to local buffer... */
122         memcpy(commandp, (char *) 0xf0010000, size);
123         commandp[size-1] = 0;
124 #else
125         memset(commandp, 0, size);
126 #endif
127
128         mcf_timervector = 69;
129         mcf_profilevector = 70;
130         mach_sched_init = coldfire_timer_init;
131         mach_tick = coldfire_tick;
132         mach_gettimeoffset = coldfire_timer_offset;
133         mach_trap_init = coldfire_trap_init;
134         mach_reset = coldfire_reset;
135 }
136
137 /***************************************************************************/