1 /***************************************************************************/
4 * linux/arch/m68knommu/platform/5249/config.c
6 * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com)
9 /***************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
18 #include <asm/traps.h>
19 #include <asm/machdep.h>
20 #include <asm/coldfire.h>
21 #include <asm/mcftimer.h>
22 #include <asm/mcfsim.h>
23 #include <asm/mcfdma.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_reset(void);
32 /***************************************************************************/
35 * DMA channel base address table.
37 unsigned int dma_base_addr
[MAX_M68K_DMA_CHANNELS
] = {
38 MCF_MBAR
+ MCFDMA_BASE0
,
39 MCF_MBAR
+ MCFDMA_BASE1
,
40 MCF_MBAR
+ MCFDMA_BASE2
,
41 MCF_MBAR
+ MCFDMA_BASE3
,
44 unsigned int dma_device_address
[MAX_M68K_DMA_CHANNELS
];
46 /***************************************************************************/
48 void mcf_autovector(unsigned int vec
)
50 volatile unsigned char *mbar
;
52 if ((vec
>= 25) && (vec
<= 31)) {
53 mbar
= (volatile unsigned char *) MCF_MBAR
;
54 vec
= 0x1 << (vec
- 24);
55 *(mbar
+ MCFSIM_AVR
) |= vec
;
56 mcf_setimr(mcf_getimr() & ~vec
);
60 /***************************************************************************/
62 void mcf_settimericr(unsigned int timer
, unsigned int level
)
64 volatile unsigned char *icrp
;
65 unsigned int icr
, imr
;
69 case 2: icr
= MCFSIM_TIMER2ICR
; imr
= MCFSIM_IMR_TIMER2
; break;
70 default: icr
= MCFSIM_TIMER1ICR
; imr
= MCFSIM_IMR_TIMER1
; break;
73 icrp
= (volatile unsigned char *) (MCF_MBAR
+ icr
);
74 *icrp
= MCFSIM_ICR_AUTOVEC
| (level
<< 2) | MCFSIM_ICR_PRI3
;
75 mcf_setimr(mcf_getimr() & ~imr
);
79 /***************************************************************************/
81 int mcf_timerirqpending(int timer
)
86 case 1: imr
= MCFSIM_IMR_TIMER1
; break;
87 case 2: imr
= MCFSIM_IMR_TIMER2
; break;
90 return (mcf_getipr() & imr
);
93 /***************************************************************************/
95 void config_BSP(char *commandp
, int size
)
97 mcf_setimr(MCFSIM_IMR_MASKALL
);
98 mach_sched_init
= coldfire_timer_init
;
99 mach_tick
= coldfire_tick
;
100 mach_gettimeoffset
= coldfire_timer_offset
;
101 mach_reset
= coldfire_reset
;
104 /***************************************************************************/