Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[pandora-kernel.git] / arch / m68knommu / platform / 5249 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5249/config.c
5  *
6  *      Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com)
7  */
8
9 /***************************************************************************/
10
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <asm/dma.h>
16 #include <asm/machdep.h>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/mcfdma.h>
20
21 /***************************************************************************/
22
23 void coldfire_reset(void);
24
25 /***************************************************************************/
26
27 /*
28  *      DMA channel base address table.
29  */
30 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
31         MCF_MBAR + MCFDMA_BASE0,
32         MCF_MBAR + MCFDMA_BASE1,
33         MCF_MBAR + MCFDMA_BASE2,
34         MCF_MBAR + MCFDMA_BASE3,
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
45         if ((vec >= 25) && (vec <= 31)) {
46                 mbar = (volatile unsigned char *) MCF_MBAR;
47                 vec = 0x1 << (vec - 24);
48                 *(mbar + MCFSIM_AVR) |= vec;
49                 mcf_setimr(mcf_getimr() & ~vec);
50         }
51 }
52
53 /***************************************************************************/
54
55 void mcf_settimericr(unsigned int timer, unsigned int level)
56 {
57         volatile unsigned char *icrp;
58         unsigned int icr, imr;
59
60         if (timer <= 2) {
61                 switch (timer) {
62                 case 2:  icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
63                 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
64                 }
65
66                 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
67                 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
68                 mcf_setimr(mcf_getimr() & ~imr);
69         }
70 }
71
72 /***************************************************************************/
73
74 int mcf_timerirqpending(int timer)
75 {
76         unsigned int imr = 0;
77
78         switch (timer) {
79         case 1:  imr = MCFSIM_IMR_TIMER1; break;
80         case 2:  imr = MCFSIM_IMR_TIMER2; break;
81         default: break;
82         }
83         return (mcf_getipr() & imr);
84 }
85
86 /***************************************************************************/
87
88 void config_BSP(char *commandp, int size)
89 {
90         mcf_setimr(MCFSIM_IMR_MASKALL);
91         mach_reset = coldfire_reset;
92 }
93
94 /***************************************************************************/