diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-11-24 05:15:06 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-11-24 05:15:06 -0500 |
commit | d97fbbed6e5bb37df75be8993bb0c61adb7d3558 (patch) | |
tree | 420fcf0be6261fa7d4b5622a7b50516dc7a91506 /drivers/tty/serial/sh-sci.c | |
parent | 0979e0e641d21d3bb318da90a64fc0024a95f50e (diff) |
serial: sh-sci: Support icount statistics for error cases.
Presently the icount stats are only adjusted for the rx/tx case, this
makes sure that they're updated appropriately for the non-tx/rx cases,
too (specifically overruns, breaks, as well as frame and parity errors).
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index c13910587bc3..3bea91b3a6f1 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -621,6 +621,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
621 | } else { | 621 | } else { |
622 | for (i = 0; i < count; i++) { | 622 | for (i = 0; i < count; i++) { |
623 | char c = sci_in(port, SCxRDR); | 623 | char c = sci_in(port, SCxRDR); |
624 | |||
624 | status = sci_in(port, SCxSR); | 625 | status = sci_in(port, SCxSR); |
625 | #if defined(CONFIG_CPU_SH3) | 626 | #if defined(CONFIG_CPU_SH3) |
626 | /* Skip "chars" during break */ | 627 | /* Skip "chars" during break */ |
@@ -649,9 +650,11 @@ static void sci_receive_chars(struct uart_port *port) | |||
649 | /* Store data and status */ | 650 | /* Store data and status */ |
650 | if (status & SCxSR_FER(port)) { | 651 | if (status & SCxSR_FER(port)) { |
651 | flag = TTY_FRAME; | 652 | flag = TTY_FRAME; |
653 | port->icount.frame++; | ||
652 | dev_notice(port->dev, "frame error\n"); | 654 | dev_notice(port->dev, "frame error\n"); |
653 | } else if (status & SCxSR_PER(port)) { | 655 | } else if (status & SCxSR_PER(port)) { |
654 | flag = TTY_PARITY; | 656 | flag = TTY_PARITY; |
657 | port->icount.parity++; | ||
655 | dev_notice(port->dev, "parity error\n"); | 658 | dev_notice(port->dev, "parity error\n"); |
656 | } else | 659 | } else |
657 | flag = TTY_NORMAL; | 660 | flag = TTY_NORMAL; |
@@ -723,6 +726,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
723 | */ | 726 | */ |
724 | if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) { | 727 | if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) { |
725 | if (status & (1 << s->cfg->overrun_bit)) { | 728 | if (status & (1 << s->cfg->overrun_bit)) { |
729 | port->icount.overrun++; | ||
730 | |||
726 | /* overrun error */ | 731 | /* overrun error */ |
727 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) | 732 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) |
728 | copied++; | 733 | copied++; |
@@ -737,6 +742,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
737 | struct sci_port *sci_port = to_sci_port(port); | 742 | struct sci_port *sci_port = to_sci_port(port); |
738 | 743 | ||
739 | if (!sci_port->break_flag) { | 744 | if (!sci_port->break_flag) { |
745 | port->icount.brk++; | ||
746 | |||
740 | sci_port->break_flag = 1; | 747 | sci_port->break_flag = 1; |
741 | sci_schedule_break_timer(sci_port); | 748 | sci_schedule_break_timer(sci_port); |
742 | 749 | ||
@@ -752,6 +759,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
752 | 759 | ||
753 | } else { | 760 | } else { |
754 | /* frame error */ | 761 | /* frame error */ |
762 | port->icount.frame++; | ||
763 | |||
755 | if (tty_insert_flip_char(tty, 0, TTY_FRAME)) | 764 | if (tty_insert_flip_char(tty, 0, TTY_FRAME)) |
756 | copied++; | 765 | copied++; |
757 | 766 | ||
@@ -761,6 +770,8 @@ static int sci_handle_errors(struct uart_port *port) | |||
761 | 770 | ||
762 | if (status & SCxSR_PER(port)) { | 771 | if (status & SCxSR_PER(port)) { |
763 | /* parity error */ | 772 | /* parity error */ |
773 | port->icount.parity++; | ||
774 | |||
764 | if (tty_insert_flip_char(tty, 0, TTY_PARITY)) | 775 | if (tty_insert_flip_char(tty, 0, TTY_PARITY)) |
765 | copied++; | 776 | copied++; |
766 | 777 | ||
@@ -787,6 +798,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
787 | if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { | 798 | if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { |
788 | sci_out(port, SCLSR, 0); | 799 | sci_out(port, SCLSR, 0); |
789 | 800 | ||
801 | port->icount.overrun++; | ||
802 | |||
790 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 803 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
791 | tty_flip_buffer_push(tty); | 804 | tty_flip_buffer_push(tty); |
792 | 805 | ||
@@ -812,6 +825,9 @@ static int sci_handle_breaks(struct uart_port *port) | |||
812 | /* Debounce break */ | 825 | /* Debounce break */ |
813 | s->break_flag = 1; | 826 | s->break_flag = 1; |
814 | #endif | 827 | #endif |
828 | |||
829 | port->icount.brk++; | ||
830 | |||
815 | /* Notify of BREAK */ | 831 | /* Notify of BREAK */ |
816 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) | 832 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) |
817 | copied++; | 833 | copied++; |