Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120132
b: refs/heads/master
c: d830fa4
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed Dec 22, 2008
1 parent 2b8bec2 commit 8d85593
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 762c69e3cad67a5cc5a01ba74e0b552ae4615258
refs/heads/master: d830fa4584a4015989b9b396a80779f28f277baa
45 changes: 24 additions & 21 deletions trunk/drivers/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,27 @@ static inline int sci_handle_errors(struct uart_port *port)
return copied;
}

static inline int sci_handle_fifo_overrun(struct uart_port *port)
{
struct tty_struct *tty = port->info->port.tty;
int copied = 0;

if (port->type != PORT_SCIF)
return 0;

if ((sci_in(port, SCLSR) & SCIF_ORER) != 0) {
sci_out(port, SCLSR, 0);

tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_flip_buffer_push(tty);

dev_notice(port->dev, "overrun error\n");
copied++;
}

return copied;
}

static inline int sci_handle_breaks(struct uart_port *port)
{
int copied = 0;
Expand All @@ -647,20 +668,11 @@ static inline int sci_handle_breaks(struct uart_port *port)
dev_dbg(port->dev, "BREAK detected\n");
}

#if defined(SCIF_ORER)
/* XXX: Handle SCIF overrun error */
if (port->type != PORT_SCI && (sci_in(port, SCLSR) & SCIF_ORER) != 0) {
sci_out(port, SCLSR, 0);
if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
copied++;
dev_notice(port->dev, "overrun error\n");
}
}
#endif

if (copied)
tty_flip_buffer_push(tty);

copied += sci_handle_fifo_overrun(port);

return copied;
}

Expand Down Expand Up @@ -698,16 +710,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
}
} else {
#if defined(SCIF_ORER)
if ((sci_in(port, SCLSR) & SCIF_ORER) != 0) {
struct tty_struct *tty = port->info->port.tty;

sci_out(port, SCLSR, 0);
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_flip_buffer_push(tty);
dev_notice(port->dev, "overrun error\n");
}
#endif
sci_handle_fifo_overrun(port);
sci_rx_interrupt(irq, ptr);
}

Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/serial/sh-sci.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,18 @@
# define SCIF_TXROOM_MAX 16
#endif

#ifndef SCIF_ORER
#define SCIF_ORER 0x0000
#endif

#define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
#define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
#define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
#define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
#define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
#define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
#define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)

#if defined(CONFIG_CPU_SUBTYPE_SH7705)
# define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER)
#else
# define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : 0x0000)
#endif
#define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER)

#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
Expand Down

0 comments on commit 8d85593

Please sign in to comment.