diff options
| author | Sonic Zhang <sonic.zhang@analog.com> | 2012-05-16 02:22:25 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-17 16:25:56 -0400 |
| commit | 3c2d0ed221a22ce2c1c9fe1e2d6142374917642e (patch) | |
| tree | 2cd3baf5f365b8cf0b6f5be019594f77b409d3c0 | |
| parent | 239c25b1a03cf57193b9a52623deb918adf6132e (diff) | |
serial: bfin_uart: RTS and CTS MMRs can be either 16-bit width or 32-bit width.
Change hardware flow control code to adapt to both bf5xx and bf60x.
Disabled serial device before set termios for bf60x.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/tty/serial/bfin_uart.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 56b95b0447d9..7924ba6d5dfb 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c | |||
| @@ -549,7 +549,7 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | |||
| 549 | static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | 549 | static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) |
| 550 | { | 550 | { |
| 551 | struct bfin_serial_port *uart = dev_id; | 551 | struct bfin_serial_port *uart = dev_id; |
| 552 | unsigned short irqstat; | 552 | unsigned int irqstat; |
| 553 | int x_pos, pos; | 553 | int x_pos, pos; |
| 554 | 554 | ||
| 555 | spin_lock(&uart->rx_lock); | 555 | spin_lock(&uart->rx_lock); |
| @@ -582,7 +582,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | |||
| 582 | static unsigned int bfin_serial_tx_empty(struct uart_port *port) | 582 | static unsigned int bfin_serial_tx_empty(struct uart_port *port) |
| 583 | { | 583 | { |
| 584 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 584 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
| 585 | unsigned short lsr; | 585 | unsigned int lsr; |
| 586 | 586 | ||
| 587 | lsr = UART_GET_LSR(uart); | 587 | lsr = UART_GET_LSR(uart); |
| 588 | if (lsr & TEMT) | 588 | if (lsr & TEMT) |
| @@ -741,7 +741,7 @@ static int bfin_serial_startup(struct uart_port *port) | |||
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | /* CTS RTS PINs are negative assertive. */ | 743 | /* CTS RTS PINs are negative assertive. */ |
| 744 | UART_PUT_MCR(uart, ACTS); | 744 | UART_PUT_MCR(uart, UART_GET_MCR(uart) | ACTS); |
| 745 | UART_SET_IER(uart, EDSSI); | 745 | UART_SET_IER(uart, EDSSI); |
| 746 | } | 746 | } |
| 747 | #endif | 747 | #endif |
| @@ -799,7 +799,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 799 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 799 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
| 800 | unsigned long flags; | 800 | unsigned long flags; |
| 801 | unsigned int baud, quot; | 801 | unsigned int baud, quot; |
| 802 | unsigned short val, ier, lcr = 0; | 802 | unsigned int ier, lcr = 0; |
| 803 | 803 | ||
| 804 | switch (termios->c_cflag & CSIZE) { | 804 | switch (termios->c_cflag & CSIZE) { |
| 805 | case CS8: | 805 | case CS8: |
| @@ -871,6 +871,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 871 | 871 | ||
| 872 | /* Disable UART */ | 872 | /* Disable UART */ |
| 873 | ier = UART_GET_IER(uart); | 873 | ier = UART_GET_IER(uart); |
| 874 | UART_PUT_GCTL(uart, UART_GET_GCTL(uart) & ~UCEN); | ||
| 874 | UART_DISABLE_INTS(uart); | 875 | UART_DISABLE_INTS(uart); |
| 875 | 876 | ||
| 876 | /* Set DLAB in LCR to Access CLK */ | 877 | /* Set DLAB in LCR to Access CLK */ |
| @@ -882,14 +883,11 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 882 | /* Clear DLAB in LCR to Access THR RBR IER */ | 883 | /* Clear DLAB in LCR to Access THR RBR IER */ |
| 883 | UART_CLEAR_DLAB(uart); | 884 | UART_CLEAR_DLAB(uart); |
| 884 | 885 | ||
| 885 | UART_PUT_LCR(uart, lcr); | 886 | UART_PUT_LCR(uart, (UART_GET_LCR(uart) & ~LCR_MASK) | lcr); |
| 886 | 887 | ||
| 887 | /* Enable UART */ | 888 | /* Enable UART */ |
| 888 | UART_ENABLE_INTS(uart, ier); | 889 | UART_ENABLE_INTS(uart, ier); |
| 889 | 890 | UART_PUT_GCTL(uart, UART_GET_GCTL(uart) | UCEN); | |
| 890 | val = UART_GET_GCTL(uart); | ||
| 891 | val |= UCEN; | ||
| 892 | UART_PUT_GCTL(uart, val); | ||
| 893 | 891 | ||
| 894 | /* Port speed changed, update the per-port timeout. */ | 892 | /* Port speed changed, update the per-port timeout. */ |
| 895 | uart_update_timeout(port, termios->c_cflag, baud); | 893 | uart_update_timeout(port, termios->c_cflag, baud); |
| @@ -949,7 +947,7 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
| 949 | static void bfin_serial_set_ldisc(struct uart_port *port, int ld) | 947 | static void bfin_serial_set_ldisc(struct uart_port *port, int ld) |
| 950 | { | 948 | { |
| 951 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 949 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
| 952 | unsigned short val; | 950 | unsigned int val; |
| 953 | 951 | ||
| 954 | switch (ld) { | 952 | switch (ld) { |
| 955 | case N_IRDA: | 953 | case N_IRDA: |
| @@ -967,7 +965,7 @@ static void bfin_serial_set_ldisc(struct uart_port *port, int ld) | |||
| 967 | static void bfin_serial_reset_irda(struct uart_port *port) | 965 | static void bfin_serial_reset_irda(struct uart_port *port) |
| 968 | { | 966 | { |
| 969 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 967 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
| 970 | unsigned short val; | 968 | unsigned int val; |
| 971 | 969 | ||
| 972 | val = UART_GET_GCTL(uart); | 970 | val = UART_GET_GCTL(uart); |
| 973 | val &= ~(UMOD_MASK | RPOLC); | 971 | val &= ~(UMOD_MASK | RPOLC); |
| @@ -1065,7 +1063,7 @@ static void __init | |||
| 1065 | bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, | 1063 | bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, |
| 1066 | int *parity, int *bits) | 1064 | int *parity, int *bits) |
| 1067 | { | 1065 | { |
| 1068 | unsigned short status; | 1066 | unsigned int status; |
| 1069 | 1067 | ||
| 1070 | status = UART_GET_IER(uart) & (ERBFI | ETBEI); | 1068 | status = UART_GET_IER(uart) & (ERBFI | ETBEI); |
| 1071 | if (status == (ERBFI | ETBEI)) { | 1069 | if (status == (ERBFI | ETBEI)) { |
