24 #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
28 #include <linux/module.h>
34 #include <linux/device.h>
35 #include <linux/tty.h>
37 #include <linux/serial_core.h>
38 #include <linux/serial.h>
41 #include <mach/hardware.h>
46 #define SERIAL_CLPS711X_MAJOR 204
47 #define SERIAL_CLPS711X_MINOR 40
48 #define SERIAL_CLPS711X_NR UART_NR
53 #define UBRLCR(port) ((port)->iobase + UBRLCR1 - SYSCON1)
54 #define UARTDR(port) ((port)->iobase + UARTDR1 - SYSCON1)
55 #define SYSFLG(port) ((port)->iobase + SYSFLG1 - SYSCON1)
56 #define SYSCON(port) ((port)->iobase + SYSCON1 - SYSCON1)
58 #define TX_IRQ(port) ((port)->irq)
59 #define RX_IRQ(port) ((port)->irq + 1)
61 #define UART_ANY_ERR (UARTDR_FRMERR | UARTDR_PARERR | UARTDR_OVERR)
63 #define tx_enabled(port) ((port)->unused[0])
81 static void clps711xuart_stop_rx(
struct uart_port *port)
86 static void clps711xuart_enable_ms(
struct uart_port *port)
94 unsigned int status, ch, flg;
118 if (ch & UARTDR_PARERR)
120 else if (ch & UARTDR_FRMERR)
144 static irqreturn_t clps711xuart_int_tx(
int irq,
void *dev_id)
167 }
while (--count > 0);
181 static unsigned int clps711xuart_tx_empty(
struct uart_port *port)
187 static unsigned int clps711xuart_get_mctrl(
struct uart_port *port)
208 clps711xuart_set_mctrl_null(
struct uart_port *port,
unsigned int mctrl)
212 static void clps711xuart_break_ctl(
struct uart_port *port,
int break_state)
219 if (break_state == -1)
224 spin_unlock_irqrestore(&port->
lock, flags);
227 static int clps711xuart_startup(
struct uart_port *port)
238 "clps711xuart_tx", port);
243 "clps711xuart_rx", port);
259 static void clps711xuart_shutdown(
struct uart_port *port)
261 unsigned int ubrlcr, syscon;
288 unsigned int ubrlcr,
baud, quot;
356 spin_unlock_irqrestore(&port->
lock, flags);
359 static const char *clps711xuart_type(
struct uart_port *port)
367 static void clps711xuart_config_port(
struct uart_port *port,
int flags)
373 static void clps711xuart_release_port(
struct uart_port *port)
377 static int clps711xuart_request_port(
struct uart_port *port)
382 static struct uart_ops clps711x_pops = {
383 .tx_empty = clps711xuart_tx_empty,
384 .set_mctrl = clps711xuart_set_mctrl_null,
385 .get_mctrl = clps711xuart_get_mctrl,
386 .stop_tx = clps711xuart_stop_tx,
387 .start_tx = clps711xuart_start_tx,
388 .stop_rx = clps711xuart_stop_rx,
389 .enable_ms = clps711xuart_enable_ms,
390 .break_ctl = clps711xuart_break_ctl,
391 .startup = clps711xuart_startup,
392 .shutdown = clps711xuart_shutdown,
393 .set_termios = clps711xuart_set_termios,
394 .type = clps711xuart_type,
395 .config_port = clps711xuart_config_port,
396 .release_port = clps711xuart_release_port,
397 .request_port = clps711xuart_request_port,
406 .ops = &clps711x_pops,
415 .ops = &clps711x_pops,
421 #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
422 static void clps711xuart_console_putchar(
struct uart_port *port,
int ch)
438 clps711xuart_console_write(
struct console *co,
const char *
s,
442 unsigned int status, syscon;
464 clps711xuart_console_get_options(
struct uart_port *port,
int *baud,
465 int *parity,
int *
bits)
468 unsigned int ubrlcr, quot;
486 *baud = port->
uartclk / (16 * (quot + 1));
508 clps711xuart_console_get_options(port, &baud, &parity, &bits);
514 static struct console clps711x_console = {
516 .write = clps711xuart_console_write,
518 .setup = clps711xuart_console_setup,
521 .data = &clps711x_reg,
524 static int __init clps711xuart_console_init(
void)
531 #define CLPS711X_CONSOLE &clps711x_console
533 #define CLPS711X_CONSOLE NULL
537 .driver_name =
"ttyCL",
546 static int __init clps711xuart_init(
void)
562 static void __exit clps711xuart_exit(
void)