Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /***************************************************************************/ |
2 | ||
3 | /* | |
4 | * linux/arch/m68knommu/platform/5272/config.c | |
5 | * | |
6 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) | |
7 | * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com) | |
8 | */ | |
9 | ||
10 | /***************************************************************************/ | |
11 | ||
12 | #include <linux/config.h> | |
13 | #include <linux/kernel.h> | |
14 | #include <linux/sched.h> | |
15 | #include <linux/param.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/interrupt.h> | |
18 | #include <asm/irq.h> | |
19 | #include <asm/dma.h> | |
20 | #include <asm/traps.h> | |
21 | #include <asm/machdep.h> | |
22 | #include <asm/coldfire.h> | |
23 | #include <asm/mcftimer.h> | |
24 | #include <asm/mcfsim.h> | |
25 | #include <asm/mcfdma.h> | |
26 | ||
27 | /***************************************************************************/ | |
28 | ||
29 | void coldfire_tick(void); | |
30 | void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); | |
31 | unsigned long coldfire_timer_offset(void); | |
32 | void coldfire_trap_init(void); | |
33 | void coldfire_reset(void); | |
34 | ||
35 | extern unsigned int mcf_timervector; | |
36 | extern unsigned int mcf_profilevector; | |
37 | extern unsigned int mcf_timerlevel; | |
38 | ||
39 | /***************************************************************************/ | |
40 | ||
41 | /* | |
42 | * Some platforms need software versions of the GPIO data registers. | |
43 | */ | |
44 | unsigned short ppdata; | |
45 | unsigned char ledbank = 0xff; | |
46 | ||
47 | /***************************************************************************/ | |
48 | ||
49 | /* | |
50 | * DMA channel base address table. | |
51 | */ | |
52 | unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { | |
53 | MCF_MBAR + MCFDMA_BASE0, | |
54 | }; | |
55 | ||
56 | unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; | |
57 | ||
58 | /***************************************************************************/ | |
59 | ||
60 | void mcf_disableall(void) | |
61 | { | |
62 | volatile unsigned long *icrp; | |
63 | ||
64 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | |
65 | icrp[0] = 0x88888888; | |
66 | icrp[1] = 0x88888888; | |
67 | icrp[2] = 0x88888888; | |
68 | icrp[3] = 0x88888888; | |
69 | } | |
70 | ||
71 | /***************************************************************************/ | |
72 | ||
73 | void mcf_autovector(unsigned int vec) | |
74 | { | |
75 | /* Everything is auto-vectored on the 5272 */ | |
76 | } | |
77 | ||
78 | /***************************************************************************/ | |
79 | ||
80 | void mcf_settimericr(int timer, int level) | |
81 | { | |
82 | volatile unsigned long *icrp; | |
83 | ||
84 | if ((timer >= 1 ) && (timer <= 4)) { | |
85 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | |
86 | *icrp = (0x8 | level) << ((4 - timer) * 4); | |
87 | } | |
88 | } | |
89 | ||
90 | /***************************************************************************/ | |
91 | ||
92 | int mcf_timerirqpending(int timer) | |
93 | { | |
94 | volatile unsigned long *icrp; | |
95 | ||
96 | if ((timer >= 1 ) && (timer <= 4)) { | |
97 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | |
98 | return (*icrp & (0x8 << ((4 - timer) * 4))); | |
99 | } | |
100 | return 0; | |
101 | } | |
102 | ||
103 | /***************************************************************************/ | |
104 | ||
105 | void config_BSP(char *commandp, int size) | |
106 | { | |
107 | #if 0 | |
108 | volatile unsigned long *pivrp; | |
109 | ||
110 | /* Set base of device vectors to be 64 */ | |
111 | pivrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PIVR); | |
112 | *pivrp = 0x40; | |
113 | #endif | |
114 | ||
115 | mcf_disableall(); | |
116 | ||
117 | #if defined(CONFIG_BOOTPARAM) | |
118 | strncpy(commandp, CONFIG_BOOTPARAM_STRING, size); | |
119 | commandp[size-1] = 0; | |
120 | #elif defined(CONFIG_NETtel) || defined(CONFIG_SCALES) | |
121 | /* Copy command line from FLASH to local buffer... */ | |
122 | memcpy(commandp, (char *) 0xf0004000, size); | |
123 | commandp[size-1] = 0; | |
124 | #elif defined(CONFIG_MTD_KeyTechnology) | |
125 | /* Copy command line from FLASH to local buffer... */ | |
126 | memcpy(commandp, (char *) 0xffe06000, size); | |
127 | commandp[size-1] = 0; | |
128 | #elif defined(CONFIG_CANCam) | |
129 | /* Copy command line from FLASH to local buffer... */ | |
130 | memcpy(commandp, (char *) 0xf0010000, size); | |
131 | commandp[size-1] = 0; | |
132 | #else | |
133 | memset(commandp, 0, size); | |
134 | #endif | |
135 | ||
136 | mcf_timervector = 69; | |
137 | mcf_profilevector = 70; | |
138 | mach_sched_init = coldfire_timer_init; | |
139 | mach_tick = coldfire_tick; | |
140 | mach_gettimeoffset = coldfire_timer_offset; | |
141 | mach_trap_init = coldfire_trap_init; | |
142 | mach_reset = coldfire_reset; | |
143 | } | |
144 | ||
145 | /***************************************************************************/ |