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>

authored by Yoshihiro Shimoda and committed by Paul Mundt 1a22f08d acca4f4d

+22 -17
+11 -9
drivers/serial/sh-sci.c
··· 478 478 return; 479 479 } 480 480 481 - if (port->type == PORT_SCIF) 482 - count = scif_txroom(port); 483 - else 481 + if (port->type == PORT_SCI) 484 482 count = sci_txroom(port); 483 + else 484 + count = scif_txroom(port); 485 485 486 486 do { 487 487 unsigned char c; ··· 510 510 } else { 511 511 ctrl = sci_in(port, SCSCR); 512 512 513 - if (port->type == PORT_SCIF) { 513 + if (port->type != PORT_SCI) { 514 514 sci_in(port, SCxSR); /* Dummy read */ 515 515 sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); 516 516 } ··· 536 536 return; 537 537 538 538 while (1) { 539 - if (port->type == PORT_SCIF) 540 - count = scif_rxroom(port); 541 - else 539 + if (port->type == PORT_SCI) 542 540 count = sci_rxroom(port); 541 + else 542 + count = scif_rxroom(port); 543 543 544 544 /* Don't copy more bytes than there is room for in the buffer */ 545 545 count = tty_buffer_request_room(tty, count); ··· 714 714 715 715 #if defined(SCIF_ORER) 716 716 /* XXX: Handle SCIF overrun error */ 717 - if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { 717 + if (port->type != PORT_SCI && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { 718 718 sci_out(port, SCLSR, 0); 719 719 if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { 720 720 copied++; ··· 1042 1042 1043 1043 sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ 1044 1044 1045 - if (port->type == PORT_SCIF) 1045 + if (port->type != PORT_SCI) 1046 1046 sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); 1047 1047 1048 1048 smr_val = sci_in(port, SCSMR) & 3; ··· 1085 1085 case PORT_SCI: return "sci"; 1086 1086 case PORT_SCIF: return "scif"; 1087 1087 case PORT_IRDA: return "irda"; 1088 + case PORT_SCIFA: return "scifa"; 1088 1089 } 1089 1090 1090 1091 return NULL; ··· 1113 1112 s->init_pins = sci_init_pins_sci; 1114 1113 break; 1115 1114 case PORT_SCIF: 1115 + case PORT_SCIFA: 1116 1116 s->init_pins = sci_init_pins_scif; 1117 1117 break; 1118 1118 case PORT_IRDA:
+8 -8
drivers/serial/sh-sci.h
··· 289 289 #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ 290 290 static inline unsigned int sci_##name##_in(struct uart_port *port) \ 291 291 { \ 292 - if (port->type == PORT_SCI) { \ 293 - SCI_IN(sci_size, sci_offset) \ 294 - } else { \ 295 - SCI_IN(scif_size, scif_offset); \ 292 + if (port->type == PORT_SCIF) { \ 293 + SCI_IN(scif_size, scif_offset) \ 294 + } else { /* PORT_SCI or PORT_SCIFA */ \ 295 + SCI_IN(sci_size, sci_offset); \ 296 296 } \ 297 297 } \ 298 298 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \ 299 299 { \ 300 - if (port->type == PORT_SCI) { \ 301 - SCI_OUT(sci_size, sci_offset, value) \ 302 - } else { \ 303 - SCI_OUT(scif_size, scif_offset, value); \ 300 + if (port->type == PORT_SCIF) { \ 301 + SCI_OUT(scif_size, scif_offset, value) \ 302 + } else { /* PORT_SCI or PORT_SCIFA */ \ 303 + SCI_OUT(sci_size, sci_offset, value); \ 304 304 } \ 305 305 } 306 306
+3
include/linux/serial_core.h
··· 155 155 156 156 #define PORT_SC26XX 82 157 157 158 + /* SH-SCI */ 159 + #define PORT_SCIFA 83 160 + 158 161 #ifdef __KERNEL__ 159 162 160 163 #include <linux/compiler.h>