diff options
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 358 |
1 files changed, 198 insertions, 160 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 10b78a37214f..c40f95c1951c 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -238,7 +238,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg, | |||
238 | { | 238 | { |
239 | struct usb_device *dev = port->serial->dev; | 239 | struct usb_device *dev = port->serial->dev; |
240 | val = val & 0x00ff; | 240 | val = val & 0x00ff; |
241 | dbg("mos7840_set_reg_sync offset is %x, value %x\n", reg, val); | 241 | dbg("mos7840_set_reg_sync offset is %x, value %x", reg, val); |
242 | 242 | ||
243 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, | 243 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, |
244 | MCS_WR_RTYPE, val, reg, NULL, 0, | 244 | MCS_WR_RTYPE, val, reg, NULL, 0, |
@@ -260,7 +260,7 @@ static int mos7840_get_reg_sync(struct usb_serial_port *port, __u16 reg, | |||
260 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ, | 260 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ, |
261 | MCS_RD_RTYPE, 0, reg, val, VENDOR_READ_LENGTH, | 261 | MCS_RD_RTYPE, 0, reg, val, VENDOR_READ_LENGTH, |
262 | MOS_WDR_TIMEOUT); | 262 | MOS_WDR_TIMEOUT); |
263 | dbg("mos7840_get_reg_sync offset is %x, return val %x\n", reg, *val); | 263 | dbg("mos7840_get_reg_sync offset is %x, return val %x", reg, *val); |
264 | *val = (*val) & 0x00ff; | 264 | *val = (*val) & 0x00ff; |
265 | return ret; | 265 | return ret; |
266 | } | 266 | } |
@@ -282,18 +282,18 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
282 | if (port->serial->num_ports == 4) { | 282 | if (port->serial->num_ports == 4) { |
283 | val |= (((__u16) port->number - | 283 | val |= (((__u16) port->number - |
284 | (__u16) (port->serial->minor)) + 1) << 8; | 284 | (__u16) (port->serial->minor)) + 1) << 8; |
285 | dbg("mos7840_set_uart_reg application number is %x\n", val); | 285 | dbg("mos7840_set_uart_reg application number is %x", val); |
286 | } else { | 286 | } else { |
287 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 287 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { |
288 | val |= (((__u16) port->number - | 288 | val |= (((__u16) port->number - |
289 | (__u16) (port->serial->minor)) + 1) << 8; | 289 | (__u16) (port->serial->minor)) + 1) << 8; |
290 | dbg("mos7840_set_uart_reg application number is %x\n", | 290 | dbg("mos7840_set_uart_reg application number is %x", |
291 | val); | 291 | val); |
292 | } else { | 292 | } else { |
293 | val |= | 293 | val |= |
294 | (((__u16) port->number - | 294 | (((__u16) port->number - |
295 | (__u16) (port->serial->minor)) + 2) << 8; | 295 | (__u16) (port->serial->minor)) + 2) << 8; |
296 | dbg("mos7840_set_uart_reg application number is %x\n", | 296 | dbg("mos7840_set_uart_reg application number is %x", |
297 | val); | 297 | val); |
298 | } | 298 | } |
299 | } | 299 | } |
@@ -315,24 +315,24 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
315 | int ret = 0; | 315 | int ret = 0; |
316 | __u16 Wval; | 316 | __u16 Wval; |
317 | 317 | ||
318 | /* dbg("application number is %4x \n", | 318 | /* dbg("application number is %4x", |
319 | (((__u16)port->number - (__u16)(port->serial->minor))+1)<<8); */ | 319 | (((__u16)port->number - (__u16)(port->serial->minor))+1)<<8); */ |
320 | /* Wval is same as application number */ | 320 | /* Wval is same as application number */ |
321 | if (port->serial->num_ports == 4) { | 321 | if (port->serial->num_ports == 4) { |
322 | Wval = | 322 | Wval = |
323 | (((__u16) port->number - (__u16) (port->serial->minor)) + | 323 | (((__u16) port->number - (__u16) (port->serial->minor)) + |
324 | 1) << 8; | 324 | 1) << 8; |
325 | dbg("mos7840_get_uart_reg application number is %x\n", Wval); | 325 | dbg("mos7840_get_uart_reg application number is %x", Wval); |
326 | } else { | 326 | } else { |
327 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 327 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { |
328 | Wval = (((__u16) port->number - | 328 | Wval = (((__u16) port->number - |
329 | (__u16) (port->serial->minor)) + 1) << 8; | 329 | (__u16) (port->serial->minor)) + 1) << 8; |
330 | dbg("mos7840_get_uart_reg application number is %x\n", | 330 | dbg("mos7840_get_uart_reg application number is %x", |
331 | Wval); | 331 | Wval); |
332 | } else { | 332 | } else { |
333 | Wval = (((__u16) port->number - | 333 | Wval = (((__u16) port->number - |
334 | (__u16) (port->serial->minor)) + 2) << 8; | 334 | (__u16) (port->serial->minor)) + 2) << 8; |
335 | dbg("mos7840_get_uart_reg application number is %x\n", | 335 | dbg("mos7840_get_uart_reg application number is %x", |
336 | Wval); | 336 | Wval); |
337 | } | 337 | } |
338 | } | 338 | } |
@@ -346,11 +346,11 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
346 | static void mos7840_dump_serial_port(struct moschip_port *mos7840_port) | 346 | static void mos7840_dump_serial_port(struct moschip_port *mos7840_port) |
347 | { | 347 | { |
348 | 348 | ||
349 | dbg("***************************************\n"); | 349 | dbg("***************************************"); |
350 | dbg("SpRegOffset is %2x\n", mos7840_port->SpRegOffset); | 350 | dbg("SpRegOffset is %2x", mos7840_port->SpRegOffset); |
351 | dbg("ControlRegOffset is %2x \n", mos7840_port->ControlRegOffset); | 351 | dbg("ControlRegOffset is %2x", mos7840_port->ControlRegOffset); |
352 | dbg("DCRRegOffset is %2x \n", mos7840_port->DcrRegOffset); | 352 | dbg("DCRRegOffset is %2x", mos7840_port->DcrRegOffset); |
353 | dbg("***************************************\n"); | 353 | dbg("***************************************"); |
354 | 354 | ||
355 | } | 355 | } |
356 | 356 | ||
@@ -474,12 +474,12 @@ static void mos7840_control_callback(struct urb *urb) | |||
474 | goto exit; | 474 | goto exit; |
475 | } | 475 | } |
476 | 476 | ||
477 | dbg("%s urb buffer size is %d\n", __func__, urb->actual_length); | 477 | dbg("%s urb buffer size is %d", __func__, urb->actual_length); |
478 | dbg("%s mos7840_port->MsrLsr is %d port %d\n", __func__, | 478 | dbg("%s mos7840_port->MsrLsr is %d port %d", __func__, |
479 | mos7840_port->MsrLsr, mos7840_port->port_num); | 479 | mos7840_port->MsrLsr, mos7840_port->port_num); |
480 | data = urb->transfer_buffer; | 480 | data = urb->transfer_buffer; |
481 | regval = (__u8) data[0]; | 481 | regval = (__u8) data[0]; |
482 | dbg("%s data is %x\n", __func__, regval); | 482 | dbg("%s data is %x", __func__, regval); |
483 | if (mos7840_port->MsrLsr == 0) | 483 | if (mos7840_port->MsrLsr == 0) |
484 | mos7840_handle_new_msr(mos7840_port, regval); | 484 | mos7840_handle_new_msr(mos7840_port, regval); |
485 | else if (mos7840_port->MsrLsr == 1) | 485 | else if (mos7840_port->MsrLsr == 1) |
@@ -538,7 +538,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
538 | __u16 wval, wreg = 0; | 538 | __u16 wval, wreg = 0; |
539 | int status = urb->status; | 539 | int status = urb->status; |
540 | 540 | ||
541 | dbg("%s", " : Entering\n"); | 541 | dbg("%s", " : Entering"); |
542 | 542 | ||
543 | switch (status) { | 543 | switch (status) { |
544 | case 0: | 544 | case 0: |
@@ -570,7 +570,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
570 | * Byte 5 FIFO status for both */ | 570 | * Byte 5 FIFO status for both */ |
571 | 571 | ||
572 | if (length && length > 5) { | 572 | if (length && length > 5) { |
573 | dbg("%s \n", "Wrong data !!!"); | 573 | dbg("%s", "Wrong data !!!"); |
574 | return; | 574 | return; |
575 | } | 575 | } |
576 | 576 | ||
@@ -587,17 +587,17 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
587 | (__u16) (serial->minor)) + 1) << 8; | 587 | (__u16) (serial->minor)) + 1) << 8; |
588 | if (mos7840_port->open) { | 588 | if (mos7840_port->open) { |
589 | if (sp[i] & 0x01) { | 589 | if (sp[i] & 0x01) { |
590 | dbg("SP%d No Interrupt !!!\n", i); | 590 | dbg("SP%d No Interrupt !!!", i); |
591 | } else { | 591 | } else { |
592 | switch (sp[i] & 0x0f) { | 592 | switch (sp[i] & 0x0f) { |
593 | case SERIAL_IIR_RLS: | 593 | case SERIAL_IIR_RLS: |
594 | dbg("Serial Port %d: Receiver status error or ", i); | 594 | dbg("Serial Port %d: Receiver status error or ", i); |
595 | dbg("address bit detected in 9-bit mode\n"); | 595 | dbg("address bit detected in 9-bit mode"); |
596 | mos7840_port->MsrLsr = 1; | 596 | mos7840_port->MsrLsr = 1; |
597 | wreg = LINE_STATUS_REGISTER; | 597 | wreg = LINE_STATUS_REGISTER; |
598 | break; | 598 | break; |
599 | case SERIAL_IIR_MS: | 599 | case SERIAL_IIR_MS: |
600 | dbg("Serial Port %d: Modem status change\n", i); | 600 | dbg("Serial Port %d: Modem status change", i); |
601 | mos7840_port->MsrLsr = 0; | 601 | mos7840_port->MsrLsr = 0; |
602 | wreg = MODEM_STATUS_REGISTER; | 602 | wreg = MODEM_STATUS_REGISTER; |
603 | break; | 603 | break; |
@@ -689,7 +689,7 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
689 | 689 | ||
690 | mos7840_port = urb->context; | 690 | mos7840_port = urb->context; |
691 | if (!mos7840_port) { | 691 | if (!mos7840_port) { |
692 | dbg("%s", "NULL mos7840_port pointer \n"); | 692 | dbg("%s", "NULL mos7840_port pointer"); |
693 | mos7840_port->read_urb_busy = false; | 693 | mos7840_port->read_urb_busy = false; |
694 | return; | 694 | return; |
695 | } | 695 | } |
@@ -702,41 +702,41 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
702 | 702 | ||
703 | port = (struct usb_serial_port *)mos7840_port->port; | 703 | port = (struct usb_serial_port *)mos7840_port->port; |
704 | if (mos7840_port_paranoia_check(port, __func__)) { | 704 | if (mos7840_port_paranoia_check(port, __func__)) { |
705 | dbg("%s", "Port Paranoia failed \n"); | 705 | dbg("%s", "Port Paranoia failed"); |
706 | mos7840_port->read_urb_busy = false; | 706 | mos7840_port->read_urb_busy = false; |
707 | return; | 707 | return; |
708 | } | 708 | } |
709 | 709 | ||
710 | serial = mos7840_get_usb_serial(port, __func__); | 710 | serial = mos7840_get_usb_serial(port, __func__); |
711 | if (!serial) { | 711 | if (!serial) { |
712 | dbg("%s\n", "Bad serial pointer "); | 712 | dbg("%s", "Bad serial pointer"); |
713 | mos7840_port->read_urb_busy = false; | 713 | mos7840_port->read_urb_busy = false; |
714 | return; | 714 | return; |
715 | } | 715 | } |
716 | 716 | ||
717 | dbg("%s\n", "Entering... \n"); | 717 | dbg("%s", "Entering... "); |
718 | 718 | ||
719 | data = urb->transfer_buffer; | 719 | data = urb->transfer_buffer; |
720 | 720 | ||
721 | dbg("%s", "Entering ........... \n"); | 721 | dbg("%s", "Entering ..........."); |
722 | 722 | ||
723 | if (urb->actual_length) { | 723 | if (urb->actual_length) { |
724 | tty = tty_port_tty_get(&mos7840_port->port->port); | 724 | tty = tty_port_tty_get(&mos7840_port->port->port); |
725 | if (tty) { | 725 | if (tty) { |
726 | tty_buffer_request_room(tty, urb->actual_length); | 726 | tty_buffer_request_room(tty, urb->actual_length); |
727 | tty_insert_flip_string(tty, data, urb->actual_length); | 727 | tty_insert_flip_string(tty, data, urb->actual_length); |
728 | dbg(" %s \n", data); | 728 | dbg(" %s ", data); |
729 | tty_flip_buffer_push(tty); | 729 | tty_flip_buffer_push(tty); |
730 | tty_kref_put(tty); | 730 | tty_kref_put(tty); |
731 | } | 731 | } |
732 | mos7840_port->icount.rx += urb->actual_length; | 732 | mos7840_port->icount.rx += urb->actual_length; |
733 | smp_wmb(); | 733 | smp_wmb(); |
734 | dbg("mos7840_port->icount.rx is %d:\n", | 734 | dbg("mos7840_port->icount.rx is %d:", |
735 | mos7840_port->icount.rx); | 735 | mos7840_port->icount.rx); |
736 | } | 736 | } |
737 | 737 | ||
738 | if (!mos7840_port->read_urb) { | 738 | if (!mos7840_port->read_urb) { |
739 | dbg("%s", "URB KILLED !!!\n"); | 739 | dbg("%s", "URB KILLED !!!"); |
740 | mos7840_port->read_urb_busy = false; | 740 | mos7840_port->read_urb_busy = false; |
741 | return; | 741 | return; |
742 | } | 742 | } |
@@ -777,16 +777,16 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
777 | spin_unlock(&mos7840_port->pool_lock); | 777 | spin_unlock(&mos7840_port->pool_lock); |
778 | 778 | ||
779 | if (status) { | 779 | if (status) { |
780 | dbg("nonzero write bulk status received:%d\n", status); | 780 | dbg("nonzero write bulk status received:%d", status); |
781 | return; | 781 | return; |
782 | } | 782 | } |
783 | 783 | ||
784 | if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) { | 784 | if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) { |
785 | dbg("%s", "Port Paranoia failed \n"); | 785 | dbg("%s", "Port Paranoia failed"); |
786 | return; | 786 | return; |
787 | } | 787 | } |
788 | 788 | ||
789 | dbg("%s \n", "Entering ........."); | 789 | dbg("%s", "Entering ........."); |
790 | 790 | ||
791 | tty = tty_port_tty_get(&mos7840_port->port->port); | 791 | tty = tty_port_tty_get(&mos7840_port->port->port); |
792 | if (tty && mos7840_port->open) | 792 | if (tty && mos7840_port->open) |
@@ -830,15 +830,17 @@ static int mos7840_open(struct tty_struct *tty, | |||
830 | struct moschip_port *mos7840_port; | 830 | struct moschip_port *mos7840_port; |
831 | struct moschip_port *port0; | 831 | struct moschip_port *port0; |
832 | 832 | ||
833 | dbg ("%s enter", __func__); | ||
834 | |||
833 | if (mos7840_port_paranoia_check(port, __func__)) { | 835 | if (mos7840_port_paranoia_check(port, __func__)) { |
834 | dbg("%s", "Port Paranoia failed \n"); | 836 | dbg("%s", "Port Paranoia failed"); |
835 | return -ENODEV; | 837 | return -ENODEV; |
836 | } | 838 | } |
837 | 839 | ||
838 | serial = port->serial; | 840 | serial = port->serial; |
839 | 841 | ||
840 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 842 | if (mos7840_serial_paranoia_check(serial, __func__)) { |
841 | dbg("%s", "Serial Paranoia failed \n"); | 843 | dbg("%s", "Serial Paranoia failed"); |
842 | return -ENODEV; | 844 | return -ENODEV; |
843 | } | 845 | } |
844 | 846 | ||
@@ -891,20 +893,20 @@ static int mos7840_open(struct tty_struct *tty, | |||
891 | Data = 0x0; | 893 | Data = 0x0; |
892 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); | 894 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); |
893 | if (status < 0) { | 895 | if (status < 0) { |
894 | dbg("Reading Spreg failed\n"); | 896 | dbg("Reading Spreg failed"); |
895 | return -1; | 897 | return -1; |
896 | } | 898 | } |
897 | Data |= 0x80; | 899 | Data |= 0x80; |
898 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); | 900 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); |
899 | if (status < 0) { | 901 | if (status < 0) { |
900 | dbg("writing Spreg failed\n"); | 902 | dbg("writing Spreg failed"); |
901 | return -1; | 903 | return -1; |
902 | } | 904 | } |
903 | 905 | ||
904 | Data &= ~0x80; | 906 | Data &= ~0x80; |
905 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); | 907 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); |
906 | if (status < 0) { | 908 | if (status < 0) { |
907 | dbg("writing Spreg failed\n"); | 909 | dbg("writing Spreg failed"); |
908 | return -1; | 910 | return -1; |
909 | } | 911 | } |
910 | /* End of block to be checked */ | 912 | /* End of block to be checked */ |
@@ -913,7 +915,7 @@ static int mos7840_open(struct tty_struct *tty, | |||
913 | status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, | 915 | status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, |
914 | &Data); | 916 | &Data); |
915 | if (status < 0) { | 917 | if (status < 0) { |
916 | dbg("Reading Controlreg failed\n"); | 918 | dbg("Reading Controlreg failed"); |
917 | return -1; | 919 | return -1; |
918 | } | 920 | } |
919 | Data |= 0x08; /* Driver done bit */ | 921 | Data |= 0x08; /* Driver done bit */ |
@@ -921,7 +923,7 @@ static int mos7840_open(struct tty_struct *tty, | |||
921 | status = mos7840_set_reg_sync(port, | 923 | status = mos7840_set_reg_sync(port, |
922 | mos7840_port->ControlRegOffset, Data); | 924 | mos7840_port->ControlRegOffset, Data); |
923 | if (status < 0) { | 925 | if (status < 0) { |
924 | dbg("writing Controlreg failed\n"); | 926 | dbg("writing Controlreg failed"); |
925 | return -1; | 927 | return -1; |
926 | } | 928 | } |
927 | /* do register settings here */ | 929 | /* do register settings here */ |
@@ -932,21 +934,21 @@ static int mos7840_open(struct tty_struct *tty, | |||
932 | Data = 0x00; | 934 | Data = 0x00; |
933 | status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 935 | status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
934 | if (status < 0) { | 936 | if (status < 0) { |
935 | dbg("disableing interrupts failed\n"); | 937 | dbg("disabling interrupts failed"); |
936 | return -1; | 938 | return -1; |
937 | } | 939 | } |
938 | /* Set FIFO_CONTROL_REGISTER to the default value */ | 940 | /* Set FIFO_CONTROL_REGISTER to the default value */ |
939 | Data = 0x00; | 941 | Data = 0x00; |
940 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); | 942 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); |
941 | if (status < 0) { | 943 | if (status < 0) { |
942 | dbg("Writing FIFO_CONTROL_REGISTER failed\n"); | 944 | dbg("Writing FIFO_CONTROL_REGISTER failed"); |
943 | return -1; | 945 | return -1; |
944 | } | 946 | } |
945 | 947 | ||
946 | Data = 0xcf; | 948 | Data = 0xcf; |
947 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); | 949 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); |
948 | if (status < 0) { | 950 | if (status < 0) { |
949 | dbg("Writing FIFO_CONTROL_REGISTER failed\n"); | 951 | dbg("Writing FIFO_CONTROL_REGISTER failed"); |
950 | return -1; | 952 | return -1; |
951 | } | 953 | } |
952 | 954 | ||
@@ -1043,12 +1045,12 @@ static int mos7840_open(struct tty_struct *tty, | |||
1043 | * (can't set it up in mos7840_startup as the * | 1045 | * (can't set it up in mos7840_startup as the * |
1044 | * structures were not set up at that time.) */ | 1046 | * structures were not set up at that time.) */ |
1045 | 1047 | ||
1046 | dbg("port number is %d \n", port->number); | 1048 | dbg("port number is %d", port->number); |
1047 | dbg("serial number is %d \n", port->serial->minor); | 1049 | dbg("serial number is %d", port->serial->minor); |
1048 | dbg("Bulkin endpoint is %d \n", port->bulk_in_endpointAddress); | 1050 | dbg("Bulkin endpoint is %d", port->bulk_in_endpointAddress); |
1049 | dbg("BulkOut endpoint is %d \n", port->bulk_out_endpointAddress); | 1051 | dbg("BulkOut endpoint is %d", port->bulk_out_endpointAddress); |
1050 | dbg("Interrupt endpoint is %d \n", port->interrupt_in_endpointAddress); | 1052 | dbg("Interrupt endpoint is %d", port->interrupt_in_endpointAddress); |
1051 | dbg("port's number in the device is %d\n", mos7840_port->port_num); | 1053 | dbg("port's number in the device is %d", mos7840_port->port_num); |
1052 | mos7840_port->read_urb = port->read_urb; | 1054 | mos7840_port->read_urb = port->read_urb; |
1053 | 1055 | ||
1054 | /* set up our bulk in urb */ | 1056 | /* set up our bulk in urb */ |
@@ -1061,7 +1063,7 @@ static int mos7840_open(struct tty_struct *tty, | |||
1061 | mos7840_port->read_urb->transfer_buffer_length, | 1063 | mos7840_port->read_urb->transfer_buffer_length, |
1062 | mos7840_bulk_in_callback, mos7840_port); | 1064 | mos7840_bulk_in_callback, mos7840_port); |
1063 | 1065 | ||
1064 | dbg("mos7840_open: bulkin endpoint is %d\n", | 1066 | dbg("mos7840_open: bulkin endpoint is %d", |
1065 | port->bulk_in_endpointAddress); | 1067 | port->bulk_in_endpointAddress); |
1066 | mos7840_port->read_urb_busy = true; | 1068 | mos7840_port->read_urb_busy = true; |
1067 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); | 1069 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); |
@@ -1087,9 +1089,11 @@ static int mos7840_open(struct tty_struct *tty, | |||
1087 | mos7840_port->icount.tx = 0; | 1089 | mos7840_port->icount.tx = 0; |
1088 | mos7840_port->icount.rx = 0; | 1090 | mos7840_port->icount.rx = 0; |
1089 | 1091 | ||
1090 | dbg("\n\nusb_serial serial:%p mos7840_port:%p\n usb_serial_port port:%p\n\n", | 1092 | dbg("usb_serial serial:%p mos7840_port:%p\n usb_serial_port port:%p", |
1091 | serial, mos7840_port, port); | 1093 | serial, mos7840_port, port); |
1092 | 1094 | ||
1095 | dbg ("%s leave", __func__); | ||
1096 | |||
1093 | return 0; | 1097 | return 0; |
1094 | 1098 | ||
1095 | } | 1099 | } |
@@ -1112,16 +1116,16 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty) | |||
1112 | unsigned long flags; | 1116 | unsigned long flags; |
1113 | struct moschip_port *mos7840_port; | 1117 | struct moschip_port *mos7840_port; |
1114 | 1118 | ||
1115 | dbg("%s \n", " mos7840_chars_in_buffer:entering ..........."); | 1119 | dbg("%s", " mos7840_chars_in_buffer:entering ..........."); |
1116 | 1120 | ||
1117 | if (mos7840_port_paranoia_check(port, __func__)) { | 1121 | if (mos7840_port_paranoia_check(port, __func__)) { |
1118 | dbg("%s", "Invalid port \n"); | 1122 | dbg("%s", "Invalid port"); |
1119 | return 0; | 1123 | return 0; |
1120 | } | 1124 | } |
1121 | 1125 | ||
1122 | mos7840_port = mos7840_get_port_private(port); | 1126 | mos7840_port = mos7840_get_port_private(port); |
1123 | if (mos7840_port == NULL) { | 1127 | if (mos7840_port == NULL) { |
1124 | dbg("%s \n", "mos7840_break:leaving ..........."); | 1128 | dbg("%s", "mos7840_break:leaving ..........."); |
1125 | return 0; | 1129 | return 0; |
1126 | } | 1130 | } |
1127 | 1131 | ||
@@ -1148,16 +1152,16 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1148 | int j; | 1152 | int j; |
1149 | __u16 Data; | 1153 | __u16 Data; |
1150 | 1154 | ||
1151 | dbg("%s\n", "mos7840_close:entering..."); | 1155 | dbg("%s", "mos7840_close:entering..."); |
1152 | 1156 | ||
1153 | if (mos7840_port_paranoia_check(port, __func__)) { | 1157 | if (mos7840_port_paranoia_check(port, __func__)) { |
1154 | dbg("%s", "Port Paranoia failed \n"); | 1158 | dbg("%s", "Port Paranoia failed"); |
1155 | return; | 1159 | return; |
1156 | } | 1160 | } |
1157 | 1161 | ||
1158 | serial = mos7840_get_usb_serial(port, __func__); | 1162 | serial = mos7840_get_usb_serial(port, __func__); |
1159 | if (!serial) { | 1163 | if (!serial) { |
1160 | dbg("%s", "Serial Paranoia failed \n"); | 1164 | dbg("%s", "Serial Paranoia failed"); |
1161 | return; | 1165 | return; |
1162 | } | 1166 | } |
1163 | 1167 | ||
@@ -1185,27 +1189,27 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1185 | * and interrupt read if they exists */ | 1189 | * and interrupt read if they exists */ |
1186 | if (serial->dev) { | 1190 | if (serial->dev) { |
1187 | if (mos7840_port->write_urb) { | 1191 | if (mos7840_port->write_urb) { |
1188 | dbg("%s", "Shutdown bulk write\n"); | 1192 | dbg("%s", "Shutdown bulk write"); |
1189 | usb_kill_urb(mos7840_port->write_urb); | 1193 | usb_kill_urb(mos7840_port->write_urb); |
1190 | } | 1194 | } |
1191 | if (mos7840_port->read_urb) { | 1195 | if (mos7840_port->read_urb) { |
1192 | dbg("%s", "Shutdown bulk read\n"); | 1196 | dbg("%s", "Shutdown bulk read"); |
1193 | usb_kill_urb(mos7840_port->read_urb); | 1197 | usb_kill_urb(mos7840_port->read_urb); |
1194 | mos7840_port->read_urb_busy = false; | 1198 | mos7840_port->read_urb_busy = false; |
1195 | } | 1199 | } |
1196 | if ((&mos7840_port->control_urb)) { | 1200 | if ((&mos7840_port->control_urb)) { |
1197 | dbg("%s", "Shutdown control read\n"); | 1201 | dbg("%s", "Shutdown control read"); |
1198 | /*/ usb_kill_urb (mos7840_port->control_urb); */ | 1202 | /*/ usb_kill_urb (mos7840_port->control_urb); */ |
1199 | } | 1203 | } |
1200 | } | 1204 | } |
1201 | /* if(mos7840_port->ctrl_buf != NULL) */ | 1205 | /* if(mos7840_port->ctrl_buf != NULL) */ |
1202 | /* kfree(mos7840_port->ctrl_buf); */ | 1206 | /* kfree(mos7840_port->ctrl_buf); */ |
1203 | port0->open_ports--; | 1207 | port0->open_ports--; |
1204 | dbg("mos7840_num_open_ports in close%d:in port%d\n", | 1208 | dbg("mos7840_num_open_ports in close%d:in port%d", |
1205 | port0->open_ports, port->number); | 1209 | port0->open_ports, port->number); |
1206 | if (port0->open_ports == 0) { | 1210 | if (port0->open_ports == 0) { |
1207 | if (serial->port[0]->interrupt_in_urb) { | 1211 | if (serial->port[0]->interrupt_in_urb) { |
1208 | dbg("%s", "Shutdown interrupt_in_urb\n"); | 1212 | dbg("%s", "Shutdown interrupt_in_urb"); |
1209 | usb_kill_urb(serial->port[0]->interrupt_in_urb); | 1213 | usb_kill_urb(serial->port[0]->interrupt_in_urb); |
1210 | } | 1214 | } |
1211 | } | 1215 | } |
@@ -1225,7 +1229,7 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1225 | 1229 | ||
1226 | mos7840_port->open = 0; | 1230 | mos7840_port->open = 0; |
1227 | 1231 | ||
1228 | dbg("%s \n", "Leaving ............"); | 1232 | dbg("%s", "Leaving ............"); |
1229 | } | 1233 | } |
1230 | 1234 | ||
1231 | /************************************************************************ | 1235 | /************************************************************************ |
@@ -1280,17 +1284,17 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1280 | struct usb_serial *serial; | 1284 | struct usb_serial *serial; |
1281 | struct moschip_port *mos7840_port; | 1285 | struct moschip_port *mos7840_port; |
1282 | 1286 | ||
1283 | dbg("%s \n", "Entering ..........."); | 1287 | dbg("%s", "Entering ..........."); |
1284 | dbg("mos7840_break: Start\n"); | 1288 | dbg("mos7840_break: Start"); |
1285 | 1289 | ||
1286 | if (mos7840_port_paranoia_check(port, __func__)) { | 1290 | if (mos7840_port_paranoia_check(port, __func__)) { |
1287 | dbg("%s", "Port Paranoia failed \n"); | 1291 | dbg("%s", "Port Paranoia failed"); |
1288 | return; | 1292 | return; |
1289 | } | 1293 | } |
1290 | 1294 | ||
1291 | serial = mos7840_get_usb_serial(port, __func__); | 1295 | serial = mos7840_get_usb_serial(port, __func__); |
1292 | if (!serial) { | 1296 | if (!serial) { |
1293 | dbg("%s", "Serial Paranoia failed \n"); | 1297 | dbg("%s", "Serial Paranoia failed"); |
1294 | return; | 1298 | return; |
1295 | } | 1299 | } |
1296 | 1300 | ||
@@ -1310,7 +1314,7 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1310 | 1314 | ||
1311 | /* FIXME: no locking on shadowLCR anywhere in driver */ | 1315 | /* FIXME: no locking on shadowLCR anywhere in driver */ |
1312 | mos7840_port->shadowLCR = data; | 1316 | mos7840_port->shadowLCR = data; |
1313 | dbg("mcs7840_break mos7840_port->shadowLCR is %x\n", | 1317 | dbg("mcs7840_break mos7840_port->shadowLCR is %x", |
1314 | mos7840_port->shadowLCR); | 1318 | mos7840_port->shadowLCR); |
1315 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, | 1319 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, |
1316 | mos7840_port->shadowLCR); | 1320 | mos7840_port->shadowLCR); |
@@ -1334,17 +1338,17 @@ static int mos7840_write_room(struct tty_struct *tty) | |||
1334 | unsigned long flags; | 1338 | unsigned long flags; |
1335 | struct moschip_port *mos7840_port; | 1339 | struct moschip_port *mos7840_port; |
1336 | 1340 | ||
1337 | dbg("%s \n", " mos7840_write_room:entering ..........."); | 1341 | dbg("%s", " mos7840_write_room:entering ..........."); |
1338 | 1342 | ||
1339 | if (mos7840_port_paranoia_check(port, __func__)) { | 1343 | if (mos7840_port_paranoia_check(port, __func__)) { |
1340 | dbg("%s", "Invalid port \n"); | 1344 | dbg("%s", "Invalid port"); |
1341 | dbg("%s \n", " mos7840_write_room:leaving ..........."); | 1345 | dbg("%s", " mos7840_write_room:leaving ..........."); |
1342 | return -1; | 1346 | return -1; |
1343 | } | 1347 | } |
1344 | 1348 | ||
1345 | mos7840_port = mos7840_get_port_private(port); | 1349 | mos7840_port = mos7840_get_port_private(port); |
1346 | if (mos7840_port == NULL) { | 1350 | if (mos7840_port == NULL) { |
1347 | dbg("%s \n", "mos7840_break:leaving ..........."); | 1351 | dbg("%s", "mos7840_break:leaving ..........."); |
1348 | return -1; | 1352 | return -1; |
1349 | } | 1353 | } |
1350 | 1354 | ||
@@ -1384,16 +1388,16 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1384 | /* __u16 Data; */ | 1388 | /* __u16 Data; */ |
1385 | const unsigned char *current_position = data; | 1389 | const unsigned char *current_position = data; |
1386 | unsigned char *data1; | 1390 | unsigned char *data1; |
1387 | dbg("%s \n", "entering ..........."); | 1391 | dbg("%s", "entering ..........."); |
1388 | /* dbg("mos7840_write: mos7840_port->shadowLCR is %x\n", | 1392 | /* dbg("mos7840_write: mos7840_port->shadowLCR is %x", |
1389 | mos7840_port->shadowLCR); */ | 1393 | mos7840_port->shadowLCR); */ |
1390 | 1394 | ||
1391 | #ifdef NOTMOS7840 | 1395 | #ifdef NOTMOS7840 |
1392 | Data = 0x00; | 1396 | Data = 0x00; |
1393 | status = mos7840_get_uart_reg(port, LINE_CONTROL_REGISTER, &Data); | 1397 | status = mos7840_get_uart_reg(port, LINE_CONTROL_REGISTER, &Data); |
1394 | mos7840_port->shadowLCR = Data; | 1398 | mos7840_port->shadowLCR = Data; |
1395 | dbg("mos7840_write: LINE_CONTROL_REGISTER is %x\n", Data); | 1399 | dbg("mos7840_write: LINE_CONTROL_REGISTER is %x", Data); |
1396 | dbg("mos7840_write: mos7840_port->shadowLCR is %x\n", | 1400 | dbg("mos7840_write: mos7840_port->shadowLCR is %x", |
1397 | mos7840_port->shadowLCR); | 1401 | mos7840_port->shadowLCR); |
1398 | 1402 | ||
1399 | /* Data = 0x03; */ | 1403 | /* Data = 0x03; */ |
@@ -1407,32 +1411,32 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1407 | /* status = mos7840_set_uart_reg(port,DIVISOR_LATCH_LSB,Data); */ | 1411 | /* status = mos7840_set_uart_reg(port,DIVISOR_LATCH_LSB,Data); */ |
1408 | Data = 0x00; | 1412 | Data = 0x00; |
1409 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_LSB, &Data); | 1413 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_LSB, &Data); |
1410 | dbg("mos7840_write:DLL value is %x\n", Data); | 1414 | dbg("mos7840_write:DLL value is %x", Data); |
1411 | 1415 | ||
1412 | Data = 0x0; | 1416 | Data = 0x0; |
1413 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_MSB, &Data); | 1417 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_MSB, &Data); |
1414 | dbg("mos7840_write:DLM value is %x\n", Data); | 1418 | dbg("mos7840_write:DLM value is %x", Data); |
1415 | 1419 | ||
1416 | Data = Data & ~SERIAL_LCR_DLAB; | 1420 | Data = Data & ~SERIAL_LCR_DLAB; |
1417 | dbg("mos7840_write: mos7840_port->shadowLCR is %x\n", | 1421 | dbg("mos7840_write: mos7840_port->shadowLCR is %x", |
1418 | mos7840_port->shadowLCR); | 1422 | mos7840_port->shadowLCR); |
1419 | status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); | 1423 | status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); |
1420 | #endif | 1424 | #endif |
1421 | 1425 | ||
1422 | if (mos7840_port_paranoia_check(port, __func__)) { | 1426 | if (mos7840_port_paranoia_check(port, __func__)) { |
1423 | dbg("%s", "Port Paranoia failed \n"); | 1427 | dbg("%s", "Port Paranoia failed"); |
1424 | return -1; | 1428 | return -1; |
1425 | } | 1429 | } |
1426 | 1430 | ||
1427 | serial = port->serial; | 1431 | serial = port->serial; |
1428 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 1432 | if (mos7840_serial_paranoia_check(serial, __func__)) { |
1429 | dbg("%s", "Serial Paranoia failed \n"); | 1433 | dbg("%s", "Serial Paranoia failed"); |
1430 | return -1; | 1434 | return -1; |
1431 | } | 1435 | } |
1432 | 1436 | ||
1433 | mos7840_port = mos7840_get_port_private(port); | 1437 | mos7840_port = mos7840_get_port_private(port); |
1434 | if (mos7840_port == NULL) { | 1438 | if (mos7840_port == NULL) { |
1435 | dbg("%s", "mos7840_port is NULL\n"); | 1439 | dbg("%s", "mos7840_port is NULL"); |
1436 | return -1; | 1440 | return -1; |
1437 | } | 1441 | } |
1438 | 1442 | ||
@@ -1444,7 +1448,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1444 | if (!mos7840_port->busy[i]) { | 1448 | if (!mos7840_port->busy[i]) { |
1445 | mos7840_port->busy[i] = 1; | 1449 | mos7840_port->busy[i] = 1; |
1446 | urb = mos7840_port->write_urb_pool[i]; | 1450 | urb = mos7840_port->write_urb_pool[i]; |
1447 | dbg("\nURB:%d", i); | 1451 | dbg("URB:%d", i); |
1448 | break; | 1452 | break; |
1449 | } | 1453 | } |
1450 | } | 1454 | } |
@@ -1479,7 +1483,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1479 | mos7840_bulk_out_data_callback, mos7840_port); | 1483 | mos7840_bulk_out_data_callback, mos7840_port); |
1480 | 1484 | ||
1481 | data1 = urb->transfer_buffer; | 1485 | data1 = urb->transfer_buffer; |
1482 | dbg("\nbulkout endpoint is %d", port->bulk_out_endpointAddress); | 1486 | dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress); |
1483 | 1487 | ||
1484 | /* send it down the pipe */ | 1488 | /* send it down the pipe */ |
1485 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1489 | status = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -1494,7 +1498,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1494 | bytes_sent = transfer_size; | 1498 | bytes_sent = transfer_size; |
1495 | mos7840_port->icount.tx += transfer_size; | 1499 | mos7840_port->icount.tx += transfer_size; |
1496 | smp_wmb(); | 1500 | smp_wmb(); |
1497 | dbg("mos7840_port->icount.tx is %d:\n", mos7840_port->icount.tx); | 1501 | dbg("mos7840_port->icount.tx is %d:", mos7840_port->icount.tx); |
1498 | exit: | 1502 | exit: |
1499 | return bytes_sent; | 1503 | return bytes_sent; |
1500 | 1504 | ||
@@ -1513,11 +1517,11 @@ static void mos7840_throttle(struct tty_struct *tty) | |||
1513 | int status; | 1517 | int status; |
1514 | 1518 | ||
1515 | if (mos7840_port_paranoia_check(port, __func__)) { | 1519 | if (mos7840_port_paranoia_check(port, __func__)) { |
1516 | dbg("%s", "Invalid port \n"); | 1520 | dbg("%s", "Invalid port"); |
1517 | return; | 1521 | return; |
1518 | } | 1522 | } |
1519 | 1523 | ||
1520 | dbg("- port %d\n", port->number); | 1524 | dbg("- port %d", port->number); |
1521 | 1525 | ||
1522 | mos7840_port = mos7840_get_port_private(port); | 1526 | mos7840_port = mos7840_get_port_private(port); |
1523 | 1527 | ||
@@ -1525,11 +1529,11 @@ static void mos7840_throttle(struct tty_struct *tty) | |||
1525 | return; | 1529 | return; |
1526 | 1530 | ||
1527 | if (!mos7840_port->open) { | 1531 | if (!mos7840_port->open) { |
1528 | dbg("%s\n", "port not opened"); | 1532 | dbg("%s", "port not opened"); |
1529 | return; | 1533 | return; |
1530 | } | 1534 | } |
1531 | 1535 | ||
1532 | dbg("%s", "Entering .......... \n"); | 1536 | dbg("%s", "Entering .........."); |
1533 | 1537 | ||
1534 | /* if we are implementing XON/XOFF, send the stop character */ | 1538 | /* if we are implementing XON/XOFF, send the stop character */ |
1535 | if (I_IXOFF(tty)) { | 1539 | if (I_IXOFF(tty)) { |
@@ -1563,7 +1567,7 @@ static void mos7840_unthrottle(struct tty_struct *tty) | |||
1563 | struct moschip_port *mos7840_port = mos7840_get_port_private(port); | 1567 | struct moschip_port *mos7840_port = mos7840_get_port_private(port); |
1564 | 1568 | ||
1565 | if (mos7840_port_paranoia_check(port, __func__)) { | 1569 | if (mos7840_port_paranoia_check(port, __func__)) { |
1566 | dbg("%s", "Invalid port \n"); | 1570 | dbg("%s", "Invalid port"); |
1567 | return; | 1571 | return; |
1568 | } | 1572 | } |
1569 | 1573 | ||
@@ -1575,7 +1579,7 @@ static void mos7840_unthrottle(struct tty_struct *tty) | |||
1575 | return; | 1579 | return; |
1576 | } | 1580 | } |
1577 | 1581 | ||
1578 | dbg("%s", "Entering .......... \n"); | 1582 | dbg("%s", "Entering .........."); |
1579 | 1583 | ||
1580 | /* if we are implementing XON/XOFF, send the start character */ | 1584 | /* if we are implementing XON/XOFF, send the start character */ |
1581 | if (I_IXOFF(tty)) { | 1585 | if (I_IXOFF(tty)) { |
@@ -1660,7 +1664,7 @@ static int mos7840_tiocmset(struct tty_struct *tty, struct file *file, | |||
1660 | 1664 | ||
1661 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); | 1665 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); |
1662 | if (status < 0) { | 1666 | if (status < 0) { |
1663 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); | 1667 | dbg("setting MODEM_CONTROL_REGISTER Failed"); |
1664 | return status; | 1668 | return status; |
1665 | } | 1669 | } |
1666 | 1670 | ||
@@ -1729,11 +1733,11 @@ static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor, | |||
1729 | custom++; | 1733 | custom++; |
1730 | *divisor = custom; | 1734 | *divisor = custom; |
1731 | 1735 | ||
1732 | dbg(" Baud %d = %d\n", baudrate, custom); | 1736 | dbg(" Baud %d = %d", baudrate, custom); |
1733 | return 0; | 1737 | return 0; |
1734 | } | 1738 | } |
1735 | 1739 | ||
1736 | dbg("%s\n", " Baud calculation Failed..."); | 1740 | dbg("%s", " Baud calculation Failed..."); |
1737 | return -1; | 1741 | return -1; |
1738 | #endif | 1742 | #endif |
1739 | } | 1743 | } |
@@ -1759,16 +1763,16 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1759 | 1763 | ||
1760 | port = (struct usb_serial_port *)mos7840_port->port; | 1764 | port = (struct usb_serial_port *)mos7840_port->port; |
1761 | if (mos7840_port_paranoia_check(port, __func__)) { | 1765 | if (mos7840_port_paranoia_check(port, __func__)) { |
1762 | dbg("%s", "Invalid port \n"); | 1766 | dbg("%s", "Invalid port"); |
1763 | return -1; | 1767 | return -1; |
1764 | } | 1768 | } |
1765 | 1769 | ||
1766 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { | 1770 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { |
1767 | dbg("%s", "Invalid Serial \n"); | 1771 | dbg("%s", "Invalid Serial"); |
1768 | return -1; | 1772 | return -1; |
1769 | } | 1773 | } |
1770 | 1774 | ||
1771 | dbg("%s", "Entering .......... \n"); | 1775 | dbg("%s", "Entering .........."); |
1772 | 1776 | ||
1773 | number = mos7840_port->port->number - mos7840_port->port->serial->minor; | 1777 | number = mos7840_port->port->number - mos7840_port->port->serial->minor; |
1774 | 1778 | ||
@@ -1784,7 +1788,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1784 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, | 1788 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, |
1785 | Data); | 1789 | Data); |
1786 | if (status < 0) { | 1790 | if (status < 0) { |
1787 | dbg("Writing spreg failed in set_serial_baud\n"); | 1791 | dbg("Writing spreg failed in set_serial_baud"); |
1788 | return -1; | 1792 | return -1; |
1789 | } | 1793 | } |
1790 | #endif | 1794 | #endif |
@@ -1797,7 +1801,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1797 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, | 1801 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, |
1798 | Data); | 1802 | Data); |
1799 | if (status < 0) { | 1803 | if (status < 0) { |
1800 | dbg("Writing spreg failed in set_serial_baud\n"); | 1804 | dbg("Writing spreg failed in set_serial_baud"); |
1801 | return -1; | 1805 | return -1; |
1802 | } | 1806 | } |
1803 | #endif | 1807 | #endif |
@@ -1812,14 +1816,14 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1812 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, | 1816 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, |
1813 | &Data); | 1817 | &Data); |
1814 | if (status < 0) { | 1818 | if (status < 0) { |
1815 | dbg("reading spreg failed in set_serial_baud\n"); | 1819 | dbg("reading spreg failed in set_serial_baud"); |
1816 | return -1; | 1820 | return -1; |
1817 | } | 1821 | } |
1818 | Data = (Data & 0x8f) | clk_sel_val; | 1822 | Data = (Data & 0x8f) | clk_sel_val; |
1819 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, | 1823 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, |
1820 | Data); | 1824 | Data); |
1821 | if (status < 0) { | 1825 | if (status < 0) { |
1822 | dbg("Writing spreg failed in set_serial_baud\n"); | 1826 | dbg("Writing spreg failed in set_serial_baud"); |
1823 | return -1; | 1827 | return -1; |
1824 | } | 1828 | } |
1825 | /* Calculate the Divisor */ | 1829 | /* Calculate the Divisor */ |
@@ -1835,11 +1839,11 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1835 | 1839 | ||
1836 | /* Write the divisor */ | 1840 | /* Write the divisor */ |
1837 | Data = (unsigned char)(divisor & 0xff); | 1841 | Data = (unsigned char)(divisor & 0xff); |
1838 | dbg("set_serial_baud Value to write DLL is %x\n", Data); | 1842 | dbg("set_serial_baud Value to write DLL is %x", Data); |
1839 | mos7840_set_uart_reg(port, DIVISOR_LATCH_LSB, Data); | 1843 | mos7840_set_uart_reg(port, DIVISOR_LATCH_LSB, Data); |
1840 | 1844 | ||
1841 | Data = (unsigned char)((divisor & 0xff00) >> 8); | 1845 | Data = (unsigned char)((divisor & 0xff00) >> 8); |
1842 | dbg("set_serial_baud Value to write DLM is %x\n", Data); | 1846 | dbg("set_serial_baud Value to write DLM is %x", Data); |
1843 | mos7840_set_uart_reg(port, DIVISOR_LATCH_MSB, Data); | 1847 | mos7840_set_uart_reg(port, DIVISOR_LATCH_MSB, Data); |
1844 | 1848 | ||
1845 | /* Disable access to divisor latch */ | 1849 | /* Disable access to divisor latch */ |
@@ -1877,12 +1881,12 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1877 | port = (struct usb_serial_port *)mos7840_port->port; | 1881 | port = (struct usb_serial_port *)mos7840_port->port; |
1878 | 1882 | ||
1879 | if (mos7840_port_paranoia_check(port, __func__)) { | 1883 | if (mos7840_port_paranoia_check(port, __func__)) { |
1880 | dbg("%s", "Invalid port \n"); | 1884 | dbg("%s", "Invalid port"); |
1881 | return; | 1885 | return; |
1882 | } | 1886 | } |
1883 | 1887 | ||
1884 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { | 1888 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { |
1885 | dbg("%s", "Invalid Serial \n"); | 1889 | dbg("%s", "Invalid Serial"); |
1886 | return; | 1890 | return; |
1887 | } | 1891 | } |
1888 | 1892 | ||
@@ -1895,7 +1899,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1895 | return; | 1899 | return; |
1896 | } | 1900 | } |
1897 | 1901 | ||
1898 | dbg("%s", "Entering .......... \n"); | 1902 | dbg("%s", "Entering .........."); |
1899 | 1903 | ||
1900 | lData = LCR_BITS_8; | 1904 | lData = LCR_BITS_8; |
1901 | lStop = LCR_STOP_1; | 1905 | lStop = LCR_STOP_1; |
@@ -1955,7 +1959,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1955 | ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); | 1959 | ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); |
1956 | mos7840_port->shadowLCR |= (lData | lParity | lStop); | 1960 | mos7840_port->shadowLCR |= (lData | lParity | lStop); |
1957 | 1961 | ||
1958 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is %x\n", | 1962 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is %x", |
1959 | mos7840_port->shadowLCR); | 1963 | mos7840_port->shadowLCR); |
1960 | /* Disable Interrupts */ | 1964 | /* Disable Interrupts */ |
1961 | Data = 0x00; | 1965 | Data = 0x00; |
@@ -1997,7 +2001,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1997 | 2001 | ||
1998 | if (!baud) { | 2002 | if (!baud) { |
1999 | /* pick a default, any default... */ | 2003 | /* pick a default, any default... */ |
2000 | dbg("%s\n", "Picked default baud..."); | 2004 | dbg("%s", "Picked default baud..."); |
2001 | baud = 9600; | 2005 | baud = 9600; |
2002 | } | 2006 | } |
2003 | 2007 | ||
@@ -2020,7 +2024,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2020 | } | 2024 | } |
2021 | wake_up(&mos7840_port->delta_msr_wait); | 2025 | wake_up(&mos7840_port->delta_msr_wait); |
2022 | mos7840_port->delta_msr_cond = 1; | 2026 | mos7840_port->delta_msr_cond = 1; |
2023 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x\n", | 2027 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x", |
2024 | mos7840_port->shadowLCR); | 2028 | mos7840_port->shadowLCR); |
2025 | 2029 | ||
2026 | return; | 2030 | return; |
@@ -2040,16 +2044,16 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2040 | unsigned int cflag; | 2044 | unsigned int cflag; |
2041 | struct usb_serial *serial; | 2045 | struct usb_serial *serial; |
2042 | struct moschip_port *mos7840_port; | 2046 | struct moschip_port *mos7840_port; |
2043 | dbg("mos7840_set_termios: START\n"); | 2047 | dbg("mos7840_set_termios: START"); |
2044 | if (mos7840_port_paranoia_check(port, __func__)) { | 2048 | if (mos7840_port_paranoia_check(port, __func__)) { |
2045 | dbg("%s", "Invalid port \n"); | 2049 | dbg("%s", "Invalid port"); |
2046 | return; | 2050 | return; |
2047 | } | 2051 | } |
2048 | 2052 | ||
2049 | serial = port->serial; | 2053 | serial = port->serial; |
2050 | 2054 | ||
2051 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 2055 | if (mos7840_serial_paranoia_check(serial, __func__)) { |
2052 | dbg("%s", "Invalid Serial \n"); | 2056 | dbg("%s", "Invalid Serial"); |
2053 | return; | 2057 | return; |
2054 | } | 2058 | } |
2055 | 2059 | ||
@@ -2063,7 +2067,7 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2063 | return; | 2067 | return; |
2064 | } | 2068 | } |
2065 | 2069 | ||
2066 | dbg("%s\n", "setting termios - "); | 2070 | dbg("%s", "setting termios - "); |
2067 | 2071 | ||
2068 | cflag = tty->termios->c_cflag; | 2072 | cflag = tty->termios->c_cflag; |
2069 | 2073 | ||
@@ -2078,7 +2082,7 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2078 | mos7840_change_port_settings(tty, mos7840_port, old_termios); | 2082 | mos7840_change_port_settings(tty, mos7840_port, old_termios); |
2079 | 2083 | ||
2080 | if (!mos7840_port->read_urb) { | 2084 | if (!mos7840_port->read_urb) { |
2081 | dbg("%s", "URB KILLED !!!!!\n"); | 2085 | dbg("%s", "URB KILLED !!!!!"); |
2082 | return; | 2086 | return; |
2083 | } | 2087 | } |
2084 | 2088 | ||
@@ -2144,7 +2148,7 @@ static int mos7840_set_modem_info(struct moschip_port *mos7840_port, | |||
2144 | 2148 | ||
2145 | port = (struct usb_serial_port *)mos7840_port->port; | 2149 | port = (struct usb_serial_port *)mos7840_port->port; |
2146 | if (mos7840_port_paranoia_check(port, __func__)) { | 2150 | if (mos7840_port_paranoia_check(port, __func__)) { |
2147 | dbg("%s", "Invalid port \n"); | 2151 | dbg("%s", "Invalid port"); |
2148 | return -1; | 2152 | return -1; |
2149 | } | 2153 | } |
2150 | 2154 | ||
@@ -2189,7 +2193,7 @@ static int mos7840_set_modem_info(struct moschip_port *mos7840_port, | |||
2189 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); | 2193 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); |
2190 | unlock_kernel(); | 2194 | unlock_kernel(); |
2191 | if (status < 0) { | 2195 | if (status < 0) { |
2192 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); | 2196 | dbg("setting MODEM_CONTROL_REGISTER Failed"); |
2193 | return -1; | 2197 | return -1; |
2194 | } | 2198 | } |
2195 | 2199 | ||
@@ -2274,7 +2278,7 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2274 | int mosret = 0; | 2278 | int mosret = 0; |
2275 | 2279 | ||
2276 | if (mos7840_port_paranoia_check(port, __func__)) { | 2280 | if (mos7840_port_paranoia_check(port, __func__)) { |
2277 | dbg("%s", "Invalid port \n"); | 2281 | dbg("%s", "Invalid port"); |
2278 | return -1; | 2282 | return -1; |
2279 | } | 2283 | } |
2280 | 2284 | ||
@@ -2374,9 +2378,8 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2374 | { | 2378 | { |
2375 | int mos7840_num_ports = 0; | 2379 | int mos7840_num_ports = 0; |
2376 | 2380 | ||
2377 | dbg("numberofendpoints: %d \n", | 2381 | dbg("numberofendpoints: cur %d, alt %d", |
2378 | (int)serial->interface->cur_altsetting->desc.bNumEndpoints); | 2382 | (int)serial->interface->cur_altsetting->desc.bNumEndpoints, |
2379 | dbg("numberofendpoints: %d \n", | ||
2380 | (int)serial->interface->altsetting->desc.bNumEndpoints); | 2383 | (int)serial->interface->altsetting->desc.bNumEndpoints); |
2381 | if (serial->interface->cur_altsetting->desc.bNumEndpoints == 5) { | 2384 | if (serial->interface->cur_altsetting->desc.bNumEndpoints == 5) { |
2382 | mos7840_num_ports = serial->num_ports = 2; | 2385 | mos7840_num_ports = serial->num_ports = 2; |
@@ -2385,7 +2388,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2385 | serial->num_bulk_out = 4; | 2388 | serial->num_bulk_out = 4; |
2386 | mos7840_num_ports = serial->num_ports = 4; | 2389 | mos7840_num_ports = serial->num_ports = 4; |
2387 | } | 2390 | } |
2388 | 2391 | dbg ("mos7840_num_ports = %d", mos7840_num_ports); | |
2389 | return mos7840_num_ports; | 2392 | return mos7840_num_ports; |
2390 | } | 2393 | } |
2391 | 2394 | ||
@@ -2400,22 +2403,24 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2400 | int i, status; | 2403 | int i, status; |
2401 | 2404 | ||
2402 | __u16 Data; | 2405 | __u16 Data; |
2403 | dbg("%s \n", " mos7840_startup :entering.........."); | 2406 | dbg("%s", "mos7840_startup :Entering.........."); |
2404 | 2407 | ||
2405 | if (!serial) { | 2408 | if (!serial) { |
2406 | dbg("%s\n", "Invalid Handler"); | 2409 | dbg("%s", "Invalid Handler"); |
2407 | return -1; | 2410 | return -1; |
2408 | } | 2411 | } |
2409 | 2412 | ||
2410 | dev = serial->dev; | 2413 | dev = serial->dev; |
2411 | 2414 | ||
2412 | dbg("%s\n", "Entering..."); | 2415 | dbg("%s", "Entering..."); |
2416 | dbg ("mos7840_startup: serial = %p", serial); | ||
2413 | 2417 | ||
2414 | /* we set up the pointers to the endpoints in the mos7840_open * | 2418 | /* we set up the pointers to the endpoints in the mos7840_open * |
2415 | * function, as the structures aren't created yet. */ | 2419 | * function, as the structures aren't created yet. */ |
2416 | 2420 | ||
2417 | /* set up port private structures */ | 2421 | /* set up port private structures */ |
2418 | for (i = 0; i < serial->num_ports; ++i) { | 2422 | for (i = 0; i < serial->num_ports; ++i) { |
2423 | dbg ("mos7840_startup: configuring port %d............", i); | ||
2419 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | 2424 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
2420 | if (mos7840_port == NULL) { | 2425 | if (mos7840_port == NULL) { |
2421 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | 2426 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); |
@@ -2473,10 +2478,10 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2473 | status = mos7840_get_reg_sync(serial->port[i], | 2478 | status = mos7840_get_reg_sync(serial->port[i], |
2474 | mos7840_port->ControlRegOffset, &Data); | 2479 | mos7840_port->ControlRegOffset, &Data); |
2475 | if (status < 0) { | 2480 | if (status < 0) { |
2476 | dbg("Reading ControlReg failed status-0x%x\n", status); | 2481 | dbg("Reading ControlReg failed status-0x%x", status); |
2477 | break; | 2482 | break; |
2478 | } else | 2483 | } else |
2479 | dbg("ControlReg Reading success val is %x, status%d\n", | 2484 | dbg("ControlReg Reading success val is %x, status%d", |
2480 | Data, status); | 2485 | Data, status); |
2481 | Data |= 0x08; /* setting driver done bit */ | 2486 | Data |= 0x08; /* setting driver done bit */ |
2482 | Data |= 0x04; /* sp1_bit to have cts change reflect in | 2487 | Data |= 0x04; /* sp1_bit to have cts change reflect in |
@@ -2486,10 +2491,10 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2486 | status = mos7840_set_reg_sync(serial->port[i], | 2491 | status = mos7840_set_reg_sync(serial->port[i], |
2487 | mos7840_port->ControlRegOffset, Data); | 2492 | mos7840_port->ControlRegOffset, Data); |
2488 | if (status < 0) { | 2493 | if (status < 0) { |
2489 | dbg("Writing ControlReg failed(rx_disable) status-0x%x\n", status); | 2494 | dbg("Writing ControlReg failed(rx_disable) status-0x%x", status); |
2490 | break; | 2495 | break; |
2491 | } else | 2496 | } else |
2492 | dbg("ControlReg Writing success(rx_disable) status%d\n", | 2497 | dbg("ControlReg Writing success(rx_disable) status%d", |
2493 | status); | 2498 | status); |
2494 | 2499 | ||
2495 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 | 2500 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 |
@@ -2498,48 +2503,48 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2498 | status = mos7840_set_reg_sync(serial->port[i], | 2503 | status = mos7840_set_reg_sync(serial->port[i], |
2499 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); | 2504 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); |
2500 | if (status < 0) { | 2505 | if (status < 0) { |
2501 | dbg("Writing DCR0 failed status-0x%x\n", status); | 2506 | dbg("Writing DCR0 failed status-0x%x", status); |
2502 | break; | 2507 | break; |
2503 | } else | 2508 | } else |
2504 | dbg("DCR0 Writing success status%d\n", status); | 2509 | dbg("DCR0 Writing success status%d", status); |
2505 | 2510 | ||
2506 | Data = 0x05; | 2511 | Data = 0x05; |
2507 | status = mos7840_set_reg_sync(serial->port[i], | 2512 | status = mos7840_set_reg_sync(serial->port[i], |
2508 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); | 2513 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); |
2509 | if (status < 0) { | 2514 | if (status < 0) { |
2510 | dbg("Writing DCR1 failed status-0x%x\n", status); | 2515 | dbg("Writing DCR1 failed status-0x%x", status); |
2511 | break; | 2516 | break; |
2512 | } else | 2517 | } else |
2513 | dbg("DCR1 Writing success status%d\n", status); | 2518 | dbg("DCR1 Writing success status%d", status); |
2514 | 2519 | ||
2515 | Data = 0x24; | 2520 | Data = 0x24; |
2516 | status = mos7840_set_reg_sync(serial->port[i], | 2521 | status = mos7840_set_reg_sync(serial->port[i], |
2517 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); | 2522 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); |
2518 | if (status < 0) { | 2523 | if (status < 0) { |
2519 | dbg("Writing DCR2 failed status-0x%x\n", status); | 2524 | dbg("Writing DCR2 failed status-0x%x", status); |
2520 | break; | 2525 | break; |
2521 | } else | 2526 | } else |
2522 | dbg("DCR2 Writing success status%d\n", status); | 2527 | dbg("DCR2 Writing success status%d", status); |
2523 | 2528 | ||
2524 | /* write values in clkstart0x0 and clkmulti 0x20 */ | 2529 | /* write values in clkstart0x0 and clkmulti 0x20 */ |
2525 | Data = 0x0; | 2530 | Data = 0x0; |
2526 | status = mos7840_set_reg_sync(serial->port[i], | 2531 | status = mos7840_set_reg_sync(serial->port[i], |
2527 | CLK_START_VALUE_REGISTER, Data); | 2532 | CLK_START_VALUE_REGISTER, Data); |
2528 | if (status < 0) { | 2533 | if (status < 0) { |
2529 | dbg("Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); | 2534 | dbg("Writing CLK_START_VALUE_REGISTER failed status-0x%x", status); |
2530 | break; | 2535 | break; |
2531 | } else | 2536 | } else |
2532 | dbg("CLK_START_VALUE_REGISTER Writing success status%d\n", status); | 2537 | dbg("CLK_START_VALUE_REGISTER Writing success status%d", status); |
2533 | 2538 | ||
2534 | Data = 0x20; | 2539 | Data = 0x20; |
2535 | status = mos7840_set_reg_sync(serial->port[i], | 2540 | status = mos7840_set_reg_sync(serial->port[i], |
2536 | CLK_MULTI_REGISTER, Data); | 2541 | CLK_MULTI_REGISTER, Data); |
2537 | if (status < 0) { | 2542 | if (status < 0) { |
2538 | dbg("Writing CLK_MULTI_REGISTER failed status-0x%x\n", | 2543 | dbg("Writing CLK_MULTI_REGISTER failed status-0x%x", |
2539 | status); | 2544 | status); |
2540 | goto error; | 2545 | goto error; |
2541 | } else | 2546 | } else |
2542 | dbg("CLK_MULTI_REGISTER Writing success status%d\n", | 2547 | dbg("CLK_MULTI_REGISTER Writing success status%d", |
2543 | status); | 2548 | status); |
2544 | 2549 | ||
2545 | /* write value 0x0 to scratchpad register */ | 2550 | /* write value 0x0 to scratchpad register */ |
@@ -2547,11 +2552,11 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2547 | status = mos7840_set_uart_reg(serial->port[i], | 2552 | status = mos7840_set_uart_reg(serial->port[i], |
2548 | SCRATCH_PAD_REGISTER, Data); | 2553 | SCRATCH_PAD_REGISTER, Data); |
2549 | if (status < 0) { | 2554 | if (status < 0) { |
2550 | dbg("Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", | 2555 | dbg("Writing SCRATCH_PAD_REGISTER failed status-0x%x", |
2551 | status); | 2556 | status); |
2552 | break; | 2557 | break; |
2553 | } else | 2558 | } else |
2554 | dbg("SCRATCH_PAD_REGISTER Writing success status%d\n", | 2559 | dbg("SCRATCH_PAD_REGISTER Writing success status%d", |
2555 | status); | 2560 | status); |
2556 | 2561 | ||
2557 | /* Zero Length flag register */ | 2562 | /* Zero Length flag register */ |
@@ -2562,30 +2567,30 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2562 | status = mos7840_set_reg_sync(serial->port[i], | 2567 | status = mos7840_set_reg_sync(serial->port[i], |
2563 | (__u16) (ZLP_REG1 + | 2568 | (__u16) (ZLP_REG1 + |
2564 | ((__u16)mos7840_port->port_num)), Data); | 2569 | ((__u16)mos7840_port->port_num)), Data); |
2565 | dbg("ZLIP offset%x\n", | 2570 | dbg("ZLIP offset %x", |
2566 | (__u16) (ZLP_REG1 + | 2571 | (__u16) (ZLP_REG1 + |
2567 | ((__u16) mos7840_port->port_num))); | 2572 | ((__u16) mos7840_port->port_num))); |
2568 | if (status < 0) { | 2573 | if (status < 0) { |
2569 | dbg("Writing ZLP_REG%d failed status-0x%x\n", | 2574 | dbg("Writing ZLP_REG%d failed status-0x%x", |
2570 | i + 2, status); | 2575 | i + 2, status); |
2571 | break; | 2576 | break; |
2572 | } else | 2577 | } else |
2573 | dbg("ZLP_REG%d Writing success status%d\n", | 2578 | dbg("ZLP_REG%d Writing success status%d", |
2574 | i + 2, status); | 2579 | i + 2, status); |
2575 | } else { | 2580 | } else { |
2576 | Data = 0xff; | 2581 | Data = 0xff; |
2577 | status = mos7840_set_reg_sync(serial->port[i], | 2582 | status = mos7840_set_reg_sync(serial->port[i], |
2578 | (__u16) (ZLP_REG1 + | 2583 | (__u16) (ZLP_REG1 + |
2579 | ((__u16)mos7840_port->port_num) - 0x1), Data); | 2584 | ((__u16)mos7840_port->port_num) - 0x1), Data); |
2580 | dbg("ZLIP offset%x\n", | 2585 | dbg("ZLIP offset %x", |
2581 | (__u16) (ZLP_REG1 + | 2586 | (__u16) (ZLP_REG1 + |
2582 | ((__u16) mos7840_port->port_num) - 0x1)); | 2587 | ((__u16) mos7840_port->port_num) - 0x1)); |
2583 | if (status < 0) { | 2588 | if (status < 0) { |
2584 | dbg("Writing ZLP_REG%d failed status-0x%x\n", | 2589 | dbg("Writing ZLP_REG%d failed status-0x%x", |
2585 | i + 1, status); | 2590 | i + 1, status); |
2586 | break; | 2591 | break; |
2587 | } else | 2592 | } else |
2588 | dbg("ZLP_REG%d Writing success status%d\n", | 2593 | dbg("ZLP_REG%d Writing success status%d", |
2589 | i + 1, status); | 2594 | i + 1, status); |
2590 | 2595 | ||
2591 | } | 2596 | } |
@@ -2599,15 +2604,16 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2599 | goto error; | 2604 | goto error; |
2600 | } | 2605 | } |
2601 | } | 2606 | } |
2607 | dbg ("mos7840_startup: all ports configured..........."); | ||
2602 | 2608 | ||
2603 | /* Zero Length flag enable */ | 2609 | /* Zero Length flag enable */ |
2604 | Data = 0x0f; | 2610 | Data = 0x0f; |
2605 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2611 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); |
2606 | if (status < 0) { | 2612 | if (status < 0) { |
2607 | dbg("Writing ZLP_REG5 failed status-0x%x\n", status); | 2613 | dbg("Writing ZLP_REG5 failed status-0x%x", status); |
2608 | goto error; | 2614 | goto error; |
2609 | } else | 2615 | } else |
2610 | dbg("ZLP_REG5 Writing success status%d\n", status); | 2616 | dbg("ZLP_REG5 Writing success status%d", status); |
2611 | 2617 | ||
2612 | /* setting configuration feature to one */ | 2618 | /* setting configuration feature to one */ |
2613 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 2619 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
@@ -2627,19 +2633,19 @@ error: | |||
2627 | } | 2633 | } |
2628 | 2634 | ||
2629 | /**************************************************************************** | 2635 | /**************************************************************************** |
2630 | * mos7840_shutdown | 2636 | * mos7840_disconnect |
2631 | * This function is called whenever the device is removed from the usb bus. | 2637 | * This function is called whenever the device is removed from the usb bus. |
2632 | ****************************************************************************/ | 2638 | ****************************************************************************/ |
2633 | 2639 | ||
2634 | static void mos7840_shutdown(struct usb_serial *serial) | 2640 | static void mos7840_disconnect(struct usb_serial *serial) |
2635 | { | 2641 | { |
2636 | int i; | 2642 | int i; |
2637 | unsigned long flags; | 2643 | unsigned long flags; |
2638 | struct moschip_port *mos7840_port; | 2644 | struct moschip_port *mos7840_port; |
2639 | dbg("%s \n", " shutdown :entering.........."); | 2645 | dbg("%s", " disconnect :entering.........."); |
2640 | 2646 | ||
2641 | if (!serial) { | 2647 | if (!serial) { |
2642 | dbg("%s", "Invalid Handler \n"); | 2648 | dbg("%s", "Invalid Handler"); |
2643 | return; | 2649 | return; |
2644 | } | 2650 | } |
2645 | 2651 | ||
@@ -2656,14 +2662,45 @@ static void mos7840_shutdown(struct usb_serial *serial) | |||
2656 | mos7840_port->zombie = 1; | 2662 | mos7840_port->zombie = 1; |
2657 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | 2663 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); |
2658 | usb_kill_urb(mos7840_port->control_urb); | 2664 | usb_kill_urb(mos7840_port->control_urb); |
2665 | } | ||
2666 | } | ||
2667 | |||
2668 | dbg("%s", "Thank u :: "); | ||
2669 | |||
2670 | } | ||
2671 | |||
2672 | /**************************************************************************** | ||
2673 | * mos7840_release | ||
2674 | * This function is called when the usb_serial structure is freed. | ||
2675 | ****************************************************************************/ | ||
2676 | |||
2677 | static void mos7840_release(struct usb_serial *serial) | ||
2678 | { | ||
2679 | int i; | ||
2680 | struct moschip_port *mos7840_port; | ||
2681 | dbg("%s", " release :entering.........."); | ||
2682 | |||
2683 | if (!serial) { | ||
2684 | dbg("%s", "Invalid Handler"); | ||
2685 | return; | ||
2686 | } | ||
2687 | |||
2688 | /* check for the ports to be closed,close the ports and disconnect */ | ||
2689 | |||
2690 | /* free private structure allocated for serial port * | ||
2691 | * stop reads and writes on all ports */ | ||
2692 | |||
2693 | for (i = 0; i < serial->num_ports; ++i) { | ||
2694 | mos7840_port = mos7840_get_port_private(serial->port[i]); | ||
2695 | dbg("mos7840_port %d = %p", i, mos7840_port); | ||
2696 | if (mos7840_port) { | ||
2659 | kfree(mos7840_port->ctrl_buf); | 2697 | kfree(mos7840_port->ctrl_buf); |
2660 | kfree(mos7840_port->dr); | 2698 | kfree(mos7840_port->dr); |
2661 | kfree(mos7840_port); | 2699 | kfree(mos7840_port); |
2662 | } | 2700 | } |
2663 | mos7840_set_port_private(serial->port[i], NULL); | ||
2664 | } | 2701 | } |
2665 | 2702 | ||
2666 | dbg("%s\n", "Thank u :: "); | 2703 | dbg("%s", "Thank u :: "); |
2667 | 2704 | ||
2668 | } | 2705 | } |
2669 | 2706 | ||
@@ -2701,7 +2738,8 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2701 | .tiocmget = mos7840_tiocmget, | 2738 | .tiocmget = mos7840_tiocmget, |
2702 | .tiocmset = mos7840_tiocmset, | 2739 | .tiocmset = mos7840_tiocmset, |
2703 | .attach = mos7840_startup, | 2740 | .attach = mos7840_startup, |
2704 | .shutdown = mos7840_shutdown, | 2741 | .disconnect = mos7840_disconnect, |
2742 | .release = mos7840_release, | ||
2705 | .read_bulk_callback = mos7840_bulk_in_callback, | 2743 | .read_bulk_callback = mos7840_bulk_in_callback, |
2706 | .read_int_callback = mos7840_interrupt_callback, | 2744 | .read_int_callback = mos7840_interrupt_callback, |
2707 | }; | 2745 | }; |
@@ -2714,7 +2752,7 @@ static int __init moschip7840_init(void) | |||
2714 | { | 2752 | { |
2715 | int retval; | 2753 | int retval; |
2716 | 2754 | ||
2717 | dbg("%s \n", " mos7840_init :entering.........."); | 2755 | dbg("%s", " mos7840_init :entering.........."); |
2718 | 2756 | ||
2719 | /* Register with the usb serial */ | 2757 | /* Register with the usb serial */ |
2720 | retval = usb_serial_register(&moschip7840_4port_device); | 2758 | retval = usb_serial_register(&moschip7840_4port_device); |
@@ -2722,14 +2760,14 @@ static int __init moschip7840_init(void) | |||
2722 | if (retval) | 2760 | if (retval) |
2723 | goto failed_port_device_register; | 2761 | goto failed_port_device_register; |
2724 | 2762 | ||
2725 | dbg("%s\n", "Entring..."); | 2763 | dbg("%s", "Entering..."); |
2726 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 2764 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
2727 | DRIVER_DESC "\n"); | 2765 | DRIVER_DESC "\n"); |
2728 | 2766 | ||
2729 | /* Register with the usb */ | 2767 | /* Register with the usb */ |
2730 | retval = usb_register(&io_driver); | 2768 | retval = usb_register(&io_driver); |
2731 | if (retval == 0) { | 2769 | if (retval == 0) { |
2732 | dbg("%s\n", "Leaving..."); | 2770 | dbg("%s", "Leaving..."); |
2733 | return 0; | 2771 | return 0; |
2734 | } | 2772 | } |
2735 | usb_serial_deregister(&moschip7840_4port_device); | 2773 | usb_serial_deregister(&moschip7840_4port_device); |
@@ -2744,13 +2782,13 @@ failed_port_device_register: | |||
2744 | static void __exit moschip7840_exit(void) | 2782 | static void __exit moschip7840_exit(void) |
2745 | { | 2783 | { |
2746 | 2784 | ||
2747 | dbg("%s \n", " mos7840_exit :entering.........."); | 2785 | dbg("%s", " mos7840_exit :entering.........."); |
2748 | 2786 | ||
2749 | usb_deregister(&io_driver); | 2787 | usb_deregister(&io_driver); |
2750 | 2788 | ||
2751 | usb_serial_deregister(&moschip7840_4port_device); | 2789 | usb_serial_deregister(&moschip7840_4port_device); |
2752 | 2790 | ||
2753 | dbg("%s\n", "Entring..."); | 2791 | dbg("%s", "Entering..."); |
2754 | } | 2792 | } |
2755 | 2793 | ||
2756 | module_init(moschip7840_init); | 2794 | module_init(moschip7840_init); |