20 #include <linux/tty.h>
29 const volatile unsigned*
read;
52 IO_STATE(R_IRQ_MASK1_SET, ser0_data,
set),
66 IO_STATE(R_IRQ_MASK1_SET, ser1_data,
set),
80 IO_STATE(R_IRQ_MASK1_SET, ser2_data,
set),
94 IO_STATE(R_IRQ_MASK1_SET, ser3_data,
set),
102 #ifdef CONFIG_ETRAX_SERIAL
107 #if defined(CONFIG_ETRAX_DEBUG_PORT0)
109 #elif defined(CONFIG_ETRAX_DEBUG_PORT1)
111 #elif defined(CONFIG_ETRAX_DEBUG_PORT2)
113 #elif defined(CONFIG_ETRAX_DEBUG_PORT3)
120 #if defined(CONFIG_ETRAX_KGDB_PORT0)
122 #elif defined(CONFIG_ETRAX_KGDB_PORT1)
124 #elif defined(CONFIG_ETRAX_KGDB_PORT2)
126 #elif defined(CONFIG_ETRAX_KGDB_PORT3)
150 else if (p->
index == 1)
155 else if (p->
index == 2)
177 IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0);
184 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
185 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
189 IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) |
190 IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz);
194 IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) |
195 IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz);
199 IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) |
200 IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz);
204 IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) |
205 IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz);
209 IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) |
210 IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz);
214 IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) |
215 IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz);
219 IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) |
220 IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz);
224 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
225 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
231 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
234 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
236 }
else if (p->
parity ==
'O') {
238 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) |
241 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd) |
245 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
248 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
253 rec_ctrl |=
IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit);
254 tr_ctrl |=
IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit);
258 rec_ctrl |=
IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit);
259 tr_ctrl |=
IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit);
266 IO_STATE(R_SERIAL0_REC_CTRL, sampling, middle) |
267 IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) |
271 IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) |
273 IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) |
275 IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, normal) |
280 console_write_direct(
struct console *co,
const char *
buf,
unsigned int len)
291 for (i = 0; i < len; i++) {
293 if (buf[i] ==
'\n') {
294 while (!(*port->
read &
IO_MASK(R_SERIAL0_READ, tr_ready)))
299 while (!(*port->
read &
IO_MASK(R_SERIAL0_READ, tr_ready)))
316 console_write(
struct console *co,
const char *buf,
unsigned int len)
321 #ifdef CONFIG_SVINTO_SIM
327 console_write_direct(co, buf, len);
343 unsigned long readval;
349 readval = *kgdb_port->
read;
350 }
while (!(readval &
IO_MASK(R_SERIAL0_READ, data_avail)));
363 while (!(*kgdb_port->
read &
IO_MASK(R_SERIAL0_READ, tr_ready)))
376 *R_IRQ_MASK1_SET = kgdb_port->
irq;
391 port = &ports[co->
index];
397 while(*s >=
'0' && *s <=
'9')
399 if (*s) port->
parity = *s++;
400 if (*s) port->
bits = *s++ -
'0';
418 static void dummy_close(
struct tty_struct *tty,
struct file * filp)
422 static int dummy_write(
struct tty_struct * tty,
423 const unsigned char *buf,
int count)
428 static int dummy_write_room(
struct tty_struct *tty)
435 .close = dummy_close,
436 .write = dummy_write,
437 .write_room = dummy_write_room,
444 dummy_driver.driver_name =
"serial";
445 dummy_driver.name =
"ttyS";
447 dummy_driver.minor_start = 68;
448 dummy_driver.num = 1;
453 dummy_driver.init_termios.c_cflag =
456 dummy_driver.init_termios.c_ispeed = 115200;
457 dummy_driver.init_termios.c_ospeed = 115200;
459 dummy_driver.ops = &dummy_ops;
461 panic(
"Couldn't register dummy serial driver\n");
468 *index = port->
index;
471 #ifdef CONFIG_ETRAX_SERIAL
472 return port ? serial_driver : &dummy_driver;
474 return &dummy_driver;
478 static struct console sercons = {
480 write: console_write,
482 device : etrax_console_device,
484 setup : console_setup,
490 static struct console sercons0 = {
492 write: console_write,
494 device : etrax_console_device,
496 setup : console_setup,
503 static struct console sercons1 = {
505 write: console_write,
507 device : etrax_console_device,
509 setup : console_setup,
515 static struct console sercons2 = {
517 write: console_write,
519 device : etrax_console_device,
521 setup : console_setup,
527 static struct console sercons3 = {
529 write: console_write,
531 device : etrax_console_device,
533 setup : console_setup,
546 static int first = 1;
561 #ifdef CONFIG_ETRAX_KGDB
562 start_port(kgdb_port);