diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-06-25 08:47:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:08 -0400 |
commit | 8ea2c2ecfcc1f31eaba8d1995b2e734ba821806a (patch) | |
tree | 80f87b4b84897c795941f97f56311abf72f46ecf /drivers/char/mxser.c | |
parent | 8a7f7c9307962ffdf81561ec8742fde1fad9fe10 (diff) |
[PATCH] moxa: partial CodingStyle cleanup & spelling fixes
Do a *partial* CodingStyle cleanup, correct some spelling in printk()'s &&
convert C++ comments to C comments - in moxa driver.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.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/char/mxser.c')
-rw-r--r-- | drivers/char/mxser.c | 794 |
1 files changed, 450 insertions, 344 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 2ad9dc80cae..645d9d713ae 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | * | 13 | * |
14 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -71,8 +71,8 @@ | |||
71 | #define MXSERMAJOR 174 | 71 | #define MXSERMAJOR 174 |
72 | #define MXSERCUMAJOR 175 | 72 | #define MXSERCUMAJOR 175 |
73 | 73 | ||
74 | #define MXSER_EVENT_TXLOW 1 | 74 | #define MXSER_EVENT_TXLOW 1 |
75 | #define MXSER_EVENT_HANGUP 2 | 75 | #define MXSER_EVENT_HANGUP 2 |
76 | 76 | ||
77 | #define MXSER_BOARDS 4 /* Max. boards */ | 77 | #define MXSER_BOARDS 4 /* Max. boards */ |
78 | #define MXSER_PORTS 32 /* Max. ports */ | 78 | #define MXSER_PORTS 32 /* Max. ports */ |
@@ -92,7 +92,8 @@ | |||
92 | #define UART_MCR_AFE 0x20 | 92 | #define UART_MCR_AFE 0x20 |
93 | #define UART_LSR_SPECIAL 0x1E | 93 | #define UART_LSR_SPECIAL 0x1E |
94 | 94 | ||
95 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|IXON|IXOFF)) | 95 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|\ |
96 | IXON|IXOFF)) | ||
96 | 97 | ||
97 | #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) | 98 | #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) |
98 | 99 | ||
@@ -152,27 +153,27 @@ static char *mxser_brdname[] = { | |||
152 | }; | 153 | }; |
153 | 154 | ||
154 | static int mxser_numports[] = { | 155 | static int mxser_numports[] = { |
155 | 8, // C168-ISA | 156 | 8, /* C168-ISA */ |
156 | 4, // C104-ISA | 157 | 4, /* C104-ISA */ |
157 | 4, // CI104J | 158 | 4, /* CI104J */ |
158 | 8, // C168-PCI | 159 | 8, /* C168-PCI */ |
159 | 4, // C104-PCI | 160 | 4, /* C104-PCI */ |
160 | 2, // C102-ISA | 161 | 2, /* C102-ISA */ |
161 | 2, // CI132 | 162 | 2, /* CI132 */ |
162 | 4, // CI134 | 163 | 4, /* CI134 */ |
163 | 2, // CP132 | 164 | 2, /* CP132 */ |
164 | 4, // CP114 | 165 | 4, /* CP114 */ |
165 | 4, // CT114 | 166 | 4, /* CT114 */ |
166 | 2, // CP102 | 167 | 2, /* CP102 */ |
167 | 4, // CP104U | 168 | 4, /* CP104U */ |
168 | 8, // CP168U | 169 | 8, /* CP168U */ |
169 | 2, // CP132U | 170 | 2, /* CP132U */ |
170 | 4, // CP134U | 171 | 4, /* CP134U */ |
171 | 4, // CP104JU | 172 | 4, /* CP104JU */ |
172 | 8, // RC7000 | 173 | 8, /* RC7000 */ |
173 | 8, // CP118U | 174 | 8, /* CP118U */ |
174 | 2, // CP102UL | 175 | 2, /* CP102UL */ |
175 | 2, // CP102U | 176 | 2, /* CP102U */ |
176 | }; | 177 | }; |
177 | 178 | ||
178 | #define UART_TYPE_NUM 2 | 179 | #define UART_TYPE_NUM 2 |
@@ -182,7 +183,7 @@ static const unsigned int Gmoxa_uart_id[UART_TYPE_NUM] = { | |||
182 | MOXA_MUST_MU860_HWID | 183 | MOXA_MUST_MU860_HWID |
183 | }; | 184 | }; |
184 | 185 | ||
185 | // This is only for PCI | 186 | /* This is only for PCI */ |
186 | #define UART_INFO_NUM 3 | 187 | #define UART_INFO_NUM 3 |
187 | struct mxpciuart_info { | 188 | struct mxpciuart_info { |
188 | int type; | 189 | int type; |
@@ -231,7 +232,7 @@ MODULE_DEVICE_TABLE(pci, mxser_pcibrds); | |||
231 | typedef struct _moxa_pci_info { | 232 | typedef struct _moxa_pci_info { |
232 | unsigned short busNum; | 233 | unsigned short busNum; |
233 | unsigned short devNum; | 234 | unsigned short devNum; |
234 | struct pci_dev *pdev; // add by Victor Yu. 06-23-2003 | 235 | struct pci_dev *pdev; /* add by Victor Yu. 06-23-2003 */ |
235 | } moxa_pci_info; | 236 | } moxa_pci_info; |
236 | 237 | ||
237 | static int ioaddr[MXSER_BOARDS] = { 0, 0, 0, 0 }; | 238 | static int ioaddr[MXSER_BOARDS] = { 0, 0, 0, 0 }; |
@@ -280,6 +281,7 @@ struct mxser_mon_ext { | |||
280 | int fifo[32]; | 281 | int fifo[32]; |
281 | int iftype[32]; | 282 | int iftype[32]; |
282 | }; | 283 | }; |
284 | |||
283 | struct mxser_hwconf { | 285 | struct mxser_hwconf { |
284 | int board_type; | 286 | int board_type; |
285 | int ports; | 287 | int ports; |
@@ -290,9 +292,9 @@ struct mxser_hwconf { | |||
290 | int ioaddr[MXSER_PORTS_PER_BOARD]; | 292 | int ioaddr[MXSER_PORTS_PER_BOARD]; |
291 | int baud_base[MXSER_PORTS_PER_BOARD]; | 293 | int baud_base[MXSER_PORTS_PER_BOARD]; |
292 | moxa_pci_info pciInfo; | 294 | moxa_pci_info pciInfo; |
293 | int IsMoxaMustChipFlag; // add by Victor Yu. 08-30-2002 | 295 | int IsMoxaMustChipFlag; /* add by Victor Yu. 08-30-2002 */ |
294 | int MaxCanSetBaudRate[MXSER_PORTS_PER_BOARD]; // add by Victor Yu. 09-04-2002 | 296 | int MaxCanSetBaudRate[MXSER_PORTS_PER_BOARD]; /* add by Victor Yu. 09-04-2002 */ |
295 | int opmode_ioaddr[MXSER_PORTS_PER_BOARD]; // add by Victor Yu. 01-05-2004 | 297 | int opmode_ioaddr[MXSER_PORTS_PER_BOARD]; /* add by Victor Yu. 01-05-2004 */ |
296 | }; | 298 | }; |
297 | 299 | ||
298 | struct mxser_struct { | 300 | struct mxser_struct { |
@@ -334,9 +336,9 @@ struct mxser_struct { | |||
334 | wait_queue_head_t delta_msr_wait; | 336 | wait_queue_head_t delta_msr_wait; |
335 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ | 337 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ |
336 | int timeout; | 338 | int timeout; |
337 | int IsMoxaMustChipFlag; // add by Victor Yu. 08-30-2002 | 339 | int IsMoxaMustChipFlag; /* add by Victor Yu. 08-30-2002 */ |
338 | int MaxCanSetBaudRate; // add by Victor Yu. 09-04-2002 | 340 | int MaxCanSetBaudRate; /* add by Victor Yu. 09-04-2002 */ |
339 | int opmode_ioaddr; // add by Victor Yu. 01-05-2004 | 341 | int opmode_ioaddr; /* add by Victor Yu. 01-05-2004 */ |
340 | unsigned char stop_rx; | 342 | unsigned char stop_rx; |
341 | unsigned char ldisc_stop_rx; | 343 | unsigned char ldisc_stop_rx; |
342 | long realbaud; | 344 | long realbaud; |
@@ -345,7 +347,6 @@ struct mxser_struct { | |||
345 | spinlock_t slock; | 347 | spinlock_t slock; |
346 | }; | 348 | }; |
347 | 349 | ||
348 | |||
349 | struct mxser_mstatus { | 350 | struct mxser_mstatus { |
350 | tcflag_t cflag; | 351 | tcflag_t cflag; |
351 | int cts; | 352 | int cts; |
@@ -358,7 +359,7 @@ static struct mxser_mstatus GMStatus[MXSER_PORTS]; | |||
358 | 359 | ||
359 | static int mxserBoardCAP[MXSER_BOARDS] = { | 360 | static int mxserBoardCAP[MXSER_BOARDS] = { |
360 | 0, 0, 0, 0 | 361 | 0, 0, 0, 0 |
361 | /* 0x180, 0x280, 0x200, 0x320 */ | 362 | /* 0x180, 0x280, 0x200, 0x320 */ |
362 | }; | 363 | }; |
363 | 364 | ||
364 | static struct tty_driver *mxvar_sdriver; | 365 | static struct tty_driver *mxvar_sdriver; |
@@ -386,7 +387,7 @@ static struct mxser_hwconf mxsercfg[MXSER_BOARDS]; | |||
386 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf); | 387 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf); |
387 | static int mxser_init(void); | 388 | static int mxser_init(void); |
388 | 389 | ||
389 | //static void mxser_poll(unsigned long); | 390 | /* static void mxser_poll(unsigned long); */ |
390 | static int mxser_get_ISA_conf(int, struct mxser_hwconf *); | 391 | static int mxser_get_ISA_conf(int, struct mxser_hwconf *); |
391 | static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *); | 392 | static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *); |
392 | static void mxser_do_softint(void *); | 393 | static void mxser_do_softint(void *); |
@@ -440,18 +441,18 @@ static int CheckIsMoxaMust(int io) | |||
440 | SET_MOXA_MUST_XON1_VALUE(io, 0x11); | 441 | SET_MOXA_MUST_XON1_VALUE(io, 0x11); |
441 | if ((hwid = inb(io + UART_MCR)) != 0) { | 442 | if ((hwid = inb(io + UART_MCR)) != 0) { |
442 | outb(oldmcr, io + UART_MCR); | 443 | outb(oldmcr, io + UART_MCR); |
443 | return (MOXA_OTHER_UART); | 444 | return MOXA_OTHER_UART; |
444 | } | 445 | } |
445 | 446 | ||
446 | GET_MOXA_MUST_HARDWARE_ID(io, &hwid); | 447 | GET_MOXA_MUST_HARDWARE_ID(io, &hwid); |
447 | for (i = 0; i < UART_TYPE_NUM; i++) { | 448 | for (i = 0; i < UART_TYPE_NUM; i++) { |
448 | if (hwid == Gmoxa_uart_id[i]) | 449 | if (hwid == Gmoxa_uart_id[i]) |
449 | return (int) hwid; | 450 | return (int)hwid; |
450 | } | 451 | } |
451 | return MOXA_OTHER_UART; | 452 | return MOXA_OTHER_UART; |
452 | } | 453 | } |
453 | 454 | ||
454 | // above is modified by Victor Yu. 08-15-2002 | 455 | /* above is modified by Victor Yu. 08-15-2002 */ |
455 | 456 | ||
456 | static struct tty_operations mxser_ops = { | 457 | static struct tty_operations mxser_ops = { |
457 | .open = mxser_open, | 458 | .open = mxser_open, |
@@ -504,7 +505,6 @@ static void __exit mxser_module_exit(void) | |||
504 | else | 505 | else |
505 | printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); | 506 | printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); |
506 | 507 | ||
507 | |||
508 | for (i = 0; i < MXSER_BOARDS; i++) { | 508 | for (i = 0; i < MXSER_BOARDS; i++) { |
509 | struct pci_dev *pdev; | 509 | struct pci_dev *pdev; |
510 | 510 | ||
@@ -513,7 +513,7 @@ static void __exit mxser_module_exit(void) | |||
513 | else { | 513 | else { |
514 | pdev = mxsercfg[i].pciInfo.pdev; | 514 | pdev = mxsercfg[i].pciInfo.pdev; |
515 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); | 515 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); |
516 | if (pdev != NULL) { //PCI | 516 | if (pdev != NULL) { /* PCI */ |
517 | release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); | 517 | release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); |
518 | release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3)); | 518 | release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3)); |
519 | } else { | 519 | } else { |
@@ -524,7 +524,6 @@ static void __exit mxser_module_exit(void) | |||
524 | } | 524 | } |
525 | if (verbose) | 525 | if (verbose) |
526 | printk(KERN_DEBUG "Done.\n"); | 526 | printk(KERN_DEBUG "Done.\n"); |
527 | |||
528 | } | 527 | } |
529 | 528 | ||
530 | static void process_txrx_fifo(struct mxser_struct *info) | 529 | static void process_txrx_fifo(struct mxser_struct *info) |
@@ -558,8 +557,10 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
558 | n = board * MXSER_PORTS_PER_BOARD; | 557 | n = board * MXSER_PORTS_PER_BOARD; |
559 | info = &mxvar_table[n]; | 558 | info = &mxvar_table[n]; |
560 | /*if (verbose) */ { | 559 | /*if (verbose) */ { |
561 | printk(KERN_DEBUG " ttyM%d - ttyM%d ", n, n + hwconf->ports - 1); | 560 | printk(KERN_DEBUG " ttyM%d - ttyM%d ", |
562 | printk(" max. baud rate = %d bps.\n", hwconf->MaxCanSetBaudRate[0]); | 561 | n, n + hwconf->ports - 1); |
562 | printk(" max. baud rate = %d bps.\n", | ||
563 | hwconf->MaxCanSetBaudRate[0]); | ||
563 | } | 564 | } |
564 | 565 | ||
565 | for (i = 0; i < hwconf->ports; i++, n++, info++) { | 566 | for (i = 0; i < hwconf->ports; i++, n++, info++) { |
@@ -568,12 +569,12 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
568 | info->irq = hwconf->irq; | 569 | info->irq = hwconf->irq; |
569 | info->vector = hwconf->vector; | 570 | info->vector = hwconf->vector; |
570 | info->vectormask = hwconf->vector_mask; | 571 | info->vectormask = hwconf->vector_mask; |
571 | info->opmode_ioaddr = hwconf->opmode_ioaddr[i]; // add by Victor Yu. 01-05-2004 | 572 | info->opmode_ioaddr = hwconf->opmode_ioaddr[i]; /* add by Victor Yu. 01-05-2004 */ |
572 | info->stop_rx = 0; | 573 | info->stop_rx = 0; |
573 | info->ldisc_stop_rx = 0; | 574 | info->ldisc_stop_rx = 0; |
574 | 575 | ||
575 | info->IsMoxaMustChipFlag = hwconf->IsMoxaMustChipFlag; | 576 | info->IsMoxaMustChipFlag = hwconf->IsMoxaMustChipFlag; |
576 | //Enhance mode enabled here | 577 | /* Enhance mode enabled here */ |
577 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { | 578 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { |
578 | ENABLE_MOXA_MUST_ENCHANCE_MODE(info->base); | 579 | ENABLE_MOXA_MUST_ENCHANCE_MODE(info->base); |
579 | } | 580 | } |
@@ -606,22 +607,25 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
606 | 607 | ||
607 | /* before set INT ISR, disable all int */ | 608 | /* before set INT ISR, disable all int */ |
608 | for (i = 0; i < hwconf->ports; i++) { | 609 | for (i = 0; i < hwconf->ports; i++) { |
609 | outb(inb(hwconf->ioaddr[i] + UART_IER) & 0xf0, hwconf->ioaddr[i] + UART_IER); | 610 | outb(inb(hwconf->ioaddr[i] + UART_IER) & 0xf0, |
611 | hwconf->ioaddr[i] + UART_IER); | ||
610 | } | 612 | } |
611 | 613 | ||
612 | n = board * MXSER_PORTS_PER_BOARD; | 614 | n = board * MXSER_PORTS_PER_BOARD; |
613 | info = &mxvar_table[n]; | 615 | info = &mxvar_table[n]; |
614 | 616 | ||
615 | retval = request_irq(hwconf->irq, mxser_interrupt, IRQ_T(info), "mxser", info); | 617 | retval = request_irq(hwconf->irq, mxser_interrupt, IRQ_T(info), |
618 | "mxser", info); | ||
616 | if (retval) { | 619 | if (retval) { |
617 | printk(KERN_ERR "Board %d: %s", board, mxser_brdname[hwconf->board_type - 1]); | 620 | printk(KERN_ERR "Board %d: %s", |
618 | printk(" Request irq fail,IRQ (%d) may be conflit with another device.\n", info->irq); | 621 | board, mxser_brdname[hwconf->board_type - 1]); |
622 | printk(" Request irq failed, IRQ (%d) may conflict with" | ||
623 | " another device.\n", info->irq); | ||
619 | return retval; | 624 | return retval; |
620 | } | 625 | } |
621 | return 0; | 626 | return 0; |
622 | } | 627 | } |
623 | 628 | ||
624 | |||
625 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) | 629 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) |
626 | { | 630 | { |
627 | mxsercfg[board] = *hwconf; | 631 | mxsercfg[board] = *hwconf; |
@@ -631,26 +635,27 @@ static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) | |||
631 | static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxser_hwconf *hwconf) | 635 | static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxser_hwconf *hwconf) |
632 | { | 636 | { |
633 | int i, j; | 637 | int i, j; |
634 | // unsigned int val; | 638 | /* unsigned int val; */ |
635 | unsigned int ioaddress; | 639 | unsigned int ioaddress; |
636 | struct pci_dev *pdev = hwconf->pciInfo.pdev; | 640 | struct pci_dev *pdev = hwconf->pciInfo.pdev; |
637 | 641 | ||
638 | //io address | 642 | /* io address */ |
639 | hwconf->board_type = board_type; | 643 | hwconf->board_type = board_type; |
640 | hwconf->ports = mxser_numports[board_type - 1]; | 644 | hwconf->ports = mxser_numports[board_type - 1]; |
641 | ioaddress = pci_resource_start(pdev, 2); | 645 | ioaddress = pci_resource_start(pdev, 2); |
642 | request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2), "mxser(IO)"); | 646 | request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2), |
647 | "mxser(IO)"); | ||
643 | 648 | ||
644 | for (i = 0; i < hwconf->ports; i++) { | 649 | for (i = 0; i < hwconf->ports; i++) |
645 | hwconf->ioaddr[i] = ioaddress + 8 * i; | 650 | hwconf->ioaddr[i] = ioaddress + 8 * i; |
646 | } | ||
647 | 651 | ||
648 | //vector | 652 | /* vector */ |
649 | ioaddress = pci_resource_start(pdev, 3); | 653 | ioaddress = pci_resource_start(pdev, 3); |
650 | request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3), "mxser(vector)"); | 654 | request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3), |
655 | "mxser(vector)"); | ||
651 | hwconf->vector = ioaddress; | 656 | hwconf->vector = ioaddress; |
652 | 657 | ||
653 | //irq | 658 | /* irq */ |
654 | hwconf->irq = hwconf->pciInfo.pdev->irq; | 659 | hwconf->irq = hwconf->pciInfo.pdev->irq; |
655 | 660 | ||
656 | hwconf->IsMoxaMustChipFlag = CheckIsMoxaMust(hwconf->ioaddr[0]); | 661 | hwconf->IsMoxaMustChipFlag = CheckIsMoxaMust(hwconf->ioaddr[0]); |
@@ -663,7 +668,7 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs | |||
663 | if (Gpci_uart_info[j].type == hwconf->IsMoxaMustChipFlag) { | 668 | if (Gpci_uart_info[j].type == hwconf->IsMoxaMustChipFlag) { |
664 | hwconf->MaxCanSetBaudRate[i] = Gpci_uart_info[j].max_baud; | 669 | hwconf->MaxCanSetBaudRate[i] = Gpci_uart_info[j].max_baud; |
665 | 670 | ||
666 | //exception....CP-102 | 671 | /* exception....CP-102 */ |
667 | if (board_type == MXSER_BOARD_CP102) | 672 | if (board_type == MXSER_BOARD_CP102) |
668 | hwconf->MaxCanSetBaudRate[i] = 921600; | 673 | hwconf->MaxCanSetBaudRate[i] = 921600; |
669 | break; | 674 | break; |
@@ -678,15 +683,15 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs | |||
678 | else | 683 | else |
679 | hwconf->opmode_ioaddr[i] = ioaddress + 0x0c; | 684 | hwconf->opmode_ioaddr[i] = ioaddress + 0x0c; |
680 | } | 685 | } |
681 | outb(0, ioaddress + 4); // default set to RS232 mode | 686 | outb(0, ioaddress + 4); /* default set to RS232 mode */ |
682 | outb(0, ioaddress + 0x0c); //default set to RS232 mode | 687 | outb(0, ioaddress + 0x0c); /* default set to RS232 mode */ |
683 | } | 688 | } |
684 | 689 | ||
685 | for (i = 0; i < hwconf->ports; i++) { | 690 | for (i = 0; i < hwconf->ports; i++) { |
686 | hwconf->vector_mask |= (1 << i); | 691 | hwconf->vector_mask |= (1 << i); |
687 | hwconf->baud_base[i] = 921600; | 692 | hwconf->baud_base[i] = 921600; |
688 | } | 693 | } |
689 | return (0); | 694 | return 0; |
690 | } | 695 | } |
691 | #endif | 696 | #endif |
692 | 697 | ||
@@ -707,7 +712,8 @@ static int mxser_init(void) | |||
707 | mxsercfg[i].board_type = -1; | 712 | mxsercfg[i].board_type = -1; |
708 | } | 713 | } |
709 | 714 | ||
710 | printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n", MXSER_VERSION); | 715 | printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n", |
716 | MXSER_VERSION); | ||
711 | 717 | ||
712 | /* Initialize the tty_driver structure */ | 718 | /* Initialize the tty_driver structure */ |
713 | memset(mxvar_sdriver, 0, sizeof(struct tty_driver)); | 719 | memset(mxvar_sdriver, 0, sizeof(struct tty_driver)); |
@@ -719,7 +725,7 @@ static int mxser_init(void) | |||
719 | mxvar_sdriver->type = TTY_DRIVER_TYPE_SERIAL; | 725 | mxvar_sdriver->type = TTY_DRIVER_TYPE_SERIAL; |
720 | mxvar_sdriver->subtype = SERIAL_TYPE_NORMAL; | 726 | mxvar_sdriver->subtype = SERIAL_TYPE_NORMAL; |
721 | mxvar_sdriver->init_termios = tty_std_termios; | 727 | mxvar_sdriver->init_termios = tty_std_termios; |
722 | mxvar_sdriver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 728 | mxvar_sdriver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; |
723 | mxvar_sdriver->flags = TTY_DRIVER_REAL_RAW; | 729 | mxvar_sdriver->flags = TTY_DRIVER_REAL_RAW; |
724 | tty_set_operations(mxvar_sdriver, &mxser_ops); | 730 | tty_set_operations(mxvar_sdriver, &mxser_ops); |
725 | mxvar_sdriver->ttys = mxvar_tty; | 731 | mxvar_sdriver->ttys = mxvar_tty; |
@@ -739,23 +745,29 @@ static int mxser_init(void) | |||
739 | /* Start finding ISA boards here */ | 745 | /* Start finding ISA boards here */ |
740 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 746 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { |
741 | int cap; | 747 | int cap; |
748 | |||
742 | if (!(cap = mxserBoardCAP[b])) | 749 | if (!(cap = mxserBoardCAP[b])) |
743 | continue; | 750 | continue; |
744 | 751 | ||
745 | retval = mxser_get_ISA_conf(cap, &hwconf); | 752 | retval = mxser_get_ISA_conf(cap, &hwconf); |
746 | 753 | ||
747 | if (retval != 0) | 754 | if (retval != 0) |
748 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | 755 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", |
756 | mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | ||
749 | 757 | ||
750 | if (retval <= 0) { | 758 | if (retval <= 0) { |
751 | if (retval == MXSER_ERR_IRQ) | 759 | if (retval == MXSER_ERR_IRQ) |
752 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 760 | printk(KERN_ERR "Invalid interrupt number, " |
761 | "board not configured\n"); | ||
753 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 762 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
754 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 763 | printk(KERN_ERR "Invalid interrupt number, " |
764 | "board not configured\n"); | ||
755 | else if (retval == MXSER_ERR_VECTOR) | 765 | else if (retval == MXSER_ERR_VECTOR) |
756 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 766 | printk(KERN_ERR "Invalid interrupt vector, " |
767 | "board not configured\n"); | ||
757 | else if (retval == MXSER_ERR_IOADDR) | 768 | else if (retval == MXSER_ERR_IOADDR) |
758 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 769 | printk(KERN_ERR "Invalid I/O address, " |
770 | "board not configured\n"); | ||
759 | 771 | ||
760 | continue; | 772 | continue; |
761 | } | 773 | } |
@@ -765,35 +777,43 @@ static int mxser_init(void) | |||
765 | hwconf.pciInfo.pdev = NULL; | 777 | hwconf.pciInfo.pdev = NULL; |
766 | 778 | ||
767 | mxser_getcfg(m, &hwconf); | 779 | mxser_getcfg(m, &hwconf); |
768 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 780 | /* |
769 | //mxser_initbrd will hook ISR. | 781 | * init mxsercfg first, |
782 | * or mxsercfg data is not correct on ISR. | ||
783 | */ | ||
784 | /* mxser_initbrd will hook ISR. */ | ||
770 | if (mxser_initbrd(m, &hwconf) < 0) | 785 | if (mxser_initbrd(m, &hwconf) < 0) |
771 | continue; | 786 | continue; |
772 | 787 | ||
773 | |||
774 | m++; | 788 | m++; |
775 | } | 789 | } |
776 | 790 | ||
777 | /* Start finding ISA boards from module arg */ | 791 | /* Start finding ISA boards from module arg */ |
778 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 792 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { |
779 | int cap; | 793 | int cap; |
794 | |||
780 | if (!(cap = ioaddr[b])) | 795 | if (!(cap = ioaddr[b])) |
781 | continue; | 796 | continue; |
782 | 797 | ||
783 | retval = mxser_get_ISA_conf(cap, &hwconf); | 798 | retval = mxser_get_ISA_conf(cap, &hwconf); |
784 | 799 | ||
785 | if (retval != 0) | 800 | if (retval != 0) |
786 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | 801 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", |
802 | mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | ||
787 | 803 | ||
788 | if (retval <= 0) { | 804 | if (retval <= 0) { |
789 | if (retval == MXSER_ERR_IRQ) | 805 | if (retval == MXSER_ERR_IRQ) |
790 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 806 | printk(KERN_ERR "Invalid interrupt number, " |
807 | "board not configured\n"); | ||
791 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 808 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
792 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 809 | printk(KERN_ERR "Invalid interrupt number, " |
810 | "board not configured\n"); | ||
793 | else if (retval == MXSER_ERR_VECTOR) | 811 | else if (retval == MXSER_ERR_VECTOR) |
794 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 812 | printk(KERN_ERR "Invalid interrupt vector, " |
813 | "board not configured\n"); | ||
795 | else if (retval == MXSER_ERR_IOADDR) | 814 | else if (retval == MXSER_ERR_IOADDR) |
796 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 815 | printk(KERN_ERR "Invalid I/O address, " |
816 | "board not configured\n"); | ||
797 | 817 | ||
798 | continue; | 818 | continue; |
799 | } | 819 | } |
@@ -803,8 +823,11 @@ static int mxser_init(void) | |||
803 | hwconf.pciInfo.pdev = NULL; | 823 | hwconf.pciInfo.pdev = NULL; |
804 | 824 | ||
805 | mxser_getcfg(m, &hwconf); | 825 | mxser_getcfg(m, &hwconf); |
806 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 826 | /* |
807 | //mxser_initbrd will hook ISR. | 827 | * init mxsercfg first, |
828 | * or mxsercfg data is not correct on ISR. | ||
829 | */ | ||
830 | /* mxser_initbrd will hook ISR. */ | ||
808 | if (mxser_initbrd(m, &hwconf) < 0) | 831 | if (mxser_initbrd(m, &hwconf) < 0) |
809 | continue; | 832 | continue; |
810 | 833 | ||
@@ -817,7 +840,8 @@ static int mxser_init(void) | |||
817 | index = 0; | 840 | index = 0; |
818 | b = 0; | 841 | b = 0; |
819 | while (b < n) { | 842 | while (b < n) { |
820 | pdev = pci_find_device(mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev); | 843 | pdev = pci_find_device(mxser_pcibrds[b].vendor, |
844 | mxser_pcibrds[b].device, pdev); | ||
821 | if (pdev == NULL) { | 845 | if (pdev == NULL) { |
822 | b++; | 846 | b++; |
823 | continue; | 847 | continue; |
@@ -825,30 +849,48 @@ static int mxser_init(void) | |||
825 | hwconf.pciInfo.busNum = busnum = pdev->bus->number; | 849 | hwconf.pciInfo.busNum = busnum = pdev->bus->number; |
826 | hwconf.pciInfo.devNum = devnum = PCI_SLOT(pdev->devfn) << 3; | 850 | hwconf.pciInfo.devNum = devnum = PCI_SLOT(pdev->devfn) << 3; |
827 | hwconf.pciInfo.pdev = pdev; | 851 | hwconf.pciInfo.pdev = pdev; |
828 | printk(KERN_INFO "Found MOXA %s board(BusNo=%d,DevNo=%d)\n", mxser_brdname[(int) (mxser_pcibrds[b].driver_data) - 1], busnum, devnum >> 3); | 852 | printk(KERN_INFO "Found MOXA %s board(BusNo=%d,DevNo=%d)\n", |
853 | mxser_brdname[(int) (mxser_pcibrds[b].driver_data) - 1], | ||
854 | busnum, devnum >> 3); | ||
829 | index++; | 855 | index++; |
830 | if (m >= MXSER_BOARDS) { | 856 | if (m >= MXSER_BOARDS) |
831 | printk(KERN_ERR "Too many Smartio/Industio family boards find (maximum %d),board not configured\n", MXSER_BOARDS); | 857 | printk(KERN_ERR |
832 | } else { | 858 | "Too many Smartio/Industio family boards find " |
859 | "(maximum %d), board not configured\n", | ||
860 | MXSER_BOARDS); | ||
861 | else { | ||
833 | if (pci_enable_device(pdev)) { | 862 | if (pci_enable_device(pdev)) { |
834 | printk(KERN_ERR "Moxa SmartI/O PCI enable fail !\n"); | 863 | printk(KERN_ERR "Moxa SmartI/O PCI enable " |
864 | "fail !\n"); | ||
835 | continue; | 865 | continue; |
836 | } | 866 | } |
837 | retval = mxser_get_PCI_conf(busnum, devnum, (int) mxser_pcibrds[b].driver_data, &hwconf); | 867 | retval = mxser_get_PCI_conf(busnum, devnum, |
868 | (int)mxser_pcibrds[b].driver_data, | ||
869 | &hwconf); | ||
838 | if (retval < 0) { | 870 | if (retval < 0) { |
839 | if (retval == MXSER_ERR_IRQ) | 871 | if (retval == MXSER_ERR_IRQ) |
840 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 872 | printk(KERN_ERR |
873 | "Invalid interrupt number, " | ||
874 | "board not configured\n"); | ||
841 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 875 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
842 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 876 | printk(KERN_ERR |
877 | "Invalid interrupt number, " | ||
878 | "board not configured\n"); | ||
843 | else if (retval == MXSER_ERR_VECTOR) | 879 | else if (retval == MXSER_ERR_VECTOR) |
844 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 880 | printk(KERN_ERR |
881 | "Invalid interrupt vector, " | ||
882 | "board not configured\n"); | ||
845 | else if (retval == MXSER_ERR_IOADDR) | 883 | else if (retval == MXSER_ERR_IOADDR) |
846 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 884 | printk(KERN_ERR |
885 | "Invalid I/O address, " | ||
886 | "board not configured\n"); | ||
847 | continue; | 887 | continue; |
848 | } | 888 | } |
849 | mxser_getcfg(m, &hwconf); | 889 | mxser_getcfg(m, &hwconf); |
850 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 890 | /* init mxsercfg first, |
851 | //mxser_initbrd will hook ISR. | 891 | * or mxsercfg data is not correct on ISR. |
892 | */ | ||
893 | /* mxser_initbrd will hook ISR. */ | ||
852 | if (mxser_initbrd(m, &hwconf) < 0) | 894 | if (mxser_initbrd(m, &hwconf) < 0) |
853 | continue; | 895 | continue; |
854 | m++; | 896 | m++; |
@@ -858,7 +900,8 @@ static int mxser_init(void) | |||
858 | 900 | ||
859 | retval = tty_register_driver(mxvar_sdriver); | 901 | retval = tty_register_driver(mxvar_sdriver); |
860 | if (retval) { | 902 | if (retval) { |
861 | printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family driver !\n"); | 903 | printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family" |
904 | " driver !\n"); | ||
862 | put_tty_driver(mxvar_sdriver); | 905 | put_tty_driver(mxvar_sdriver); |
863 | 906 | ||
864 | for (i = 0; i < MXSER_BOARDS; i++) { | 907 | for (i = 0; i < MXSER_BOARDS; i++) { |
@@ -866,7 +909,7 @@ static int mxser_init(void) | |||
866 | continue; | 909 | continue; |
867 | else { | 910 | else { |
868 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); | 911 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); |
869 | //todo: release io, vector | 912 | /* todo: release io, vector */ |
870 | } | 913 | } |
871 | } | 914 | } |
872 | return retval; | 915 | return retval; |
@@ -926,7 +969,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
926 | return -ENODEV; | 969 | return -ENODEV; |
927 | info = mxvar_table + line; | 970 | info = mxvar_table + line; |
928 | if (!info->base) | 971 | if (!info->base) |
929 | return (-ENODEV); | 972 | return -ENODEV; |
930 | 973 | ||
931 | tty->driver_data = info; | 974 | tty->driver_data = info; |
932 | info->tty = tty; | 975 | info->tty = tty; |
@@ -935,11 +978,11 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
935 | */ | 978 | */ |
936 | retval = mxser_startup(info); | 979 | retval = mxser_startup(info); |
937 | if (retval) | 980 | if (retval) |
938 | return (retval); | 981 | return retval; |
939 | 982 | ||
940 | retval = mxser_block_til_ready(tty, filp, info); | 983 | retval = mxser_block_til_ready(tty, filp, info); |
941 | if (retval) | 984 | if (retval) |
942 | return (retval); | 985 | return retval; |
943 | 986 | ||
944 | info->count++; | 987 | info->count++; |
945 | 988 | ||
@@ -955,11 +998,12 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
955 | info->pgrp = process_group(current); | 998 | info->pgrp = process_group(current); |
956 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 999 | clear_bit(TTY_DONT_FLIP, &tty->flags); |
957 | 1000 | ||
958 | //status = mxser_get_msr(info->base, 0, info->port); | 1001 | /* |
959 | //mxser_check_modem_status(info, status); | 1002 | status = mxser_get_msr(info->base, 0, info->port); |
1003 | mxser_check_modem_status(info, status); | ||
1004 | */ | ||
960 | 1005 | ||
961 | /* unmark here for very high baud rate (ex. 921600 bps) used | 1006 | /* unmark here for very high baud rate (ex. 921600 bps) used */ |
962 | */ | ||
963 | tty->low_latency = 1; | 1007 | tty->low_latency = 1; |
964 | return 0; | 1008 | return 0; |
965 | } | 1009 | } |
@@ -997,11 +1041,13 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
997 | * one, we've got real problems, since it means the | 1041 | * one, we've got real problems, since it means the |
998 | * serial port won't be shutdown. | 1042 | * serial port won't be shutdown. |
999 | */ | 1043 | */ |
1000 | printk(KERN_ERR "mxser_close: bad serial port count; tty->count is 1, " "info->count is %d\n", info->count); | 1044 | printk(KERN_ERR "mxser_close: bad serial port count; " |
1045 | "tty->count is 1, info->count is %d\n", info->count); | ||
1001 | info->count = 1; | 1046 | info->count = 1; |
1002 | } | 1047 | } |
1003 | if (--info->count < 0) { | 1048 | if (--info->count < 0) { |
1004 | printk(KERN_ERR "mxser_close: bad serial port count for ttys%d: %d\n", info->port, info->count); | 1049 | printk(KERN_ERR "mxser_close: bad serial port count for " |
1050 | "ttys%d: %d\n", info->port, info->count); | ||
1005 | info->count = 0; | 1051 | info->count = 0; |
1006 | } | 1052 | } |
1007 | if (info->count) { | 1053 | if (info->count) { |
@@ -1056,7 +1102,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1056 | 1102 | ||
1057 | ld = tty_ldisc_ref(tty); | 1103 | ld = tty_ldisc_ref(tty); |
1058 | if (ld) { | 1104 | if (ld) { |
1059 | if(ld->flush_buffer) | 1105 | if (ld->flush_buffer) |
1060 | ld->flush_buffer(tty); | 1106 | ld->flush_buffer(tty); |
1061 | tty_ldisc_deref(ld); | 1107 | tty_ldisc_deref(ld); |
1062 | } | 1108 | } |
@@ -1082,27 +1128,30 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou | |||
1082 | unsigned long flags; | 1128 | unsigned long flags; |
1083 | 1129 | ||
1084 | if (!info->xmit_buf) | 1130 | if (!info->xmit_buf) |
1085 | return (0); | 1131 | return 0; |
1086 | 1132 | ||
1087 | while (1) { | 1133 | while (1) { |
1088 | c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, SERIAL_XMIT_SIZE - info->xmit_head)); | 1134 | c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, |
1135 | SERIAL_XMIT_SIZE - info->xmit_head)); | ||
1089 | if (c <= 0) | 1136 | if (c <= 0) |
1090 | break; | 1137 | break; |
1091 | 1138 | ||
1092 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | 1139 | memcpy(info->xmit_buf + info->xmit_head, buf, c); |
1093 | spin_lock_irqsave(&info->slock, flags); | 1140 | spin_lock_irqsave(&info->slock, flags); |
1094 | info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE - 1); | 1141 | info->xmit_head = (info->xmit_head + c) & |
1142 | (SERIAL_XMIT_SIZE - 1); | ||
1095 | info->xmit_cnt += c; | 1143 | info->xmit_cnt += c; |
1096 | spin_unlock_irqrestore(&info->slock, flags); | 1144 | spin_unlock_irqrestore(&info->slock, flags); |
1097 | 1145 | ||
1098 | buf += c; | 1146 | buf += c; |
1099 | count -= c; | 1147 | count -= c; |
1100 | total += c; | 1148 | total += c; |
1101 | |||
1102 | } | 1149 | } |
1103 | 1150 | ||
1104 | if (info->xmit_cnt && !tty->stopped && !(info->IER & UART_IER_THRI)) { | 1151 | if (info->xmit_cnt && !tty->stopped && !(info->IER & UART_IER_THRI)) { |
1105 | if (!tty->hw_stopped || (info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { | 1152 | if (!tty->hw_stopped || |
1153 | (info->type == PORT_16550A) || | ||
1154 | (info->IsMoxaMustChipFlag)) { | ||
1106 | spin_lock_irqsave(&info->slock, flags); | 1155 | spin_lock_irqsave(&info->slock, flags); |
1107 | info->IER |= UART_IER_THRI; | 1156 | info->IER |= UART_IER_THRI; |
1108 | outb(info->IER, info->base + UART_IER); | 1157 | outb(info->IER, info->base + UART_IER); |
@@ -1129,7 +1178,9 @@ static void mxser_put_char(struct tty_struct *tty, unsigned char ch) | |||
1129 | info->xmit_cnt++; | 1178 | info->xmit_cnt++; |
1130 | spin_unlock_irqrestore(&info->slock, flags); | 1179 | spin_unlock_irqrestore(&info->slock, flags); |
1131 | if (!tty->stopped && !(info->IER & UART_IER_THRI)) { | 1180 | if (!tty->stopped && !(info->IER & UART_IER_THRI)) { |
1132 | if (!tty->hw_stopped || (info->type == PORT_16550A) || info->IsMoxaMustChipFlag) { | 1181 | if (!tty->hw_stopped || |
1182 | (info->type == PORT_16550A) || | ||
1183 | info->IsMoxaMustChipFlag) { | ||
1133 | spin_lock_irqsave(&info->slock, flags); | 1184 | spin_lock_irqsave(&info->slock, flags); |
1134 | info->IER |= UART_IER_THRI; | 1185 | info->IER |= UART_IER_THRI; |
1135 | outb(info->IER, info->base + UART_IER); | 1186 | outb(info->IER, info->base + UART_IER); |
@@ -1144,7 +1195,13 @@ static void mxser_flush_chars(struct tty_struct *tty) | |||
1144 | struct mxser_struct *info = tty->driver_data; | 1195 | struct mxser_struct *info = tty->driver_data; |
1145 | unsigned long flags; | 1196 | unsigned long flags; |
1146 | 1197 | ||
1147 | if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf || (tty->hw_stopped && (info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag))) | 1198 | if (info->xmit_cnt <= 0 || |
1199 | tty->stopped || | ||
1200 | !info->xmit_buf || | ||
1201 | (tty->hw_stopped && | ||
1202 | (info->type != PORT_16550A) && | ||
1203 | (!info->IsMoxaMustChipFlag) | ||
1204 | )) | ||
1148 | return; | 1205 | return; |
1149 | 1206 | ||
1150 | spin_lock_irqsave(&info->slock, flags); | 1207 | spin_lock_irqsave(&info->slock, flags); |
@@ -1163,7 +1220,7 @@ static int mxser_write_room(struct tty_struct *tty) | |||
1163 | ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; | 1220 | ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; |
1164 | if (ret < 0) | 1221 | if (ret < 0) |
1165 | ret = 0; | 1222 | ret = 0; |
1166 | return (ret); | 1223 | return ret; |
1167 | } | 1224 | } |
1168 | 1225 | ||
1169 | static int mxser_chars_in_buffer(struct tty_struct *tty) | 1226 | static int mxser_chars_in_buffer(struct tty_struct *tty) |
@@ -1184,7 +1241,8 @@ static void mxser_flush_buffer(struct tty_struct *tty) | |||
1184 | 1241 | ||
1185 | /* below added by shinhay */ | 1242 | /* below added by shinhay */ |
1186 | fcr = inb(info->base + UART_FCR); | 1243 | fcr = inb(info->base + UART_FCR); |
1187 | outb((fcr | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 1244 | outb((fcr | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
1245 | info->base + UART_FCR); | ||
1188 | outb(fcr, info->base + UART_FCR); | 1246 | outb(fcr, info->base + UART_FCR); |
1189 | 1247 | ||
1190 | spin_unlock_irqrestore(&info->slock, flags); | 1248 | spin_unlock_irqrestore(&info->slock, flags); |
@@ -1206,9 +1264,9 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1206 | void __user *argp = (void __user *)arg; | 1264 | void __user *argp = (void __user *)arg; |
1207 | 1265 | ||
1208 | if (tty->index == MXSER_PORTS) | 1266 | if (tty->index == MXSER_PORTS) |
1209 | return (mxser_ioctl_special(cmd, argp)); | 1267 | return mxser_ioctl_special(cmd, argp); |
1210 | 1268 | ||
1211 | // following add by Victor Yu. 01-05-2004 | 1269 | /* following add by Victor Yu. 01-05-2004 */ |
1212 | if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { | 1270 | if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { |
1213 | int opmode, p; | 1271 | int opmode, p; |
1214 | static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; | 1272 | static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; |
@@ -1219,7 +1277,10 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1219 | if (cmd == MOXA_SET_OP_MODE) { | 1277 | if (cmd == MOXA_SET_OP_MODE) { |
1220 | if (get_user(opmode, (int __user *) argp)) | 1278 | if (get_user(opmode, (int __user *) argp)) |
1221 | return -EFAULT; | 1279 | return -EFAULT; |
1222 | if (opmode != RS232_MODE && opmode != RS485_2WIRE_MODE && opmode != RS422_MODE && opmode != RS485_4WIRE_MODE) | 1280 | if (opmode != RS232_MODE && |
1281 | opmode != RS485_2WIRE_MODE && | ||
1282 | opmode != RS422_MODE && | ||
1283 | opmode != RS485_4WIRE_MODE) | ||
1223 | return -EFAULT; | 1284 | return -EFAULT; |
1224 | mask = ModeMask[p]; | 1285 | mask = ModeMask[p]; |
1225 | shiftbit = p * 2; | 1286 | shiftbit = p * 2; |
@@ -1236,36 +1297,36 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1236 | } | 1297 | } |
1237 | return 0; | 1298 | return 0; |
1238 | } | 1299 | } |
1239 | // above add by Victor Yu. 01-05-2004 | 1300 | /* above add by Victor Yu. 01-05-2004 */ |
1240 | 1301 | ||
1241 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { | 1302 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { |
1242 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1303 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1243 | return (-EIO); | 1304 | return -EIO; |
1244 | } | 1305 | } |
1245 | switch (cmd) { | 1306 | switch (cmd) { |
1246 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 1307 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
1247 | retval = tty_check_change(tty); | 1308 | retval = tty_check_change(tty); |
1248 | if (retval) | 1309 | if (retval) |
1249 | return (retval); | 1310 | return retval; |
1250 | tty_wait_until_sent(tty, 0); | 1311 | tty_wait_until_sent(tty, 0); |
1251 | if (!arg) | 1312 | if (!arg) |
1252 | mxser_send_break(info, HZ / 4); /* 1/4 second */ | 1313 | mxser_send_break(info, HZ / 4); /* 1/4 second */ |
1253 | return (0); | 1314 | return 0; |
1254 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | 1315 | case TCSBRKP: /* support for POSIX tcsendbreak() */ |
1255 | retval = tty_check_change(tty); | 1316 | retval = tty_check_change(tty); |
1256 | if (retval) | 1317 | if (retval) |
1257 | return (retval); | 1318 | return retval; |
1258 | tty_wait_until_sent(tty, 0); | 1319 | tty_wait_until_sent(tty, 0); |
1259 | mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); | 1320 | mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); |
1260 | return (0); | 1321 | return 0; |
1261 | case TIOCGSOFTCAR: | 1322 | case TIOCGSOFTCAR: |
1262 | return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) argp); | 1323 | return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); |
1263 | case TIOCSSOFTCAR: | 1324 | case TIOCSSOFTCAR: |
1264 | if (get_user(templ, (unsigned long __user *) argp)) | 1325 | if (get_user(templ, (unsigned long __user *) argp)) |
1265 | return -EFAULT; | 1326 | return -EFAULT; |
1266 | arg = templ; | 1327 | arg = templ; |
1267 | tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); | 1328 | tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); |
1268 | return (0); | 1329 | return 0; |
1269 | case TIOCGSERIAL: | 1330 | case TIOCGSERIAL: |
1270 | return mxser_get_serial_info(info, argp); | 1331 | return mxser_get_serial_info(info, argp); |
1271 | case TIOCSSERIAL: | 1332 | case TIOCSSERIAL: |
@@ -1278,7 +1339,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1278 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1339 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
1279 | * Caller should use TIOCGICOUNT to see which one it was | 1340 | * Caller should use TIOCGICOUNT to see which one it was |
1280 | */ | 1341 | */ |
1281 | case TIOCMIWAIT:{ | 1342 | case TIOCMIWAIT: { |
1282 | DECLARE_WAITQUEUE(wait, current); | 1343 | DECLARE_WAITQUEUE(wait, current); |
1283 | int ret; | 1344 | int ret; |
1284 | spin_lock_irqsave(&info->slock, flags); | 1345 | spin_lock_irqsave(&info->slock, flags); |
@@ -1292,7 +1353,14 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1292 | spin_unlock_irqrestore(&info->slock, flags); | 1353 | spin_unlock_irqrestore(&info->slock, flags); |
1293 | 1354 | ||
1294 | set_current_state(TASK_INTERRUPTIBLE); | 1355 | set_current_state(TASK_INTERRUPTIBLE); |
1295 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { | 1356 | if (((arg & TIOCM_RNG) && |
1357 | (cnow.rng != cprev.rng)) || | ||
1358 | ((arg & TIOCM_DSR) && | ||
1359 | (cnow.dsr != cprev.dsr)) || | ||
1360 | ((arg & TIOCM_CD) && | ||
1361 | (cnow.dcd != cprev.dcd)) || | ||
1362 | ((arg & TIOCM_CTS) && | ||
1363 | (cnow.cts != cprev.cts))) { | ||
1296 | ret = 0; | 1364 | ret = 0; |
1297 | break; | 1365 | break; |
1298 | } | 1366 | } |
@@ -1338,21 +1406,18 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1338 | put_user(cnow.dsr, &p_cuser->dsr); | 1406 | put_user(cnow.dsr, &p_cuser->dsr); |
1339 | put_user(cnow.rng, &p_cuser->rng); | 1407 | put_user(cnow.rng, &p_cuser->rng); |
1340 | put_user(cnow.dcd, &p_cuser->dcd); | 1408 | put_user(cnow.dcd, &p_cuser->dcd); |
1341 | |||
1342 | /* */ | ||
1343 | return 0; | 1409 | return 0; |
1344 | case MOXA_HighSpeedOn: | 1410 | case MOXA_HighSpeedOn: |
1345 | return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *) argp); | 1411 | return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); |
1346 | 1412 | case MOXA_SDS_RSTICOUNTER: { | |
1347 | case MOXA_SDS_RSTICOUNTER:{ | ||
1348 | info->mon_data.rxcnt = 0; | 1413 | info->mon_data.rxcnt = 0; |
1349 | info->mon_data.txcnt = 0; | 1414 | info->mon_data.txcnt = 0; |
1350 | return 0; | 1415 | return 0; |
1351 | } | 1416 | } |
1352 | // (above) added by James. | 1417 | /* (above) added by James. */ |
1353 | case MOXA_ASPP_SETBAUD:{ | 1418 | case MOXA_ASPP_SETBAUD:{ |
1354 | long baud; | 1419 | long baud; |
1355 | if (get_user(baud, (long __user *) argp)) | 1420 | if (get_user(baud, (long __user *)argp)) |
1356 | return -EFAULT; | 1421 | return -EFAULT; |
1357 | mxser_set_baud(info, baud); | 1422 | mxser_set_baud(info, baud); |
1358 | return 0; | 1423 | return 0; |
@@ -1377,9 +1442,10 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1377 | 1442 | ||
1378 | return 0; | 1443 | return 0; |
1379 | } | 1444 | } |
1380 | case MOXA_ASPP_MON:{ | 1445 | case MOXA_ASPP_MON: { |
1381 | int mcr, status; | 1446 | int mcr, status; |
1382 | // info->mon_data.ser_param = tty->termios->c_cflag; | 1447 | |
1448 | /* info->mon_data.ser_param = tty->termios->c_cflag; */ | ||
1383 | 1449 | ||
1384 | status = mxser_get_msr(info->base, 1, info->port, info); | 1450 | status = mxser_get_msr(info->base, 1, info->port, info); |
1385 | mxser_check_modem_status(info, status); | 1451 | mxser_check_modem_status(info, status); |
@@ -1400,25 +1466,25 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1400 | else | 1466 | else |
1401 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; | 1467 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; |
1402 | 1468 | ||
1403 | 1469 | if (copy_to_user(argp, &info->mon_data, | |
1404 | if (copy_to_user(argp, &info->mon_data, sizeof(struct mxser_mon))) | 1470 | sizeof(struct mxser_mon))) |
1405 | return -EFAULT; | 1471 | return -EFAULT; |
1406 | 1472 | ||
1407 | return 0; | 1473 | return 0; |
1408 | |||
1409 | } | 1474 | } |
1410 | 1475 | ||
1411 | case MOXA_ASPP_LSTATUS:{ | 1476 | case MOXA_ASPP_LSTATUS: { |
1412 | if (copy_to_user(argp, &info->err_shadow, sizeof(unsigned char))) | 1477 | if (copy_to_user(argp, &info->err_shadow, |
1478 | sizeof(unsigned char))) | ||
1413 | return -EFAULT; | 1479 | return -EFAULT; |
1414 | 1480 | ||
1415 | info->err_shadow = 0; | 1481 | info->err_shadow = 0; |
1416 | return 0; | 1482 | return 0; |
1417 | |||
1418 | } | 1483 | } |
1419 | case MOXA_SET_BAUD_METHOD:{ | 1484 | case MOXA_SET_BAUD_METHOD: { |
1420 | int method; | 1485 | int method; |
1421 | if (get_user(method, (int __user *) argp)) | 1486 | |
1487 | if (get_user(method, (int __user *)argp)) | ||
1422 | return -EFAULT; | 1488 | return -EFAULT; |
1423 | mxser_set_baud_method[info->port] = method; | 1489 | mxser_set_baud_method[info->port] = method; |
1424 | if (copy_to_user(argp, &method, sizeof(int))) | 1490 | if (copy_to_user(argp, &method, sizeof(int))) |
@@ -1442,7 +1508,8 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1442 | 1508 | ||
1443 | switch (cmd) { | 1509 | switch (cmd) { |
1444 | case MOXA_GET_CONF: | 1510 | case MOXA_GET_CONF: |
1445 | if (copy_to_user(argp, mxsercfg, sizeof(struct mxser_hwconf) * 4)) | 1511 | if (copy_to_user(argp, mxsercfg, |
1512 | sizeof(struct mxser_hwconf) * 4)) | ||
1446 | return -EFAULT; | 1513 | return -EFAULT; |
1447 | return 0; | 1514 | return 0; |
1448 | case MOXA_GET_MAJOR: | 1515 | case MOXA_GET_MAJOR: |
@@ -1461,11 +1528,11 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1461 | if (mxvar_table[i].base) | 1528 | if (mxvar_table[i].base) |
1462 | result |= (1 << i); | 1529 | result |= (1 << i); |
1463 | } | 1530 | } |
1464 | return put_user(result, (unsigned long __user *) argp); | 1531 | return put_user(result, (unsigned long __user *)argp); |
1465 | case MOXA_GETDATACOUNT: | 1532 | case MOXA_GETDATACOUNT: |
1466 | if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) | 1533 | if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) |
1467 | return -EFAULT; | 1534 | return -EFAULT; |
1468 | return (0); | 1535 | return 0; |
1469 | case MOXA_GETMSTATUS: | 1536 | case MOXA_GETMSTATUS: |
1470 | for (i = 0; i < MXSER_PORTS; i++) { | 1537 | for (i = 0; i < MXSER_PORTS; i++) { |
1471 | GMStatus[i].ri = 0; | 1538 | GMStatus[i].ri = 0; |
@@ -1498,22 +1565,26 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1498 | else | 1565 | else |
1499 | GMStatus[i].cts = 0; | 1566 | GMStatus[i].cts = 0; |
1500 | } | 1567 | } |
1501 | if (copy_to_user(argp, GMStatus, sizeof(struct mxser_mstatus) * MXSER_PORTS)) | 1568 | if (copy_to_user(argp, GMStatus, |
1569 | sizeof(struct mxser_mstatus) * MXSER_PORTS)) | ||
1502 | return -EFAULT; | 1570 | return -EFAULT; |
1503 | return 0; | 1571 | return 0; |
1504 | case MOXA_ASPP_MON_EXT:{ | 1572 | case MOXA_ASPP_MON_EXT: { |
1505 | int status; | 1573 | int status; |
1506 | int opmode, p; | 1574 | int opmode, p; |
1507 | int shiftbit; | 1575 | int shiftbit; |
1508 | unsigned cflag, iflag; | 1576 | unsigned cflag, iflag; |
1509 | 1577 | ||
1510 | for (i = 0; i < MXSER_PORTS; i++) { | 1578 | for (i = 0; i < MXSER_PORTS; i++) { |
1511 | |||
1512 | if (!mxvar_table[i].base) | 1579 | if (!mxvar_table[i].base) |
1513 | continue; | 1580 | continue; |
1514 | 1581 | ||
1515 | status = mxser_get_msr(mxvar_table[i].base, 0, i, &(mxvar_table[i])); | 1582 | status = mxser_get_msr(mxvar_table[i].base, 0, |
1516 | // mxser_check_modem_status(&mxvar_table[i], status); | 1583 | i, &(mxvar_table[i])); |
1584 | /* | ||
1585 | mxser_check_modem_status(&mxvar_table[i], | ||
1586 | status); | ||
1587 | */ | ||
1517 | if (status & UART_MSR_TERI) | 1588 | if (status & UART_MSR_TERI) |
1518 | mxvar_table[i].icount.rng++; | 1589 | mxvar_table[i].icount.rng++; |
1519 | if (status & UART_MSR_DDSR) | 1590 | if (status & UART_MSR_DDSR) |
@@ -1578,75 +1649,76 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1578 | return 0; | 1649 | return 0; |
1579 | } | 1650 | } |
1580 | 1651 | ||
1581 | |||
1582 | static void mxser_stoprx(struct tty_struct *tty) | 1652 | static void mxser_stoprx(struct tty_struct *tty) |
1583 | { | 1653 | { |
1584 | struct mxser_struct *info = tty->driver_data; | 1654 | struct mxser_struct *info = tty->driver_data; |
1585 | //unsigned long flags; | 1655 | /* unsigned long flags; */ |
1586 | |||
1587 | 1656 | ||
1588 | info->ldisc_stop_rx = 1; | 1657 | info->ldisc_stop_rx = 1; |
1589 | if (I_IXOFF(tty)) { | 1658 | if (I_IXOFF(tty)) { |
1590 | 1659 | /* MX_LOCK(&info->slock); */ | |
1591 | //MX_LOCK(&info->slock); | 1660 | /* following add by Victor Yu. 09-02-2002 */ |
1592 | // following add by Victor Yu. 09-02-2002 | ||
1593 | if (info->IsMoxaMustChipFlag) { | 1661 | if (info->IsMoxaMustChipFlag) { |
1594 | info->IER &= ~MOXA_MUST_RECV_ISR; | 1662 | info->IER &= ~MOXA_MUST_RECV_ISR; |
1595 | outb(info->IER, info->base + UART_IER); | 1663 | outb(info->IER, info->base + UART_IER); |
1596 | } else { | 1664 | } else { |
1597 | // above add by Victor Yu. 09-02-2002 | 1665 | /* above add by Victor Yu. 09-02-2002 */ |
1598 | |||
1599 | info->x_char = STOP_CHAR(tty); | 1666 | info->x_char = STOP_CHAR(tty); |
1600 | // outb(info->IER, 0); // mask by Victor Yu. 09-02-2002 | 1667 | /* mask by Victor Yu. 09-02-2002 */ |
1668 | /* outb(info->IER, 0); */ | ||
1601 | outb(0, info->base + UART_IER); | 1669 | outb(0, info->base + UART_IER); |
1602 | info->IER |= UART_IER_THRI; | 1670 | info->IER |= UART_IER_THRI; |
1603 | outb(info->IER, info->base + UART_IER); /* force Tx interrupt */ | 1671 | /* force Tx interrupt */ |
1604 | } // add by Victor Yu. 09-02-2002 | 1672 | outb(info->IER, info->base + UART_IER); |
1605 | //MX_UNLOCK(&info->slock); | 1673 | } /* add by Victor Yu. 09-02-2002 */ |
1674 | /* MX_UNLOCK(&info->slock); */ | ||
1606 | } | 1675 | } |
1607 | 1676 | ||
1608 | if (info->tty->termios->c_cflag & CRTSCTS) { | 1677 | if (info->tty->termios->c_cflag & CRTSCTS) { |
1609 | //MX_LOCK(&info->slock); | 1678 | /* MX_LOCK(&info->slock); */ |
1610 | info->MCR &= ~UART_MCR_RTS; | 1679 | info->MCR &= ~UART_MCR_RTS; |
1611 | outb(info->MCR, info->base + UART_MCR); | 1680 | outb(info->MCR, info->base + UART_MCR); |
1612 | //MX_UNLOCK(&info->slock); | 1681 | /* MX_UNLOCK(&info->slock); */ |
1613 | } | 1682 | } |
1614 | } | 1683 | } |
1615 | 1684 | ||
1616 | static void mxser_startrx(struct tty_struct *tty) | 1685 | static void mxser_startrx(struct tty_struct *tty) |
1617 | { | 1686 | { |
1618 | struct mxser_struct *info = tty->driver_data; | 1687 | struct mxser_struct *info = tty->driver_data; |
1619 | //unsigned long flags; | 1688 | /* unsigned long flags; */ |
1620 | 1689 | ||
1621 | info->ldisc_stop_rx = 0; | 1690 | info->ldisc_stop_rx = 0; |
1622 | if (I_IXOFF(tty)) { | 1691 | if (I_IXOFF(tty)) { |
1623 | if (info->x_char) | 1692 | if (info->x_char) |
1624 | info->x_char = 0; | 1693 | info->x_char = 0; |
1625 | else { | 1694 | else { |
1626 | //MX_LOCK(&info->slock); | 1695 | /* MX_LOCK(&info->slock); */ |
1627 | 1696 | ||
1628 | // following add by Victor Yu. 09-02-2002 | 1697 | /* following add by Victor Yu. 09-02-2002 */ |
1629 | if (info->IsMoxaMustChipFlag) { | 1698 | if (info->IsMoxaMustChipFlag) { |
1630 | info->IER |= MOXA_MUST_RECV_ISR; | 1699 | info->IER |= MOXA_MUST_RECV_ISR; |
1631 | outb(info->IER, info->base + UART_IER); | 1700 | outb(info->IER, info->base + UART_IER); |
1632 | } else { | 1701 | } else { |
1633 | // above add by Victor Yu. 09-02-2002 | 1702 | /* above add by Victor Yu. 09-02-2002 */ |
1634 | 1703 | ||
1635 | info->x_char = START_CHAR(tty); | 1704 | info->x_char = START_CHAR(tty); |
1636 | // outb(info->IER, 0); // mask by Victor Yu. 09-02-2002 | 1705 | /* mask by Victor Yu. 09-02-2002 */ |
1637 | outb(0, info->base + UART_IER); // add by Victor Yu. 09-02-2002 | 1706 | /* outb(info->IER, 0); */ |
1638 | info->IER |= UART_IER_THRI; /* force Tx interrupt */ | 1707 | /* add by Victor Yu. 09-02-2002 */ |
1708 | outb(0, info->base + UART_IER); | ||
1709 | /* force Tx interrupt */ | ||
1710 | info->IER |= UART_IER_THRI; | ||
1639 | outb(info->IER, info->base + UART_IER); | 1711 | outb(info->IER, info->base + UART_IER); |
1640 | } // add by Victor Yu. 09-02-2002 | 1712 | } /* add by Victor Yu. 09-02-2002 */ |
1641 | //MX_UNLOCK(&info->slock); | 1713 | /* MX_UNLOCK(&info->slock); */ |
1642 | } | 1714 | } |
1643 | } | 1715 | } |
1644 | 1716 | ||
1645 | if (info->tty->termios->c_cflag & CRTSCTS) { | 1717 | if (info->tty->termios->c_cflag & CRTSCTS) { |
1646 | //MX_LOCK(&info->slock); | 1718 | /* MX_LOCK(&info->slock); */ |
1647 | info->MCR |= UART_MCR_RTS; | 1719 | info->MCR |= UART_MCR_RTS; |
1648 | outb(info->MCR, info->base + UART_MCR); | 1720 | outb(info->MCR, info->base + UART_MCR); |
1649 | //MX_UNLOCK(&info->slock); | 1721 | /* MX_UNLOCK(&info->slock); */ |
1650 | } | 1722 | } |
1651 | } | 1723 | } |
1652 | 1724 | ||
@@ -1656,20 +1728,22 @@ static void mxser_startrx(struct tty_struct *tty) | |||
1656 | */ | 1728 | */ |
1657 | static void mxser_throttle(struct tty_struct *tty) | 1729 | static void mxser_throttle(struct tty_struct *tty) |
1658 | { | 1730 | { |
1659 | //struct mxser_struct *info = tty->driver_data; | 1731 | /* struct mxser_struct *info = tty->driver_data; */ |
1660 | //unsigned long flags; | 1732 | /* unsigned long flags; */ |
1661 | //MX_LOCK(&info->slock); | 1733 | |
1734 | /* MX_LOCK(&info->slock); */ | ||
1662 | mxser_stoprx(tty); | 1735 | mxser_stoprx(tty); |
1663 | //MX_UNLOCK(&info->slock); | 1736 | /* MX_UNLOCK(&info->slock); */ |
1664 | } | 1737 | } |
1665 | 1738 | ||
1666 | static void mxser_unthrottle(struct tty_struct *tty) | 1739 | static void mxser_unthrottle(struct tty_struct *tty) |
1667 | { | 1740 | { |
1668 | //struct mxser_struct *info = tty->driver_data; | 1741 | /* struct mxser_struct *info = tty->driver_data; */ |
1669 | //unsigned long flags; | 1742 | /* unsigned long flags; */ |
1670 | //MX_LOCK(&info->slock); | 1743 | |
1744 | /* MX_LOCK(&info->slock); */ | ||
1671 | mxser_startrx(tty); | 1745 | mxser_startrx(tty); |
1672 | //MX_UNLOCK(&info->slock); | 1746 | /* MX_UNLOCK(&info->slock); */ |
1673 | } | 1747 | } |
1674 | 1748 | ||
1675 | static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termios) | 1749 | static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termios) |
@@ -1677,27 +1751,30 @@ static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termio | |||
1677 | struct mxser_struct *info = tty->driver_data; | 1751 | struct mxser_struct *info = tty->driver_data; |
1678 | unsigned long flags; | 1752 | unsigned long flags; |
1679 | 1753 | ||
1680 | if ((tty->termios->c_cflag != old_termios->c_cflag) || (RELEVANT_IFLAG(tty->termios->c_iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | 1754 | if ((tty->termios->c_cflag != old_termios->c_cflag) || |
1755 | (RELEVANT_IFLAG(tty->termios->c_iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
1681 | 1756 | ||
1682 | mxser_change_speed(info, old_termios); | 1757 | mxser_change_speed(info, old_termios); |
1683 | 1758 | ||
1684 | if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { | 1759 | if ((old_termios->c_cflag & CRTSCTS) && |
1760 | !(tty->termios->c_cflag & CRTSCTS)) { | ||
1685 | tty->hw_stopped = 0; | 1761 | tty->hw_stopped = 0; |
1686 | mxser_start(tty); | 1762 | mxser_start(tty); |
1687 | } | 1763 | } |
1688 | } | 1764 | } |
1689 | 1765 | ||
1690 | /* Handle sw stopped */ | 1766 | /* Handle sw stopped */ |
1691 | if ((old_termios->c_iflag & IXON) && !(tty->termios->c_iflag & IXON)) { | 1767 | if ((old_termios->c_iflag & IXON) && |
1768 | !(tty->termios->c_iflag & IXON)) { | ||
1692 | tty->stopped = 0; | 1769 | tty->stopped = 0; |
1693 | 1770 | ||
1694 | // following add by Victor Yu. 09-02-2002 | 1771 | /* following add by Victor Yu. 09-02-2002 */ |
1695 | if (info->IsMoxaMustChipFlag) { | 1772 | if (info->IsMoxaMustChipFlag) { |
1696 | spin_lock_irqsave(&info->slock, flags); | 1773 | spin_lock_irqsave(&info->slock, flags); |
1697 | DISABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(info->base); | 1774 | DISABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(info->base); |
1698 | spin_unlock_irqrestore(&info->slock, flags); | 1775 | spin_unlock_irqrestore(&info->slock, flags); |
1699 | } | 1776 | } |
1700 | // above add by Victor Yu. 09-02-2002 | 1777 | /* above add by Victor Yu. 09-02-2002 */ |
1701 | 1778 | ||
1702 | mxser_start(tty); | 1779 | mxser_start(tty); |
1703 | } | 1780 | } |
@@ -1777,7 +1854,8 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1777 | if (!timeout || timeout > 2 * info->timeout) | 1854 | if (!timeout || timeout > 2 * info->timeout) |
1778 | timeout = 2 * info->timeout; | 1855 | timeout = 2 * info->timeout; |
1779 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT | 1856 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT |
1780 | printk(KERN_DEBUG "In rs_wait_until_sent(%d) check=%lu...", timeout, char_time); | 1857 | printk(KERN_DEBUG "In rs_wait_until_sent(%d) check=%lu...", |
1858 | timeout, char_time); | ||
1781 | printk("jiff=%lu...", jiffies); | 1859 | printk("jiff=%lu...", jiffies); |
1782 | #endif | 1860 | #endif |
1783 | while (!((lsr = inb(info->base + UART_LSR)) & UART_LSR_TEMT)) { | 1861 | while (!((lsr = inb(info->base + UART_LSR)) & UART_LSR_TEMT)) { |
@@ -1815,7 +1893,7 @@ void mxser_hangup(struct tty_struct *tty) | |||
1815 | } | 1893 | } |
1816 | 1894 | ||
1817 | 1895 | ||
1818 | // added by James 03-12-2004. | 1896 | /* added by James 03-12-2004. */ |
1819 | /* | 1897 | /* |
1820 | * mxser_rs_break() --- routine which turns the break handling on or off | 1898 | * mxser_rs_break() --- routine which turns the break handling on or off |
1821 | */ | 1899 | */ |
@@ -1826,13 +1904,15 @@ static void mxser_rs_break(struct tty_struct *tty, int break_state) | |||
1826 | 1904 | ||
1827 | spin_lock_irqsave(&info->slock, flags); | 1905 | spin_lock_irqsave(&info->slock, flags); |
1828 | if (break_state == -1) | 1906 | if (break_state == -1) |
1829 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, info->base + UART_LCR); | 1907 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, |
1908 | info->base + UART_LCR); | ||
1830 | else | 1909 | else |
1831 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, info->base + UART_LCR); | 1910 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, |
1911 | info->base + UART_LCR); | ||
1832 | spin_unlock_irqrestore(&info->slock, flags); | 1912 | spin_unlock_irqrestore(&info->slock, flags); |
1833 | } | 1913 | } |
1834 | 1914 | ||
1835 | // (above) added by James. | 1915 | /* (above) added by James. */ |
1836 | 1916 | ||
1837 | 1917 | ||
1838 | /* | 1918 | /* |
@@ -1848,7 +1928,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1848 | int handled = IRQ_NONE; | 1928 | int handled = IRQ_NONE; |
1849 | 1929 | ||
1850 | port = NULL; | 1930 | port = NULL; |
1851 | //spin_lock(&gm_lock); | 1931 | /* spin_lock(&gm_lock); */ |
1852 | 1932 | ||
1853 | for (i = 0; i < MXSER_BOARDS; i++) { | 1933 | for (i = 0; i < MXSER_BOARDS; i++) { |
1854 | if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) { | 1934 | if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) { |
@@ -1857,29 +1937,25 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1857 | } | 1937 | } |
1858 | } | 1938 | } |
1859 | 1939 | ||
1860 | if (i == MXSER_BOARDS) { | 1940 | if (i == MXSER_BOARDS) |
1861 | goto irq_stop; | 1941 | goto irq_stop; |
1862 | } | 1942 | if (port == 0) |
1863 | if (port == 0) { | ||
1864 | goto irq_stop; | 1943 | goto irq_stop; |
1865 | } | ||
1866 | max = mxser_numports[mxsercfg[i].board_type - 1]; | 1944 | max = mxser_numports[mxsercfg[i].board_type - 1]; |
1867 | while (1) { | 1945 | while (1) { |
1868 | irqbits = inb(port->vector) & port->vectormask; | 1946 | irqbits = inb(port->vector) & port->vectormask; |
1869 | if (irqbits == port->vectormask) { | 1947 | if (irqbits == port->vectormask) |
1870 | break; | 1948 | break; |
1871 | } | ||
1872 | 1949 | ||
1873 | handled = IRQ_HANDLED; | 1950 | handled = IRQ_HANDLED; |
1874 | for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) { | 1951 | for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) { |
1875 | if (irqbits == port->vectormask) { | 1952 | if (irqbits == port->vectormask) |
1876 | break; | 1953 | break; |
1877 | } | ||
1878 | if (bits & irqbits) | 1954 | if (bits & irqbits) |
1879 | continue; | 1955 | continue; |
1880 | info = port + i; | 1956 | info = port + i; |
1881 | 1957 | ||
1882 | // following add by Victor Yu. 09-13-2002 | 1958 | /* following add by Victor Yu. 09-13-2002 */ |
1883 | iir = inb(info->base + UART_IIR); | 1959 | iir = inb(info->base + UART_IIR); |
1884 | if (iir & UART_IIR_NO_INT) | 1960 | if (iir & UART_IIR_NO_INT) |
1885 | continue; | 1961 | continue; |
@@ -1890,9 +1966,9 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1890 | inb(info->base + UART_MSR); | 1966 | inb(info->base + UART_MSR); |
1891 | continue; | 1967 | continue; |
1892 | } | 1968 | } |
1893 | // above add by Victor Yu. 09-13-2002 | 1969 | /* above add by Victor Yu. 09-13-2002 */ |
1894 | /* | 1970 | /* |
1895 | if ( info->tty->flip.count < TTY_FLIPBUF_SIZE/4 ){ | 1971 | if (info->tty->flip.count < TTY_FLIPBUF_SIZE / 4) { |
1896 | info->IER |= MOXA_MUST_RECV_ISR; | 1972 | info->IER |= MOXA_MUST_RECV_ISR; |
1897 | outb(info->IER, info->base + UART_IER); | 1973 | outb(info->IER, info->base + UART_IER); |
1898 | } | 1974 | } |
@@ -1908,18 +1984,15 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1908 | status = inb(info->base + UART_LSR) & info->read_status_mask; | 1984 | status = inb(info->base + UART_LSR) & info->read_status_mask; |
1909 | */ | 1985 | */ |
1910 | 1986 | ||
1911 | // following add by Victor Yu. 09-02-2002 | 1987 | /* following add by Victor Yu. 09-02-2002 */ |
1912 | status = inb(info->base + UART_LSR); | 1988 | status = inb(info->base + UART_LSR); |
1913 | 1989 | ||
1914 | if (status & UART_LSR_PE) { | 1990 | if (status & UART_LSR_PE) |
1915 | info->err_shadow |= NPPI_NOTIFY_PARITY; | 1991 | info->err_shadow |= NPPI_NOTIFY_PARITY; |
1916 | } | 1992 | if (status & UART_LSR_FE) |
1917 | if (status & UART_LSR_FE) { | ||
1918 | info->err_shadow |= NPPI_NOTIFY_FRAMING; | 1993 | info->err_shadow |= NPPI_NOTIFY_FRAMING; |
1919 | } | 1994 | if (status & UART_LSR_OE) |
1920 | if (status & UART_LSR_OE) { | ||
1921 | info->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; | 1995 | info->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; |
1922 | } | ||
1923 | if (status & UART_LSR_BI) | 1996 | if (status & UART_LSR_BI) |
1924 | info->err_shadow |= NPPI_NOTIFY_BREAK; | 1997 | info->err_shadow |= NPPI_NOTIFY_BREAK; |
1925 | 1998 | ||
@@ -1930,11 +2003,14 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1930 | continue; | 2003 | continue; |
1931 | } | 2004 | } |
1932 | */ | 2005 | */ |
1933 | if (iir == MOXA_MUST_IIR_GDA || iir == MOXA_MUST_IIR_RDA || iir == MOXA_MUST_IIR_RTO || iir == MOXA_MUST_IIR_LSR) | 2006 | if (iir == MOXA_MUST_IIR_GDA || |
2007 | iir == MOXA_MUST_IIR_RDA || | ||
2008 | iir == MOXA_MUST_IIR_RTO || | ||
2009 | iir == MOXA_MUST_IIR_LSR) | ||
1934 | mxser_receive_chars(info, &status); | 2010 | mxser_receive_chars(info, &status); |
1935 | 2011 | ||
1936 | } else { | 2012 | } else { |
1937 | // above add by Victor Yu. 09-02-2002 | 2013 | /* above add by Victor Yu. 09-02-2002 */ |
1938 | 2014 | ||
1939 | status &= info->read_status_mask; | 2015 | status &= info->read_status_mask; |
1940 | if (status & UART_LSR_DR) | 2016 | if (status & UART_LSR_DR) |
@@ -1944,13 +2020,13 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1944 | if (msr & UART_MSR_ANY_DELTA) { | 2020 | if (msr & UART_MSR_ANY_DELTA) { |
1945 | mxser_check_modem_status(info, msr); | 2021 | mxser_check_modem_status(info, msr); |
1946 | } | 2022 | } |
1947 | // following add by Victor Yu. 09-13-2002 | 2023 | /* following add by Victor Yu. 09-13-2002 */ |
1948 | if (info->IsMoxaMustChipFlag) { | 2024 | if (info->IsMoxaMustChipFlag) { |
1949 | if ((iir == 0x02) && (status & UART_LSR_THRE)) { | 2025 | if ((iir == 0x02) && (status & UART_LSR_THRE)) { |
1950 | mxser_transmit_chars(info); | 2026 | mxser_transmit_chars(info); |
1951 | } | 2027 | } |
1952 | } else { | 2028 | } else { |
1953 | // above add by Victor Yu. 09-13-2002 | 2029 | /* above add by Victor Yu. 09-13-2002 */ |
1954 | 2030 | ||
1955 | if (status & UART_LSR_THRE) { | 2031 | if (status & UART_LSR_THRE) { |
1956 | /* 8-2-99 by William | 2032 | /* 8-2-99 by William |
@@ -1966,7 +2042,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1966 | } | 2042 | } |
1967 | 2043 | ||
1968 | irq_stop: | 2044 | irq_stop: |
1969 | //spin_unlock(&gm_lock); | 2045 | /* spin_unlock(&gm_lock); */ |
1970 | return handled; | 2046 | return handled; |
1971 | } | 2047 | } |
1972 | 2048 | ||
@@ -1984,56 +2060,58 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) | |||
1984 | 2060 | ||
1985 | recv_room = tty->receive_room; | 2061 | recv_room = tty->receive_room; |
1986 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { | 2062 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { |
1987 | //mxser_throttle(tty); | 2063 | /* mxser_throttle(tty); */ |
1988 | mxser_stoprx(tty); | 2064 | mxser_stoprx(tty); |
1989 | //return; | 2065 | /* return; */ |
1990 | } | 2066 | } |
1991 | 2067 | ||
1992 | // following add by Victor Yu. 09-02-2002 | 2068 | /* following add by Victor Yu. 09-02-2002 */ |
1993 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { | 2069 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { |
1994 | 2070 | ||
1995 | if (*status & UART_LSR_SPECIAL) { | 2071 | if (*status & UART_LSR_SPECIAL) { |
1996 | goto intr_old; | 2072 | goto intr_old; |
1997 | } | 2073 | } |
1998 | // following add by Victor Yu. 02-11-2004 | 2074 | /* following add by Victor Yu. 02-11-2004 */ |
1999 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU860_HWID && (*status & MOXA_MUST_LSR_RERR)) | 2075 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU860_HWID && |
2076 | (*status & MOXA_MUST_LSR_RERR)) | ||
2000 | goto intr_old; | 2077 | goto intr_old; |
2001 | // above add by Victor Yu. 02-14-2004 | 2078 | /* above add by Victor Yu. 02-14-2004 */ |
2002 | if (*status & MOXA_MUST_LSR_RERR) | 2079 | if (*status & MOXA_MUST_LSR_RERR) |
2003 | goto intr_old; | 2080 | goto intr_old; |
2004 | 2081 | ||
2005 | gdl = inb(info->base + MOXA_MUST_GDL_REGISTER); | 2082 | gdl = inb(info->base + MOXA_MUST_GDL_REGISTER); |
2006 | 2083 | ||
2007 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU150_HWID) // add by Victor Yu. 02-11-2004 | 2084 | /* add by Victor Yu. 02-11-2004 */ |
2085 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU150_HWID) | ||
2008 | gdl &= MOXA_MUST_GDL_MASK; | 2086 | gdl &= MOXA_MUST_GDL_MASK; |
2009 | if (gdl >= recv_room) { | 2087 | if (gdl >= recv_room) { |
2010 | if (!info->ldisc_stop_rx) { | 2088 | if (!info->ldisc_stop_rx) { |
2011 | //mxser_throttle(tty); | 2089 | /* mxser_throttle(tty); */ |
2012 | mxser_stoprx(tty); | 2090 | mxser_stoprx(tty); |
2013 | } | 2091 | } |
2014 | //return; | 2092 | /* return; */ |
2015 | } | 2093 | } |
2016 | while (gdl--) { | 2094 | while (gdl--) { |
2017 | ch = inb(info->base + UART_RX); | 2095 | ch = inb(info->base + UART_RX); |
2018 | tty_insert_flip_char(tty, ch, 0); | 2096 | tty_insert_flip_char(tty, ch, 0); |
2019 | cnt++; | 2097 | cnt++; |
2020 | /* | 2098 | /* |
2021 | if((cnt>=HI_WATER) && (info->stop_rx==0)){ | 2099 | if ((cnt >= HI_WATER) && (info->stop_rx == 0)) { |
2022 | mxser_stoprx(tty); | 2100 | mxser_stoprx(tty); |
2023 | info->stop_rx=1; | 2101 | info->stop_rx = 1; |
2024 | break; | 2102 | break; |
2025 | } */ | 2103 | } */ |
2026 | } | 2104 | } |
2027 | goto end_intr; | 2105 | goto end_intr; |
2028 | } | 2106 | } |
2029 | intr_old: | 2107 | intr_old: |
2030 | // above add by Victor Yu. 09-02-2002 | 2108 | /* above add by Victor Yu. 09-02-2002 */ |
2031 | 2109 | ||
2032 | do { | 2110 | do { |
2033 | if (max-- < 0) | 2111 | if (max-- < 0) |
2034 | break; | 2112 | break; |
2035 | /* | 2113 | /* |
2036 | if((cnt>=HI_WATER) && (info->stop_rx==0)){ | 2114 | if ((cnt >= HI_WATER) && (info->stop_rx == 0)) { |
2037 | mxser_stoprx(tty); | 2115 | mxser_stoprx(tty); |
2038 | info->stop_rx=1; | 2116 | info->stop_rx=1; |
2039 | break; | 2117 | break; |
@@ -2041,11 +2119,11 @@ intr_old: | |||
2041 | */ | 2119 | */ |
2042 | 2120 | ||
2043 | ch = inb(info->base + UART_RX); | 2121 | ch = inb(info->base + UART_RX); |
2044 | // following add by Victor Yu. 09-02-2002 | 2122 | /* following add by Victor Yu. 09-02-2002 */ |
2045 | if (info->IsMoxaMustChipFlag && (*status & UART_LSR_OE) /*&& !(*status&UART_LSR_DR) */ ) | 2123 | if (info->IsMoxaMustChipFlag && (*status & UART_LSR_OE) /*&& !(*status&UART_LSR_DR) */ ) |
2046 | outb(0x23, info->base + UART_FCR); | 2124 | outb(0x23, info->base + UART_FCR); |
2047 | *status &= info->read_status_mask; | 2125 | *status &= info->read_status_mask; |
2048 | // above add by Victor Yu. 09-02-2002 | 2126 | /* above add by Victor Yu. 09-02-2002 */ |
2049 | if (*status & info->ignore_status_mask) { | 2127 | if (*status & info->ignore_status_mask) { |
2050 | if (++ignored > 100) | 2128 | if (++ignored > 100) |
2051 | break; | 2129 | break; |
@@ -2080,7 +2158,7 @@ intr_old: | |||
2080 | cnt++; | 2158 | cnt++; |
2081 | if (cnt >= recv_room) { | 2159 | if (cnt >= recv_room) { |
2082 | if (!info->ldisc_stop_rx) { | 2160 | if (!info->ldisc_stop_rx) { |
2083 | //mxser_throttle(tty); | 2161 | /* mxser_throttle(tty); */ |
2084 | mxser_stoprx(tty); | 2162 | mxser_stoprx(tty); |
2085 | } | 2163 | } |
2086 | break; | 2164 | break; |
@@ -2088,21 +2166,20 @@ intr_old: | |||
2088 | 2166 | ||
2089 | } | 2167 | } |
2090 | 2168 | ||
2091 | // following add by Victor Yu. 09-02-2002 | 2169 | /* following add by Victor Yu. 09-02-2002 */ |
2092 | if (info->IsMoxaMustChipFlag) | 2170 | if (info->IsMoxaMustChipFlag) |
2093 | break; | 2171 | break; |
2094 | // above add by Victor Yu. 09-02-2002 | 2172 | /* above add by Victor Yu. 09-02-2002 */ |
2095 | 2173 | ||
2096 | /* mask by Victor Yu. 09-02-2002 | 2174 | /* mask by Victor Yu. 09-02-2002 |
2097 | *status = inb(info->base + UART_LSR) & info->read_status_mask; | 2175 | *status = inb(info->base + UART_LSR) & info->read_status_mask; |
2098 | */ | 2176 | */ |
2099 | // following add by Victor Yu. 09-02-2002 | 2177 | /* following add by Victor Yu. 09-02-2002 */ |
2100 | *status = inb(info->base + UART_LSR); | 2178 | *status = inb(info->base + UART_LSR); |
2101 | // above add by Victor Yu. 09-02-2002 | 2179 | /* above add by Victor Yu. 09-02-2002 */ |
2102 | } while (*status & UART_LSR_DR); | 2180 | } while (*status & UART_LSR_DR); |
2103 | 2181 | ||
2104 | end_intr: // add by Victor Yu. 09-02-2002 | 2182 | end_intr: /* add by Victor Yu. 09-02-2002 */ |
2105 | |||
2106 | mxvar_log.rxcnt[info->port] += cnt; | 2183 | mxvar_log.rxcnt[info->port] += cnt; |
2107 | info->mon_data.rxcnt += cnt; | 2184 | info->mon_data.rxcnt += cnt; |
2108 | info->mon_data.up_rxcnt += cnt; | 2185 | info->mon_data.up_rxcnt += cnt; |
@@ -2137,7 +2214,10 @@ static void mxser_transmit_chars(struct mxser_struct *info) | |||
2137 | return; | 2214 | return; |
2138 | } | 2215 | } |
2139 | 2216 | ||
2140 | if ((info->xmit_cnt <= 0) || info->tty->stopped || (info->tty->hw_stopped && (info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag))) { | 2217 | if ((info->xmit_cnt <= 0) || info->tty->stopped || |
2218 | (info->tty->hw_stopped && | ||
2219 | (info->type != PORT_16550A) && | ||
2220 | (!info->IsMoxaMustChipFlag))) { | ||
2141 | info->IER &= ~UART_IER_THRI; | 2221 | info->IER &= ~UART_IER_THRI; |
2142 | outb(info->IER, info->base + UART_IER); | 2222 | outb(info->IER, info->base + UART_IER); |
2143 | spin_unlock_irqrestore(&info->slock, flags); | 2223 | spin_unlock_irqrestore(&info->slock, flags); |
@@ -2147,17 +2227,18 @@ static void mxser_transmit_chars(struct mxser_struct *info) | |||
2147 | cnt = info->xmit_cnt; | 2227 | cnt = info->xmit_cnt; |
2148 | count = info->xmit_fifo_size; | 2228 | count = info->xmit_fifo_size; |
2149 | do { | 2229 | do { |
2150 | outb(info->xmit_buf[info->xmit_tail++], info->base + UART_TX); | 2230 | outb(info->xmit_buf[info->xmit_tail++], |
2231 | info->base + UART_TX); | ||
2151 | info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE - 1); | 2232 | info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE - 1); |
2152 | if (--info->xmit_cnt <= 0) | 2233 | if (--info->xmit_cnt <= 0) |
2153 | break; | 2234 | break; |
2154 | } while (--count > 0); | 2235 | } while (--count > 0); |
2155 | mxvar_log.txcnt[info->port] += (cnt - info->xmit_cnt); | 2236 | mxvar_log.txcnt[info->port] += (cnt - info->xmit_cnt); |
2156 | 2237 | ||
2157 | // added by James 03-12-2004. | 2238 | /* added by James 03-12-2004. */ |
2158 | info->mon_data.txcnt += (cnt - info->xmit_cnt); | 2239 | info->mon_data.txcnt += (cnt - info->xmit_cnt); |
2159 | info->mon_data.up_txcnt += (cnt - info->xmit_cnt); | 2240 | info->mon_data.up_txcnt += (cnt - info->xmit_cnt); |
2160 | // (above) added by James. | 2241 | /* (above) added by James. */ |
2161 | 2242 | ||
2162 | /* added by casper 1/11/2000 */ | 2243 | /* added by casper 1/11/2000 */ |
2163 | info->icount.tx += (cnt - info->xmit_cnt); | 2244 | info->icount.tx += (cnt - info->xmit_cnt); |
@@ -2188,7 +2269,6 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2188 | info->mon_data.modem_status = status; | 2269 | info->mon_data.modem_status = status; |
2189 | wake_up_interruptible(&info->delta_msr_wait); | 2270 | wake_up_interruptible(&info->delta_msr_wait); |
2190 | 2271 | ||
2191 | |||
2192 | if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { | 2272 | if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { |
2193 | if (status & UART_MSR_DCD) | 2273 | if (status & UART_MSR_DCD) |
2194 | wake_up_interruptible(&info->open_wait); | 2274 | wake_up_interruptible(&info->open_wait); |
@@ -2200,7 +2280,8 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2200 | if (status & UART_MSR_CTS) { | 2280 | if (status & UART_MSR_CTS) { |
2201 | info->tty->hw_stopped = 0; | 2281 | info->tty->hw_stopped = 0; |
2202 | 2282 | ||
2203 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2283 | if ((info->type != PORT_16550A) && |
2284 | (!info->IsMoxaMustChipFlag)) { | ||
2204 | info->IER |= UART_IER_THRI; | 2285 | info->IER |= UART_IER_THRI; |
2205 | outb(info->IER, info->base + UART_IER); | 2286 | outb(info->IER, info->base + UART_IER); |
2206 | } | 2287 | } |
@@ -2209,7 +2290,8 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2209 | } else { | 2290 | } else { |
2210 | if (!(status & UART_MSR_CTS)) { | 2291 | if (!(status & UART_MSR_CTS)) { |
2211 | info->tty->hw_stopped = 1; | 2292 | info->tty->hw_stopped = 1; |
2212 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2293 | if ((info->type != PORT_16550A) && |
2294 | (!info->IsMoxaMustChipFlag)) { | ||
2213 | info->IER &= ~UART_IER_THRI; | 2295 | info->IER &= ~UART_IER_THRI; |
2214 | outb(info->IER, info->base + UART_IER); | 2296 | outb(info->IER, info->base + UART_IER); |
2215 | } | 2297 | } |
@@ -2231,7 +2313,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2231 | */ | 2313 | */ |
2232 | if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { | 2314 | if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { |
2233 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2315 | info->flags |= ASYNC_NORMAL_ACTIVE; |
2234 | return (0); | 2316 | return 0; |
2235 | } | 2317 | } |
2236 | 2318 | ||
2237 | if (tty->termios->c_cflag & CLOCAL) | 2319 | if (tty->termios->c_cflag & CLOCAL) |
@@ -2254,7 +2336,8 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2254 | info->blocked_open++; | 2336 | info->blocked_open++; |
2255 | while (1) { | 2337 | while (1) { |
2256 | spin_lock_irqsave(&info->slock, flags); | 2338 | spin_lock_irqsave(&info->slock, flags); |
2257 | outb(inb(info->base + UART_MCR) | UART_MCR_DTR | UART_MCR_RTS, info->base + UART_MCR); | 2339 | outb(inb(info->base + UART_MCR) | |
2340 | UART_MCR_DTR | UART_MCR_RTS, info->base + UART_MCR); | ||
2258 | spin_unlock_irqrestore(&info->slock, flags); | 2341 | spin_unlock_irqrestore(&info->slock, flags); |
2259 | set_current_state(TASK_INTERRUPTIBLE); | 2342 | set_current_state(TASK_INTERRUPTIBLE); |
2260 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)) { | 2343 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)) { |
@@ -2264,7 +2347,9 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2264 | retval = -ERESTARTSYS; | 2347 | retval = -ERESTARTSYS; |
2265 | break; | 2348 | break; |
2266 | } | 2349 | } |
2267 | if (!(info->flags & ASYNC_CLOSING) && (do_clocal || (inb(info->base + UART_MSR) & UART_MSR_DCD))) | 2350 | if (!(info->flags & ASYNC_CLOSING) && |
2351 | (do_clocal || | ||
2352 | (inb(info->base + UART_MSR) & UART_MSR_DCD))) | ||
2268 | break; | 2353 | break; |
2269 | if (signal_pending(current)) { | 2354 | if (signal_pending(current)) { |
2270 | retval = -ERESTARTSYS; | 2355 | retval = -ERESTARTSYS; |
@@ -2278,27 +2363,26 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2278 | info->count++; | 2363 | info->count++; |
2279 | info->blocked_open--; | 2364 | info->blocked_open--; |
2280 | if (retval) | 2365 | if (retval) |
2281 | return (retval); | 2366 | return retval; |
2282 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2367 | info->flags |= ASYNC_NORMAL_ACTIVE; |
2283 | return (0); | 2368 | return 0; |
2284 | } | 2369 | } |
2285 | 2370 | ||
2286 | static int mxser_startup(struct mxser_struct *info) | 2371 | static int mxser_startup(struct mxser_struct *info) |
2287 | { | 2372 | { |
2288 | |||
2289 | unsigned long page; | 2373 | unsigned long page; |
2290 | unsigned long flags; | 2374 | unsigned long flags; |
2291 | 2375 | ||
2292 | page = __get_free_page(GFP_KERNEL); | 2376 | page = __get_free_page(GFP_KERNEL); |
2293 | if (!page) | 2377 | if (!page) |
2294 | return (-ENOMEM); | 2378 | return -ENOMEM; |
2295 | 2379 | ||
2296 | spin_lock_irqsave(&info->slock, flags); | 2380 | spin_lock_irqsave(&info->slock, flags); |
2297 | 2381 | ||
2298 | if (info->flags & ASYNC_INITIALIZED) { | 2382 | if (info->flags & ASYNC_INITIALIZED) { |
2299 | free_page(page); | 2383 | free_page(page); |
2300 | spin_unlock_irqrestore(&info->slock, flags); | 2384 | spin_unlock_irqrestore(&info->slock, flags); |
2301 | return (0); | 2385 | return 0; |
2302 | } | 2386 | } |
2303 | 2387 | ||
2304 | if (!info->base || !info->type) { | 2388 | if (!info->base || !info->type) { |
@@ -2306,7 +2390,7 @@ static int mxser_startup(struct mxser_struct *info) | |||
2306 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2390 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
2307 | free_page(page); | 2391 | free_page(page); |
2308 | spin_unlock_irqrestore(&info->slock, flags); | 2392 | spin_unlock_irqrestore(&info->slock, flags); |
2309 | return (0); | 2393 | return 0; |
2310 | } | 2394 | } |
2311 | if (info->xmit_buf) | 2395 | if (info->xmit_buf) |
2312 | free_page(page); | 2396 | free_page(page); |
@@ -2318,9 +2402,12 @@ static int mxser_startup(struct mxser_struct *info) | |||
2318 | * (they will be reenabled in mxser_change_speed()) | 2402 | * (they will be reenabled in mxser_change_speed()) |
2319 | */ | 2403 | */ |
2320 | if (info->IsMoxaMustChipFlag) | 2404 | if (info->IsMoxaMustChipFlag) |
2321 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | 2405 | outb((UART_FCR_CLEAR_RCVR | |
2406 | UART_FCR_CLEAR_XMIT | | ||
2407 | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | ||
2322 | else | 2408 | else |
2323 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 2409 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
2410 | info->base + UART_FCR); | ||
2324 | 2411 | ||
2325 | /* | 2412 | /* |
2326 | * At this point there's no way the LSR could still be 0xFF; | 2413 | * At this point there's no way the LSR could still be 0xFF; |
@@ -2332,9 +2419,9 @@ static int mxser_startup(struct mxser_struct *info) | |||
2332 | if (capable(CAP_SYS_ADMIN)) { | 2419 | if (capable(CAP_SYS_ADMIN)) { |
2333 | if (info->tty) | 2420 | if (info->tty) |
2334 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2421 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
2335 | return (0); | 2422 | return 0; |
2336 | } else | 2423 | } else |
2337 | return (-ENODEV); | 2424 | return -ENODEV; |
2338 | } | 2425 | } |
2339 | 2426 | ||
2340 | /* | 2427 | /* |
@@ -2356,12 +2443,12 @@ static int mxser_startup(struct mxser_struct *info) | |||
2356 | * Finally, enable interrupts | 2443 | * Finally, enable interrupts |
2357 | */ | 2444 | */ |
2358 | info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; | 2445 | info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; |
2359 | // info->IER = UART_IER_RLSI | UART_IER_RDI; | 2446 | /* info->IER = UART_IER_RLSI | UART_IER_RDI; */ |
2360 | 2447 | ||
2361 | // following add by Victor Yu. 08-30-2002 | 2448 | /* following add by Victor Yu. 08-30-2002 */ |
2362 | if (info->IsMoxaMustChipFlag) | 2449 | if (info->IsMoxaMustChipFlag) |
2363 | info->IER |= MOXA_MUST_IER_EGDAI; | 2450 | info->IER |= MOXA_MUST_IER_EGDAI; |
2364 | // above add by Victor Yu. 08-30-2002 | 2451 | /* above add by Victor Yu. 08-30-2002 */ |
2365 | outb(info->IER, info->base + UART_IER); /* enable interrupts */ | 2452 | outb(info->IER, info->base + UART_IER); /* enable interrupts */ |
2366 | 2453 | ||
2367 | /* | 2454 | /* |
@@ -2383,7 +2470,7 @@ static int mxser_startup(struct mxser_struct *info) | |||
2383 | mxser_change_speed(info, NULL); | 2470 | mxser_change_speed(info, NULL); |
2384 | 2471 | ||
2385 | info->flags |= ASYNC_INITIALIZED; | 2472 | info->flags |= ASYNC_INITIALIZED; |
2386 | return (0); | 2473 | return 0; |
2387 | } | 2474 | } |
2388 | 2475 | ||
2389 | /* | 2476 | /* |
@@ -2421,12 +2508,15 @@ static void mxser_shutdown(struct mxser_struct *info) | |||
2421 | outb(info->MCR, info->base + UART_MCR); | 2508 | outb(info->MCR, info->base + UART_MCR); |
2422 | 2509 | ||
2423 | /* clear Rx/Tx FIFO's */ | 2510 | /* clear Rx/Tx FIFO's */ |
2424 | // following add by Victor Yu. 08-30-2002 | 2511 | /* following add by Victor Yu. 08-30-2002 */ |
2425 | if (info->IsMoxaMustChipFlag) | 2512 | if (info->IsMoxaMustChipFlag) |
2426 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | 2513 | outb((UART_FCR_CLEAR_RCVR | |
2514 | UART_FCR_CLEAR_XMIT | | ||
2515 | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | ||
2427 | else | 2516 | else |
2428 | // above add by Victor Yu. 08-30-2002 | 2517 | /* above add by Victor Yu. 08-30-2002 */ |
2429 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 2518 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
2519 | info->base + UART_FCR); | ||
2430 | 2520 | ||
2431 | /* read data port to reset things */ | 2521 | /* read data port to reset things */ |
2432 | (void) inb(info->base + UART_RX); | 2522 | (void) inb(info->base + UART_RX); |
@@ -2436,11 +2526,10 @@ static void mxser_shutdown(struct mxser_struct *info) | |||
2436 | 2526 | ||
2437 | info->flags &= ~ASYNC_INITIALIZED; | 2527 | info->flags &= ~ASYNC_INITIALIZED; |
2438 | 2528 | ||
2439 | // following add by Victor Yu. 09-23-2002 | 2529 | /* following add by Victor Yu. 09-23-2002 */ |
2440 | if (info->IsMoxaMustChipFlag) { | 2530 | if (info->IsMoxaMustChipFlag) |
2441 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->base); | 2531 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->base); |
2442 | } | 2532 | /* above add by Victor Yu. 09-23-2002 */ |
2443 | // above add by Victor Yu. 09-23-2002 | ||
2444 | 2533 | ||
2445 | spin_unlock_irqrestore(&info->slock, flags); | 2534 | spin_unlock_irqrestore(&info->slock, flags); |
2446 | } | 2535 | } |
@@ -2457,14 +2546,12 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2457 | long baud; | 2546 | long baud; |
2458 | unsigned long flags; | 2547 | unsigned long flags; |
2459 | 2548 | ||
2460 | |||
2461 | if (!info->tty || !info->tty->termios) | 2549 | if (!info->tty || !info->tty->termios) |
2462 | return ret; | 2550 | return ret; |
2463 | cflag = info->tty->termios->c_cflag; | 2551 | cflag = info->tty->termios->c_cflag; |
2464 | if (!(info->base)) | 2552 | if (!(info->base)) |
2465 | return ret; | 2553 | return ret; |
2466 | 2554 | ||
2467 | |||
2468 | #ifndef B921600 | 2555 | #ifndef B921600 |
2469 | #define B921600 (B460800 +1) | 2556 | #define B921600 (B460800 +1) |
2470 | #endif | 2557 | #endif |
@@ -2559,9 +2646,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2559 | cval |= 0x04; | 2646 | cval |= 0x04; |
2560 | if (cflag & PARENB) | 2647 | if (cflag & PARENB) |
2561 | cval |= UART_LCR_PARITY; | 2648 | cval |= UART_LCR_PARITY; |
2562 | if (!(cflag & PARODD)) { | 2649 | if (!(cflag & PARODD)) |
2563 | cval |= UART_LCR_EPAR; | 2650 | cval |= UART_LCR_EPAR; |
2564 | } | ||
2565 | if (cflag & CMSPAR) | 2651 | if (cflag & CMSPAR) |
2566 | cval |= UART_LCR_SPAR; | 2652 | cval |= UART_LCR_SPAR; |
2567 | 2653 | ||
@@ -2574,13 +2660,12 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2574 | fcr = 0; | 2660 | fcr = 0; |
2575 | } else { | 2661 | } else { |
2576 | fcr = UART_FCR_ENABLE_FIFO; | 2662 | fcr = UART_FCR_ENABLE_FIFO; |
2577 | // following add by Victor Yu. 08-30-2002 | 2663 | /* following add by Victor Yu. 08-30-2002 */ |
2578 | if (info->IsMoxaMustChipFlag) { | 2664 | if (info->IsMoxaMustChipFlag) { |
2579 | fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; | 2665 | fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; |
2580 | SET_MOXA_MUST_FIFO_VALUE(info); | 2666 | SET_MOXA_MUST_FIFO_VALUE(info); |
2581 | } else { | 2667 | } else { |
2582 | // above add by Victor Yu. 08-30-2002 | 2668 | /* above add by Victor Yu. 08-30-2002 */ |
2583 | |||
2584 | switch (info->rx_trigger) { | 2669 | switch (info->rx_trigger) { |
2585 | case 1: | 2670 | case 1: |
2586 | fcr |= UART_FCR_TRIGGER_1; | 2671 | fcr |= UART_FCR_TRIGGER_1; |
@@ -2606,22 +2691,24 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2606 | info->IER |= UART_IER_MSI; | 2691 | info->IER |= UART_IER_MSI; |
2607 | if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { | 2692 | if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { |
2608 | info->MCR |= UART_MCR_AFE; | 2693 | info->MCR |= UART_MCR_AFE; |
2609 | //status = mxser_get_msr(info->base, 0, info->port); | 2694 | /* status = mxser_get_msr(info->base, 0, info->port); */ |
2610 | /* save_flags(flags); | 2695 | /* |
2696 | save_flags(flags); | ||
2611 | cli(); | 2697 | cli(); |
2612 | status = inb(baseaddr + UART_MSR); | 2698 | status = inb(baseaddr + UART_MSR); |
2613 | restore_flags(flags);*/ | 2699 | restore_flags(flags); |
2614 | //mxser_check_modem_status(info, status); | 2700 | */ |
2701 | /* mxser_check_modem_status(info, status); */ | ||
2615 | } else { | 2702 | } else { |
2616 | //status = mxser_get_msr(info->base, 0, info->port); | 2703 | /* status = mxser_get_msr(info->base, 0, info->port); */ |
2617 | 2704 | /* MX_LOCK(&info->slock); */ | |
2618 | //MX_LOCK(&info->slock); | ||
2619 | status = inb(info->base + UART_MSR); | 2705 | status = inb(info->base + UART_MSR); |
2620 | //MX_UNLOCK(&info->slock); | 2706 | /* MX_UNLOCK(&info->slock); */ |
2621 | if (info->tty->hw_stopped) { | 2707 | if (info->tty->hw_stopped) { |
2622 | if (status & UART_MSR_CTS) { | 2708 | if (status & UART_MSR_CTS) { |
2623 | info->tty->hw_stopped = 0; | 2709 | info->tty->hw_stopped = 0; |
2624 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2710 | if ((info->type != PORT_16550A) && |
2711 | (!info->IsMoxaMustChipFlag)) { | ||
2625 | info->IER |= UART_IER_THRI; | 2712 | info->IER |= UART_IER_THRI; |
2626 | outb(info->IER, info->base + UART_IER); | 2713 | outb(info->IER, info->base + UART_IER); |
2627 | } | 2714 | } |
@@ -2630,7 +2717,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2630 | } else { | 2717 | } else { |
2631 | if (!(status & UART_MSR_CTS)) { | 2718 | if (!(status & UART_MSR_CTS)) { |
2632 | info->tty->hw_stopped = 1; | 2719 | info->tty->hw_stopped = 1; |
2633 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2720 | if ((info->type != PORT_16550A) && |
2721 | (!info->IsMoxaMustChipFlag)) { | ||
2634 | info->IER &= ~UART_IER_THRI; | 2722 | info->IER &= ~UART_IER_THRI; |
2635 | outb(info->IER, info->base + UART_IER); | 2723 | outb(info->IER, info->base + UART_IER); |
2636 | } | 2724 | } |
@@ -2668,11 +2756,17 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2668 | * overruns too. (For real raw support). | 2756 | * overruns too. (For real raw support). |
2669 | */ | 2757 | */ |
2670 | if (I_IGNPAR(info->tty)) { | 2758 | if (I_IGNPAR(info->tty)) { |
2671 | info->ignore_status_mask |= UART_LSR_OE | UART_LSR_PE | UART_LSR_FE; | 2759 | info->ignore_status_mask |= |
2672 | info->read_status_mask |= UART_LSR_OE | UART_LSR_PE | UART_LSR_FE; | 2760 | UART_LSR_OE | |
2761 | UART_LSR_PE | | ||
2762 | UART_LSR_FE; | ||
2763 | info->read_status_mask |= | ||
2764 | UART_LSR_OE | | ||
2765 | UART_LSR_PE | | ||
2766 | UART_LSR_FE; | ||
2673 | } | 2767 | } |
2674 | } | 2768 | } |
2675 | // following add by Victor Yu. 09-02-2002 | 2769 | /* following add by Victor Yu. 09-02-2002 */ |
2676 | if (info->IsMoxaMustChipFlag) { | 2770 | if (info->IsMoxaMustChipFlag) { |
2677 | spin_lock_irqsave(&info->slock, flags); | 2771 | spin_lock_irqsave(&info->slock, flags); |
2678 | SET_MOXA_MUST_XON1_VALUE(info->base, START_CHAR(info->tty)); | 2772 | SET_MOXA_MUST_XON1_VALUE(info->base, START_CHAR(info->tty)); |
@@ -2698,7 +2792,7 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2698 | */ | 2792 | */ |
2699 | spin_unlock_irqrestore(&info->slock, flags); | 2793 | spin_unlock_irqrestore(&info->slock, flags); |
2700 | } | 2794 | } |
2701 | // above add by Victor Yu. 09-02-2002 | 2795 | /* above add by Victor Yu. 09-02-2002 */ |
2702 | 2796 | ||
2703 | 2797 | ||
2704 | outb(fcr, info->base + UART_FCR); /* set fcr */ | 2798 | outb(fcr, info->base + UART_FCR); /* set fcr */ |
@@ -2729,10 +2823,8 @@ static int mxser_set_baud(struct mxser_struct *info, long newspd) | |||
2729 | quot = (2 * info->baud_base / 269); | 2823 | quot = (2 * info->baud_base / 269); |
2730 | } else if (newspd) { | 2824 | } else if (newspd) { |
2731 | quot = info->baud_base / newspd; | 2825 | quot = info->baud_base / newspd; |
2732 | |||
2733 | if (quot == 0) | 2826 | if (quot == 0) |
2734 | quot = 1; | 2827 | quot = 1; |
2735 | |||
2736 | } else { | 2828 | } else { |
2737 | quot = 0; | 2829 | quot = 0; |
2738 | } | 2830 | } |
@@ -2765,8 +2857,6 @@ static int mxser_set_baud(struct mxser_struct *info, long newspd) | |||
2765 | return ret; | 2857 | return ret; |
2766 | } | 2858 | } |
2767 | 2859 | ||
2768 | |||
2769 | |||
2770 | /* | 2860 | /* |
2771 | * ------------------------------------------------------------ | 2861 | * ------------------------------------------------------------ |
2772 | * friends of mxser_ioctl() | 2862 | * friends of mxser_ioctl() |
@@ -2777,7 +2867,7 @@ static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct | |||
2777 | struct serial_struct tmp; | 2867 | struct serial_struct tmp; |
2778 | 2868 | ||
2779 | if (!retinfo) | 2869 | if (!retinfo) |
2780 | return (-EFAULT); | 2870 | return -EFAULT; |
2781 | memset(&tmp, 0, sizeof(tmp)); | 2871 | memset(&tmp, 0, sizeof(tmp)); |
2782 | tmp.type = info->type; | 2872 | tmp.type = info->type; |
2783 | tmp.line = info->port; | 2873 | tmp.line = info->port; |
@@ -2791,7 +2881,7 @@ static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct | |||
2791 | tmp.hub6 = 0; | 2881 | tmp.hub6 = 0; |
2792 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) | 2882 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) |
2793 | return -EFAULT; | 2883 | return -EFAULT; |
2794 | return (0); | 2884 | return 0; |
2795 | } | 2885 | } |
2796 | 2886 | ||
2797 | static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct __user *new_info) | 2887 | static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct __user *new_info) |
@@ -2801,29 +2891,37 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2801 | int retval = 0; | 2891 | int retval = 0; |
2802 | 2892 | ||
2803 | if (!new_info || !info->base) | 2893 | if (!new_info || !info->base) |
2804 | return (-EFAULT); | 2894 | return -EFAULT; |
2805 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) | 2895 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) |
2806 | return -EFAULT; | 2896 | return -EFAULT; |
2807 | 2897 | ||
2808 | if ((new_serial.irq != info->irq) || (new_serial.port != info->base) || (new_serial.custom_divisor != info->custom_divisor) || (new_serial.baud_base != info->baud_base)) | 2898 | if ((new_serial.irq != info->irq) || |
2809 | return (-EPERM); | 2899 | (new_serial.port != info->base) || |
2900 | (new_serial.custom_divisor != info->custom_divisor) || | ||
2901 | (new_serial.baud_base != info->baud_base)) | ||
2902 | return -EPERM; | ||
2810 | 2903 | ||
2811 | flags = info->flags & ASYNC_SPD_MASK; | 2904 | flags = info->flags & ASYNC_SPD_MASK; |
2812 | 2905 | ||
2813 | if (!capable(CAP_SYS_ADMIN)) { | 2906 | if (!capable(CAP_SYS_ADMIN)) { |
2814 | if ((new_serial.baud_base != info->baud_base) || (new_serial.close_delay != info->close_delay) || ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) | 2907 | if ((new_serial.baud_base != info->baud_base) || |
2815 | return (-EPERM); | 2908 | (new_serial.close_delay != info->close_delay) || |
2816 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | (new_serial.flags & ASYNC_USR_MASK)); | 2909 | ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) |
2910 | return -EPERM; | ||
2911 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | ||
2912 | (new_serial.flags & ASYNC_USR_MASK)); | ||
2817 | } else { | 2913 | } else { |
2818 | /* | 2914 | /* |
2819 | * OK, past this point, all the error checking has been done. | 2915 | * OK, past this point, all the error checking has been done. |
2820 | * At this point, we start making changes..... | 2916 | * At this point, we start making changes..... |
2821 | */ | 2917 | */ |
2822 | info->flags = ((info->flags & ~ASYNC_FLAGS) | (new_serial.flags & ASYNC_FLAGS)); | 2918 | info->flags = ((info->flags & ~ASYNC_FLAGS) | |
2919 | (new_serial.flags & ASYNC_FLAGS)); | ||
2823 | info->close_delay = new_serial.close_delay * HZ / 100; | 2920 | info->close_delay = new_serial.close_delay * HZ / 100; |
2824 | info->closing_wait = new_serial.closing_wait * HZ / 100; | 2921 | info->closing_wait = new_serial.closing_wait * HZ / 100; |
2825 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 2922 | info->tty->low_latency = |
2826 | info->tty->low_latency = 0; //(info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 2923 | (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
2924 | info->tty->low_latency = 0; /* (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; */ | ||
2827 | } | 2925 | } |
2828 | 2926 | ||
2829 | /* added by casper, 3/17/2000, for mouse */ | 2927 | /* added by casper, 3/17/2000, for mouse */ |
@@ -2831,7 +2929,6 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2831 | 2929 | ||
2832 | process_txrx_fifo(info); | 2930 | process_txrx_fifo(info); |
2833 | 2931 | ||
2834 | /* */ | ||
2835 | if (info->flags & ASYNC_INITIALIZED) { | 2932 | if (info->flags & ASYNC_INITIALIZED) { |
2836 | if (flags != (info->flags & ASYNC_SPD_MASK)) { | 2933 | if (flags != (info->flags & ASYNC_SPD_MASK)) { |
2837 | mxser_change_speed(info, NULL); | 2934 | mxser_change_speed(info, NULL); |
@@ -2839,7 +2936,7 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2839 | } else { | 2936 | } else { |
2840 | retval = mxser_startup(info); | 2937 | retval = mxser_startup(info); |
2841 | } | 2938 | } |
2842 | return (retval); | 2939 | return retval; |
2843 | } | 2940 | } |
2844 | 2941 | ||
2845 | /* | 2942 | /* |
@@ -2876,11 +2973,13 @@ static void mxser_send_break(struct mxser_struct *info, int duration) | |||
2876 | return; | 2973 | return; |
2877 | set_current_state(TASK_INTERRUPTIBLE); | 2974 | set_current_state(TASK_INTERRUPTIBLE); |
2878 | spin_lock_irqsave(&info->slock, flags); | 2975 | spin_lock_irqsave(&info->slock, flags); |
2879 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, info->base + UART_LCR); | 2976 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, |
2977 | info->base + UART_LCR); | ||
2880 | spin_unlock_irqrestore(&info->slock, flags); | 2978 | spin_unlock_irqrestore(&info->slock, flags); |
2881 | schedule_timeout(duration); | 2979 | schedule_timeout(duration); |
2882 | spin_lock_irqsave(&info->slock, flags); | 2980 | spin_lock_irqsave(&info->slock, flags); |
2883 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, info->base + UART_LCR); | 2981 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, |
2982 | info->base + UART_LCR); | ||
2884 | spin_unlock_irqrestore(&info->slock, flags); | 2983 | spin_unlock_irqrestore(&info->slock, flags); |
2885 | } | 2984 | } |
2886 | 2985 | ||
@@ -2892,9 +2991,9 @@ static int mxser_tiocmget(struct tty_struct *tty, struct file *file) | |||
2892 | 2991 | ||
2893 | 2992 | ||
2894 | if (tty->index == MXSER_PORTS) | 2993 | if (tty->index == MXSER_PORTS) |
2895 | return (-ENOIOCTLCMD); | 2994 | return -ENOIOCTLCMD; |
2896 | if (tty->flags & (1 << TTY_IO_ERROR)) | 2995 | if (tty->flags & (1 << TTY_IO_ERROR)) |
2897 | return (-EIO); | 2996 | return -EIO; |
2898 | 2997 | ||
2899 | control = info->MCR; | 2998 | control = info->MCR; |
2900 | 2999 | ||
@@ -2904,7 +3003,11 @@ static int mxser_tiocmget(struct tty_struct *tty, struct file *file) | |||
2904 | mxser_check_modem_status(info, status); | 3003 | mxser_check_modem_status(info, status); |
2905 | spin_unlock_irqrestore(&info->slock, flags); | 3004 | spin_unlock_irqrestore(&info->slock, flags); |
2906 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | | 3005 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | |
2907 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | 3006 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | |
3007 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | | ||
3008 | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | | ||
3009 | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | | ||
3010 | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | ||
2908 | } | 3011 | } |
2909 | 3012 | ||
2910 | static int mxser_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) | 3013 | static int mxser_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) |
@@ -2968,38 +3071,36 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
2968 | hwconf->board_type = MXSER_BOARD_CI104J; | 3071 | hwconf->board_type = MXSER_BOARD_CI104J; |
2969 | hwconf->ports = 4; | 3072 | hwconf->ports = 4; |
2970 | } else | 3073 | } else |
2971 | return (0); | 3074 | return 0; |
2972 | 3075 | ||
2973 | irq = 0; | 3076 | irq = 0; |
2974 | if (hwconf->ports == 2) { | 3077 | if (hwconf->ports == 2) { |
2975 | irq = regs[9] & 0xF000; | 3078 | irq = regs[9] & 0xF000; |
2976 | irq = irq | (irq >> 4); | 3079 | irq = irq | (irq >> 4); |
2977 | if (irq != (regs[9] & 0xFF00)) | 3080 | if (irq != (regs[9] & 0xFF00)) |
2978 | return (MXSER_ERR_IRQ_CONFLIT); | 3081 | return MXSER_ERR_IRQ_CONFLIT; |
2979 | } else if (hwconf->ports == 4) { | 3082 | } else if (hwconf->ports == 4) { |
2980 | irq = regs[9] & 0xF000; | 3083 | irq = regs[9] & 0xF000; |
2981 | irq = irq | (irq >> 4); | 3084 | irq = irq | (irq >> 4); |
2982 | irq = irq | (irq >> 8); | 3085 | irq = irq | (irq >> 8); |
2983 | if (irq != regs[9]) | 3086 | if (irq != regs[9]) |
2984 | return (MXSER_ERR_IRQ_CONFLIT); | 3087 | return MXSER_ERR_IRQ_CONFLIT; |
2985 | } else if (hwconf->ports == 8) { | 3088 | } else if (hwconf->ports == 8) { |
2986 | irq = regs[9] & 0xF000; | 3089 | irq = regs[9] & 0xF000; |
2987 | irq = irq | (irq >> 4); | 3090 | irq = irq | (irq >> 4); |
2988 | irq = irq | (irq >> 8); | 3091 | irq = irq | (irq >> 8); |
2989 | if ((irq != regs[9]) || (irq != regs[10])) | 3092 | if ((irq != regs[9]) || (irq != regs[10])) |
2990 | return (MXSER_ERR_IRQ_CONFLIT); | 3093 | return MXSER_ERR_IRQ_CONFLIT; |
2991 | } | 3094 | } |
2992 | 3095 | ||
2993 | if (!irq) { | 3096 | if (!irq) |
2994 | return (MXSER_ERR_IRQ); | 3097 | return MXSER_ERR_IRQ; |
2995 | } | 3098 | hwconf->irq = ((int)(irq & 0xF000) >> 12); |
2996 | hwconf->irq = ((int) (irq & 0xF000) >> 12); | ||
2997 | for (i = 0; i < 8; i++) | 3099 | for (i = 0; i < 8; i++) |
2998 | hwconf->ioaddr[i] = (int) regs[i + 1] & 0xFFF8; | 3100 | hwconf->ioaddr[i] = (int) regs[i + 1] & 0xFFF8; |
2999 | if ((regs[12] & 0x80) == 0) { | 3101 | if ((regs[12] & 0x80) == 0) |
3000 | return (MXSER_ERR_VECTOR); | 3102 | return MXSER_ERR_VECTOR; |
3001 | } | 3103 | hwconf->vector = (int)regs[11]; /* interrupt vector */ |
3002 | hwconf->vector = (int) regs[11]; /* interrupt vector */ | ||
3003 | if (id == 1) | 3104 | if (id == 1) |
3004 | hwconf->vector_mask = 0x00FF; | 3105 | hwconf->vector_mask = 0x00FF; |
3005 | else | 3106 | else |
@@ -3007,10 +3108,10 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
3007 | for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) { | 3108 | for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) { |
3008 | if (regs[12] & bits) { | 3109 | if (regs[12] & bits) { |
3009 | hwconf->baud_base[i] = 921600; | 3110 | hwconf->baud_base[i] = 921600; |
3010 | hwconf->MaxCanSetBaudRate[i] = 921600; // add by Victor Yu. 09-04-2002 | 3111 | hwconf->MaxCanSetBaudRate[i] = 921600; /* add by Victor Yu. 09-04-2002 */ |
3011 | } else { | 3112 | } else { |
3012 | hwconf->baud_base[i] = 115200; | 3113 | hwconf->baud_base[i] = 115200; |
3013 | hwconf->MaxCanSetBaudRate[i] = 115200; // add by Victor Yu. 09-04-2002 | 3114 | hwconf->MaxCanSetBaudRate[i] = 115200; /* add by Victor Yu. 09-04-2002 */ |
3014 | } | 3115 | } |
3015 | } | 3116 | } |
3016 | scratch2 = inb(cap + UART_LCR) & (~UART_LCR_DLAB); | 3117 | scratch2 = inb(cap + UART_LCR) & (~UART_LCR_DLAB); |
@@ -3030,7 +3131,7 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
3030 | hwconf->ports = 4; | 3131 | hwconf->ports = 4; |
3031 | request_region(hwconf->ioaddr[0], 8 * hwconf->ports, "mxser(IO)"); | 3132 | request_region(hwconf->ioaddr[0], 8 * hwconf->ports, "mxser(IO)"); |
3032 | request_region(hwconf->vector, 1, "mxser(vector)"); | 3133 | request_region(hwconf->vector, 1, "mxser(vector)"); |
3033 | return (hwconf->ports); | 3134 | return hwconf->ports; |
3034 | } | 3135 | } |
3035 | 3136 | ||
3036 | #define CHIP_SK 0x01 /* Serial Data Clock in Eprom */ | 3137 | #define CHIP_SK 0x01 /* Serial Data Clock in Eprom */ |
@@ -3053,7 +3154,7 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3053 | 3154 | ||
3054 | id = mxser_program_mode(port); | 3155 | id = mxser_program_mode(port); |
3055 | if (id < 0) | 3156 | if (id < 0) |
3056 | return (id); | 3157 | return id; |
3057 | for (i = 0; i < 14; i++) { | 3158 | for (i = 0; i < 14; i++) { |
3058 | k = (i & 0x3F) | 0x180; | 3159 | k = (i & 0x3F) | 0x180; |
3059 | for (j = 0x100; j > 0; j >>= 1) { | 3160 | for (j = 0x100; j > 0; j >>= 1) { |
@@ -3066,7 +3167,7 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3066 | outb(CHIP_CS | CHIP_SK, port); /* A? bit of read */ | 3167 | outb(CHIP_CS | CHIP_SK, port); /* A? bit of read */ |
3067 | } | 3168 | } |
3068 | } | 3169 | } |
3069 | (void) inb(port); | 3170 | (void)inb(port); |
3070 | value = 0; | 3171 | value = 0; |
3071 | for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) { | 3172 | for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) { |
3072 | outb(CHIP_CS, port); | 3173 | outb(CHIP_CS, port); |
@@ -3078,28 +3179,33 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3078 | outb(0, port); | 3179 | outb(0, port); |
3079 | } | 3180 | } |
3080 | mxser_normal_mode(port); | 3181 | mxser_normal_mode(port); |
3081 | return (id); | 3182 | return id; |
3082 | } | 3183 | } |
3083 | 3184 | ||
3084 | static int mxser_program_mode(int port) | 3185 | static int mxser_program_mode(int port) |
3085 | { | 3186 | { |
3086 | int id, i, j, n; | 3187 | int id, i, j, n; |
3087 | //unsigned long flags; | 3188 | /* unsigned long flags; */ |
3088 | 3189 | ||
3089 | spin_lock(&gm_lock); | 3190 | spin_lock(&gm_lock); |
3090 | outb(0, port); | 3191 | outb(0, port); |
3091 | outb(0, port); | 3192 | outb(0, port); |
3092 | outb(0, port); | 3193 | outb(0, port); |
3093 | (void) inb(port); | 3194 | (void)inb(port); |
3094 | (void) inb(port); | 3195 | (void)inb(port); |
3095 | outb(0, port); | 3196 | outb(0, port); |
3096 | (void) inb(port); | 3197 | (void)inb(port); |
3097 | //restore_flags(flags); | 3198 | /* restore_flags(flags); */ |
3098 | spin_unlock(&gm_lock); | 3199 | spin_unlock(&gm_lock); |
3099 | 3200 | ||
3100 | id = inb(port + 1) & 0x1F; | 3201 | id = inb(port + 1) & 0x1F; |
3101 | if ((id != C168_ASIC_ID) && (id != C104_ASIC_ID) && (id != C102_ASIC_ID) && (id != CI132_ASIC_ID) && (id != CI134_ASIC_ID) && (id != CI104J_ASIC_ID)) | 3202 | if ((id != C168_ASIC_ID) && |
3102 | return (-1); | 3203 | (id != C104_ASIC_ID) && |
3204 | (id != C102_ASIC_ID) && | ||
3205 | (id != CI132_ASIC_ID) && | ||
3206 | (id != CI134_ASIC_ID) && | ||
3207 | (id != CI104J_ASIC_ID)) | ||
3208 | return -1; | ||
3103 | for (i = 0, j = 0; i < 4; i++) { | 3209 | for (i = 0, j = 0; i < 4; i++) { |
3104 | n = inb(port + 2); | 3210 | n = inb(port + 2); |
3105 | if (n == 'M') { | 3211 | if (n == 'M') { |
@@ -3112,7 +3218,7 @@ static int mxser_program_mode(int port) | |||
3112 | } | 3218 | } |
3113 | if (j != 2) | 3219 | if (j != 2) |
3114 | id = -2; | 3220 | id = -2; |
3115 | return (id); | 3221 | return id; |
3116 | } | 3222 | } |
3117 | 3223 | ||
3118 | static void mxser_normal_mode(int port) | 3224 | static void mxser_normal_mode(int port) |
@@ -3130,7 +3236,7 @@ static void mxser_normal_mode(int port) | |||
3130 | if ((n & 0x61) == 0x60) | 3236 | if ((n & 0x61) == 0x60) |
3131 | break; | 3237 | break; |
3132 | if ((n & 1) == 1) | 3238 | if ((n & 1) == 1) |
3133 | (void) inb(port); | 3239 | (void)inb(port); |
3134 | } | 3240 | } |
3135 | outb(0x00, port + 4); | 3241 | outb(0x00, port + 4); |
3136 | } | 3242 | } |