ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[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 #include <asm/delay.h>
27
28 /***************************************************************************/
29
30 void coldfire_tick(void);
31 void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
32 unsigned long coldfire_timer_offset(void);
33 void coldfire_trap_init(void);
34 void coldfire_reset(void);
35
36 extern unsigned int mcf_timervector;
37 extern unsigned int mcf_profilevector;
38 extern unsigned int mcf_timerlevel;
39
40 /***************************************************************************/
41
42 /*
43  *      DMA channel base address table.
44  */
45 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
46         MCF_MBAR + MCFDMA_BASE0,
47 };
48
49 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
50
51 /***************************************************************************/
52
53 void mcf_disableall(void)
54 {
55         volatile unsigned long  *icrp;
56
57         icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
58         icrp[0] = 0x88888888;
59         icrp[1] = 0x88888888;
60         icrp[2] = 0x88888888;
61         icrp[3] = 0x88888888;
62 }
63
64 /***************************************************************************/
65
66 void mcf_autovector(unsigned int vec)
67 {
68         /* Everything is auto-vectored on the 5272 */
69 }
70
71 /***************************************************************************/
72
73 void mcf_settimericr(int timer, int level)
74 {
75         volatile unsigned long *icrp;
76
77         if ((timer >= 1 ) && (timer <= 4)) {
78                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
79                 *icrp = (0x8 | level) << ((4 - timer) * 4);
80         }
81 }
82
83 /***************************************************************************/
84
85 int mcf_timerirqpending(int timer)
86 {
87         volatile unsigned long *icrp;
88
89         if ((timer >= 1 ) && (timer <= 4)) {
90                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
91                 return (*icrp & (0x8 << ((4 - timer) * 4)));
92         }
93         return 0;
94 }
95
96 /***************************************************************************/
97
98 void config_BSP(char *commandp, int size)
99 {
100 #if 0
101         volatile unsigned long  *pivrp;
102
103         /* Set base of device vectors to be 64 */
104         pivrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PIVR);
105         *pivrp = 0x40;
106 #endif
107
108         mcf_disableall();
109
110 #if defined(CONFIG_BOOTPARAM)
111         strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
112         commandp[size-1] = 0;
113 #elif defined(CONFIG_NETtel)
114         /* Copy command line from FLASH to local buffer... */
115         memcpy(commandp, (char *) 0xf0004000, size);
116         commandp[size-1] = 0;
117 #elif defined(CONFIG_MTD_KeyTechnology)
118         /* Copy command line from FLASH to local buffer... */
119         memcpy(commandp, (char *) 0xffe06000, size);
120         commandp[size-1] = 0;
121 #else
122         memset(commandp, 0, size);
123 #endif
124
125         mcf_timervector = 69;
126         mcf_profilevector = 70;
127         mach_sched_init = coldfire_timer_init;
128         mach_tick = coldfire_tick;
129         mach_gettimeoffset = coldfire_timer_offset;
130         mach_trap_init = coldfire_trap_init;
131         mach_reset = coldfire_reset;
132 }
133
134 /***************************************************************************/