]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/m68knommu/platform/5206e/config.c
m68knommu: cleanup m68knommu timer code
[linux-2.6-omap-h63xx.git] / arch / m68knommu / platform / 5206e / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5206e/config.c
5  *
6  *      Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7  */
8
9 /***************************************************************************/
10
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/interrupt.h>
14 #include <asm/dma.h>
15 #include <asm/machdep.h>
16 #include <asm/coldfire.h>
17 #include <asm/mcfsim.h>
18 #include <asm/mcfdma.h>
19
20 /***************************************************************************/
21
22 void coldfire_reset(void);
23
24 /***************************************************************************/
25
26 /*
27  *      DMA channel base address table.
28  */
29 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
30         MCF_MBAR + MCFDMA_BASE0,
31         MCF_MBAR + MCFDMA_BASE1,
32 };
33
34 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
35
36 /***************************************************************************/
37
38 void mcf_autovector(unsigned int vec)
39 {
40         volatile unsigned char  *mbar;
41         unsigned char           icr;
42
43         if ((vec >= 25) && (vec <= 31)) {
44                 vec -= 25;
45                 mbar = (volatile unsigned char *) MCF_MBAR;
46                 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
47                 *(mbar + MCFSIM_ICR1 + vec) = icr;
48                 vec = 0x1 << (vec + 1);
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
92 #if defined(CONFIG_NETtel)
93         /* Copy command line from FLASH to local buffer... */
94         memcpy(commandp, (char *) 0xf0004000, size);
95         commandp[size-1] = 0;
96 #endif /* CONFIG_NETtel */
97
98         mach_reset = coldfire_reset;
99 }
100
101 /***************************************************************************/