diff options
author | Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> | 2015-03-16 12:19:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-26 17:42:27 -0400 |
commit | cb772fe75fa189c25ec258d36dabf914205e6635 (patch) | |
tree | 1012966f1552d6cd26ae2f0c7791e53943c83680 | |
parent | 0814e8d5da2b6f25088fe28d5e23f511d8441883 (diff) |
serial: sh-sci: Add overrun handling of SCIFA and SCIFB
SCIFA and SCIFB can detect the overrun, but it does not support.
This adds overrun handling of SCIFA and SCIFB.
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 5b50c792ad5f..5bf997253a46 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -844,14 +844,32 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
844 | struct tty_port *tport = &port->state->port; | 844 | struct tty_port *tport = &port->state->port; |
845 | struct sci_port *s = to_sci_port(port); | 845 | struct sci_port *s = to_sci_port(port); |
846 | struct plat_sci_reg *reg; | 846 | struct plat_sci_reg *reg; |
847 | int copied = 0; | 847 | int copied = 0, offset; |
848 | u16 status, bit; | ||
848 | 849 | ||
849 | reg = sci_getreg(port, SCLSR); | 850 | switch (port->type) { |
851 | case PORT_SCIF: | ||
852 | case PORT_HSCIF: | ||
853 | offset = SCLSR; | ||
854 | break; | ||
855 | case PORT_SCIFA: | ||
856 | case PORT_SCIFB: | ||
857 | offset = SCxSR; | ||
858 | break; | ||
859 | default: | ||
860 | return 0; | ||
861 | } | ||
862 | |||
863 | reg = sci_getreg(port, offset); | ||
850 | if (!reg->size) | 864 | if (!reg->size) |
851 | return 0; | 865 | return 0; |
852 | 866 | ||
853 | if ((serial_port_in(port, SCLSR) & (1 << s->overrun_bit))) { | 867 | status = serial_port_in(port, offset); |
854 | serial_port_out(port, SCLSR, 0); | 868 | bit = 1 << s->overrun_bit; |
869 | |||
870 | if (status & bit) { | ||
871 | status &= ~bit; | ||
872 | serial_port_out(port, offset, status); | ||
855 | 873 | ||
856 | port->icount.overrun++; | 874 | port->icount.overrun++; |
857 | 875 | ||
@@ -996,16 +1014,24 @@ static inline unsigned long port_rx_irq_mask(struct uart_port *port) | |||
996 | 1014 | ||
997 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | 1015 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) |
998 | { | 1016 | { |
999 | unsigned short ssr_status, scr_status, err_enabled; | 1017 | unsigned short ssr_status, scr_status, err_enabled, orer_status = 0; |
1000 | unsigned short slr_status = 0; | ||
1001 | struct uart_port *port = ptr; | 1018 | struct uart_port *port = ptr; |
1002 | struct sci_port *s = to_sci_port(port); | 1019 | struct sci_port *s = to_sci_port(port); |
1003 | irqreturn_t ret = IRQ_NONE; | 1020 | irqreturn_t ret = IRQ_NONE; |
1004 | 1021 | ||
1005 | ssr_status = serial_port_in(port, SCxSR); | 1022 | ssr_status = serial_port_in(port, SCxSR); |
1006 | scr_status = serial_port_in(port, SCSCR); | 1023 | scr_status = serial_port_in(port, SCSCR); |
1007 | if (port->type == PORT_SCIF || port->type == PORT_HSCIF) | 1024 | switch (port->type) { |
1008 | slr_status = serial_port_in(port, SCLSR); | 1025 | case PORT_SCIF: |
1026 | case PORT_HSCIF: | ||
1027 | orer_status = serial_port_in(port, SCLSR); | ||
1028 | break; | ||
1029 | case PORT_SCIFA: | ||
1030 | case PORT_SCIFB: | ||
1031 | orer_status = ssr_status; | ||
1032 | break; | ||
1033 | } | ||
1034 | |||
1009 | err_enabled = scr_status & port_rx_irq_mask(port); | 1035 | err_enabled = scr_status & port_rx_irq_mask(port); |
1010 | 1036 | ||
1011 | /* Tx Interrupt */ | 1037 | /* Tx Interrupt */ |
@@ -1033,10 +1059,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | |||
1033 | ret = sci_br_interrupt(irq, ptr); | 1059 | ret = sci_br_interrupt(irq, ptr); |
1034 | 1060 | ||
1035 | /* Overrun Interrupt */ | 1061 | /* Overrun Interrupt */ |
1036 | if (port->type == PORT_SCIF || port->type == PORT_HSCIF) { | 1062 | if (orer_status & (1 << s->overrun_bit)) |
1037 | if (slr_status & 0x01) | 1063 | sci_handle_fifo_overrun(port); |
1038 | sci_handle_fifo_overrun(port); | ||
1039 | } | ||
1040 | 1064 | ||
1041 | return ret; | 1065 | return ret; |
1042 | } | 1066 | } |