Pull cpuidle into release branch
[pandora-kernel.git] / arch / m68knommu / platform / 5206 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5206/config.c
5  *
6  *      Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7  *      Copyright (C) 2000-2001, Lineo Inc. (www.lineo.com) 
8  */
9
10 /***************************************************************************/
11
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
16 #include <asm/dma.h>
17 #include <asm/machdep.h>
18 #include <asm/coldfire.h>
19 #include <asm/mcftimer.h>
20 #include <asm/mcfsim.h>
21 #include <asm/mcfdma.h>
22
23 /***************************************************************************/
24
25 void coldfire_reset(void);
26
27 /***************************************************************************/
28
29 /*
30  *      DMA channel base address table.
31  */
32 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
33         MCF_MBAR + MCFDMA_BASE0,
34         MCF_MBAR + MCFDMA_BASE1,
35 };
36
37 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
38
39 /***************************************************************************/
40
41 void mcf_autovector(unsigned int vec)
42 {
43         volatile unsigned char  *mbar;
44         unsigned char           icr;
45
46         if ((vec >= 25) && (vec <= 31)) {
47                 vec -= 25;
48                 mbar = (volatile unsigned char *) MCF_MBAR;
49                 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
50                 *(mbar + MCFSIM_ICR1 + vec) = icr;
51                 vec = 0x1 << (vec + 1);
52                 mcf_setimr(mcf_getimr() & ~vec);
53         }
54 }
55
56 /***************************************************************************/
57
58 void mcf_settimericr(unsigned int timer, unsigned int level)
59 {
60         volatile unsigned char *icrp;
61         unsigned int icr, imr;
62
63         if (timer <= 2) {
64                 switch (timer) {
65                 case 2:  icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
66                 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
67                 }
68
69                 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
70                 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
71                 mcf_setimr(mcf_getimr() & ~imr);
72         }
73 }
74
75 /***************************************************************************/
76
77 int mcf_timerirqpending(int timer)
78 {
79         unsigned int imr = 0;
80
81         switch (timer) {
82         case 1:  imr = MCFSIM_IMR_TIMER1; break;
83         case 2:  imr = MCFSIM_IMR_TIMER2; break;
84         default: break;
85         }
86         return (mcf_getipr() & imr);
87 }
88
89 /***************************************************************************/
90
91 void config_BSP(char *commandp, int size)
92 {
93         mcf_setimr(MCFSIM_IMR_MASKALL);
94         mach_reset = coldfire_reset;
95 }
96
97 /***************************************************************************/