mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
serial: sh-sci: fix cannot work SH7723 SCIFA
SH7723 has SCIFA. This module is similer SCI register map, but it has FIFO. So this patch adds new type(PORT_SCIFA) and change some type checking. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
acca4f4d9b
commit
1a22f08dbd
3 changed files with 22 additions and 17 deletions
|
@ -478,10 +478,10 @@ static void sci_transmit_chars(struct uart_port *port)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port->type == PORT_SCIF)
|
if (port->type == PORT_SCI)
|
||||||
count = scif_txroom(port);
|
|
||||||
else
|
|
||||||
count = sci_txroom(port);
|
count = sci_txroom(port);
|
||||||
|
else
|
||||||
|
count = scif_txroom(port);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
@ -510,7 +510,7 @@ static void sci_transmit_chars(struct uart_port *port)
|
||||||
} else {
|
} else {
|
||||||
ctrl = sci_in(port, SCSCR);
|
ctrl = sci_in(port, SCSCR);
|
||||||
|
|
||||||
if (port->type == PORT_SCIF) {
|
if (port->type != PORT_SCI) {
|
||||||
sci_in(port, SCxSR); /* Dummy read */
|
sci_in(port, SCxSR); /* Dummy read */
|
||||||
sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
|
sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
|
||||||
}
|
}
|
||||||
|
@ -536,10 +536,10 @@ static inline void sci_receive_chars(struct uart_port *port)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (port->type == PORT_SCIF)
|
if (port->type == PORT_SCI)
|
||||||
count = scif_rxroom(port);
|
|
||||||
else
|
|
||||||
count = sci_rxroom(port);
|
count = sci_rxroom(port);
|
||||||
|
else
|
||||||
|
count = scif_rxroom(port);
|
||||||
|
|
||||||
/* Don't copy more bytes than there is room for in the buffer */
|
/* Don't copy more bytes than there is room for in the buffer */
|
||||||
count = tty_buffer_request_room(tty, count);
|
count = tty_buffer_request_room(tty, count);
|
||||||
|
@ -714,7 +714,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
|
||||||
|
|
||||||
#if defined(SCIF_ORER)
|
#if defined(SCIF_ORER)
|
||||||
/* XXX: Handle SCIF overrun error */
|
/* XXX: Handle SCIF overrun error */
|
||||||
if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) {
|
if (port->type != PORT_SCI && (sci_in(port, SCLSR) & SCIF_ORER) != 0) {
|
||||||
sci_out(port, SCLSR, 0);
|
sci_out(port, SCLSR, 0);
|
||||||
if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
|
if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
|
||||||
copied++;
|
copied++;
|
||||||
|
@ -1042,7 +1042,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
|
||||||
|
|
||||||
sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
|
sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
|
||||||
|
|
||||||
if (port->type == PORT_SCIF)
|
if (port->type != PORT_SCI)
|
||||||
sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
|
sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
|
||||||
|
|
||||||
smr_val = sci_in(port, SCSMR) & 3;
|
smr_val = sci_in(port, SCSMR) & 3;
|
||||||
|
@ -1085,6 +1085,7 @@ static const char *sci_type(struct uart_port *port)
|
||||||
case PORT_SCI: return "sci";
|
case PORT_SCI: return "sci";
|
||||||
case PORT_SCIF: return "scif";
|
case PORT_SCIF: return "scif";
|
||||||
case PORT_IRDA: return "irda";
|
case PORT_IRDA: return "irda";
|
||||||
|
case PORT_SCIFA: return "scifa";
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1112,6 +1113,7 @@ static void sci_config_port(struct uart_port *port, int flags)
|
||||||
s->init_pins = sci_init_pins_sci;
|
s->init_pins = sci_init_pins_sci;
|
||||||
break;
|
break;
|
||||||
case PORT_SCIF:
|
case PORT_SCIF:
|
||||||
|
case PORT_SCIFA:
|
||||||
s->init_pins = sci_init_pins_scif;
|
s->init_pins = sci_init_pins_scif;
|
||||||
break;
|
break;
|
||||||
case PORT_IRDA:
|
case PORT_IRDA:
|
||||||
|
|
|
@ -289,18 +289,18 @@
|
||||||
#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
|
#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
|
||||||
static inline unsigned int sci_##name##_in(struct uart_port *port) \
|
static inline unsigned int sci_##name##_in(struct uart_port *port) \
|
||||||
{ \
|
{ \
|
||||||
if (port->type == PORT_SCI) { \
|
if (port->type == PORT_SCIF) { \
|
||||||
SCI_IN(sci_size, sci_offset) \
|
SCI_IN(scif_size, scif_offset) \
|
||||||
} else { \
|
} else { /* PORT_SCI or PORT_SCIFA */ \
|
||||||
SCI_IN(scif_size, scif_offset); \
|
SCI_IN(sci_size, sci_offset); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
|
static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
|
||||||
{ \
|
{ \
|
||||||
if (port->type == PORT_SCI) { \
|
if (port->type == PORT_SCIF) { \
|
||||||
SCI_OUT(sci_size, sci_offset, value) \
|
SCI_OUT(scif_size, scif_offset, value) \
|
||||||
} else { \
|
} else { /* PORT_SCI or PORT_SCIFA */ \
|
||||||
SCI_OUT(scif_size, scif_offset, value); \
|
SCI_OUT(sci_size, sci_offset, value); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,9 @@
|
||||||
|
|
||||||
#define PORT_SC26XX 82
|
#define PORT_SC26XX 82
|
||||||
|
|
||||||
|
/* SH-SCI */
|
||||||
|
#define PORT_SCIFA 83
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue