diff options
author | Kars de Jong <jongk@linux-m68k.org> | 2008-11-20 07:47:18 -0500 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2011-12-10 13:52:45 -0500 |
commit | f9994894953d6bd9d5ed2719a34d027a4e0c2131 (patch) | |
tree | 07c0ba833ae382e95dd391a598b3117bef27f6a8 /arch/m68k | |
parent | f8bd9de913fc004705002f7bd6e840b1c685b188 (diff) |
m68k/mvme16x: Add support for EARLY_PRINTK
Added support for EARLY_PRINTK when running on an MVME16x board.
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/Kconfig.debug | 11 | ||||
-rw-r--r-- | arch/m68k/mvme16x/config.c | 160 |
2 files changed, 171 insertions, 0 deletions
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug index 2bdb1b01115c..8702dc65f7f2 100644 --- a/arch/m68k/Kconfig.debug +++ b/arch/m68k/Kconfig.debug | |||
@@ -2,6 +2,17 @@ menu "Kernel hacking" | |||
2 | 2 | ||
3 | source "lib/Kconfig.debug" | 3 | source "lib/Kconfig.debug" |
4 | 4 | ||
5 | config EARLY_PRINTK | ||
6 | bool "Early printk" if EMBEDDED | ||
7 | depends on MVME16x | ||
8 | default y | ||
9 | help | ||
10 | Write kernel log output directly to a serial port. | ||
11 | |||
12 | This is useful for kernel debugging when your machine crashes very | ||
13 | early before the console code is initialized. | ||
14 | You should normally say N here, unless you want to debug such a crash. | ||
15 | |||
5 | if !MMU | 16 | if !MMU |
6 | 17 | ||
7 | config FULLDEBUG | 18 | config FULLDEBUG |
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c index 31a66d99cbca..c3fb3bdd7ed9 100644 --- a/arch/m68k/mvme16x/config.c +++ b/arch/m68k/mvme16x/config.c | |||
@@ -124,6 +124,163 @@ static void __init mvme16x_init_IRQ (void) | |||
124 | #define PccSCCMICR 0x1d | 124 | #define PccSCCMICR 0x1d |
125 | #define PccSCCTICR 0x1e | 125 | #define PccSCCTICR 0x1e |
126 | #define PccSCCRICR 0x1f | 126 | #define PccSCCRICR 0x1f |
127 | #define PccTPIACKR 0x25 | ||
128 | |||
129 | #ifdef CONFIG_EARLY_PRINTK | ||
130 | |||
131 | /**** cd2401 registers ****/ | ||
132 | #define CD2401_ADDR (0xfff45000) | ||
133 | |||
134 | #define CyGFRCR (0x81) | ||
135 | #define CyCCR (0x13) | ||
136 | #define CyCLR_CHAN (0x40) | ||
137 | #define CyINIT_CHAN (0x20) | ||
138 | #define CyCHIP_RESET (0x10) | ||
139 | #define CyENB_XMTR (0x08) | ||
140 | #define CyDIS_XMTR (0x04) | ||
141 | #define CyENB_RCVR (0x02) | ||
142 | #define CyDIS_RCVR (0x01) | ||
143 | #define CyCAR (0xee) | ||
144 | #define CyIER (0x11) | ||
145 | #define CyMdmCh (0x80) | ||
146 | #define CyRxExc (0x20) | ||
147 | #define CyRxData (0x08) | ||
148 | #define CyTxMpty (0x02) | ||
149 | #define CyTxRdy (0x01) | ||
150 | #define CyLICR (0x26) | ||
151 | #define CyRISR (0x89) | ||
152 | #define CyTIMEOUT (0x80) | ||
153 | #define CySPECHAR (0x70) | ||
154 | #define CyOVERRUN (0x08) | ||
155 | #define CyPARITY (0x04) | ||
156 | #define CyFRAME (0x02) | ||
157 | #define CyBREAK (0x01) | ||
158 | #define CyREOIR (0x84) | ||
159 | #define CyTEOIR (0x85) | ||
160 | #define CyMEOIR (0x86) | ||
161 | #define CyNOTRANS (0x08) | ||
162 | #define CyRFOC (0x30) | ||
163 | #define CyRDR (0xf8) | ||
164 | #define CyTDR (0xf8) | ||
165 | #define CyMISR (0x8b) | ||
166 | #define CyRISR (0x89) | ||
167 | #define CyTISR (0x8a) | ||
168 | #define CyMSVR1 (0xde) | ||
169 | #define CyMSVR2 (0xdf) | ||
170 | #define CyDSR (0x80) | ||
171 | #define CyDCD (0x40) | ||
172 | #define CyCTS (0x20) | ||
173 | #define CyDTR (0x02) | ||
174 | #define CyRTS (0x01) | ||
175 | #define CyRTPRL (0x25) | ||
176 | #define CyRTPRH (0x24) | ||
177 | #define CyCOR1 (0x10) | ||
178 | #define CyPARITY_NONE (0x00) | ||
179 | #define CyPARITY_E (0x40) | ||
180 | #define CyPARITY_O (0xC0) | ||
181 | #define Cy_5_BITS (0x04) | ||
182 | #define Cy_6_BITS (0x05) | ||
183 | #define Cy_7_BITS (0x06) | ||
184 | #define Cy_8_BITS (0x07) | ||
185 | #define CyCOR2 (0x17) | ||
186 | #define CyETC (0x20) | ||
187 | #define CyCtsAE (0x02) | ||
188 | #define CyCOR3 (0x16) | ||
189 | #define Cy_1_STOP (0x02) | ||
190 | #define Cy_2_STOP (0x04) | ||
191 | #define CyCOR4 (0x15) | ||
192 | #define CyREC_FIFO (0x0F) /* Receive FIFO threshold */ | ||
193 | #define CyCOR5 (0x14) | ||
194 | #define CyCOR6 (0x18) | ||
195 | #define CyCOR7 (0x07) | ||
196 | #define CyRBPR (0xcb) | ||
197 | #define CyRCOR (0xc8) | ||
198 | #define CyTBPR (0xc3) | ||
199 | #define CyTCOR (0xc0) | ||
200 | #define CySCHR1 (0x1f) | ||
201 | #define CySCHR2 (0x1e) | ||
202 | #define CyTPR (0xda) | ||
203 | #define CyPILR1 (0xe3) | ||
204 | #define CyPILR2 (0xe0) | ||
205 | #define CyPILR3 (0xe1) | ||
206 | #define CyCMR (0x1b) | ||
207 | #define CyASYNC (0x02) | ||
208 | #define CyLICR (0x26) | ||
209 | #define CyLIVR (0x09) | ||
210 | #define CySCRL (0x23) | ||
211 | #define CySCRH (0x22) | ||
212 | #define CyTFTC (0x80) | ||
213 | |||
214 | static void cons_write(struct console *co, const char *str, unsigned count) | ||
215 | { | ||
216 | volatile unsigned char *base_addr = (u_char *)CD2401_ADDR; | ||
217 | volatile u_char sink; | ||
218 | u_char ier; | ||
219 | int port; | ||
220 | u_char do_lf = 0; | ||
221 | int i = 0; | ||
222 | |||
223 | /* Ensure transmitter is enabled! */ | ||
224 | |||
225 | port = 0; | ||
226 | base_addr[CyCAR] = (u_char)port; | ||
227 | while (base_addr[CyCCR]) | ||
228 | ; | ||
229 | base_addr[CyCCR] = CyENB_XMTR; | ||
230 | |||
231 | ier = base_addr[CyIER]; | ||
232 | base_addr[CyIER] = CyTxMpty; | ||
233 | |||
234 | while (1) { | ||
235 | if (pcc2chip[PccSCCTICR] & 0x20) | ||
236 | { | ||
237 | /* We have a Tx int. Acknowledge it */ | ||
238 | sink = pcc2chip[PccTPIACKR]; | ||
239 | if ((base_addr[CyLICR] >> 2) == port) { | ||
240 | if (i == count) { | ||
241 | /* Last char of string is now output */ | ||
242 | base_addr[CyTEOIR] = CyNOTRANS; | ||
243 | break; | ||
244 | } | ||
245 | if (do_lf) { | ||
246 | base_addr[CyTDR] = '\n'; | ||
247 | str++; | ||
248 | i++; | ||
249 | do_lf = 0; | ||
250 | } | ||
251 | else if (*str == '\n') { | ||
252 | base_addr[CyTDR] = '\r'; | ||
253 | do_lf = 1; | ||
254 | } | ||
255 | else { | ||
256 | base_addr[CyTDR] = *str++; | ||
257 | i++; | ||
258 | } | ||
259 | base_addr[CyTEOIR] = 0; | ||
260 | } | ||
261 | else | ||
262 | base_addr[CyTEOIR] = CyNOTRANS; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | base_addr[CyIER] = ier; | ||
267 | } | ||
268 | |||
269 | static struct console cons_info = | ||
270 | { | ||
271 | .name = "sercon", | ||
272 | .write = cons_write, | ||
273 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
274 | .index = -1, | ||
275 | }; | ||
276 | |||
277 | static void __init mvme16x_early_console(void) | ||
278 | { | ||
279 | register_console(&cons_info); | ||
280 | |||
281 | printk(KERN_INFO "MVME16x: early console registered\n"); | ||
282 | } | ||
283 | #endif | ||
127 | 284 | ||
128 | void __init config_mvme16x(void) | 285 | void __init config_mvme16x(void) |
129 | { | 286 | { |
@@ -183,6 +340,9 @@ void __init config_mvme16x(void) | |||
183 | pcc2chip[PccSCCMICR] = 0x10; | 340 | pcc2chip[PccSCCMICR] = 0x10; |
184 | pcc2chip[PccSCCTICR] = 0x10; | 341 | pcc2chip[PccSCCTICR] = 0x10; |
185 | pcc2chip[PccSCCRICR] = 0x10; | 342 | pcc2chip[PccSCCRICR] = 0x10; |
343 | #ifdef CONFIG_EARLY_PRINTK | ||
344 | mvme16x_early_console(); | ||
345 | #endif | ||
186 | } | 346 | } |
187 | } | 347 | } |
188 | 348 | ||