Skip to content

Commit

Permalink
tty: 8250: jz4780: Add MCR register bits for flow control.
Browse files Browse the repository at this point in the history
These bits are not standard 550 uart.
For the serial module in the JZ4780, they need to be enabled
for flow control to work.

Found using old ingenic history to get BT to work on 3.16

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
  • Loading branch information
Zubair Lutfullah Kakakhel authored and Zubair Lutfullah Kakakhel committed Jan 23, 2015
1 parent 8f4d8f4 commit f2c4b22
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/tty/serial/8250/8250_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@

#include "8250.h"

#ifdef CONFIG_MACH_JZ4780
#define JZ_UART_MCR_MDCE 0x80 /* Enable modem function */
#define JZ_UART_MCR_FCM 0x40 /* flow control by hardware */
#endif

/*
* Configuration:
* share_irqs - whether we pass IRQF_SHARED to request_irq(). This option
Expand Down Expand Up @@ -1945,6 +1950,13 @@ static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl)
if (mctrl & TIOCM_LOOP)
mcr |= UART_MCR_LOOP;

if (port->type == PORT_INGENIC_JZ4780) {
if (mctrl & JZ_UART_MCR_MDCE)
mcr |= JZ_UART_MCR_MDCE;
if (mctrl & JZ_UART_MCR_FCM)
mcr |= JZ_UART_MCR_FCM;
}

mcr = (mcr & up->mcr_mask) | up->mcr_force | up->mcr;

serial_port_out(port, UART_MCR, mcr);
Expand Down Expand Up @@ -2527,8 +2539,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
*/
up->ier &= ~UART_IER_MSI;
if (!(up->bugs & UART_BUG_NOMSR) &&
UART_ENABLE_MS(&up->port, termios->c_cflag))
UART_ENABLE_MS(&up->port, termios->c_cflag)) {
up->ier |= UART_IER_MSI;
if (port->type == PORT_INGENIC_JZ4780)
up->port.mctrl = JZ_UART_MCR_MDCE | JZ_UART_MCR_FCM;
}
if (up->capabilities & UART_CAP_UUE)
up->ier |= UART_IER_UUE;
if (up->capabilities & UART_CAP_RTOIE)
Expand Down

0 comments on commit f2c4b22

Please sign in to comment.