aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-07 12:52:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-07 12:52:46 -0400
commit664481ed45cdbda2ab853ddd3c2690b69aca9103 (patch)
tree6d0814ad0981ea94b1ffc0b54e33de38af793a43 /drivers
parentd6a624eef128c97b35fcea47cd00ef22f005e7aa (diff)
parenta052d2c31b7b87e9b4bdee634af666b5e830e56f (diff)
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Pull SuperH fixes from Paul Mundt. * tag 'sh-for-linus' of git://github.com/pmundt/linux-sh: sh: fix clock-sh7757 for the latest sh_mobile_sdhi driver serial: sh-sci: use serial_port_in/out vs sci_in/out. sh: vsyscall: Fix up .eh_frame generation. sh: dma: Fix up device attribute mismatch from sysdev fallout. sh: dwarf unwinder depends on SHcompact. sh: fix up fallout from system.h disintegration.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/sh-sci.c167
-rw-r--r--drivers/tty/serial/sh-sci.h8
2 files changed, 86 insertions, 89 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index bf461cf99616..3158e17b665c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -355,9 +355,6 @@ static void sci_serial_out(struct uart_port *p, int offset, int value)
355 WARN(1, "Invalid register access\n"); 355 WARN(1, "Invalid register access\n");
356} 356}
357 357
358#define sci_in(up, offset) (up->serial_in(up, offset))
359#define sci_out(up, offset, value) (up->serial_out(up, offset, value))
360
361static int sci_probe_regmap(struct plat_sci_port *cfg) 358static int sci_probe_regmap(struct plat_sci_port *cfg)
362{ 359{
363 switch (cfg->type) { 360 switch (cfg->type) {
@@ -422,9 +419,9 @@ static int sci_poll_get_char(struct uart_port *port)
422 int c; 419 int c;
423 420
424 do { 421 do {
425 status = sci_in(port, SCxSR); 422 status = serial_port_in(port, SCxSR);
426 if (status & SCxSR_ERRORS(port)) { 423 if (status & SCxSR_ERRORS(port)) {
427 sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); 424 serial_port_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
428 continue; 425 continue;
429 } 426 }
430 break; 427 break;
@@ -433,11 +430,11 @@ static int sci_poll_get_char(struct uart_port *port)
433 if (!(status & SCxSR_RDxF(port))) 430 if (!(status & SCxSR_RDxF(port)))
434 return NO_POLL_CHAR; 431 return NO_POLL_CHAR;
435 432
436 c = sci_in(port, SCxRDR); 433 c = serial_port_in(port, SCxRDR);
437 434
438 /* Dummy read */ 435 /* Dummy read */
439 sci_in(port, SCxSR); 436 serial_port_in(port, SCxSR);
440 sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); 437 serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
441 438
442 return c; 439 return c;
443} 440}
@@ -448,11 +445,11 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
448 unsigned short status; 445 unsigned short status;
449 446
450 do { 447 do {
451 status = sci_in(port, SCxSR); 448 status = serial_port_in(port, SCxSR);
452 } while (!(status & SCxSR_TDxE(port))); 449 } while (!(status & SCxSR_TDxE(port)));
453 450
454 sci_out(port, SCxTDR, c); 451 serial_port_out(port, SCxTDR, c);
455 sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port)); 452 serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port));
456} 453}
457#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ 454#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
458 455
@@ -480,10 +477,10 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag)
480 ((!(cflag & CRTSCTS)))) { 477 ((!(cflag & CRTSCTS)))) {
481 unsigned short status; 478 unsigned short status;
482 479
483 status = sci_in(port, SCSPTR); 480 status = serial_port_in(port, SCSPTR);
484 status &= ~SCSPTR_CTSIO; 481 status &= ~SCSPTR_CTSIO;
485 status |= SCSPTR_RTSIO; 482 status |= SCSPTR_RTSIO;
486 sci_out(port, SCSPTR, status); /* Set RTS = 1 */ 483 serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */
487 } 484 }
488} 485}
489 486
@@ -493,13 +490,13 @@ static int sci_txfill(struct uart_port *port)
493 490
494 reg = sci_getreg(port, SCTFDR); 491 reg = sci_getreg(port, SCTFDR);
495 if (reg->size) 492 if (reg->size)
496 return sci_in(port, SCTFDR) & 0xff; 493 return serial_port_in(port, SCTFDR) & 0xff;
497 494
498 reg = sci_getreg(port, SCFDR); 495 reg = sci_getreg(port, SCFDR);
499 if (reg->size) 496 if (reg->size)
500 return sci_in(port, SCFDR) >> 8; 497 return serial_port_in(port, SCFDR) >> 8;
501 498
502 return !(sci_in(port, SCxSR) & SCI_TDRE); 499 return !(serial_port_in(port, SCxSR) & SCI_TDRE);
503} 500}
504 501
505static int sci_txroom(struct uart_port *port) 502static int sci_txroom(struct uart_port *port)
@@ -513,13 +510,13 @@ static int sci_rxfill(struct uart_port *port)
513 510
514 reg = sci_getreg(port, SCRFDR); 511 reg = sci_getreg(port, SCRFDR);
515 if (reg->size) 512 if (reg->size)
516 return sci_in(port, SCRFDR) & 0xff; 513 return serial_port_in(port, SCRFDR) & 0xff;
517 514
518 reg = sci_getreg(port, SCFDR); 515 reg = sci_getreg(port, SCFDR);
519 if (reg->size) 516 if (reg->size)
520 return sci_in(port, SCFDR) & ((port->fifosize << 1) - 1); 517 return serial_port_in(port, SCFDR) & ((port->fifosize << 1) - 1);
521 518
522 return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0; 519 return (serial_port_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
523} 520}
524 521
525/* 522/*
@@ -547,14 +544,14 @@ static void sci_transmit_chars(struct uart_port *port)
547 unsigned short ctrl; 544 unsigned short ctrl;
548 int count; 545 int count;
549 546
550 status = sci_in(port, SCxSR); 547 status = serial_port_in(port, SCxSR);
551 if (!(status & SCxSR_TDxE(port))) { 548 if (!(status & SCxSR_TDxE(port))) {
552 ctrl = sci_in(port, SCSCR); 549 ctrl = serial_port_in(port, SCSCR);
553 if (uart_circ_empty(xmit)) 550 if (uart_circ_empty(xmit))
554 ctrl &= ~SCSCR_TIE; 551 ctrl &= ~SCSCR_TIE;
555 else 552 else
556 ctrl |= SCSCR_TIE; 553 ctrl |= SCSCR_TIE;
557 sci_out(port, SCSCR, ctrl); 554 serial_port_out(port, SCSCR, ctrl);
558 return; 555 return;
559 } 556 }
560 557
@@ -573,27 +570,27 @@ static void sci_transmit_chars(struct uart_port *port)
573 break; 570 break;
574 } 571 }
575 572
576 sci_out(port, SCxTDR, c); 573 serial_port_out(port, SCxTDR, c);
577 574
578 port->icount.tx++; 575 port->icount.tx++;
579 } while (--count > 0); 576 } while (--count > 0);
580 577
581 sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); 578 serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
582 579
583 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 580 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
584 uart_write_wakeup(port); 581 uart_write_wakeup(port);
585 if (uart_circ_empty(xmit)) { 582 if (uart_circ_empty(xmit)) {
586 sci_stop_tx(port); 583 sci_stop_tx(port);
587 } else { 584 } else {
588 ctrl = sci_in(port, SCSCR); 585 ctrl = serial_port_in(port, SCSCR);
589 586
590 if (port->type != PORT_SCI) { 587 if (port->type != PORT_SCI) {
591 sci_in(port, SCxSR); /* Dummy read */ 588 serial_port_in(port, SCxSR); /* Dummy read */
592 sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); 589 serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
593 } 590 }
594 591
595 ctrl |= SCSCR_TIE; 592 ctrl |= SCSCR_TIE;
596 sci_out(port, SCSCR, ctrl); 593 serial_port_out(port, SCSCR, ctrl);
597 } 594 }
598} 595}
599 596
@@ -608,7 +605,7 @@ static void sci_receive_chars(struct uart_port *port)
608 unsigned short status; 605 unsigned short status;
609 unsigned char flag; 606 unsigned char flag;
610 607
611 status = sci_in(port, SCxSR); 608 status = serial_port_in(port, SCxSR);
612 if (!(status & SCxSR_RDxF(port))) 609 if (!(status & SCxSR_RDxF(port)))
613 return; 610 return;
614 611
@@ -621,7 +618,7 @@ static void sci_receive_chars(struct uart_port *port)
621 break; 618 break;
622 619
623 if (port->type == PORT_SCI) { 620 if (port->type == PORT_SCI) {
624 char c = sci_in(port, SCxRDR); 621 char c = serial_port_in(port, SCxRDR);
625 if (uart_handle_sysrq_char(port, c) || 622 if (uart_handle_sysrq_char(port, c) ||
626 sci_port->break_flag) 623 sci_port->break_flag)
627 count = 0; 624 count = 0;
@@ -629,9 +626,9 @@ static void sci_receive_chars(struct uart_port *port)
629 tty_insert_flip_char(tty, c, TTY_NORMAL); 626 tty_insert_flip_char(tty, c, TTY_NORMAL);
630 } else { 627 } else {
631 for (i = 0; i < count; i++) { 628 for (i = 0; i < count; i++) {
632 char c = sci_in(port, SCxRDR); 629 char c = serial_port_in(port, SCxRDR);
633 630
634 status = sci_in(port, SCxSR); 631 status = serial_port_in(port, SCxSR);
635#if defined(CONFIG_CPU_SH3) 632#if defined(CONFIG_CPU_SH3)
636 /* Skip "chars" during break */ 633 /* Skip "chars" during break */
637 if (sci_port->break_flag) { 634 if (sci_port->break_flag) {
@@ -672,8 +669,8 @@ static void sci_receive_chars(struct uart_port *port)
672 } 669 }
673 } 670 }
674 671
675 sci_in(port, SCxSR); /* dummy read */ 672 serial_port_in(port, SCxSR); /* dummy read */
676 sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); 673 serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
677 674
678 copied += count; 675 copied += count;
679 port->icount.rx += count; 676 port->icount.rx += count;
@@ -683,8 +680,8 @@ static void sci_receive_chars(struct uart_port *port)
683 /* Tell the rest of the system the news. New characters! */ 680 /* Tell the rest of the system the news. New characters! */
684 tty_flip_buffer_push(tty); 681 tty_flip_buffer_push(tty);
685 } else { 682 } else {
686 sci_in(port, SCxSR); /* dummy read */ 683 serial_port_in(port, SCxSR); /* dummy read */
687 sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); 684 serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
688 } 685 }
689} 686}
690 687
@@ -726,7 +723,7 @@ static void sci_break_timer(unsigned long data)
726static int sci_handle_errors(struct uart_port *port) 723static int sci_handle_errors(struct uart_port *port)
727{ 724{
728 int copied = 0; 725 int copied = 0;
729 unsigned short status = sci_in(port, SCxSR); 726 unsigned short status = serial_port_in(port, SCxSR);
730 struct tty_struct *tty = port->state->port.tty; 727 struct tty_struct *tty = port->state->port.tty;
731 struct sci_port *s = to_sci_port(port); 728 struct sci_port *s = to_sci_port(port);
732 729
@@ -804,8 +801,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
804 if (!reg->size) 801 if (!reg->size)
805 return 0; 802 return 0;
806 803
807 if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { 804 if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
808 sci_out(port, SCLSR, 0); 805 serial_port_out(port, SCLSR, 0);
809 806
810 port->icount.overrun++; 807 port->icount.overrun++;
811 808
@@ -822,7 +819,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
822static int sci_handle_breaks(struct uart_port *port) 819static int sci_handle_breaks(struct uart_port *port)
823{ 820{
824 int copied = 0; 821 int copied = 0;
825 unsigned short status = sci_in(port, SCxSR); 822 unsigned short status = serial_port_in(port, SCxSR);
826 struct tty_struct *tty = port->state->port.tty; 823 struct tty_struct *tty = port->state->port.tty;
827 struct sci_port *s = to_sci_port(port); 824 struct sci_port *s = to_sci_port(port);
828 825
@@ -859,8 +856,8 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
859 struct sci_port *s = to_sci_port(port); 856 struct sci_port *s = to_sci_port(port);
860 857
861 if (s->chan_rx) { 858 if (s->chan_rx) {
862 u16 scr = sci_in(port, SCSCR); 859 u16 scr = serial_port_in(port, SCSCR);
863 u16 ssr = sci_in(port, SCxSR); 860 u16 ssr = serial_port_in(port, SCxSR);
864 861
865 /* Disable future Rx interrupts */ 862 /* Disable future Rx interrupts */
866 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 863 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
@@ -869,9 +866,9 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
869 } else { 866 } else {
870 scr &= ~SCSCR_RIE; 867 scr &= ~SCSCR_RIE;
871 } 868 }
872 sci_out(port, SCSCR, scr); 869 serial_port_out(port, SCSCR, scr);
873 /* Clear current interrupt */ 870 /* Clear current interrupt */
874 sci_out(port, SCxSR, ssr & ~(1 | SCxSR_RDxF(port))); 871 serial_port_out(port, SCxSR, ssr & ~(1 | SCxSR_RDxF(port)));
875 dev_dbg(port->dev, "Rx IRQ %lu: setup t-out in %u jiffies\n", 872 dev_dbg(port->dev, "Rx IRQ %lu: setup t-out in %u jiffies\n",
876 jiffies, s->rx_timeout); 873 jiffies, s->rx_timeout);
877 mod_timer(&s->rx_timer, jiffies + s->rx_timeout); 874 mod_timer(&s->rx_timer, jiffies + s->rx_timeout);
@@ -909,15 +906,15 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
909 if (port->type == PORT_SCI) { 906 if (port->type == PORT_SCI) {
910 if (sci_handle_errors(port)) { 907 if (sci_handle_errors(port)) {
911 /* discard character in rx buffer */ 908 /* discard character in rx buffer */
912 sci_in(port, SCxSR); 909 serial_port_in(port, SCxSR);
913 sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); 910 serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
914 } 911 }
915 } else { 912 } else {
916 sci_handle_fifo_overrun(port); 913 sci_handle_fifo_overrun(port);
917 sci_rx_interrupt(irq, ptr); 914 sci_rx_interrupt(irq, ptr);
918 } 915 }
919 916
920 sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); 917 serial_port_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
921 918
922 /* Kick the transmission */ 919 /* Kick the transmission */
923 sci_tx_interrupt(irq, ptr); 920 sci_tx_interrupt(irq, ptr);
@@ -931,7 +928,7 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
931 928
932 /* Handle BREAKs */ 929 /* Handle BREAKs */
933 sci_handle_breaks(port); 930 sci_handle_breaks(port);
934 sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); 931 serial_port_out(port, SCxSR, SCxSR_BREAK_CLEAR(port));
935 932
936 return IRQ_HANDLED; 933 return IRQ_HANDLED;
937} 934}
@@ -955,8 +952,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
955 struct sci_port *s = to_sci_port(port); 952 struct sci_port *s = to_sci_port(port);
956 irqreturn_t ret = IRQ_NONE; 953 irqreturn_t ret = IRQ_NONE;
957 954
958 ssr_status = sci_in(port, SCxSR); 955 ssr_status = serial_port_in(port, SCxSR);
959 scr_status = sci_in(port, SCSCR); 956 scr_status = serial_port_in(port, SCSCR);
960 err_enabled = scr_status & port_rx_irq_mask(port); 957 err_enabled = scr_status & port_rx_irq_mask(port);
961 958
962 /* Tx Interrupt */ 959 /* Tx Interrupt */
@@ -1170,7 +1167,7 @@ static void sci_free_gpios(struct sci_port *port)
1170 1167
1171static unsigned int sci_tx_empty(struct uart_port *port) 1168static unsigned int sci_tx_empty(struct uart_port *port)
1172{ 1169{
1173 unsigned short status = sci_in(port, SCxSR); 1170 unsigned short status = serial_port_in(port, SCxSR);
1174 unsigned short in_tx_fifo = sci_txfill(port); 1171 unsigned short in_tx_fifo = sci_txfill(port);
1175 1172
1176 return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0; 1173 return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0;
@@ -1198,7 +1195,7 @@ static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
1198 */ 1195 */
1199 reg = sci_getreg(port, SCFCR); 1196 reg = sci_getreg(port, SCFCR);
1200 if (reg->size) 1197 if (reg->size)
1201 sci_out(port, SCFCR, sci_in(port, SCFCR) | 1); 1198 serial_port_out(port, SCFCR, serial_port_in(port, SCFCR) | 1);
1202 } 1199 }
1203} 1200}
1204 1201
@@ -1240,8 +1237,8 @@ static void sci_dma_tx_complete(void *arg)
1240 } else { 1237 } else {
1241 s->cookie_tx = -EINVAL; 1238 s->cookie_tx = -EINVAL;
1242 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 1239 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
1243 u16 ctrl = sci_in(port, SCSCR); 1240 u16 ctrl = serial_port_in(port, SCSCR);
1244 sci_out(port, SCSCR, ctrl & ~SCSCR_TIE); 1241 serial_port_out(port, SCSCR, ctrl & ~SCSCR_TIE);
1245 } 1242 }
1246 } 1243 }
1247 1244
@@ -1494,13 +1491,13 @@ static void sci_start_tx(struct uart_port *port)
1494 1491
1495#ifdef CONFIG_SERIAL_SH_SCI_DMA 1492#ifdef CONFIG_SERIAL_SH_SCI_DMA
1496 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 1493 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
1497 u16 new, scr = sci_in(port, SCSCR); 1494 u16 new, scr = serial_port_in(port, SCSCR);
1498 if (s->chan_tx) 1495 if (s->chan_tx)
1499 new = scr | 0x8000; 1496 new = scr | 0x8000;
1500 else 1497 else
1501 new = scr & ~0x8000; 1498 new = scr & ~0x8000;
1502 if (new != scr) 1499 if (new != scr)
1503 sci_out(port, SCSCR, new); 1500 serial_port_out(port, SCSCR, new);
1504 } 1501 }
1505 1502
1506 if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && 1503 if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) &&
@@ -1512,8 +1509,8 @@ static void sci_start_tx(struct uart_port *port)
1512 1509
1513 if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 1510 if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
1514 /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ 1511 /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */
1515 ctrl = sci_in(port, SCSCR); 1512 ctrl = serial_port_in(port, SCSCR);
1516 sci_out(port, SCSCR, ctrl | SCSCR_TIE); 1513 serial_port_out(port, SCSCR, ctrl | SCSCR_TIE);
1517 } 1514 }
1518} 1515}
1519 1516
@@ -1522,40 +1519,40 @@ static void sci_stop_tx(struct uart_port *port)
1522 unsigned short ctrl; 1519 unsigned short ctrl;
1523 1520
1524 /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */ 1521 /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */
1525 ctrl = sci_in(port, SCSCR); 1522 ctrl = serial_port_in(port, SCSCR);
1526 1523
1527 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) 1524 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
1528 ctrl &= ~0x8000; 1525 ctrl &= ~0x8000;
1529 1526
1530 ctrl &= ~SCSCR_TIE; 1527 ctrl &= ~SCSCR_TIE;
1531 1528
1532 sci_out(port, SCSCR, ctrl); 1529 serial_port_out(port, SCSCR, ctrl);
1533} 1530}
1534 1531
1535static void sci_start_rx(struct uart_port *port) 1532static void sci_start_rx(struct uart_port *port)
1536{ 1533{
1537 unsigned short ctrl; 1534 unsigned short ctrl;
1538 1535
1539 ctrl = sci_in(port, SCSCR) | port_rx_irq_mask(port); 1536 ctrl = serial_port_in(port, SCSCR) | port_rx_irq_mask(port);
1540 1537
1541 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) 1538 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
1542 ctrl &= ~0x4000; 1539 ctrl &= ~0x4000;
1543 1540
1544 sci_out(port, SCSCR, ctrl); 1541 serial_port_out(port, SCSCR, ctrl);
1545} 1542}
1546 1543
1547static void sci_stop_rx(struct uart_port *port) 1544static void sci_stop_rx(struct uart_port *port)
1548{ 1545{
1549 unsigned short ctrl; 1546 unsigned short ctrl;
1550 1547
1551 ctrl = sci_in(port, SCSCR); 1548 ctrl = serial_port_in(port, SCSCR);
1552 1549
1553 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) 1550 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
1554 ctrl &= ~0x4000; 1551 ctrl &= ~0x4000;
1555 1552
1556 ctrl &= ~port_rx_irq_mask(port); 1553 ctrl &= ~port_rx_irq_mask(port);
1557 1554
1558 sci_out(port, SCSCR, ctrl); 1555 serial_port_out(port, SCSCR, ctrl);
1559} 1556}
1560 1557
1561static void sci_enable_ms(struct uart_port *port) 1558static void sci_enable_ms(struct uart_port *port)
@@ -1589,13 +1586,13 @@ static void rx_timer_fn(unsigned long arg)
1589{ 1586{
1590 struct sci_port *s = (struct sci_port *)arg; 1587 struct sci_port *s = (struct sci_port *)arg;
1591 struct uart_port *port = &s->port; 1588 struct uart_port *port = &s->port;
1592 u16 scr = sci_in(port, SCSCR); 1589 u16 scr = serial_port_in(port, SCSCR);
1593 1590
1594 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 1591 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
1595 scr &= ~0x4000; 1592 scr &= ~0x4000;
1596 enable_irq(s->cfg->irqs[1]); 1593 enable_irq(s->cfg->irqs[1]);
1597 } 1594 }
1598 sci_out(port, SCSCR, scr | SCSCR_RIE); 1595 serial_port_out(port, SCSCR, scr | SCSCR_RIE);
1599 dev_dbg(port->dev, "DMA Rx timed out\n"); 1596 dev_dbg(port->dev, "DMA Rx timed out\n");
1600 schedule_work(&s->work_rx); 1597 schedule_work(&s->work_rx);
1601} 1598}
@@ -1776,14 +1773,14 @@ static void sci_reset(struct uart_port *port)
1776 unsigned int status; 1773 unsigned int status;
1777 1774
1778 do { 1775 do {
1779 status = sci_in(port, SCxSR); 1776 status = serial_port_in(port, SCxSR);
1780 } while (!(status & SCxSR_TEND(port))); 1777 } while (!(status & SCxSR_TEND(port)));
1781 1778
1782 sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ 1779 serial_port_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
1783 1780
1784 reg = sci_getreg(port, SCFCR); 1781 reg = sci_getreg(port, SCFCR);
1785 if (reg->size) 1782 if (reg->size)
1786 sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); 1783 serial_port_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
1787} 1784}
1788 1785
1789static void sci_set_termios(struct uart_port *port, struct ktermios *termios, 1786static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
@@ -1812,7 +1809,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
1812 1809
1813 sci_reset(port); 1810 sci_reset(port);
1814 1811
1815 smr_val = sci_in(port, SCSMR) & 3; 1812 smr_val = serial_port_in(port, SCSMR) & 3;
1816 1813
1817 if ((termios->c_cflag & CSIZE) == CS7) 1814 if ((termios->c_cflag & CSIZE) == CS7)
1818 smr_val |= 0x40; 1815 smr_val |= 0x40;
@@ -1825,19 +1822,19 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
1825 1822
1826 uart_update_timeout(port, termios->c_cflag, baud); 1823 uart_update_timeout(port, termios->c_cflag, baud);
1827 1824
1828 sci_out(port, SCSMR, smr_val); 1825 serial_port_out(port, SCSMR, smr_val);
1829 1826
1830 dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t, 1827 dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t,
1831 s->cfg->scscr); 1828 s->cfg->scscr);
1832 1829
1833 if (t > 0) { 1830 if (t > 0) {
1834 if (t >= 256) { 1831 if (t >= 256) {
1835 sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1); 1832 serial_port_out(port, SCSMR, (serial_port_in(port, SCSMR) & ~3) | 1);
1836 t >>= 2; 1833 t >>= 2;
1837 } else 1834 } else
1838 sci_out(port, SCSMR, sci_in(port, SCSMR) & ~3); 1835 serial_port_out(port, SCSMR, serial_port_in(port, SCSMR) & ~3);
1839 1836
1840 sci_out(port, SCBRR, t); 1837 serial_port_out(port, SCBRR, t);
1841 udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */ 1838 udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */
1842 } 1839 }
1843 1840
@@ -1845,7 +1842,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
1845 1842
1846 reg = sci_getreg(port, SCFCR); 1843 reg = sci_getreg(port, SCFCR);
1847 if (reg->size) { 1844 if (reg->size) {
1848 unsigned short ctrl = sci_in(port, SCFCR); 1845 unsigned short ctrl = serial_port_in(port, SCFCR);
1849 1846
1850 if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) { 1847 if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
1851 if (termios->c_cflag & CRTSCTS) 1848 if (termios->c_cflag & CRTSCTS)
@@ -1861,10 +1858,10 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
1861 */ 1858 */
1862 ctrl &= ~(SCFCR_RFRST | SCFCR_TFRST); 1859 ctrl &= ~(SCFCR_RFRST | SCFCR_TFRST);
1863 1860
1864 sci_out(port, SCFCR, ctrl); 1861 serial_port_out(port, SCFCR, ctrl);
1865 } 1862 }
1866 1863
1867 sci_out(port, SCSCR, s->cfg->scscr); 1864 serial_port_out(port, SCSCR, s->cfg->scscr);
1868 1865
1869#ifdef CONFIG_SERIAL_SH_SCI_DMA 1866#ifdef CONFIG_SERIAL_SH_SCI_DMA
1870 /* 1867 /*
@@ -2166,7 +2163,7 @@ static void serial_console_write(struct console *co, const char *s,
2166 2163
2167 /* wait until fifo is empty and last bit has been transmitted */ 2164 /* wait until fifo is empty and last bit has been transmitted */
2168 bits = SCxSR_TDxE(port) | SCxSR_TEND(port); 2165 bits = SCxSR_TDxE(port) | SCxSR_TEND(port);
2169 while ((sci_in(port, SCxSR) & bits) != bits) 2166 while ((serial_port_in(port, SCxSR) & bits) != bits)
2170 cpu_relax(); 2167 cpu_relax();
2171 2168
2172 sci_port_disable(sci_port); 2169 sci_port_disable(sci_port);
@@ -2260,12 +2257,12 @@ static int sci_runtime_suspend(struct device *dev)
2260 if (uart_console(port)) { 2257 if (uart_console(port)) {
2261 struct plat_sci_reg *reg; 2258 struct plat_sci_reg *reg;
2262 2259
2263 sci_port->saved_smr = sci_in(port, SCSMR); 2260 sci_port->saved_smr = serial_port_in(port, SCSMR);
2264 sci_port->saved_brr = sci_in(port, SCBRR); 2261 sci_port->saved_brr = serial_port_in(port, SCBRR);
2265 2262
2266 reg = sci_getreg(port, SCFCR); 2263 reg = sci_getreg(port, SCFCR);
2267 if (reg->size) 2264 if (reg->size)
2268 sci_port->saved_fcr = sci_in(port, SCFCR); 2265 sci_port->saved_fcr = serial_port_in(port, SCFCR);
2269 else 2266 else
2270 sci_port->saved_fcr = 0; 2267 sci_port->saved_fcr = 0;
2271 } 2268 }
@@ -2279,13 +2276,13 @@ static int sci_runtime_resume(struct device *dev)
2279 2276
2280 if (uart_console(port)) { 2277 if (uart_console(port)) {
2281 sci_reset(port); 2278 sci_reset(port);
2282 sci_out(port, SCSMR, sci_port->saved_smr); 2279 serial_port_out(port, SCSMR, sci_port->saved_smr);
2283 sci_out(port, SCBRR, sci_port->saved_brr); 2280 serial_port_out(port, SCBRR, sci_port->saved_brr);
2284 2281
2285 if (sci_port->saved_fcr) 2282 if (sci_port->saved_fcr)
2286 sci_out(port, SCFCR, sci_port->saved_fcr); 2283 serial_port_out(port, SCFCR, sci_port->saved_fcr);
2287 2284
2288 sci_out(port, SCSCR, sci_port->cfg->scscr); 2285 serial_port_out(port, SCSCR, sci_port->cfg->scscr);
2289 } 2286 }
2290 return 0; 2287 return 0;
2291} 2288}
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index a1a2d364f92b..4c22a1529aac 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -20,10 +20,10 @@
20 defined(CONFIG_ARCH_SH7372) || \ 20 defined(CONFIG_ARCH_SH7372) || \
21 defined(CONFIG_ARCH_R8A7740) 21 defined(CONFIG_ARCH_R8A7740)
22 22
23# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc) 23# define SCxSR_RDxF_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfffc)
24# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73) 24# define SCxSR_ERROR_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfd73)
25# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf) 25# define SCxSR_TDxE_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffdf)
26# define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3) 26# define SCxSR_BREAK_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffe3)
27#else 27#else
28# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc) 28# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
29# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073) 29# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)