mos7840.c (3d7a96f5a485b7d06c2379f343d7312af89ec9e2) | mos7840.c (50de36f7af3b1d791c402478210790c582126fe5) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 200 unchanged lines hidden (view full) --- 209 struct urb *control_urb; 210 struct usb_ctrlrequest *dr; 211 char *ctrl_buf; 212 int MsrLsr; 213 214 spinlock_t pool_lock; 215 struct urb *write_urb_pool[NUM_URBS]; 216 char busy[NUM_URBS]; | 1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 200 unchanged lines hidden (view full) --- 209 struct urb *control_urb; 210 struct usb_ctrlrequest *dr; 211 char *ctrl_buf; 212 int MsrLsr; 213 214 spinlock_t pool_lock; 215 struct urb *write_urb_pool[NUM_URBS]; 216 char busy[NUM_URBS]; |
217 bool read_urb_busy; |
|
217}; 218 219 220static int debug; 221 222/* 223 * mos7840_set_reg_sync 224 * To set the Control register by calling usb_fill_control_urb function --- 449 unchanged lines hidden (view full) --- 674 int retval; 675 unsigned char *data; 676 struct usb_serial *serial; 677 struct usb_serial_port *port; 678 struct moschip_port *mos7840_port; 679 struct tty_struct *tty; 680 int status = urb->status; 681 | 218}; 219 220 221static int debug; 222 223/* 224 * mos7840_set_reg_sync 225 * To set the Control register by calling usb_fill_control_urb function --- 449 unchanged lines hidden (view full) --- 675 int retval; 676 unsigned char *data; 677 struct usb_serial *serial; 678 struct usb_serial_port *port; 679 struct moschip_port *mos7840_port; 680 struct tty_struct *tty; 681 int status = urb->status; 682 |
682 if (status) { 683 dbg("nonzero read bulk status received: %d", status); 684 return; 685 } 686 | |
687 mos7840_port = urb->context; 688 if (!mos7840_port) { 689 dbg("%s", "NULL mos7840_port pointer \n"); | 683 mos7840_port = urb->context; 684 if (!mos7840_port) { 685 dbg("%s", "NULL mos7840_port pointer \n"); |
686 mos7840_port->read_urb_busy = false; |
|
690 return; 691 } 692 | 687 return; 688 } 689 |
690 if (status) { 691 dbg("nonzero read bulk status received: %d", status); 692 mos7840_port->read_urb_busy = false; 693 return; 694 } 695 |
|
693 port = (struct usb_serial_port *)mos7840_port->port; 694 if (mos7840_port_paranoia_check(port, __func__)) { 695 dbg("%s", "Port Paranoia failed \n"); | 696 port = (struct usb_serial_port *)mos7840_port->port; 697 if (mos7840_port_paranoia_check(port, __func__)) { 698 dbg("%s", "Port Paranoia failed \n"); |
699 mos7840_port->read_urb_busy = false; |
|
696 return; 697 } 698 699 serial = mos7840_get_usb_serial(port, __func__); 700 if (!serial) { 701 dbg("%s\n", "Bad serial pointer "); | 700 return; 701 } 702 703 serial = mos7840_get_usb_serial(port, __func__); 704 if (!serial) { 705 dbg("%s\n", "Bad serial pointer "); |
706 mos7840_port->read_urb_busy = false; |
|
702 return; 703 } 704 705 dbg("%s\n", "Entering... \n"); 706 707 data = urb->transfer_buffer; 708 709 dbg("%s", "Entering ........... \n"); --- 10 unchanged lines hidden (view full) --- 720 mos7840_port->icount.rx += urb->actual_length; 721 smp_wmb(); 722 dbg("mos7840_port->icount.rx is %d:\n", 723 mos7840_port->icount.rx); 724 } 725 726 if (!mos7840_port->read_urb) { 727 dbg("%s", "URB KILLED !!!\n"); | 707 return; 708 } 709 710 dbg("%s\n", "Entering... \n"); 711 712 data = urb->transfer_buffer; 713 714 dbg("%s", "Entering ........... \n"); --- 10 unchanged lines hidden (view full) --- 725 mos7840_port->icount.rx += urb->actual_length; 726 smp_wmb(); 727 dbg("mos7840_port->icount.rx is %d:\n", 728 mos7840_port->icount.rx); 729 } 730 731 if (!mos7840_port->read_urb) { 732 dbg("%s", "URB KILLED !!!\n"); |
733 mos7840_port->read_urb_busy = false; |
|
728 return; 729 } 730 731 732 mos7840_port->read_urb->dev = serial->dev; 733 | 734 return; 735 } 736 737 738 mos7840_port->read_urb->dev = serial->dev; 739 |
740 mos7840_port->read_urb_busy = true; |
|
734 retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 735 736 if (retval) { | 741 retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 742 743 if (retval) { |
737 dbg(" usb_submit_urb(read bulk) failed, retval = %d", 738 retval); | 744 dbg("usb_submit_urb(read bulk) failed, retval = %d", retval); 745 mos7840_port->read_urb_busy = false; |
739 } 740} 741 742/***************************************************************************** 743 * mos7840_bulk_out_data_callback 744 * this is the callback function for when we have finished sending 745 * serial data on the bulk out endpoint. 746 *****************************************************************************/ --- 303 unchanged lines hidden (view full) --- 1050 usb_rcvbulkpipe(serial->dev, 1051 port->bulk_in_endpointAddress), 1052 port->bulk_in_buffer, 1053 mos7840_port->read_urb->transfer_buffer_length, 1054 mos7840_bulk_in_callback, mos7840_port); 1055 1056 dbg("mos7840_open: bulkin endpoint is %d\n", 1057 port->bulk_in_endpointAddress); | 746 } 747} 748 749/***************************************************************************** 750 * mos7840_bulk_out_data_callback 751 * this is the callback function for when we have finished sending 752 * serial data on the bulk out endpoint. 753 *****************************************************************************/ --- 303 unchanged lines hidden (view full) --- 1057 usb_rcvbulkpipe(serial->dev, 1058 port->bulk_in_endpointAddress), 1059 port->bulk_in_buffer, 1060 mos7840_port->read_urb->transfer_buffer_length, 1061 mos7840_bulk_in_callback, mos7840_port); 1062 1063 dbg("mos7840_open: bulkin endpoint is %d\n", 1064 port->bulk_in_endpointAddress); |
1065 mos7840_port->read_urb_busy = true; |
|
1058 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); 1059 if (response) { 1060 dev_err(&port->dev, "%s - Error %d submitting control urb\n", 1061 __func__, response); | 1066 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); 1067 if (response) { 1068 dev_err(&port->dev, "%s - Error %d submitting control urb\n", 1069 __func__, response); |
1070 mos7840_port->read_urb_busy = false; |
|
1062 } 1063 1064 /* initialize our wait queues */ 1065 init_waitqueue_head(&mos7840_port->wait_chase); 1066 init_waitqueue_head(&mos7840_port->delta_msr_wait); 1067 1068 /* initialize our icount structure */ 1069 memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); --- 152 unchanged lines hidden (view full) --- 1222 if (serial->dev) { 1223 if (mos7840_port->write_urb) { 1224 dbg("%s", "Shutdown bulk write\n"); 1225 usb_kill_urb(mos7840_port->write_urb); 1226 } 1227 if (mos7840_port->read_urb) { 1228 dbg("%s", "Shutdown bulk read\n"); 1229 usb_kill_urb(mos7840_port->read_urb); | 1071 } 1072 1073 /* initialize our wait queues */ 1074 init_waitqueue_head(&mos7840_port->wait_chase); 1075 init_waitqueue_head(&mos7840_port->delta_msr_wait); 1076 1077 /* initialize our icount structure */ 1078 memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); --- 152 unchanged lines hidden (view full) --- 1231 if (serial->dev) { 1232 if (mos7840_port->write_urb) { 1233 dbg("%s", "Shutdown bulk write\n"); 1234 usb_kill_urb(mos7840_port->write_urb); 1235 } 1236 if (mos7840_port->read_urb) { 1237 dbg("%s", "Shutdown bulk read\n"); 1238 usb_kill_urb(mos7840_port->read_urb); |
1239 mos7840_port->read_urb_busy = false; |
|
1230 } 1231 if ((&mos7840_port->control_urb)) { 1232 dbg("%s", "Shutdown control read\n"); 1233 /*/ usb_kill_urb (mos7840_port->control_urb); */ 1234 } 1235 } 1236/* if(mos7840_port->ctrl_buf != NULL) */ 1237/* kfree(mos7840_port->ctrl_buf); */ --- 800 unchanged lines hidden (view full) --- 2038 2039 dbg("%s - baud rate = %d", __func__, baud); 2040 status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); 2041 2042 /* Enable Interrupts */ 2043 Data = 0x0c; 2044 mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); 2045 | 1240 } 1241 if ((&mos7840_port->control_urb)) { 1242 dbg("%s", "Shutdown control read\n"); 1243 /*/ usb_kill_urb (mos7840_port->control_urb); */ 1244 } 1245 } 1246/* if(mos7840_port->ctrl_buf != NULL) */ 1247/* kfree(mos7840_port->ctrl_buf); */ --- 800 unchanged lines hidden (view full) --- 2048 2049 dbg("%s - baud rate = %d", __func__, baud); 2050 status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); 2051 2052 /* Enable Interrupts */ 2053 Data = 0x0c; 2054 mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); 2055 |
2046 if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2056 if (mos7840_port->read_urb_busy == false) { |
2047 mos7840_port->read_urb->dev = serial->dev; | 2057 mos7840_port->read_urb->dev = serial->dev; |
2048 | 2058 mos7840_port->read_urb_busy = true; |
2049 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2059 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2050 | |
2051 if (status) { | 2060 if (status) { |
2052 dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2061 dbg("usb_submit_urb(read bulk) failed, status = %d", |
2053 status); | 2062 status); |
2063 mos7840_port->read_urb_busy = false; |
|
2054 } 2055 } 2056 wake_up(&mos7840_port->delta_msr_wait); 2057 mos7840_port->delta_msr_cond = 1; 2058 dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x\n", 2059 mos7840_port->shadowLCR); 2060 2061 return; --- 50 unchanged lines hidden (view full) --- 2112 2113 mos7840_change_port_settings(tty, mos7840_port, old_termios); 2114 2115 if (!mos7840_port->read_urb) { 2116 dbg("%s", "URB KILLED !!!!!\n"); 2117 return; 2118 } 2119 | 2064 } 2065 } 2066 wake_up(&mos7840_port->delta_msr_wait); 2067 mos7840_port->delta_msr_cond = 1; 2068 dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x\n", 2069 mos7840_port->shadowLCR); 2070 2071 return; --- 50 unchanged lines hidden (view full) --- 2122 2123 mos7840_change_port_settings(tty, mos7840_port, old_termios); 2124 2125 if (!mos7840_port->read_urb) { 2126 dbg("%s", "URB KILLED !!!!!\n"); 2127 return; 2128 } 2129 |
2120 if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2130 if (mos7840_port->read_urb_busy == false) { |
2121 mos7840_port->read_urb->dev = serial->dev; | 2131 mos7840_port->read_urb->dev = serial->dev; |
2132 mos7840_port->read_urb_busy = true; |
|
2122 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 2123 if (status) { | 2133 status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); 2134 if (status) { |
2124 dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2135 dbg("usb_submit_urb(read bulk) failed, status = %d", |
2125 status); | 2136 status); |
2137 mos7840_port->read_urb_busy = false; |
|
2126 } 2127 } 2128 return; 2129} 2130 2131/***************************************************************************** 2132 * mos7840_get_lsr_info - get line status register info 2133 * --- 656 unchanged lines hidden --- | 2138 } 2139 } 2140 return; 2141} 2142 2143/***************************************************************************** 2144 * mos7840_get_lsr_info - get line status register info 2145 * --- 656 unchanged lines hidden --- |