提交 75c249fd 编写于 作者: G Geert Uytterhoeven 提交者: Greg Kroah-Hartman

serial: sh-sci: Replace hardcoded overrun bit values

Add the missing overrun bit definition for (H)SCIF.
Replace overrun_bit by overrun_mask, so we can use the existing
defines instead of hardcoded values.
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2922598c
...@@ -81,7 +81,7 @@ struct sci_port { ...@@ -81,7 +81,7 @@ struct sci_port {
/* Platform configuration */ /* Platform configuration */
struct plat_sci_port *cfg; struct plat_sci_port *cfg;
int overrun_bit; unsigned int overrun_mask;
unsigned int error_mask; unsigned int error_mask;
unsigned int sampling_rate; unsigned int sampling_rate;
...@@ -803,7 +803,7 @@ static int sci_handle_errors(struct uart_port *port) ...@@ -803,7 +803,7 @@ static int sci_handle_errors(struct uart_port *port)
struct sci_port *s = to_sci_port(port); struct sci_port *s = to_sci_port(port);
/* Handle overruns */ /* Handle overruns */
if (status & (1 << s->overrun_bit)) { if (status & s->overrun_mask) {
port->icount.overrun++; port->icount.overrun++;
/* overrun error */ /* overrun error */
...@@ -867,7 +867,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) ...@@ -867,7 +867,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
struct sci_port *s = to_sci_port(port); struct sci_port *s = to_sci_port(port);
struct plat_sci_reg *reg; struct plat_sci_reg *reg;
int copied = 0, offset; int copied = 0, offset;
u16 status, bit; u16 status;
switch (port->type) { switch (port->type) {
case PORT_SCIF: case PORT_SCIF:
...@@ -887,10 +887,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port) ...@@ -887,10 +887,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
return 0; return 0;
status = serial_port_in(port, offset); status = serial_port_in(port, offset);
bit = 1 << s->overrun_bit; if (status & s->overrun_mask) {
status &= ~s->overrun_mask;
if (status & bit) {
status &= ~bit;
serial_port_out(port, offset, status); serial_port_out(port, offset, status);
port->icount.overrun++; port->icount.overrun++;
...@@ -1081,7 +1079,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) ...@@ -1081,7 +1079,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
ret = sci_br_interrupt(irq, ptr); ret = sci_br_interrupt(irq, ptr);
/* Overrun Interrupt */ /* Overrun Interrupt */
if (orer_status & (1 << s->overrun_bit)) if (orer_status & s->overrun_mask)
sci_handle_fifo_overrun(port); sci_handle_fifo_overrun(port);
return ret; return ret;
...@@ -2256,32 +2254,32 @@ static int sci_init_single(struct platform_device *dev, ...@@ -2256,32 +2254,32 @@ static int sci_init_single(struct platform_device *dev,
switch (p->type) { switch (p->type) {
case PORT_SCIFB: case PORT_SCIFB:
port->fifosize = 256; port->fifosize = 256;
sci_port->overrun_bit = 9; sci_port->overrun_mask = SCIFA_ORER;
sampling_rate = 16; sampling_rate = 16;
break; break;
case PORT_HSCIF: case PORT_HSCIF:
port->fifosize = 128; port->fifosize = 128;
sampling_rate = 0; sampling_rate = 0;
sci_port->overrun_bit = 0; sci_port->overrun_mask = SCLSR_ORER;
break; break;
case PORT_SCIFA: case PORT_SCIFA:
port->fifosize = 64; port->fifosize = 64;
sci_port->overrun_bit = 9; sci_port->overrun_mask = SCIFA_ORER;
sampling_rate = 16; sampling_rate = 16;
break; break;
case PORT_SCIF: case PORT_SCIF:
port->fifosize = 16; port->fifosize = 16;
if (p->regtype == SCIx_SH7705_SCIF_REGTYPE) { if (p->regtype == SCIx_SH7705_SCIF_REGTYPE) {
sci_port->overrun_bit = 9; sci_port->overrun_mask = SCIFA_ORER;
sampling_rate = 16; sampling_rate = 16;
} else { } else {
sci_port->overrun_bit = 0; sci_port->overrun_mask = SCLSR_ORER;
sampling_rate = 32; sampling_rate = 32;
} }
break; break;
default: default:
port->fifosize = 1; port->fifosize = 1;
sci_port->overrun_bit = 5; sci_port->overrun_mask = SCI_ORER;
sampling_rate = 32; sampling_rate = 32;
break; break;
} }
...@@ -2335,7 +2333,7 @@ static int sci_init_single(struct platform_device *dev, ...@@ -2335,7 +2333,7 @@ static int sci_init_single(struct platform_device *dev,
* Make the error mask inclusive of overrun detection, if * Make the error mask inclusive of overrun detection, if
* supported. * supported.
*/ */
sci_port->error_mask |= 1 << sci_port->overrun_bit; sci_port->error_mask |= sci_port->overrun_mask;
port->type = p->type; port->type = p->type;
port->flags = UPF_FIXED_PORT | p->flags; port->flags = UPF_FIXED_PORT | p->flags;
......
...@@ -87,6 +87,9 @@ enum { ...@@ -87,6 +87,9 @@ enum {
#define SCFCR_RFRST BIT(1) /* Receive FIFO Data Register Reset */ #define SCFCR_RFRST BIT(1) /* Receive FIFO Data Register Reset */
#define SCFCR_LOOP BIT(0) /* Loopback Test */ #define SCFCR_LOOP BIT(0) /* Loopback Test */
/* SCLSR (Line Status Register) on (H)SCIF */
#define SCLSR_ORER BIT(0) /* Overrun Error */
/* SCSPTR (Serial Port Register), optional */ /* SCSPTR (Serial Port Register), optional */
#define SCSPTR_RTSIO BIT(7) /* Serial Port RTS Pin Input/Output */ #define SCSPTR_RTSIO BIT(7) /* Serial Port RTS Pin Input/Output */
#define SCSPTR_RTSDT BIT(6) /* Serial Port RTS Pin Data */ #define SCSPTR_RTSDT BIT(6) /* Serial Port RTS Pin Data */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册