16 #include <linux/kernel.h>
19 #include <linux/module.h>
21 #include <linux/tty.h>
23 #include <linux/serial.h>
24 #include <linux/serial_core.h>
39 #if !defined(mcf_getppdcd)
40 #define mcf_getppdcd(p) (1)
42 #if !defined(mcf_getppdtr)
43 #define mcf_getppdtr(p) (1)
45 #if !defined(mcf_setppdtr)
46 #define mcf_setppdtr(p, v) do { } while (0)
100 static void mcf_start_tx(
struct uart_port *port)
110 static void mcf_stop_tx(
struct uart_port *port)
120 static void mcf_stop_rx(
struct uart_port *port)
130 static void mcf_break_ctl(
struct uart_port *port,
int break_state)
135 if (break_state == -1)
139 spin_unlock_irqrestore(&port->
lock, flags);
144 static void mcf_enable_ms(
struct uart_port *port)
150 static int mcf_startup(
struct uart_port *port)
169 spin_unlock_irqrestore(&port->
lock, flags);
176 static void mcf_shutdown(
struct uart_port *port)
191 spin_unlock_irqrestore(&port->
lock, flags);
200 unsigned int baud, baudclk;
201 #if defined(CONFIG_M5272)
204 unsigned char mr1, mr2;
207 #if defined(CONFIG_M5272)
260 #if defined(CONFIG_M5272)
267 spin_unlock_irqrestore(&port->
lock, flags);
272 static void mcf_rx_chars(
struct mcf_uart *pp)
288 if (uart_handle_break(port))
300 if (status & MCFUART_USR_RXBREAK)
302 else if (status & MCFUART_USR_RXPARITY)
304 else if (status & MCFUART_USR_RXFRAMING)
318 static void mcf_tx_chars(
struct mcf_uart *pp)
359 spin_lock(&port->
lock);
368 spin_unlock(&port->
lock);
375 static void mcf_config_port(
struct uart_port *port,
int flags)
385 "interrupt vector=%d\n", port->
line, port->
irq);
390 static const char *mcf_type(
struct uart_port *port)
397 static int mcf_request_port(
struct uart_port *port)
405 static void mcf_release_port(
struct uart_port *port)
424 static const struct uart_ops mcf_uart_ops = {
425 .tx_empty = mcf_tx_empty,
426 .get_mctrl = mcf_get_mctrl,
427 .set_mctrl = mcf_set_mctrl,
428 .start_tx = mcf_start_tx,
429 .stop_tx = mcf_stop_tx,
430 .stop_rx = mcf_stop_rx,
431 .enable_ms = mcf_enable_ms,
432 .break_ctl = mcf_break_ctl,
433 .startup = mcf_startup,
434 .shutdown = mcf_shutdown,
435 .set_termios = mcf_set_termios,
437 .request_port = mcf_request_port,
438 .release_port = mcf_release_port,
439 .config_port = mcf_config_port,
440 .verify_port = mcf_verify_port,
443 static struct mcf_uart mcf_ports[4];
445 #define MCF_MAXPORTS ARRAY_SIZE(mcf_ports)
448 #if defined(CONFIG_SERIAL_MCF_CONSOLE)
457 port = &mcf_ports[
i].port;
468 port->
ops = &mcf_uart_ops;
476 static void mcf_console_putc(
struct console *co,
const char c)
481 for (i = 0; (i < 0x10000); i++) {
486 for (i = 0; (i < 0x10000); i++) {
494 static void mcf_console_write(
struct console *co,
const char *
s,
unsigned int count)
496 for (; (
count); count--, s++) {
497 mcf_console_putc(co, *s);
499 mcf_console_putc(co,
'\r');
508 int baud = CONFIG_SERIAL_MCF_BAUDRATE;
515 port = &mcf_ports[co->
index].port;
529 static struct console mcf_console = {
531 .write = mcf_console_write,
533 .setup = mcf_console_setup,
539 static int __init mcf_console_init(
void)
547 #define MCF_CONSOLE &mcf_console
553 #define MCF_CONSOLE NULL
564 .driver_name =
"mcf",
581 port = &mcf_ports[
i].port;
591 port->
ops = &mcf_uart_ops;
608 port = &mcf_ports[
i].port;
629 static int __init mcf_init(
void)
633 printk(
"ColdFire internal UART serial driver\n");
646 static void __exit mcf_exit(
void)