aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2008-01-18 07:44:13 -0500
committerJesper Nilsson <jesper.nilsson@axis.com>2008-02-08 05:06:29 -0500
commit18b0f3461664f4f8348832d33b481252cf2904f9 (patch)
tree948325e45f56bda8e22b20aa2738ddc831a74634 /arch/cris/arch-v10
parentd8468472e4206a6b3e777d29ee64eb91d2671415 (diff)
CRIS v10: Update and fix bug in kernel/debugport.
- Move local_irq_save to after possible return in console_write_direct. - Remove old raw_printk hack, not needed anymore. - Add watchdog handling. - Make serial_driver use depend on CONFIG_ETRAX_SERIAL. - Remove useless CVS log.
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c134
1 files changed, 23 insertions, 111 deletions
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 93679a48c791..04d5eee2c90c 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -1,6 +1,6 @@
1/* Serialport functions for debugging 1/* Serialport functions for debugging
2 * 2 *
3 * Copyright (c) 2000 Axis Communications AB 3 * Copyright (c) 2000-2007 Axis Communications AB
4 * 4 *
5 * Authors: Bjorn Wesen 5 * Authors: Bjorn Wesen
6 * 6 *
@@ -11,96 +11,6 @@
11 * enableDebugIRQ() 11 * enableDebugIRQ()
12 * init_etrax_debug() 12 * init_etrax_debug()
13 * 13 *
14 * $Log: debugport.c,v $
15 * Revision 1.27 2005/06/10 10:34:14 starvik
16 * Real console support
17 *
18 * Revision 1.26 2005/06/07 07:06:07 starvik
19 * Added LF->CR translation to make ETRAX customers happy.
20 *
21 * Revision 1.25 2005/03/08 08:56:47 mikaelam
22 * Do only set index as port->index if port is defined, otherwise use the index from the command line
23 *
24 * Revision 1.24 2005/01/19 10:26:33 mikaelam
25 * Return the cris serial driver in console device driver callback function
26 *
27 * Revision 1.23 2005/01/14 10:12:17 starvik
28 * KGDB on separate port.
29 * Console fixes from 2.4.
30 *
31 * Revision 1.22 2005/01/11 16:06:13 starvik
32 * typo
33 *
34 * Revision 1.21 2005/01/11 13:49:14 starvik
35 * Added raw_printk to be used where we don't trust the console.
36 *
37 * Revision 1.20 2004/12/27 11:18:32 starvik
38 * Merge of Linux 2.6.10 (not functional yet).
39 *
40 * Revision 1.19 2004/10/21 07:26:16 starvik
41 * Made it possible to specify console settings on kernel command line.
42 *
43 * Revision 1.18 2004/10/19 13:07:37 starvik
44 * Merge of Linux 2.6.9
45 *
46 * Revision 1.17 2004/09/29 10:33:46 starvik
47 * Resolved a dealock when printing debug from kernel.
48 *
49 * Revision 1.16 2004/08/24 06:12:19 starvik
50 * Whitespace cleanup
51 *
52 * Revision 1.15 2004/08/16 12:37:19 starvik
53 * Merge of Linux 2.6.8
54 *
55 * Revision 1.14 2004/05/17 13:11:29 starvik
56 * Disable DMA until real serial driver is up
57 *
58 * Revision 1.13 2004/05/14 07:58:01 starvik
59 * Merge of changes from 2.4
60 *
61 * Revision 1.12 2003/09/11 07:29:49 starvik
62 * Merge of Linux 2.6.0-test5
63 *
64 * Revision 1.11 2003/07/07 09:53:36 starvik
65 * Revert all the 2.5.74 merge changes to make the console work again
66 *
67 * Revision 1.9 2003/02/17 17:07:23 starvik
68 * Solved the problem with corrupted debug output (from Linux 2.4)
69 * * Wait until DMA, FIFO and pipe is empty before and after transmissions
70 * * Buffer data until a FIFO flush can be triggered.
71 *
72 * Revision 1.8 2003/01/22 06:48:36 starvik
73 * Fixed warnings issued by GCC 3.2.1
74 *
75 * Revision 1.7 2002/12/12 08:26:32 starvik
76 * Don't use C-comments inside CVS comments
77 *
78 * Revision 1.6 2002/12/11 15:42:02 starvik
79 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
80 *
81 * Revision 1.5 2002/11/20 06:58:03 starvik
82 * Compiles with kgdb
83 *
84 * Revision 1.4 2002/11/19 14:35:24 starvik
85 * Changes from linux 2.4
86 * Changed struct initializer syntax to the currently preferred notation
87 *
88 * Revision 1.3 2002/11/06 09:47:03 starvik
89 * Modified for new interrupt macros
90 *
91 * Revision 1.2 2002/01/21 15:21:50 bjornw
92 * Update for kdev_t changes
93 *
94 * Revision 1.6 2001/04/17 13:58:39 orjanf
95 * * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
96 *
97 * Revision 1.5 2001/03/26 14:22:05 bjornw
98 * Namechange of some config options
99 *
100 * Revision 1.4 2000/10/06 12:37:26 bjornw
101 * Use physical addresses when talking to DMA
102 *
103 *
104 */ 14 */
105 15
106#include <linux/console.h> 16#include <linux/console.h>
@@ -112,6 +22,8 @@
112#include <asm/arch/svinto.h> 22#include <asm/arch/svinto.h>
113#include <asm/io.h> /* Get SIMCOUT. */ 23#include <asm/io.h> /* Get SIMCOUT. */
114 24
25extern void reset_watchdog(void);
26
115struct dbg_port 27struct dbg_port
116{ 28{
117 unsigned int index; 29 unsigned int index;
@@ -188,7 +100,9 @@ struct dbg_port ports[]=
188 } 100 }
189}; 101};
190 102
103#ifdef CONFIG_ETRAX_SERIAL
191extern struct tty_driver *serial_driver; 104extern struct tty_driver *serial_driver;
105#endif
192 106
193struct dbg_port* port = 107struct dbg_port* port =
194#if defined(CONFIG_ETRAX_DEBUG_PORT0) 108#if defined(CONFIG_ETRAX_DEBUG_PORT0)
@@ -368,11 +282,12 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
368{ 282{
369 int i; 283 int i;
370 unsigned long flags; 284 unsigned long flags;
371 local_irq_save(flags);
372 285
373 if (!port) 286 if (!port)
374 return; 287 return;
375 288
289 local_irq_save(flags);
290
376 /* Send data */ 291 /* Send data */
377 for (i = 0; i < len; i++) { 292 for (i = 0; i < len; i++) {
378 /* LF -> CRLF */ 293 /* LF -> CRLF */
@@ -386,26 +301,16 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
386 ; 301 ;
387 *port->write = buf[i]; 302 *port->write = buf[i];
388 } 303 }
389 local_irq_restore(flags);
390}
391 304
392int raw_printk(const char *fmt, ...) 305 /*
393{ 306 * Feed the watchdog, otherwise it will reset the chip during boot.
394 static char buf[1024]; 307 * The time to send an ordinary boot message line (10-90 chars)
395 int printed_len; 308 * varies between 1-8ms at 115200. What makes up for the additional
396 static int first = 1; 309 * 90ms that allows the watchdog to bite?
397 if (first) { 310 */
398 /* Force reinitialization of the port to get manual mode. */ 311 reset_watchdog();
399 port->started = 0; 312
400 start_port(port); 313 local_irq_restore(flags);
401 first = 0;
402 }
403 va_list args;
404 va_start(args, fmt);
405 printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
406 va_end(args);
407 console_write_direct(NULL, buf, strlen(buf));
408 return printed_len;
409} 314}
410 315
411static void 316static void
@@ -500,6 +405,7 @@ console_setup(struct console *co, char *options)
500 return 0; 405 return 0;
501} 406}
502 407
408
503/* This is a dummy serial device that throws away anything written to it. 409/* This is a dummy serial device that throws away anything written to it.
504 * This is used when no debug output is wanted. 410 * This is used when no debug output is wanted.
505 */ 411 */
@@ -555,7 +461,13 @@ etrax_console_device(struct console* co, int *index)
555{ 461{
556 if (port) 462 if (port)
557 *index = port->index; 463 *index = port->index;
464 else
465 *index = 0;
466#ifdef CONFIG_ETRAX_SERIAL
558 return port ? serial_driver : &dummy_driver; 467 return port ? serial_driver : &dummy_driver;
468#else
469 return &dummy_driver;
470#endif
559} 471}
560 472
561static struct console sercons = { 473static struct console sercons = {