22 #include <linux/module.h>
23 #include <linux/errno.h>
24 #include <linux/signal.h>
25 #include <linux/sched.h>
28 #include <linux/tty.h>
30 #include <linux/serial.h>
33 #include <linux/string.h>
34 #include <linux/fcntl.h>
35 #include <linux/ptrace.h>
39 #include <linux/pci.h>
40 #include <linux/bitops.h>
41 #include <linux/slab.h>
46 #include <asm/uaccess.h>
50 #define MXSER_VERSION "2.0.5"
51 #define MXSERMAJOR 174
53 #define MXSER_BOARDS 4
54 #define MXSER_PORTS_PER_BOARD 8
55 #define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD)
56 #define MXSER_ISR_PASS_LIMIT 100
59 #define MOXA_OTHER_UART 0x00
60 #define MOXA_MUST_MU150_HWID 0x01
61 #define MOXA_MUST_MU860_HWID 0x02
63 #define WAKEUP_CHARS 256
65 #define UART_MCR_AFE 0x20
66 #define UART_LSR_SPECIAL 0x1E
68 #define PCI_DEVICE_ID_POS104UL 0x1044
69 #define PCI_DEVICE_ID_CB108 0x1080
70 #define PCI_DEVICE_ID_CP102UF 0x1023
71 #define PCI_DEVICE_ID_CP112UL 0x1120
72 #define PCI_DEVICE_ID_CB114 0x1142
73 #define PCI_DEVICE_ID_CP114UL 0x1143
74 #define PCI_DEVICE_ID_CB134I 0x1341
75 #define PCI_DEVICE_ID_CP138U 0x1380
78 #define C168_ASIC_ID 1
79 #define C104_ASIC_ID 2
80 #define C102_ASIC_ID 0xB
81 #define CI132_ASIC_ID 4
82 #define CI134_ASIC_ID 3
83 #define CI104J_ASIC_ID 5
85 #define MXSER_HIGHBAUD 1
98 } Gpci_uart_info[] = {
103 #define UART_INFO_NUM ARRAY_SIZE(Gpci_uart_info)
112 {
"C168 series", 8, },
113 {
"C104 series", 4, },
114 {
"CI-104J series", 4, },
115 {
"C168H/PCI series", 8, },
116 {
"C104H/PCI series", 4, },
119 {
"CI-134 series", 4, },
120 {
"CP-132 series", 2, },
121 {
"CP-114 series", 4, },
122 {
"CT-114 series", 4, },
124 {
"CP-104U series", 4, },
125 {
"CP-168U series", 8, },
126 {
"CP-132U series", 2, },
127 {
"CP-134U series", 4, },
128 {
"CP-104JU series", 4, },
129 {
"Moxa UC7000 Serial", 8, },
130 {
"CP-118U series", 8, },
131 {
"CP-102UL series", 2, },
132 {
"CP-102U series", 2, },
133 {
"CP-118EL series", 8, },
134 {
"CP-168EL series", 8, },
135 {
"CP-104EL series", 4, },
136 {
"CB-108 series", 8, },
137 {
"CB-114 series", 4, },
138 {
"CB-134I series", 4, },
139 {
"CP-138U series", 8, },
140 {
"POS-104UL series", 4, },
141 {
"CP-114UL series", 4, },
142 {
"CP-102UF series", 2, },
143 {
"CP-112UL series", 2, },
291 static void mxser_enable_must_enchance_mode(
unsigned long baseio)
307 static void mxser_disable_must_enchance_mode(
unsigned long baseio)
323 static void mxser_set_must_xon1_value(
unsigned long baseio,
u8 value)
340 static void mxser_set_must_xoff1_value(
unsigned long baseio,
u8 value)
376 static void mxser_set_must_enum_value(
unsigned long baseio,
u8 value)
394 static void mxser_get_must_hardware_id(
unsigned long baseio,
u8 *pId)
412 static void SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(
unsigned long baseio)
427 static void mxser_enable_must_tx_software_flow_control(
unsigned long baseio)
443 static void mxser_disable_must_tx_software_flow_control(
unsigned long baseio)
458 static void mxser_enable_must_rx_software_flow_control(
unsigned long baseio)
474 static void mxser_disable_must_rx_software_flow_control(
unsigned long baseio)
490 static int __devinit CheckIsMoxaMust(
unsigned long io)
496 mxser_disable_must_enchance_mode(io);
499 mxser_set_must_xon1_value(io, 0x11);
505 mxser_get_must_hardware_id(io, &hwid);
507 if (hwid == Gpci_uart_info[i].
type)
514 static void process_txrx_fifo(
struct mxser_port *info)
525 if (info->
board->chip_flag == Gpci_uart_info[i].type) {
534 static unsigned char mxser_get_msr(
int baseaddr,
int mode,
int port)
541 mxser_msr[
port] &= 0x0F;
543 status = mxser_msr[
port];
550 static int mxser_carrier_raised(
struct tty_port *port)
556 static void mxser_dtr_rts(
struct tty_port *port,
int on)
568 spin_unlock_irqrestore(&mp->
slock, flags);
571 static int mxser_set_baud(
struct tty_struct *tty,
long newspd)
620 if (quot % newspd > newspd / 2) {
626 mxser_set_must_enum_value(info->
ioaddr, quot);
629 mxser_set_must_enum_value(info->
ioaddr, 0);
638 static int mxser_change_speed(
struct tty_struct *tty,
646 cflag = tty->termios.c_cflag;
650 if (mxser_set_baud_method[tty->
index] == 0)
654 switch (cflag &
CSIZE) {
681 if (info->
board->chip_flag) {
684 mxser_set_must_fifo_value(info);
689 if (info->
board->chip_flag) {
691 mxser_set_must_fifo_value(info);
724 !info->
board->chip_flag) {
735 if (!(status & UART_MSR_CTS)) {
738 (!info->
board->chip_flag)) {
787 if (info->
board->chip_flag) {
791 mxser_enable_must_rx_software_flow_control(
794 mxser_disable_must_rx_software_flow_control(
798 mxser_enable_must_tx_software_flow_control(
801 mxser_disable_must_tx_software_flow_control(
813 static void mxser_check_modem_status(
struct tty_struct *tty,
833 if (tty_port_cts_enabled(&port->
port)) {
835 if (status & UART_MSR_CTS) {
839 (!port->
board->chip_flag)) {
849 if (!(status & UART_MSR_CTS)) {
852 !port->
board->chip_flag) {
877 spin_unlock_irqrestore(&info->
slock, flags);
880 info->
port.xmit_buf = (
unsigned char *) page;
886 if (info->
board->chip_flag)
900 spin_unlock_irqrestore(&info->
slock, flags);
928 if (info->
board->chip_flag)
946 mxser_change_speed(tty,
NULL);
947 spin_unlock_irqrestore(&info->
slock, flags);
955 static void mxser_shutdown_port(
struct tty_port *port)
971 if (info->
port.xmit_buf) {
980 if (info->
board->chip_flag)
992 if (info->
board->chip_flag)
993 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->
ioaddr);
995 spin_unlock_irqrestore(&info->
slock, flags);
1020 static void mxser_flush_buffer(
struct tty_struct *tty)
1024 unsigned long flags;
1035 spin_unlock_irqrestore(&info->
slock, flags);
1041 static void mxser_close_port(
struct tty_port *port)
1052 if (info->
board->chip_flag)
1075 static void mxser_close(
struct tty_struct *tty,
struct file *filp)
1085 mxser_close_port(port);
1086 mxser_flush_buffer(tty);
1087 mxser_shutdown_port(port);
1100 unsigned long flags;
1102 if (!info->
port.xmit_buf)
1116 spin_unlock_irqrestore(&info->
slock, flags);
1126 (info->
board->chip_flag)) {
1132 spin_unlock_irqrestore(&info->
slock, flags);
1138 static int mxser_put_char(
struct tty_struct *tty,
unsigned char ch)
1141 unsigned long flags;
1143 if (!info->
port.xmit_buf)
1153 spin_unlock_irqrestore(&info->
slock, flags);
1157 info->
board->chip_flag) {
1162 spin_unlock_irqrestore(&info->
slock, flags);
1169 static void mxser_flush_chars(
struct tty_struct *tty)
1172 unsigned long flags;
1176 !info->
board->chip_flag))
1185 spin_unlock_irqrestore(&info->
slock, flags);
1188 static int mxser_write_room(
struct tty_struct *tty)
1194 return ret < 0 ? 0 :
ret;
1197 static int mxser_chars_in_buffer(
struct tty_struct *tty)
1208 static int mxser_get_serial_info(
struct tty_struct *tty,
1216 .irq = info->
board->irq,
1217 .flags = info->
port.flags,
1219 .close_delay = info->
port.close_delay,
1220 .closing_wait = info->
port.closing_wait,
1229 static int mxser_set_serial_info(
struct tty_struct *tty,
1236 unsigned long sl_flags;
1240 if (!new_info || !info->
ioaddr)
1245 if (new_serial.irq != info->
board->irq ||
1246 new_serial.port != info->
ioaddr)
1252 if ((new_serial.baud_base != info->
baud_base) ||
1253 (new_serial.close_delay != info->
port.close_delay) ||
1265 port->
close_delay = new_serial.close_delay * HZ / 100;
1266 port->
closing_wait = new_serial.closing_wait * HZ / 100;
1269 (new_serial.baud_base != info->
baud_base ||
1270 new_serial.custom_divisor !=
1272 if (new_serial.custom_divisor == 0)
1274 baud = new_serial.baud_base / new_serial.custom_divisor;
1279 info->
type = new_serial.type;
1281 process_txrx_fifo(info);
1286 mxser_change_speed(tty,
NULL);
1287 spin_unlock_irqrestore(&info->
slock, sl_flags);
1290 retval = mxser_activate(port, tty);
1307 static int mxser_get_lsr_info(
struct mxser_port *info,
1308 unsigned int __user *
value)
1312 unsigned long flags;
1316 spin_unlock_irqrestore(&info->
slock, flags);
1321 static int mxser_tiocmget(
struct tty_struct *tty)
1325 unsigned long flags;
1333 control = info->
MCR;
1338 mxser_check_modem_status(tty, info, status);
1339 spin_unlock_irqrestore(&info->
slock, flags);
1348 static int mxser_tiocmset(
struct tty_struct *tty,
1349 unsigned int set,
unsigned int clear)
1352 unsigned long flags;
1373 spin_unlock_irqrestore(&info->
slock, flags);
1377 static int __init mxser_program_mode(
int port)
1389 id =
inb(port + 1) & 0x1F;
1397 for (i = 0, j = 0; i < 4; i++) {
1401 }
else if ((j == 1) && (n == 1)) {
1412 static void __init mxser_normal_mode(
int port)
1416 outb(0xA5, port + 1);
1417 outb(0x80, port + 3);
1420 outb(0x03, port + 3);
1421 outb(0x13, port + 4);
1422 for (i = 0; i < 16; i++) {
1424 if ((n & 0x61) == 0x60)
1429 outb(0x00, port + 4);
1432 #define CHIP_SK 0x01
1433 #define CHIP_DO 0x02
1434 #define CHIP_CS 0x04
1435 #define CHIP_DI 0x08
1436 #define EN_CCMD 0x000
1437 #define EN0_RSARLO 0x008
1438 #define EN0_RSARHI 0x009
1439 #define EN0_RCNTLO 0x00A
1440 #define EN0_RCNTHI 0x00B
1441 #define EN0_DCFG 0x00E
1442 #define EN0_PORT 0x010
1443 #define ENC_PAGE0 0x000
1444 #define ENC_PAGE3 0x0C0
1445 static int __init mxser_read_register(
int port,
unsigned short *
regs)
1450 id = mxser_program_mode(port);
1453 for (i = 0; i < 14; i++) {
1454 k = (i & 0x3F) | 0x180;
1455 for (j = 0x100; j > 0; j >>= 1) {
1467 for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) {
1476 mxser_normal_mode(port);
1480 static int mxser_ioctl_special(
unsigned int cmd,
void __user *
argp)
1492 "%x (GET_MAJOR), fix your userspace\n",
1494 return put_user(ttymajor, (
int __user *)argp);
1500 if (mxser_boards[i].ports[j].ioaddr)
1502 return put_user(result, (
unsigned long __user *)argp);
1513 ip = &mxser_boards[
i].ports[
j];
1526 ms.cflag = tty->termios.c_cflag;
1528 spin_lock_irq(&ip->
slock);
1530 spin_unlock_irq(&ip->
slock);
1535 if (status & UART_MSR_CTS)
1547 unsigned int cflag, iflag,
p;
1560 ip = &mxser_boards[
i].ports[
j];
1569 spin_lock_irq(&ip->
slock);
1570 status = mxser_get_msr(ip->
ioaddr, 0, p);
1572 if (status & UART_MSR_TERI)
1574 if (status & UART_MSR_DDSR)
1576 if (status & UART_MSR_DDCD)
1578 if (status & UART_MSR_DCTS)
1588 spin_unlock_irq(&ip->
slock);
1597 cflag = tty->termios.c_cflag;
1598 iflag = tty->termios.c_iflag;
1605 me->
parity[
p] = cflag & (PARENB | PARODD |
1608 if (cflag & CRTSCTS)
1634 static int mxser_cflags_changed(
struct mxser_port *info,
unsigned long arg,
1638 unsigned long flags;
1643 spin_unlock_irqrestore(&info->
slock, flags);
1645 ret = ((arg &
TIOCM_RNG) && (cnow.rng != cprev->
rng)) ||
1655 static int mxser_ioctl(
struct tty_struct *tty,
1656 unsigned int cmd,
unsigned long arg)
1661 unsigned long flags;
1666 return mxser_ioctl_special(cmd, argp);
1670 unsigned long opmode;
1671 static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f };
1677 if (
get_user(opmode, (
int __user *) argp))
1686 spin_lock_irq(&info->
slock);
1689 val |= (opmode << shiftbit);
1691 spin_unlock_irq(&info->
slock);
1694 spin_lock_irq(&info->
slock);
1696 spin_unlock_irq(&info->
slock);
1698 if (
put_user(opmode, (
int __user *)argp))
1711 retval = mxser_get_serial_info(tty, argp);
1716 retval = mxser_set_serial_info(tty, argp);
1720 return mxser_get_lsr_info(info, argp);
1730 spin_unlock_irqrestore(&info->
slock, flags);
1733 mxser_cflags_changed(info, arg, &cnow));
1737 spin_lock_irq(&info->
slock);
1740 spin_unlock_irq(&info->
slock);
1746 len = mxser_chars_in_buffer(tty);
1747 spin_lock_irq(&info->
slock);
1749 spin_unlock_irq(&info->
slock);
1750 len += (lsr ? 0 : 1);
1752 return put_user(len, (
int __user *)argp);
1757 spin_lock_irq(&info->
slock);
1758 status = mxser_get_msr(info->
ioaddr, 1, tty->
index);
1759 mxser_check_modem_status(tty, info, status);
1762 spin_unlock_irq(&info->
slock);
1795 if (
get_user(method, (
int __user *)argp))
1798 return put_user(method, (
int __user *)argp);
1813 static int mxser_get_icount(
struct tty_struct *tty,
1819 unsigned long flags;
1823 spin_unlock_irqrestore(&info->
slock, flags);
1825 icount->
frame = cnow.frame;
1826 icount->
brk = cnow.brk;
1827 icount->
overrun = cnow.overrun;
1829 icount->
parity = cnow.parity;
1830 icount->
rx = cnow.rx;
1831 icount->
tx = cnow.tx;
1832 icount->
cts = cnow.cts;
1833 icount->
dsr = cnow.dsr;
1834 icount->
rng = cnow.rng;
1835 icount->
dcd = cnow.dcd;
1839 static void mxser_stoprx(
struct tty_struct *tty)
1845 if (info->
board->chip_flag) {
1856 if (tty->termios.c_cflag & CRTSCTS) {
1866 static void mxser_throttle(
struct tty_struct *tty)
1871 static void mxser_unthrottle(
struct tty_struct *tty)
1881 if (info->
board->chip_flag) {
1893 if (tty->termios.c_cflag & CRTSCTS) {
1905 static void mxser_stop(
struct tty_struct *tty)
1908 unsigned long flags;
1915 spin_unlock_irqrestore(&info->
slock, flags);
1918 static void mxser_start(
struct tty_struct *tty)
1921 unsigned long flags;
1929 spin_unlock_irqrestore(&info->
slock, flags);
1935 unsigned long flags;
1938 mxser_change_speed(tty, old_termios);
1939 spin_unlock_irqrestore(&info->
slock, flags);
1941 if ((old_termios->
c_cflag & CRTSCTS) &&
1942 !(tty->termios.c_cflag & CRTSCTS)) {
1949 !(tty->termios.c_iflag &
IXON)) {
1952 if (info->
board->chip_flag) {
1954 mxser_disable_must_rx_software_flow_control(
1956 spin_unlock_irqrestore(&info->
slock, flags);
1966 static void mxser_wait_until_sent(
struct tty_struct *tty,
int timeout)
1969 unsigned long orig_jiffies, char_time;
1970 unsigned long flags;
1989 char_time = char_time / 5;
1992 if (timeout && timeout < char_time)
2003 if (!timeout || timeout > 2 * info->
timeout)
2008 spin_unlock_irqrestore(&info->
slock, flags);
2013 if (timeout &&
time_after(jiffies, orig_jiffies + timeout))
2016 spin_unlock_irqrestore(&info->
slock, flags);
2023 static void mxser_hangup(
struct tty_struct *tty)
2027 mxser_flush_buffer(tty);
2034 static int mxser_rs_break(
struct tty_struct *tty,
int break_state)
2037 unsigned long flags;
2040 if (break_state == -1)
2046 spin_unlock_irqrestore(&info->
slock, flags);
2050 static void mxser_receive_chars(
struct tty_struct *tty,
2053 unsigned char ch, gdl;
2069 if (*status & MOXA_MUST_LSR_RERR)
2076 if (gdl >= recv_room) {
2082 tty_insert_flip_char(tty, ch, 0);
2098 if (++ignored > 100)
2102 if (*status & UART_LSR_SPECIAL) {
2115 }
else if (*status & UART_LSR_OE) {
2121 tty_insert_flip_char(tty, ch, flag);
2123 if (cnt >= recv_room) {
2131 if (port->
board->chip_flag)
2138 mxvar_log.rxcnt[tty->
index] +=
cnt;
2147 spin_unlock(&port->
slock);
2149 spin_lock(&port->
slock);
2159 mxvar_log.txcnt[tty->
index]++;
2172 (!port->
board->chip_flag))) {
2186 }
while (--count > 0);
2211 unsigned int int_cnt, pass_counter = 0;
2216 if (dev_id == &mxser_boards[i]) {
2221 if (i == MXSER_BOARDS)
2225 max = brd->
info->nports;
2232 for (i = 0, bits = 1; i <
max; i++, irqbits |=
bits, bits <<= 1) {
2240 spin_lock(&port->
slock);
2249 !(port->
port.flags &
2260 if (status & UART_LSR_PE)
2262 if (status & UART_LSR_FE)
2264 if (status & UART_LSR_OE)
2267 if (status & UART_LSR_BI)
2270 if (port->
board->chip_flag) {
2275 mxser_receive_chars(tty, port,
2281 mxser_receive_chars(tty, port,
2285 if (msr & UART_MSR_ANY_DELTA)
2286 mxser_check_modem_status(tty, port, msr);
2288 if (port->
board->chip_flag) {
2289 if (iir == 0x02 && (status &
2291 mxser_transmit_chars(tty, port);
2294 mxser_transmit_chars(tty, port);
2298 spin_unlock(&port->
slock);
2308 .close = mxser_close,
2309 .write = mxser_write,
2310 .put_char = mxser_put_char,
2311 .flush_chars = mxser_flush_chars,
2312 .write_room = mxser_write_room,
2313 .chars_in_buffer = mxser_chars_in_buffer,
2314 .flush_buffer = mxser_flush_buffer,
2315 .ioctl = mxser_ioctl,
2316 .throttle = mxser_throttle,
2317 .unthrottle = mxser_unthrottle,
2318 .set_termios = mxser_set_termios,
2320 .start = mxser_start,
2321 .hangup = mxser_hangup,
2322 .break_ctl = mxser_rs_break,
2323 .wait_until_sent = mxser_wait_until_sent,
2324 .tiocmget = mxser_tiocmget,
2325 .tiocmset = mxser_tiocmset,
2326 .get_icount = mxser_get_icount,
2330 .carrier_raised = mxser_carrier_raised,
2331 .dtr_rts = mxser_dtr_rts,
2332 .activate = mxser_activate,
2333 .shutdown = mxser_shutdown_port,
2340 static bool allow_overlapping_vector;
2342 MODULE_PARM_DESC(allow_overlapping_vector,
"whether we allow ISA cards to be configured such that vector overlabs IO ports (default=no)");
2344 static bool mxser_overlapping_vector(
struct mxser_board *brd)
2346 return allow_overlapping_vector &&
2351 static int mxser_request_vector(
struct mxser_board *brd)
2353 if (mxser_overlapping_vector(brd))
2358 static void mxser_release_vector(
struct mxser_board *brd)
2360 if (mxser_overlapping_vector(brd))
2365 static void mxser_release_ISA_res(
struct mxser_board *brd)
2369 mxser_release_vector(brd);
2380 brd->
ports[0].max_baud);
2382 for (i = 0; i < brd->
info->nports; i++) {
2385 info->
port.ops = &mxser_port_ops;
2392 mxser_enable_must_enchance_mode(info->
ioaddr);
2397 process_txrx_fifo(info);
2400 info->
port.close_delay = 5 * HZ / 10;
2401 info->
port.closing_wait = 30 *
HZ;
2416 "conflict with another device.\n",
2425 unsigned short regs[16], irq;
2430 id = mxser_read_register(cap, regs);
2433 brd->
info = &mxser_cards[0];
2436 brd->
info = &mxser_cards[1];
2439 brd->
info = &mxser_cards[2];
2442 brd->
info = &mxser_cards[5];
2445 brd->
info = &mxser_cards[6];
2448 brd->
info = &mxser_cards[7];
2458 irq = regs[9] & 0xF000;
2459 irq = irq | (irq >> 4);
2460 if (irq != (regs[9] & 0xFF00))
2461 goto err_irqconflict;
2462 }
else if (brd->
info->nports == 4) {
2463 irq = regs[9] & 0xF000;
2464 irq = irq | (irq >> 4);
2465 irq = irq | (irq >> 8);
2467 goto err_irqconflict;
2468 }
else if (brd->
info->nports == 8) {
2469 irq = regs[9] & 0xF000;
2470 irq = irq | (irq >> 4);
2471 irq = irq | (irq >> 8);
2472 if ((irq != regs[9]) || (irq != regs[10]))
2473 goto err_irqconflict;
2480 brd->
irq = ((
int)(irq & 0xF000) >> 12);
2481 for (i = 0; i < 8; i++)
2482 brd->
ports[i].ioaddr = (
int) regs[i + 1] & 0xFFF8;
2483 if ((regs[12] & 0x80) == 0) {
2492 for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) {
2493 if (regs[12] & bits) {
2494 brd->
ports[
i].baud_base = 921600;
2495 brd->
ports[
i].max_baud = 921600;
2497 brd->
ports[
i].baud_base = 115200;
2498 brd->
ports[
i].max_baud = 115200;
2515 "0x%.8lx-0x%.8lx\n",
2517 8 * brd->
info->nports - 1);
2521 ret = mxser_request_vector(brd);
2525 "0x%.8lx-0x%.8lx\n",
2527 8 * brd->
info->nports - 1);
2530 return brd->
info->nports;
2543 unsigned long ioaddress;
2547 if (mxser_boards[i].info ==
NULL)
2550 if (i >= MXSER_BOARDS) {
2551 dev_err(&pdev->
dev,
"too many boards found (maximum %d), board "
2552 "not configured\n", MXSER_BOARDS);
2556 brd = &mxser_boards[
i];
2558 dev_info(&pdev->
dev,
"found MOXA %s board (BusNo=%d, DevNo=%d)\n",
2575 for (i = 0; i < brd->
info->nports; i++)
2576 brd->
ports[i].ioaddr = ioaddress + 8 * i;
2592 for (i = 0; i < brd->
info->nports; i++) {
2596 Gpci_uart_info[
j].max_baud;
2600 brd->
ports[
i].max_baud = 921600;
2607 for (i = 0; i < brd->
info->nports; i++) {
2609 brd->
ports[
i].opmode_ioaddr = ioaddress + 4;
2611 brd->
ports[
i].opmode_ioaddr = ioaddress + 0x0c;
2613 outb(0, ioaddress + 4);
2614 outb(0, ioaddress + 0x0c);
2617 for (i = 0; i < brd->
info->nports; i++) {
2619 brd->
ports[
i].baud_base = 921600;
2623 retval = mxser_initbrd(brd, pdev);
2627 for (i = 0; i < brd->
info->nports; i++)
2629 brd->
idx + i, &pdev->
dev);
2631 pci_set_drvdata(pdev, brd);
2654 for (i = 0; i < brd->
info->nports; i++)
2667 .id_table = mxser_pcibrds,
2668 .probe = mxser_probe,
2672 static int __init mxser_module_init(
void)
2675 unsigned int b,
i,
m;
2678 mxvar_sdriver = alloc_tty_driver(
MXSER_PORTS + 1);
2686 mxvar_sdriver->
name =
"ttyMI";
2687 mxvar_sdriver->
major = ttymajor;
2708 brd = &mxser_boards[
m];
2709 retval = mxser_get_ISA_conf(ioaddr[b], brd);
2716 brd->
info->name, ioaddr[b]);
2719 if (mxser_initbrd(brd,
NULL) < 0) {
2725 for (i = 0; i < brd->
info->nports; i++)
2727 mxvar_sdriver, brd->
idx + i,
NULL);
2732 retval = pci_register_driver(&mxser_driver);
2749 static void __exit mxser_module_exit(
void)
2756 if (mxser_boards[i].info !=
NULL)
2757 for (j = 0; j < mxser_boards[
i].info->nports; j++)
2759 mxser_boards[i].
idx + j);
2764 if (mxser_boards[i].info !=
NULL)
2765 mxser_release_ISA_res(&mxser_boards[i]);