Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: sh-sci: Fix TE setting on SCI IP

As per the RZ/G2L users hardware manual (Rev.1.20 Sep, 2022), section
23.3.7 Serial Data Transmission (Asynchronous Mode) it is mentioned
that the TE (transmit enable) must be set after setting TIE (transmit
interrupt enable) or these 2 bits are set to 1 simultaneously by a
single instruction. So set these 2 bits in single instruction.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230412145053.114847-4-biju.das.jz@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Biju Das and committed by
Greg Kroah-Hartman
1707ce2d cf383d12

+17 -2
+17 -2
drivers/tty/serial/sh-sci.c
··· 601 601 port->type == PORT_SCIFA || port->type == PORT_SCIFB) { 602 602 /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ 603 603 ctrl = serial_port_in(port, SCSCR); 604 + 605 + /* 606 + * For SCI, TE (transmit enable) must be set after setting TIE 607 + * (transmit interrupt enable) or in the same instruction to start 608 + * the transmit process. 609 + */ 610 + if (port->type == PORT_SCI) 611 + ctrl |= SCSCR_TE; 612 + 604 613 serial_port_out(port, SCSCR, ctrl | SCSCR_TIE); 605 614 } 606 615 } ··· 2609 2600 sci_set_mctrl(port, port->mctrl); 2610 2601 } 2611 2602 2612 - scr_val |= SCSCR_RE | SCSCR_TE | 2613 - (s->cfg->scscr & ~(SCSCR_CKE1 | SCSCR_CKE0)); 2603 + /* 2604 + * For SCI, TE (transmit enable) must be set after setting TIE 2605 + * (transmit interrupt enable) or in the same instruction to 2606 + * start the transmitting process. So skip setting TE here for SCI. 2607 + */ 2608 + if (port->type != PORT_SCI) 2609 + scr_val |= SCSCR_TE; 2610 + scr_val |= SCSCR_RE | (s->cfg->scscr & ~(SCSCR_CKE1 | SCSCR_CKE0)); 2614 2611 serial_port_out(port, SCSCR, scr_val | s->hscif_tot); 2615 2612 if ((srr + 1 == 5) && 2616 2613 (port->type == PORT_SCIFA || port->type == PORT_SCIFB)) {