diff options
Diffstat (limited to 'drivers/char/moxa.c')
-rw-r--r-- | drivers/char/moxa.c | 80 |
1 files changed, 6 insertions, 74 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); |