diff options
-rw-r--r-- | drivers/char/moxa.c | 80 | ||||
-rw-r--r-- | drivers/char/mxser.c | 66 | ||||
-rw-r--r-- | drivers/char/riscom8.c | 22 |
3 files changed, 11 insertions, 157 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index a369dd6877d8..c1a6d3c48da1 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -260,7 +260,7 @@ static void MoxaPortEnable(int); | |||
260 | static void MoxaPortDisable(int); | 260 | static void MoxaPortDisable(int); |
261 | static long MoxaPortGetMaxBaud(int); | 261 | static long MoxaPortGetMaxBaud(int); |
262 | static long MoxaPortSetBaud(int, long); | 262 | static long MoxaPortSetBaud(int, long); |
263 | static int MoxaPortSetTermio(int, struct termios *); | 263 | static int MoxaPortSetTermio(int, struct termios *, speed_t); |
264 | static int MoxaPortGetLineOut(int, int *, int *); | 264 | static int MoxaPortGetLineOut(int, int *, int *); |
265 | static void MoxaPortLineCtrl(int, int, int); | 265 | static void MoxaPortLineCtrl(int, int, int); |
266 | static void MoxaPortFlowCtrl(int, int, int, int, int, int); | 266 | static void MoxaPortFlowCtrl(int, int, int, int, int, int); |
@@ -986,7 +986,7 @@ static void set_tty_param(struct tty_struct *tty) | |||
986 | if (ts->c_iflag & IXANY) | 986 | if (ts->c_iflag & IXANY) |
987 | xany = 1; | 987 | xany = 1; |
988 | MoxaPortFlowCtrl(ch->port, rts, cts, txflow, rxflow, xany); | 988 | MoxaPortFlowCtrl(ch->port, rts, cts, txflow, rxflow, xany); |
989 | MoxaPortSetTermio(ch->port, ts); | 989 | MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty)); |
990 | } | 990 | } |
991 | 991 | ||
992 | static int block_till_ready(struct tty_struct *tty, struct file *filp, | 992 | static int block_till_ready(struct tty_struct *tty, struct file *filp, |
@@ -1900,9 +1900,10 @@ int MoxaPortsOfCard(int cardno) | |||
1900 | * | 1900 | * |
1901 | * Function 12: Configure the port. | 1901 | * Function 12: Configure the port. |
1902 | * Syntax: | 1902 | * Syntax: |
1903 | * int MoxaPortSetTermio(int port, struct termios *termio); | 1903 | * int MoxaPortSetTermio(int port, struct termios *termio, speed_t baud); |
1904 | * int port : port number (0 - 127) | 1904 | * int port : port number (0 - 127) |
1905 | * struct termios * termio : termio structure pointer | 1905 | * struct termios * termio : termio structure pointer |
1906 | * speed_t baud : baud rate | ||
1906 | * | 1907 | * |
1907 | * return: -1 : this port is invalid or termio == NULL | 1908 | * return: -1 : this port is invalid or termio == NULL |
1908 | * 0 : setting O.K. | 1909 | * 0 : setting O.K. |
@@ -2182,11 +2183,10 @@ long MoxaPortSetBaud(int port, long baud) | |||
2182 | return (baud); | 2183 | return (baud); |
2183 | } | 2184 | } |
2184 | 2185 | ||
2185 | int MoxaPortSetTermio(int port, struct termios *termio) | 2186 | int MoxaPortSetTermio(int port, struct termios *termio, speed_t baud) |
2186 | { | 2187 | { |
2187 | void __iomem *ofsAddr; | 2188 | void __iomem *ofsAddr; |
2188 | tcflag_t cflag; | 2189 | tcflag_t cflag; |
2189 | long baud; | ||
2190 | tcflag_t mode = 0; | 2190 | tcflag_t mode = 0; |
2191 | 2191 | ||
2192 | if (moxaChkPort[port] == 0 || termio == 0) | 2192 | if (moxaChkPort[port] == 0 || termio == 0) |
@@ -2222,77 +2222,9 @@ int MoxaPortSetTermio(int port, struct termios *termio) | |||
2222 | 2222 | ||
2223 | moxafunc(ofsAddr, FC_SetDataMode, (ushort) mode); | 2223 | moxafunc(ofsAddr, FC_SetDataMode, (ushort) mode); |
2224 | 2224 | ||
2225 | cflag &= (CBAUD | CBAUDEX); | ||
2226 | #ifndef B921600 | ||
2227 | #define B921600 (B460800+1) | ||
2228 | #endif | ||
2229 | switch (cflag) { | ||
2230 | case B921600: | ||
2231 | baud = 921600L; | ||
2232 | break; | ||
2233 | case B460800: | ||
2234 | baud = 460800L; | ||
2235 | break; | ||
2236 | case B230400: | ||
2237 | baud = 230400L; | ||
2238 | break; | ||
2239 | case B115200: | ||
2240 | baud = 115200L; | ||
2241 | break; | ||
2242 | case B57600: | ||
2243 | baud = 57600L; | ||
2244 | break; | ||
2245 | case B38400: | ||
2246 | baud = 38400L; | ||
2247 | break; | ||
2248 | case B19200: | ||
2249 | baud = 19200L; | ||
2250 | break; | ||
2251 | case B9600: | ||
2252 | baud = 9600L; | ||
2253 | break; | ||
2254 | case B4800: | ||
2255 | baud = 4800L; | ||
2256 | break; | ||
2257 | case B2400: | ||
2258 | baud = 2400L; | ||
2259 | break; | ||
2260 | case B1800: | ||
2261 | baud = 1800L; | ||
2262 | break; | ||
2263 | case B1200: | ||
2264 | baud = 1200L; | ||
2265 | break; | ||
2266 | case B600: | ||
2267 | baud = 600L; | ||
2268 | break; | ||
2269 | case B300: | ||
2270 | baud = 300L; | ||
2271 | break; | ||
2272 | case B200: | ||
2273 | baud = 200L; | ||
2274 | break; | ||
2275 | case B150: | ||
2276 | baud = 150L; | ||
2277 | break; | ||
2278 | case B134: | ||
2279 | baud = 134L; | ||
2280 | break; | ||
2281 | case B110: | ||
2282 | baud = 110L; | ||
2283 | break; | ||
2284 | case B75: | ||
2285 | baud = 75L; | ||
2286 | break; | ||
2287 | case B50: | ||
2288 | baud = 50L; | ||
2289 | break; | ||
2290 | default: | ||
2291 | baud = 0; | ||
2292 | } | ||
2293 | if ((moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_ISA) || | 2225 | if ((moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_ISA) || |
2294 | (moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_PCI)) { | 2226 | (moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_PCI)) { |
2295 | if (baud == 921600L) | 2227 | if (baud >= 921600L) |
2296 | return (-1); | 2228 | return (-1); |
2297 | } | 2229 | } |
2298 | MoxaPortSetBaud(port, baud); | 2230 | MoxaPortSetBaud(port, baud); |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 556abd3e0d07..27a653772049 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -2554,71 +2554,7 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2554 | #define B921600 (B460800 +1) | 2554 | #define B921600 (B460800 +1) |
2555 | #endif | 2555 | #endif |
2556 | if (mxser_set_baud_method[info->port] == 0) { | 2556 | if (mxser_set_baud_method[info->port] == 0) { |
2557 | switch (cflag & (CBAUD | CBAUDEX)) { | 2557 | baud = tty_get_baud_rate(info->tty); |
2558 | case B921600: | ||
2559 | baud = 921600; | ||
2560 | break; | ||
2561 | case B460800: | ||
2562 | baud = 460800; | ||
2563 | break; | ||
2564 | case B230400: | ||
2565 | baud = 230400; | ||
2566 | break; | ||
2567 | case B115200: | ||
2568 | baud = 115200; | ||
2569 | break; | ||
2570 | case B57600: | ||
2571 | baud = 57600; | ||
2572 | break; | ||
2573 | case B38400: | ||
2574 | baud = 38400; | ||
2575 | break; | ||
2576 | case B19200: | ||
2577 | baud = 19200; | ||
2578 | break; | ||
2579 | case B9600: | ||
2580 | baud = 9600; | ||
2581 | break; | ||
2582 | case B4800: | ||
2583 | baud = 4800; | ||
2584 | break; | ||
2585 | case B2400: | ||
2586 | baud = 2400; | ||
2587 | break; | ||
2588 | case B1800: | ||
2589 | baud = 1800; | ||
2590 | break; | ||
2591 | case B1200: | ||
2592 | baud = 1200; | ||
2593 | break; | ||
2594 | case B600: | ||
2595 | baud = 600; | ||
2596 | break; | ||
2597 | case B300: | ||
2598 | baud = 300; | ||
2599 | break; | ||
2600 | case B200: | ||
2601 | baud = 200; | ||
2602 | break; | ||
2603 | case B150: | ||
2604 | baud = 150; | ||
2605 | break; | ||
2606 | case B134: | ||
2607 | baud = 134; | ||
2608 | break; | ||
2609 | case B110: | ||
2610 | baud = 110; | ||
2611 | break; | ||
2612 | case B75: | ||
2613 | baud = 75; | ||
2614 | break; | ||
2615 | case B50: | ||
2616 | baud = 50; | ||
2617 | break; | ||
2618 | default: | ||
2619 | baud = 0; | ||
2620 | break; | ||
2621 | } | ||
2622 | mxser_set_baud(info, baud); | 2558 | mxser_set_baud(info, baud); |
2623 | } | 2559 | } |
2624 | 2560 | ||
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index f1c94f771af5..06b9f78a95d9 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -675,26 +675,12 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) | |||
675 | port->COR2 = 0; | 675 | port->COR2 = 0; |
676 | port->MSVR = MSVR_RTS; | 676 | port->MSVR = MSVR_RTS; |
677 | 677 | ||
678 | baud = C_BAUD(tty); | 678 | baud = tty_get_baud_rate(tty); |
679 | |||
680 | if (baud & CBAUDEX) { | ||
681 | baud &= ~CBAUDEX; | ||
682 | if (baud < 1 || baud > 2) | ||
683 | port->tty->termios->c_cflag &= ~CBAUDEX; | ||
684 | else | ||
685 | baud += 15; | ||
686 | } | ||
687 | if (baud == 15) { | ||
688 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | ||
689 | baud ++; | ||
690 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | ||
691 | baud += 2; | ||
692 | } | ||
693 | 679 | ||
694 | /* Select port on the board */ | 680 | /* Select port on the board */ |
695 | rc_out(bp, CD180_CAR, port_No(port)); | 681 | rc_out(bp, CD180_CAR, port_No(port)); |
696 | 682 | ||
697 | if (!baud_table[baud]) { | 683 | if (!baud) { |
698 | /* Drop DTR & exit */ | 684 | /* Drop DTR & exit */ |
699 | bp->DTR |= (1u << port_No(port)); | 685 | bp->DTR |= (1u << port_No(port)); |
700 | rc_out(bp, RC_DTR, bp->DTR); | 686 | rc_out(bp, RC_DTR, bp->DTR); |
@@ -710,7 +696,7 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) | |||
710 | */ | 696 | */ |
711 | 697 | ||
712 | /* Set baud rate for port */ | 698 | /* Set baud rate for port */ |
713 | tmp = (((RC_OSCFREQ + baud_table[baud]/2) / baud_table[baud] + | 699 | tmp = (((RC_OSCFREQ + baud/2) / baud + |
714 | CD180_TPC/2) / CD180_TPC); | 700 | CD180_TPC/2) / CD180_TPC); |
715 | 701 | ||
716 | rc_out(bp, CD180_RBPRH, (tmp >> 8) & 0xff); | 702 | rc_out(bp, CD180_RBPRH, (tmp >> 8) & 0xff); |
@@ -718,7 +704,7 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) | |||
718 | rc_out(bp, CD180_RBPRL, tmp & 0xff); | 704 | rc_out(bp, CD180_RBPRL, tmp & 0xff); |
719 | rc_out(bp, CD180_TBPRL, tmp & 0xff); | 705 | rc_out(bp, CD180_TBPRL, tmp & 0xff); |
720 | 706 | ||
721 | baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */ | 707 | baud = (baud + 5) / 10; /* Estimated CPS */ |
722 | 708 | ||
723 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ | 709 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ |
724 | tmp = ((baud + HZ/2) / HZ) * 2 - CD180_NFIFO; | 710 | tmp = ((baud + HZ/2) / HZ) * 2 - CD180_NFIFO; |