1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5407/config.c
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2000, Lineo (www.lineo.com)
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>
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_reset(void);
33 extern unsigned int mcf_timervector;
34 extern unsigned int mcf_profilevector;
35 extern unsigned int mcf_timerlevel;
37 /***************************************************************************/
40 * DMA channel base address table.
42 unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
43 MCF_MBAR + MCFDMA_BASE0,
44 MCF_MBAR + MCFDMA_BASE1,
45 MCF_MBAR + MCFDMA_BASE2,
46 MCF_MBAR + MCFDMA_BASE3,
49 unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
51 /***************************************************************************/
53 void mcf_autovector(unsigned int vec)
55 volatile unsigned char *mbar;
57 if ((vec >= 25) && (vec <= 31)) {
58 mbar = (volatile unsigned char *) MCF_MBAR;
59 vec = 0x1 << (vec - 24);
60 *(mbar + MCFSIM_AVR) |= vec;
61 mcf_setimr(mcf_getimr() & ~vec);
65 /***************************************************************************/
67 void mcf_settimericr(unsigned int timer, unsigned int level)
69 volatile unsigned char *icrp;
70 unsigned int icr, imr;
74 case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break;
75 default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break;
78 icrp = (volatile unsigned char *) (MCF_MBAR + icr);
79 *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3;
80 mcf_setimr(mcf_getimr() & ~imr);
84 /***************************************************************************/
86 int mcf_timerirqpending(int timer)
91 case 1: imr = MCFSIM_IMR_TIMER1; break;
92 case 2: imr = MCFSIM_IMR_TIMER2; break;
95 return (mcf_getipr() & imr);
98 /***************************************************************************/
100 void config_BSP(char *commandp, int size)
102 mcf_setimr(MCFSIM_IMR_MASKALL);
104 #if defined(CONFIG_CLEOPATRA)
105 /* Different timer setup - to prevent device clash */
106 mcf_timervector = 30;
107 mcf_profilevector = 31;
111 mach_sched_init = coldfire_timer_init;
112 mach_tick = coldfire_tick;
113 mach_gettimeoffset = coldfire_timer_offset;
114 mach_reset = coldfire_reset;
117 /***************************************************************************/