Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
[sfrench/cifs-2.6.git] / arch / m68knommu / platform / 5272 / config.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5272/config.c
5  *
6  *      Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7  *      Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.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  *      Some platforms need software versions of the GPIO data registers.
34  */
35 unsigned short ppdata;
36 unsigned char ledbank = 0xff;
37
38 /***************************************************************************/
39
40 /*
41  *      DMA channel base address table.
42  */
43 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
44         MCF_MBAR + MCFDMA_BASE0,
45 };
46
47 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
48
49 /***************************************************************************/
50
51 void mcf_disableall(void)
52 {
53         volatile unsigned long  *icrp;
54
55         icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
56         icrp[0] = 0x88888888;
57         icrp[1] = 0x88888888;
58         icrp[2] = 0x88888888;
59         icrp[3] = 0x88888888;
60 }
61
62 /***************************************************************************/
63
64 void mcf_autovector(unsigned int vec)
65 {
66         /* Everything is auto-vectored on the 5272 */
67 }
68
69 /***************************************************************************/
70
71 void mcf_settimericr(int timer, int level)
72 {
73         volatile unsigned long *icrp;
74
75         if ((timer >= 1 ) && (timer <= 4)) {
76                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
77                 *icrp = (0x8 | level) << ((4 - timer) * 4);
78         }
79 }
80
81 /***************************************************************************/
82
83 int mcf_timerirqpending(int timer)
84 {
85         volatile unsigned long *icrp;
86
87         if ((timer >= 1 ) && (timer <= 4)) {
88                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
89                 return (*icrp & (0x8 << ((4 - timer) * 4)));
90         }
91         return 0;
92 }
93
94 /***************************************************************************/
95
96 void config_BSP(char *commandp, int size)
97 {
98 #if defined (CONFIG_MOD5272)
99         volatile unsigned char  *pivrp;
100
101         /* Set base of device vectors to be 64 */
102         pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
103         *pivrp = 0x40;
104 #endif
105
106         mcf_disableall();
107
108 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
109         /* Copy command line from FLASH to local buffer... */
110         memcpy(commandp, (char *) 0xf0004000, size);
111         commandp[size-1] = 0;
112 #elif defined(CONFIG_MTD_KeyTechnology)
113         /* Copy command line from FLASH to local buffer... */
114         memcpy(commandp, (char *) 0xffe06000, size);
115         commandp[size-1] = 0;
116 #elif defined(CONFIG_CANCam)
117         /* Copy command line from FLASH to local buffer... */
118         memcpy(commandp, (char *) 0xf0010000, size);
119         commandp[size-1] = 0;
120 #endif
121
122         mcf_timervector = 69;
123         mcf_profilevector = 70;
124         mach_reset = coldfire_reset;
125 }
126
127 /***************************************************************************/