aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-11-30 08:16:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 18:18:06 -0500
commit4b3b49bb77eddb540e7c69e2129f5334cf713bf8 (patch)
tree415490efdbd059d1e2c7b43546361215697dd55d /drivers/mmc/card
parentc271cf37ba17631e371c97e2e8c8c353a83793e2 (diff)
tty: sdio_uart: add modem functionality
Add the POSIX block for carrier Linux TIOCMIWAIT functionality is still lacking from the driver. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r--drivers/mmc/card/sdio_uart.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index b999972eaf28..2a13db54ffc4 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -29,6 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/sched.h>
32#include <linux/mutex.h> 33#include <linux/mutex.h>
33#include <linux/seq_file.h> 34#include <linux/seq_file.h>
34#include <linux/serial_reg.h> 35#include <linux/serial_reg.h>
@@ -86,6 +87,7 @@ struct sdio_uart_port {
86 struct uart_icount icount; 87 struct uart_icount icount;
87 unsigned int uartclk; 88 unsigned int uartclk;
88 unsigned int mctrl; 89 unsigned int mctrl;
90 unsigned int rx_mctrl;
89 unsigned int read_status_mask; 91 unsigned int read_status_mask;
90 unsigned int ignore_status_mask; 92 unsigned int ignore_status_mask;
91 unsigned char x_char; 93 unsigned char x_char;
@@ -220,6 +222,8 @@ static unsigned int sdio_uart_get_mctrl(struct sdio_uart_port *port)
220 unsigned char status; 222 unsigned char status;
221 unsigned int ret; 223 unsigned int ret;
222 224
225 /* FIXME: What stops this losing the delta bits and breaking
226 sdio_uart_check_modem_status ? */
223 status = sdio_in(port, UART_MSR); 227 status = sdio_in(port, UART_MSR);
224 228
225 ret = 0; 229 ret = 0;
@@ -503,8 +507,20 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
503 port->icount.rng++; 507 port->icount.rng++;
504 if (status & UART_MSR_DDSR) 508 if (status & UART_MSR_DDSR)
505 port->icount.dsr++; 509 port->icount.dsr++;
506 if (status & UART_MSR_DDCD) 510 if (status & UART_MSR_DDCD) {
507 port->icount.dcd++; 511 port->icount.dcd++;
512 /* DCD raise - wake for open */
513 if (status & UART_MSR_DCD)
514 wake_up_interruptible(&port->port.open_wait);
515 else {
516 /* DCD drop - hang up if tty attached */
517 tty = tty_port_tty_get(&port->port);
518 if (tty) {
519 tty_hangup(tty);
520 tty_kref_put(tty);
521 }
522 }
523 }
508 if (status & UART_MSR_DCTS) { 524 if (status & UART_MSR_DCTS) {
509 port->icount.cts++; 525 port->icount.cts++;
510 tty = tty_port_tty_get(&port->port); 526 tty = tty_port_tty_get(&port->port);
@@ -560,6 +576,20 @@ static void sdio_uart_irq(struct sdio_func *func)
560 port->in_sdio_uart_irq = NULL; 576 port->in_sdio_uart_irq = NULL;
561} 577}
562 578
579static int uart_carrier_raised(struct tty_port *tport)
580{
581 struct sdio_uart_port *port =
582 container_of(tport, struct sdio_uart_port, port);
583 unsigned int ret = sdio_uart_claim_func(port);
584 if (ret) /* Missing hardware shoudn't block for carrier */
585 return 1;
586 ret = sdio_uart_get_mctrl(port);
587 sdio_uart_release_func(port);
588 if (ret & TIOCM_CAR)
589 return 1;
590 return 0;
591}
592
563/** 593/**
564 * uart_dtr_rts - port helper to set uart signals 594 * uart_dtr_rts - port helper to set uart signals
565 * @tport: tty port to be updated 595 * @tport: tty port to be updated
@@ -1044,6 +1074,7 @@ static const struct file_operations sdio_uart_proc_fops = {
1044 1074
1045static const struct tty_port_operations sdio_uart_port_ops = { 1075static const struct tty_port_operations sdio_uart_port_ops = {
1046 .dtr_rts = uart_dtr_rts, 1076 .dtr_rts = uart_dtr_rts,
1077 .carrier_raised = uart_carrier_raised,
1047 .shutdown = sdio_uart_shutdown, 1078 .shutdown = sdio_uart_shutdown,
1048 .activate = sdio_uart_activate, 1079 .activate = sdio_uart_activate,
1049}; 1080};