diff options
Diffstat (limited to 'arch/m68knommu/platform/5206e/config.c')
-rw-r--r-- | arch/m68knommu/platform/5206e/config.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c new file mode 100644 index 000000000000..f35b8606c1ee --- /dev/null +++ b/arch/m68knommu/platform/5206e/config.c | |||
@@ -0,0 +1,120 @@ | |||
1 | /***************************************************************************/ | ||
2 | |||
3 | /* | ||
4 | * linux/arch/m68knommu/platform/5206e/config.c | ||
5 | * | ||
6 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) | ||
7 | */ | ||
8 | |||
9 | /***************************************************************************/ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/param.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <asm/irq.h> | ||
17 | #include <asm/dma.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> | ||
24 | #include <asm/irq.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 | /***************************************************************************/ | ||
35 | |||
36 | /* | ||
37 | * DMA channel base address table. | ||
38 | */ | ||
39 | unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { | ||
40 | MCF_MBAR + MCFDMA_BASE0, | ||
41 | MCF_MBAR + MCFDMA_BASE1, | ||
42 | }; | ||
43 | |||
44 | unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; | ||
45 | |||
46 | /***************************************************************************/ | ||
47 | |||
48 | void mcf_autovector(unsigned int vec) | ||
49 | { | ||
50 | volatile unsigned char *mbar; | ||
51 | unsigned char icr; | ||
52 | |||
53 | if ((vec >= 25) && (vec <= 31)) { | ||
54 | vec -= 25; | ||
55 | mbar = (volatile unsigned char *) MCF_MBAR; | ||
56 | icr = MCFSIM_ICR_AUTOVEC | (vec << 3); | ||
57 | *(mbar + MCFSIM_ICR1 + vec) = icr; | ||
58 | vec = 0x1 << (vec + 1); | ||
59 | mcf_setimr(mcf_getimr() & ~vec); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | /***************************************************************************/ | ||
64 | |||
65 | void mcf_settimericr(unsigned int timer, unsigned int level) | ||
66 | { | ||
67 | volatile unsigned char *icrp; | ||
68 | unsigned int icr, imr; | ||
69 | |||
70 | if (timer <= 2) { | ||
71 | switch (timer) { | ||
72 | case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break; | ||
73 | default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break; | ||
74 | } | ||
75 | |||
76 | icrp = (volatile unsigned char *) (MCF_MBAR + icr); | ||
77 | *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3; | ||
78 | mcf_setimr(mcf_getimr() & ~imr); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | /***************************************************************************/ | ||
83 | |||
84 | int mcf_timerirqpending(int timer) | ||
85 | { | ||
86 | unsigned int imr = 0; | ||
87 | |||
88 | switch (timer) { | ||
89 | case 1: imr = MCFSIM_IMR_TIMER1; break; | ||
90 | case 2: imr = MCFSIM_IMR_TIMER2; break; | ||
91 | default: break; | ||
92 | } | ||
93 | return (mcf_getipr() & imr); | ||
94 | } | ||
95 | |||
96 | /***************************************************************************/ | ||
97 | |||
98 | void config_BSP(char *commandp, int size) | ||
99 | { | ||
100 | mcf_setimr(MCFSIM_IMR_MASKALL); | ||
101 | |||
102 | #if defined(CONFIG_BOOTPARAM) | ||
103 | strncpy(commandp, CONFIG_BOOTPARAM_STRING, size); | ||
104 | commandp[size-1] = 0; | ||
105 | #elif defined(CONFIG_NETtel) | ||
106 | /* Copy command line from FLASH to local buffer... */ | ||
107 | memcpy(commandp, (char *) 0xf0004000, size); | ||
108 | commandp[size-1] = 0; | ||
109 | #else | ||
110 | memset(commandp, 0, size); | ||
111 | #endif /* CONFIG_NETtel */ | ||
112 | |||
113 | mach_sched_init = coldfire_timer_init; | ||
114 | mach_tick = coldfire_tick; | ||
115 | mach_gettimeoffset = coldfire_timer_offset; | ||
116 | mach_trap_init = coldfire_trap_init; | ||
117 | mach_reset = coldfire_reset; | ||
118 | } | ||
119 | |||
120 | /***************************************************************************/ | ||