Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37619
b: refs/heads/master
c: c7bce30
h: refs/heads/master
i:
  37617: fa8728a
  37615: 3c7fbdc
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Oct 1, 2006
1 parent bf5b044 commit 4ea051d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 158 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00988a3514bbc0cce781c067cf52559741d88b80
refs/heads/master: c7bce3097c0f9bbed76ee6fd03742f2624031a45
80 changes: 6 additions & 74 deletions trunk/drivers/char/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static void MoxaPortEnable(int);
static void MoxaPortDisable(int);
static long MoxaPortGetMaxBaud(int);
static long MoxaPortSetBaud(int, long);
static int MoxaPortSetTermio(int, struct termios *);
static int MoxaPortSetTermio(int, struct termios *, speed_t);
static int MoxaPortGetLineOut(int, int *, int *);
static void MoxaPortLineCtrl(int, int, int);
static void MoxaPortFlowCtrl(int, int, int, int, int, int);
Expand Down Expand Up @@ -986,7 +986,7 @@ static void set_tty_param(struct tty_struct *tty)
if (ts->c_iflag & IXANY)
xany = 1;
MoxaPortFlowCtrl(ch->port, rts, cts, txflow, rxflow, xany);
MoxaPortSetTermio(ch->port, ts);
MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty));
}

static int block_till_ready(struct tty_struct *tty, struct file *filp,
Expand Down Expand Up @@ -1900,9 +1900,10 @@ int MoxaPortsOfCard(int cardno)
*
* Function 12: Configure the port.
* Syntax:
* int MoxaPortSetTermio(int port, struct termios *termio);
* int MoxaPortSetTermio(int port, struct termios *termio, speed_t baud);
* int port : port number (0 - 127)
* struct termios * termio : termio structure pointer
* speed_t baud : baud rate
*
* return: -1 : this port is invalid or termio == NULL
* 0 : setting O.K.
Expand Down Expand Up @@ -2182,11 +2183,10 @@ long MoxaPortSetBaud(int port, long baud)
return (baud);
}

int MoxaPortSetTermio(int port, struct termios *termio)
int MoxaPortSetTermio(int port, struct termios *termio, speed_t baud)
{
void __iomem *ofsAddr;
tcflag_t cflag;
long baud;
tcflag_t mode = 0;

if (moxaChkPort[port] == 0 || termio == 0)
Expand Down Expand Up @@ -2222,77 +2222,9 @@ int MoxaPortSetTermio(int port, struct termios *termio)

moxafunc(ofsAddr, FC_SetDataMode, (ushort) mode);

cflag &= (CBAUD | CBAUDEX);
#ifndef B921600
#define B921600 (B460800+1)
#endif
switch (cflag) {
case B921600:
baud = 921600L;
break;
case B460800:
baud = 460800L;
break;
case B230400:
baud = 230400L;
break;
case B115200:
baud = 115200L;
break;
case B57600:
baud = 57600L;
break;
case B38400:
baud = 38400L;
break;
case B19200:
baud = 19200L;
break;
case B9600:
baud = 9600L;
break;
case B4800:
baud = 4800L;
break;
case B2400:
baud = 2400L;
break;
case B1800:
baud = 1800L;
break;
case B1200:
baud = 1200L;
break;
case B600:
baud = 600L;
break;
case B300:
baud = 300L;
break;
case B200:
baud = 200L;
break;
case B150:
baud = 150L;
break;
case B134:
baud = 134L;
break;
case B110:
baud = 110L;
break;
case B75:
baud = 75L;
break;
case B50:
baud = 50L;
break;
default:
baud = 0;
}
if ((moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_ISA) ||
(moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_PCI)) {
if (baud == 921600L)
if (baud >= 921600L)
return (-1);
}
MoxaPortSetBaud(port, baud);
Expand Down
66 changes: 1 addition & 65 deletions trunk/drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2554,71 +2554,7 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter
#define B921600 (B460800 +1)
#endif
if (mxser_set_baud_method[info->port] == 0) {
switch (cflag & (CBAUD | CBAUDEX)) {
case B921600:
baud = 921600;
break;
case B460800:
baud = 460800;
break;
case B230400:
baud = 230400;
break;
case B115200:
baud = 115200;
break;
case B57600:
baud = 57600;
break;
case B38400:
baud = 38400;
break;
case B19200:
baud = 19200;
break;
case B9600:
baud = 9600;
break;
case B4800:
baud = 4800;
break;
case B2400:
baud = 2400;
break;
case B1800:
baud = 1800;
break;
case B1200:
baud = 1200;
break;
case B600:
baud = 600;
break;
case B300:
baud = 300;
break;
case B200:
baud = 200;
break;
case B150:
baud = 150;
break;
case B134:
baud = 134;
break;
case B110:
baud = 110;
break;
case B75:
baud = 75;
break;
case B50:
baud = 50;
break;
default:
baud = 0;
break;
}
baud = tty_get_baud_rate(info->tty);
mxser_set_baud(info, baud);
}

Expand Down
22 changes: 4 additions & 18 deletions trunk/drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,26 +675,12 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
port->COR2 = 0;
port->MSVR = MSVR_RTS;

baud = C_BAUD(tty);

if (baud & CBAUDEX) {
baud &= ~CBAUDEX;
if (baud < 1 || baud > 2)
port->tty->termios->c_cflag &= ~CBAUDEX;
else
baud += 15;
}
if (baud == 15) {
if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
baud ++;
if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
baud += 2;
}
baud = tty_get_baud_rate(tty);

/* Select port on the board */
rc_out(bp, CD180_CAR, port_No(port));

if (!baud_table[baud]) {
if (!baud) {
/* Drop DTR & exit */
bp->DTR |= (1u << port_No(port));
rc_out(bp, RC_DTR, bp->DTR);
Expand All @@ -710,15 +696,15 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
*/

/* Set baud rate for port */
tmp = (((RC_OSCFREQ + baud_table[baud]/2) / baud_table[baud] +
tmp = (((RC_OSCFREQ + baud/2) / baud +
CD180_TPC/2) / CD180_TPC);

rc_out(bp, CD180_RBPRH, (tmp >> 8) & 0xff);
rc_out(bp, CD180_TBPRH, (tmp >> 8) & 0xff);
rc_out(bp, CD180_RBPRL, tmp & 0xff);
rc_out(bp, CD180_TBPRL, tmp & 0xff);

baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */
baud = (baud + 5) / 10; /* Estimated CPS */

/* Two timer ticks seems enough to wakeup something like SLIP driver */
tmp = ((baud + HZ/2) / HZ) * 2 - CD180_NFIFO;
Expand Down

0 comments on commit 4ea051d

Please sign in to comment.