SAMA5 Serial: Fix a couple of errors backporting termios and flowcontrol

This commit is contained in:
Gregory Nutt 2015-04-08 14:35:04 -06:00
parent 2ba3ccbde0
commit 98b0659abf
2 changed files with 13 additions and 5 deletions

View File

@ -282,38 +282,45 @@ config SAMA5_UART0
default y default y
depends on SAMA5_HAVE_UART0 depends on SAMA5_HAVE_UART0
select ARCH_HAVE_UART0 select ARCH_HAVE_UART0
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_UART1 config SAMA5_UART1
bool "UART 1" bool "UART 1"
default n default n
depends on SAMA5_HAVE_UART1 depends on SAMA5_HAVE_UART1
select ARCH_HAVE_UART1 select ARCH_HAVE_UART1
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_USART0 config SAMA5_USART0
bool "USART 0" bool "USART 0"
default n default n
select ARCH_HAVE_USART0 select ARCH_HAVE_USART0
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_USART1 config SAMA5_USART1
bool "USART 1" bool "USART 1"
default n default n
select ARCH_HAVE_USART1 select ARCH_HAVE_USART1
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_USART2 config SAMA5_USART2
bool "USART 2" bool "USART 2"
default n default n
select ARCH_HAVE_USART2 select ARCH_HAVE_USART2
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_USART3 config SAMA5_USART3
bool "USART 3" bool "USART 3"
default n default n
select ARCH_HAVE_USART3 select ARCH_HAVE_USART3
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_USART4 config SAMA5_USART4
bool "USART 4" bool "USART 4"
default n default n
depends on SAMA5_HAVE_USART4 depends on SAMA5_HAVE_USART4
select ARCH_HAVE_USART4 select ARCH_HAVE_USART4
select ARCH_HAVE_SERIAL_TERMIOS
config SAMA5_TWI0 config SAMA5_TWI0
bool "Two-Wire Interface 0 (TWI0)" bool "Two-Wire Interface 0 (TWI0)"

View File

@ -404,7 +404,7 @@ struct up_dev_s
uint8_t bits; /* Number of bits (7 or 8) */ uint8_t bits; /* Number of bits (7 or 8) */
bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */ bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */
#if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL)
bool flowc; /* input flow control (RTS) enabled */ bool flowc; /* input flow control (RTS) enabled */
#endif #endif
}; };
@ -521,7 +521,7 @@ static struct up_dev_s g_uart1priv =
.parity = CONFIG_UART1_PARITY, .parity = CONFIG_UART1_PARITY,
.bits = CONFIG_UART1_BITS, .bits = CONFIG_UART1_BITS,
.stopbits2 = CONFIG_UART1_2STOP, .stopbits2 = CONFIG_UART1_2STOP,
; };
static uart_dev_t g_uart1port = static uart_dev_t g_uart1port =
{ {
@ -1239,16 +1239,17 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
#if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL)
priv->flowc = flowc; priv->flowc = flowc;
#endif #endif
/* effect the changes immediately - note that we do not /* Effect the changes immediately - note that we do not
* implement TCSADRAIN / TCSAFLUSH * implement TCSADRAIN / TCSAFLUSH
*/ */
up_disableallints(priv, &imr); imr = up_serialin(priv, SAM_UART_IMR_OFFSET);
up_disableallints(priv);
ret = up_setup(dev); ret = up_setup(dev);
/* Restore the interrupt state */ /* Restore the interrupt state */
up_restoreusartint(priv, imr); up_serialout(priv, SAM_UART_IER_OFFSET, imr);
} }
} }
break; break;