aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sh-sci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sh-sci.c')
-rw-r--r--drivers/serial/sh-sci.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index ce6ee92b3a1b..3df2aaec829f 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -410,7 +410,6 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
410#endif 410#endif
411 411
412#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ 412#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
413 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
414 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 413 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
415 defined(CONFIG_CPU_SUBTYPE_SH7785) 414 defined(CONFIG_CPU_SUBTYPE_SH7785)
416static inline int scif_txroom(struct uart_port *port) 415static inline int scif_txroom(struct uart_port *port)
@@ -422,6 +421,22 @@ static inline int scif_rxroom(struct uart_port *port)
422{ 421{
423 return sci_in(port, SCRFDR) & 0xff; 422 return sci_in(port, SCRFDR) & 0xff;
424} 423}
424#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
425static inline int scif_txroom(struct uart_port *port)
426{
427 if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
428 return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
429 else /* SCIF2 */
430 return SCIF2_TXROOM_MAX - (sci_in(port, SCFDR) >> 8);
431}
432
433static inline int scif_rxroom(struct uart_port *port)
434{
435 if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
436 return sci_in(port, SCRFDR) & 0xff;
437 else /* SCIF2 */
438 return sci_in(port, SCFDR) & SCIF2_RFDC_MASK;
439}
425#else 440#else
426static inline int scif_txroom(struct uart_port *port) 441static inline int scif_txroom(struct uart_port *port)
427{ 442{
@@ -521,7 +536,7 @@ static void sci_transmit_chars(struct uart_port *port)
521static inline void sci_receive_chars(struct uart_port *port) 536static inline void sci_receive_chars(struct uart_port *port)
522{ 537{
523 struct sci_port *sci_port = (struct sci_port *)port; 538 struct sci_port *sci_port = (struct sci_port *)port;
524 struct tty_struct *tty = port->info->tty; 539 struct tty_struct *tty = port->info->port.tty;
525 int i, count, copied = 0; 540 int i, count, copied = 0;
526 unsigned short status; 541 unsigned short status;
527 unsigned char flag; 542 unsigned char flag;
@@ -642,7 +657,7 @@ static inline int sci_handle_errors(struct uart_port *port)
642{ 657{
643 int copied = 0; 658 int copied = 0;
644 unsigned short status = sci_in(port, SCxSR); 659 unsigned short status = sci_in(port, SCxSR);
645 struct tty_struct *tty = port->info->tty; 660 struct tty_struct *tty = port->info->port.tty;
646 661
647 if (status & SCxSR_ORER(port)) { 662 if (status & SCxSR_ORER(port)) {
648 /* overrun error */ 663 /* overrun error */
@@ -692,7 +707,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
692{ 707{
693 int copied = 0; 708 int copied = 0;
694 unsigned short status = sci_in(port, SCxSR); 709 unsigned short status = sci_in(port, SCxSR);
695 struct tty_struct *tty = port->info->tty; 710 struct tty_struct *tty = port->info->port.tty;
696 struct sci_port *s = &sci_ports[port->line]; 711 struct sci_port *s = &sci_ports[port->line];
697 712
698 if (uart_handle_break(port)) 713 if (uart_handle_break(port))
@@ -762,7 +777,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
762 } else { 777 } else {
763#if defined(SCIF_ORER) 778#if defined(SCIF_ORER)
764 if((sci_in(port, SCLSR) & SCIF_ORER) != 0) { 779 if((sci_in(port, SCLSR) & SCIF_ORER) != 0) {
765 struct tty_struct *tty = port->info->tty; 780 struct tty_struct *tty = port->info->port.tty;
766 781
767 sci_out(port, SCLSR, 0); 782 sci_out(port, SCLSR, 0);
768 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 783 tty_insert_flip_char(tty, 0, TTY_OVERRUN);