diff options
author | Nicolas Pitre <nico@cam.org> | 2007-07-04 23:40:34 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 15:02:57 -0400 |
commit | 5ed334a1f8caaae98806d572f78c5802975ea20f (patch) | |
tree | 782905c5f25652af672bb38ed42a68c0c71e8e4c | |
parent | 6e418a9d26ab4fd44b3e07dc1158027cbdf0a919 (diff) |
sdio: add /proc interface to sdio_uart driver
This mimics what the serial_core does. Useful for diagnostics.
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r-- | drivers/mmc/card/sdio_uart.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c index e4d9e85ff584..190120d1449a 100644 --- a/drivers/mmc/card/sdio_uart.c +++ b/drivers/mmc/card/sdio_uart.c | |||
@@ -913,6 +913,67 @@ static int sdio_uart_tiocmset(struct tty_struct *tty, struct file *file, | |||
913 | return result; | 913 | return result; |
914 | } | 914 | } |
915 | 915 | ||
916 | static int sdio_uart_read_proc(char *page, char **start, off_t off, | ||
917 | int count, int *eof, void *data) | ||
918 | { | ||
919 | int i, len = 0; | ||
920 | off_t begin = 0; | ||
921 | |||
922 | len += sprintf(page, "serinfo:1.0 driver%s%s revision:%s\n", | ||
923 | "", "", ""); | ||
924 | for (i = 0; i < UART_NR && len < PAGE_SIZE - 96; i++) { | ||
925 | struct sdio_uart_port *port = sdio_uart_port_get(i); | ||
926 | if (port) { | ||
927 | len += sprintf(page+len, "%d: uart:SDIO", i); | ||
928 | if(capable(CAP_SYS_ADMIN)) { | ||
929 | len += sprintf(page + len, " tx:%d rx:%d", | ||
930 | port->icount.tx, port->icount.rx); | ||
931 | if (port->icount.frame) | ||
932 | len += sprintf(page + len, " fe:%d", | ||
933 | port->icount.frame); | ||
934 | if (port->icount.parity) | ||
935 | len += sprintf(page + len, " pe:%d", | ||
936 | port->icount.parity); | ||
937 | if (port->icount.brk) | ||
938 | len += sprintf(page + len, " brk:%d", | ||
939 | port->icount.brk); | ||
940 | if (port->icount.overrun) | ||
941 | len += sprintf(page + len, " oe:%d", | ||
942 | port->icount.overrun); | ||
943 | if (port->icount.cts) | ||
944 | len += sprintf(page + len, " cts:%d", | ||
945 | port->icount.cts); | ||
946 | if (port->icount.dsr) | ||
947 | len += sprintf(page + len, " dsr:%d", | ||
948 | port->icount.dsr); | ||
949 | if (port->icount.rng) | ||
950 | len += sprintf(page + len, " rng:%d", | ||
951 | port->icount.rng); | ||
952 | if (port->icount.dcd) | ||
953 | len += sprintf(page + len, " dcd:%d", | ||
954 | port->icount.dcd); | ||
955 | } | ||
956 | strcat(page, "\n"); | ||
957 | len++; | ||
958 | sdio_uart_port_put(port); | ||
959 | } | ||
960 | |||
961 | if (len + begin > off + count) | ||
962 | goto done; | ||
963 | if (len + begin < off) { | ||
964 | begin += len; | ||
965 | len = 0; | ||
966 | } | ||
967 | } | ||
968 | *eof = 1; | ||
969 | |||
970 | done: | ||
971 | if (off >= len + begin) | ||
972 | return 0; | ||
973 | *start = page + (off - begin); | ||
974 | return (count < begin + len - off) ? count : (begin + len - off); | ||
975 | } | ||
976 | |||
916 | static const struct tty_operations sdio_uart_ops = { | 977 | static const struct tty_operations sdio_uart_ops = { |
917 | .open = sdio_uart_open, | 978 | .open = sdio_uart_open, |
918 | .close = sdio_uart_close, | 979 | .close = sdio_uart_close, |
@@ -926,6 +987,7 @@ static const struct tty_operations sdio_uart_ops = { | |||
926 | .break_ctl = sdio_uart_break_ctl, | 987 | .break_ctl = sdio_uart_break_ctl, |
927 | .tiocmget = sdio_uart_tiocmget, | 988 | .tiocmget = sdio_uart_tiocmget, |
928 | .tiocmset = sdio_uart_tiocmset, | 989 | .tiocmset = sdio_uart_tiocmset, |
990 | .read_proc = sdio_uart_read_proc, | ||
929 | }; | 991 | }; |
930 | 992 | ||
931 | static struct tty_driver *sdio_uart_tty_driver; | 993 | static struct tty_driver *sdio_uart_tty_driver; |