RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / m68knommu / platform / 5206e / config.c
blob0f67320b4031aaea269cfc7e7004ed9ce6ef905c
1 /***************************************************************************/
3 /*
4 * linux/arch/m68knommu/platform/5206e/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 */
9 /***************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/param.h>
14 #include <linux/interrupt.h>
15 #include <asm/irq.h>
16 #include <asm/dma.h>
17 #include <asm/traps.h>
18 #include <asm/machdep.h>
19 #include <asm/coldfire.h>
20 #include <asm/mcftimer.h>
21 #include <asm/mcfsim.h>
22 #include <asm/mcfdma.h>
23 #include <asm/irq.h>
25 /***************************************************************************/
27 void coldfire_tick(void);
28 void coldfire_timer_init(irq_handler_t handler);
29 unsigned long coldfire_timer_offset(void);
30 void coldfire_trap_init(void);
31 void coldfire_reset(void);
33 /***************************************************************************/
36 * DMA channel base address table.
38 unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
39 MCF_MBAR + MCFDMA_BASE0,
40 MCF_MBAR + MCFDMA_BASE1,
43 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
45 /***************************************************************************/
47 void mcf_autovector(unsigned int vec)
49 volatile unsigned char *mbar;
50 unsigned char icr;
52 if ((vec >= 25) && (vec <= 31)) {
53 vec -= 25;
54 mbar = (volatile unsigned char *) MCF_MBAR;
55 icr = MCFSIM_ICR_AUTOVEC | (vec << 3);
56 *(mbar + MCFSIM_ICR1 + vec) = icr;
57 vec = 0x1 << (vec + 1);
58 mcf_setimr(mcf_getimr() & ~vec);
62 /***************************************************************************/
64 void mcf_settimericr(unsigned int timer, unsigned int level)
66 volatile unsigned char *icrp;
67 unsigned int icr, imr;
69 if (timer <= 2) {
70 switch (timer) {
71 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
72 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
75 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
76 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
77 mcf_setimr(mcf_getimr() & ~imr);
81 /***************************************************************************/
83 int mcf_timerirqpending(int timer)
85 unsigned int imr = 0;
87 switch (timer) {
88 case 1: imr = MCFSIM_IMR_TIMER1; break;
89 case 2: imr = MCFSIM_IMR_TIMER2; break;
90 default: break;
92 return (mcf_getipr() & imr);
95 /***************************************************************************/
97 void config_BSP(char *commandp, int size)
99 mcf_setimr(MCFSIM_IMR_MASKALL);
101 #if defined(CONFIG_BOOTPARAM)
102 strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
103 commandp[size-1] = 0;
104 #elif defined(CONFIG_NETtel)
105 /* Copy command line from FLASH to local buffer... */
106 memcpy(commandp, (char *) 0xf0004000, size);
107 commandp[size-1] = 0;
108 #else
109 memset(commandp, 0, size);
110 #endif /* CONFIG_NETtel */
112 mach_sched_init = coldfire_timer_init;
113 mach_tick = coldfire_tick;
114 mach_gettimeoffset = coldfire_timer_offset;
115 mach_trap_init = coldfire_trap_init;
116 mach_reset = coldfire_reset;
119 /***************************************************************************/