http://downloads.netgear.com/files/GPL/DM111PSP_v3.61d_GPL.tar.gz
[bcm963xx.git] / kernel / linux / arch / m68knommu / platform / 5307 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5307/config.c
5  *
6  *      Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7  *      Copyright (C) 2000, Lineo (www.lineo.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 #include <asm/mcfwdebug.h>
28
29 /***************************************************************************/
30
31 void coldfire_tick(void);
32 void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
33 unsigned long coldfire_timer_offset(void);
34 void coldfire_trap_init(void);
35 void coldfire_reset(void);
36
37 extern unsigned int mcf_timervector;
38 extern unsigned int mcf_profilevector;
39 extern unsigned int mcf_timerlevel;
40
41 /***************************************************************************/
42
43 /*
44  *      DMA channel base address table.
45  */
46 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
47         MCF_MBAR + MCFDMA_BASE0,
48         MCF_MBAR + MCFDMA_BASE1,
49         MCF_MBAR + MCFDMA_BASE2,
50         MCF_MBAR + MCFDMA_BASE3,
51 };
52
53 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
54
55 /***************************************************************************/
56
57 void mcf_autovector(unsigned int vec)
58 {
59         volatile unsigned char  *mbar;
60
61         if ((vec >= 25) && (vec <= 31)) {
62                 mbar = (volatile unsigned char *) MCF_MBAR;
63                 vec = 0x1 << (vec - 24);
64                 *(mbar + MCFSIM_AVR) |= vec;
65                 mcf_setimr(mcf_getimr() & ~vec);
66         }
67 }
68
69 /***************************************************************************/
70
71 void mcf_settimericr(unsigned int timer, unsigned int level)
72 {
73         volatile unsigned char *icrp;
74         unsigned int icr, imr;
75
76         if (timer <= 2) {
77                 switch (timer) {
78                 case 2:  icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
79                 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
80                 }
81
82                 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
83                 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
84                 mcf_setimr(mcf_getimr() & ~imr);
85         }
86 }
87
88 /***************************************************************************/
89
90 int mcf_timerirqpending(int timer)
91 {
92         unsigned int imr = 0;
93
94         switch (timer) {
95         case 1:  imr = MCFSIM_IMR_TIMER1; break;
96         case 2:  imr = MCFSIM_IMR_TIMER2; break;
97         default: break;
98         }
99         return (mcf_getipr() & imr);
100 }
101
102 /***************************************************************************/
103
104 void config_BSP(char *commandp, int size)
105 {
106         mcf_setimr(MCFSIM_IMR_MASKALL);
107
108 #if defined(CONFIG_BOOTPARAM)
109         strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
110         commandp[size-1] = 0;
111 #elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
112       defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \
113       defined(CONFIG_CLEOPATRA)
114         /* Copy command line from FLASH to local buffer... */
115         memcpy(commandp, (char *) 0xf0004000, size);
116         commandp[size-1] = 0;
117         /* Different timer setup - to prevent device clash */
118         mcf_timervector = 30;
119         mcf_profilevector = 31;
120         mcf_timerlevel = 6;
121 #else
122         memset(commandp, 0, size);
123 #endif
124
125         mach_sched_init = coldfire_timer_init;
126         mach_tick = coldfire_tick;
127         mach_gettimeoffset = coldfire_timer_offset;
128         mach_trap_init = coldfire_trap_init;
129         mach_reset = coldfire_reset;
130
131 #ifdef MCF_BDM_DISABLE
132         /*
133          * Disable the BDM clocking.  This also turns off most of the rest of
134          * the BDM device.  This is good for EMC reasons. This option is not
135          * incompatible with the memory protection option.
136          */
137         wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
138 #endif
139 }
140
141 /***************************************************************************/