diff options
author | V. Ananda Krishnan <mansarov@us.ibm.com> | 2006-02-01 03:05:20 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 08:53:14 -0800 |
commit | bb3c190e8d43fcbf1210effb05dc660cb3ccf817 (patch) | |
tree | 2ef533e648752f438492cd65623fe86b1d621476 /drivers/serial/jsm | |
parent | bfaa1deeb982c985d8e0435e835baeaae63b57fd (diff) | |
download | linux-bb3c190e8d43fcbf1210effb05dc660cb3ccf817.tar.gz linux-bb3c190e8d43fcbf1210effb05dc660cb3ccf817.tar.bz2 linux-bb3c190e8d43fcbf1210effb05dc660cb3ccf817.zip |
[PATCH] jsm: fix for high baud rates problem
Scott Kilau <Scott_Kilau@digi.com>
Digi serial port console doesn't work when baud rates are set higher than
38400. So the lookup table and code in jsm_neo.c has been modified and
tested. Please let me have the feed-back.
Signed-off-by: V.Ananda Krishnan <mansarov@us.ibm.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/serial/jsm')
-rw-r--r-- | drivers/serial/jsm/jsm_neo.c | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c index 6f22b42d9337..87e4e2cf8ce7 100644 --- a/drivers/serial/jsm/jsm_neo.c +++ b/drivers/serial/jsm/jsm_neo.c @@ -965,56 +965,47 @@ static void neo_param(struct jsm_channel *ch) baud = ch->ch_custom_speed; if (ch->ch_flags & CH_BAUD0) ch->ch_flags &= ~(CH_BAUD0); - } else { - int iindex = 0; - int jindex = 0; - - const u64 bauds[4][16] = { - { - 0, 50, 75, 110, - 134, 150, 200, 300, - 600, 1200, 1800, 2400, - 4800, 9600, 19200, 38400 }, - { - 0, 57600, 115200, 230400, - 460800, 150, 200, 921600, - 600, 1200, 1800, 2400, - 4800, 9600, 19200, 38400 }, - { - 0, 57600, 76800, 115200, - 131657, 153600, 230400, 460800, - 921600, 1200, 1800, 2400, - 4800, 9600, 19200, 38400 }, - { - 0, 57600, 115200, 230400, - 460800, 150, 200, 921600, - 600, 1200, 1800, 2400, - 4800, 9600, 19200, 38400 } - }; - - baud = C_BAUD(ch->uart_port.info->tty) & 0xff; - - if (ch->ch_c_cflag & CBAUDEX) - iindex = 1; - - jindex = baud; - - if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16)) - baud = bauds[iindex][jindex]; - else { - jsm_printk(IOCTL, DEBUG, &ch->ch_bd->pci_dev, - "baud indices were out of range (%d)(%d)", - iindex, jindex); - baud = 0; + } else { + int i; + unsigned int cflag; + static struct { + unsigned int rate; + unsigned int cflag; + } baud_rates[] = { + { 921600, B921600 }, + { 460800, B460800 }, + { 230400, B230400 }, + { 115200, B115200 }, + { 57600, B57600 }, + { 38400, B38400 }, + { 19200, B19200 }, + { 9600, B9600 }, + { 4800, B4800 }, + { 2400, B2400 }, + { 1200, B1200 }, + { 600, B600 }, + { 300, B300 }, + { 200, B200 }, + { 150, B150 }, + { 134, B134 }, + { 110, B110 }, + { 75, B75 }, + { 50, B50 }, + }; + + cflag = C_BAUD(ch->uart_port.info->tty); + baud = 9600; + for (i = 0; i < ARRAY_SIZE(baud_rates); i++) { + if (baud_rates[i].cflag == cflag) { + baud = baud_rates[i].rate; + break; } - - if (baud == 0) - baud = 9600; - - if (ch->ch_flags & CH_BAUD0) - ch->ch_flags &= ~(CH_BAUD0); } + if (ch->ch_flags & CH_BAUD0) + ch->ch_flags &= ~(CH_BAUD0); + } + if (ch->ch_c_cflag & PARENB) lcr |= UART_LCR_PARITY; |