summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio/sio.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2003-09-17 14:05:16 +0000
committerbde <bde@FreeBSD.org>2003-09-17 14:05:16 +0000
commit0c91aa7050a5a698cd77122c7a51de20355ce314 (patch)
tree6eb1a374ff8bdc11ccd56b7223b075fe4f01d142 /sys/dev/sio/sio.c
parentc724a09a952988671da7b1f2c3f6a65c8fa590a9 (diff)
downloadFreeBSD-src-0c91aa7050a5a698cd77122c7a51de20355ce314.zip
FreeBSD-src-0c91aa7050a5a698cd77122c7a51de20355ce314.tar.gz
Cleaned up initialization of hardware flow control for 16650As. Use
defined values instead of hard-coded values. Don't repeat the register access part of the code 4 times times or triple-space statements. This fixes half of the style bugs in rev.1.172. Hardware flow control of 16650As is still officially unsupported. I was mistaken about it being broken. It is broken in 16650s but is fixed in 16650As except for the maximum trigger level (which is no longer used). Testing of the 16650's broken hardware flow control watermarks by programming them on 16950s showed that their effects are not too bad if the fifo size and trigger level are reasonably large (16 is much better than 8).
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r--sys/dev/sio/sio.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 916f5dd..4fa8ef7 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -2205,6 +2205,7 @@ comparam(tp, t)
u_int divisor;
u_char dlbh;
u_char dlbl;
+ u_char efr_flowbits;
int s;
int unit;
@@ -2309,18 +2310,13 @@ comparam(tp, t)
sio_setreg(com, com_dlbh, dlbh);
}
- sio_setreg(com, com_cfcr, com->cfcr_image = cfcr);
-
if (!(tp->t_state & TS_TTSTOP))
com->state |= CS_TTGO;
+ efr_flowbits = 0;
if (cflag & CRTS_IFLOW) {
- if (com->st16650a) {
- sio_setreg(com, com_cfcr, 0xbf);
- sio_setreg(com, com_fifo,
- sio_getreg(com, com_fifo) | 0x40);
- }
com->state |= CS_RTS_IFLOW;
+ efr_flowbits |= EFR_AUTORTS;
/*
* If CS_RTS_IFLOW just changed from off to on, the change
* needs to be propagated to MCR_RTS. This isn't urgent,
@@ -2334,14 +2330,8 @@ comparam(tp, t)
* on here, since comstart() won't do it later.
*/
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
- if (com->st16650a) {
- sio_setreg(com, com_cfcr, 0xbf);
- sio_setreg(com, com_fifo,
- sio_getreg(com, com_fifo) & ~0x40);
- }
}
-
/*
* Set up state to handle output flow control.
* XXX - worth handling MDMBUF (DCD) flow control at the lowest level?
@@ -2351,22 +2341,18 @@ comparam(tp, t)
com->state &= ~CS_CTS_OFLOW;
if (cflag & CCTS_OFLOW) {
com->state |= CS_CTS_OFLOW;
+ efr_flowbits |= EFR_AUTOCTS;
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
- if (com->st16650a) {
- sio_setreg(com, com_cfcr, 0xbf);
- sio_setreg(com, com_fifo,
- sio_getreg(com, com_fifo) | 0x80);
- }
- } else {
- if (com->st16650a) {
- sio_setreg(com, com_cfcr, 0xbf);
- sio_setreg(com, com_fifo,
- sio_getreg(com, com_fifo) & ~0x80);
- }
}
- sio_setreg(com, com_cfcr, com->cfcr_image);
+ if (com->st16650a) {
+ sio_setreg(com, com_lcr, LCR_EFR_ENABLE);
+ sio_setreg(com, com_efr,
+ (sio_getreg(com, com_efr)
+ & ~(EFR_AUTOCTS | EFR_AUTORTS)) | efr_flowbits);
+ }
+ sio_setreg(com, com_cfcr, com->cfcr_image = cfcr);
/* XXX shouldn't call functions while intrs are disabled. */
disc_optim(tp, t, com);
OpenPOWER on IntegriCloud