]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - arch/m68knommu/platform/5272/config.c
Remove obsolete #include <linux/config.h>
[linux-3.10.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/sched.h>
14 #include <linux/param.h>
15 #include <linux/init.h>
16 #include <linux/interrupt.h>
17 #include <asm/irq.h>
18 #include <asm/dma.h>
19 #include <asm/traps.h>
20 #include <asm/machdep.h>
21 #include <asm/coldfire.h>
22 #include <asm/mcftimer.h>
23 #include <asm/mcfsim.h>
24 #include <asm/mcfdma.h>
25
26 /***************************************************************************/
27
28 void coldfire_tick(void);
29 void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
30 unsigned long coldfire_timer_offset(void);
31 void coldfire_trap_init(void);
32 void coldfire_reset(void);
33
34 extern unsigned int mcf_timervector;
35 extern unsigned int mcf_profilevector;
36 extern unsigned int mcf_timerlevel;
37
38 /***************************************************************************/
39
40 /*
41  *      Some platforms need software versions of the GPIO data registers.
42  */
43 unsigned short ppdata;
44 unsigned char ledbank = 0xff;
45
46 /***************************************************************************/
47
48 /*
49  *      DMA channel base address table.
50  */
51 unsigned int   dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
52         MCF_MBAR + MCFDMA_BASE0,
53 };
54
55 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
56
57 /***************************************************************************/
58
59 void mcf_disableall(void)
60 {
61         volatile unsigned long  *icrp;
62
63         icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
64         icrp[0] = 0x88888888;
65         icrp[1] = 0x88888888;
66         icrp[2] = 0x88888888;
67         icrp[3] = 0x88888888;
68 }
69
70 /***************************************************************************/
71
72 void mcf_autovector(unsigned int vec)
73 {
74         /* Everything is auto-vectored on the 5272 */
75 }
76
77 /***************************************************************************/
78
79 void mcf_settimericr(int timer, int level)
80 {
81         volatile unsigned long *icrp;
82
83         if ((timer >= 1 ) && (timer <= 4)) {
84                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
85                 *icrp = (0x8 | level) << ((4 - timer) * 4);
86         }
87 }
88
89 /***************************************************************************/
90
91 int mcf_timerirqpending(int timer)
92 {
93         volatile unsigned long *icrp;
94
95         if ((timer >= 1 ) && (timer <= 4)) {
96                 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
97                 return (*icrp & (0x8 << ((4 - timer) * 4)));
98         }
99         return 0;
100 }
101
102 /***************************************************************************/
103
104 void config_BSP(char *commandp, int size)
105 {
106 #if defined (CONFIG_MOD5272)
107         volatile unsigned char  *pivrp;
108
109         /* Set base of device vectors to be 64 */
110         pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
111         *pivrp = 0x40;
112 #endif
113
114         mcf_disableall();
115
116 #if defined(CONFIG_BOOTPARAM)
117         strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
118         commandp[size-1] = 0;
119 #elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
120         /* Copy command line from FLASH to local buffer... */
121         memcpy(commandp, (char *) 0xf0004000, size);
122         commandp[size-1] = 0;
123 #elif defined(CONFIG_MTD_KeyTechnology)
124         /* Copy command line from FLASH to local buffer... */
125         memcpy(commandp, (char *) 0xffe06000, size);
126         commandp[size-1] = 0;
127 #elif defined(CONFIG_CANCam)
128         /* Copy command line from FLASH to local buffer... */
129         memcpy(commandp, (char *) 0xf0010000, size);
130         commandp[size-1] = 0;
131 #else
132         memset(commandp, 0, size);
133 #endif
134
135         mcf_timervector = 69;
136         mcf_profilevector = 70;
137         mach_sched_init = coldfire_timer_init;
138         mach_tick = coldfire_tick;
139         mach_gettimeoffset = coldfire_timer_offset;
140         mach_trap_init = coldfire_trap_init;
141         mach_reset = coldfire_reset;
142 }
143
144 /***************************************************************************/