Pull cpuidle into release branch
[pandora-kernel.git] / arch / m68knommu / platform / 5407 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5407/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/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/mcfsim.h>
20 #include <asm/mcfdma.h>
21
22 /***************************************************************************/
23
24 void coldfire_reset(void);
25
26 extern unsigned int mcf_timervector;
27 extern unsigned int mcf_profilevector;
28 extern unsigned int mcf_timerlevel;
29
30 /***************************************************************************/
31
32 /*
33  *      DMA channel base address table.
34  */
35 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
36         MCF_MBAR + MCFDMA_BASE0,
37         MCF_MBAR + MCFDMA_BASE1,
38         MCF_MBAR + MCFDMA_BASE2,
39         MCF_MBAR + MCFDMA_BASE3,
40 };
41
42 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
43
44 /***************************************************************************/
45
46 void mcf_autovector(unsigned int vec)
47 {
48         volatile unsigned char  *mbar;
49
50         if ((vec >= 25) && (vec <= 31)) {
51                 mbar = (volatile unsigned char *) MCF_MBAR;
52                 vec = 0x1 << (vec - 24);
53                 *(mbar + MCFSIM_AVR) |= vec;
54                 mcf_setimr(mcf_getimr() & ~vec);
55         }
56 }
57
58 /***************************************************************************/
59
60 void mcf_settimericr(unsigned int timer, unsigned int level)
61 {
62         volatile unsigned char *icrp;
63         unsigned int icr, imr;
64
65         if (timer <= 2) {
66                 switch (timer) {
67                 case 2:  icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
68                 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
69                 }
70
71                 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
72                 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
73                 mcf_setimr(mcf_getimr() & ~imr);
74         }
75 }
76
77 /***************************************************************************/
78
79 int mcf_timerirqpending(int timer)
80 {
81         unsigned int imr = 0;
82
83         switch (timer) {
84         case 1:  imr = MCFSIM_IMR_TIMER1; break;
85         case 2:  imr = MCFSIM_IMR_TIMER2; break;
86         default: break;
87         }
88         return (mcf_getipr() & imr);
89 }
90
91 /***************************************************************************/
92
93 void config_BSP(char *commandp, int size)
94 {
95         mcf_setimr(MCFSIM_IMR_MASKALL);
96
97 #if defined(CONFIG_CLEOPATRA)
98         /* Different timer setup - to prevent device clash */
99         mcf_timervector = 30;
100         mcf_profilevector = 31;
101         mcf_timerlevel = 6;
102 #endif
103
104         mach_reset = coldfire_reset;
105 }
106
107 /***************************************************************************/