RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / m68knommu / platform / 5272 / config.c
blob6b437cc977763c6f19645b5114eafb58e47bd12d
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/5272/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
8 */
10 /***************************************************************************/
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>
26 /***************************************************************************/
28 void coldfire_tick(void);
29 void coldfire_timer_init(irq_handler_t handler);
30 unsigned long coldfire_timer_offset(void);
31 void coldfire_trap_init(void);
32 void coldfire_reset(void);
34 extern unsigned int mcf_timervector;
35 extern unsigned int mcf_profilevector;
36 extern unsigned int mcf_timerlevel;
38 /***************************************************************************/
41 * Some platforms need software versions of the GPIO data registers.
43 unsigned short ppdata;
44 unsigned char ledbank = 0xff;
46 /***************************************************************************/
49 * DMA channel base address table.
51 unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
52 MCF_MBAR + MCFDMA_BASE0,
55 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
57 /***************************************************************************/
59 void mcf_disableall(void)
61 volatile unsigned long *icrp;
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;
70 /***************************************************************************/
72 void mcf_autovector(unsigned int vec)
74 /* Everything is auto-vectored on the 5272 */
77 /***************************************************************************/
79 void mcf_settimericr(int timer, int level)
81 volatile unsigned long *icrp;
83 if ((timer >= 1 ) && (timer <= 4)) {
84 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
85 *icrp = (0x8 | level) << ((4 - timer) * 4);
89 /***************************************************************************/
91 int mcf_timerirqpending(int timer)
93 volatile unsigned long *icrp;
95 if ((timer >= 1 ) && (timer <= 4)) {
96 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
97 return (*icrp & (0x8 << ((4 - timer) * 4)));
99 return 0;
102 /***************************************************************************/
104 void config_BSP(char *commandp, int size)
106 #if defined (CONFIG_MOD5272)
107 volatile unsigned char *pivrp;
109 /* Set base of device vectors to be 64 */
110 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
111 *pivrp = 0x40;
112 #endif
114 mcf_disableall();
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
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;
144 /***************************************************************************/