diff options
-rw-r--r-- | drivers/usb/serial/io_ti.c | 383 |
1 files changed, 162 insertions, 221 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 3936904c6419..54916d724145 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -233,8 +233,8 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, | |||
233 | if (status < 0) | 233 | if (status < 0) |
234 | return status; | 234 | return status; |
235 | if (status != size) { | 235 | if (status != size) { |
236 | dbg("%s - wanted to write %d, but only wrote %d", | 236 | dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", |
237 | __func__, size, status); | 237 | __func__, size, status); |
238 | return -ECOMM; | 238 | return -ECOMM; |
239 | } | 239 | } |
240 | return 0; | 240 | return 0; |
@@ -251,8 +251,8 @@ static int ti_vsend_sync(struct usb_device *dev, __u8 request, | |||
251 | if (status < 0) | 251 | if (status < 0) |
252 | return status; | 252 | return status; |
253 | if (status != size) { | 253 | if (status != size) { |
254 | dbg("%s - wanted to write %d, but only wrote %d", | 254 | dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", |
255 | __func__, size, status); | 255 | __func__, size, status); |
256 | return -ECOMM; | 256 | return -ECOMM; |
257 | } | 257 | } |
258 | return 0; | 258 | return 0; |
@@ -270,7 +270,7 @@ static int purge_port(struct usb_serial_port *port, __u16 mask) | |||
270 | { | 270 | { |
271 | int port_number = port->number - port->serial->minor; | 271 | int port_number = port->number - port->serial->minor; |
272 | 272 | ||
273 | dbg("%s - port %d, mask %x", __func__, port_number, mask); | 273 | dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); |
274 | 274 | ||
275 | return send_cmd(port->serial->dev, | 275 | return send_cmd(port->serial->dev, |
276 | UMPC_PURGE_PORT, | 276 | UMPC_PURGE_PORT, |
@@ -295,7 +295,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
295 | __u8 read_length; | 295 | __u8 read_length; |
296 | __be16 be_start_address; | 296 | __be16 be_start_address; |
297 | 297 | ||
298 | dbg("%s - @ %x for %d", __func__, start_address, length); | 298 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length); |
299 | 299 | ||
300 | /* Read in blocks of 64 bytes | 300 | /* Read in blocks of 64 bytes |
301 | * (TI firmware can't handle more than 64 byte reads) | 301 | * (TI firmware can't handle more than 64 byte reads) |
@@ -307,8 +307,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
307 | read_length = (__u8)length; | 307 | read_length = (__u8)length; |
308 | 308 | ||
309 | if (read_length > 1) { | 309 | if (read_length > 1) { |
310 | dbg("%s - @ %x for %d", __func__, | 310 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length); |
311 | start_address, read_length); | ||
312 | } | 311 | } |
313 | be_start_address = cpu_to_be16(start_address); | 312 | be_start_address = cpu_to_be16(start_address); |
314 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, | 313 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, |
@@ -317,7 +316,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
317 | buffer, read_length); | 316 | buffer, read_length); |
318 | 317 | ||
319 | if (status) { | 318 | if (status) { |
320 | dbg("%s - ERROR %x", __func__, status); | 319 | dev_dbg(&dev->dev, "%s - ERROR %x\n", __func__, status); |
321 | return status; | 320 | return status; |
322 | } | 321 | } |
323 | 322 | ||
@@ -353,13 +352,13 @@ static int read_boot_mem(struct edgeport_serial *serial, | |||
353 | UMPC_MEMORY_READ, serial->TI_I2C_Type, | 352 | UMPC_MEMORY_READ, serial->TI_I2C_Type, |
354 | (__u16)(start_address+i), &buffer[i], 0x01); | 353 | (__u16)(start_address+i), &buffer[i], 0x01); |
355 | if (status) { | 354 | if (status) { |
356 | dbg("%s - ERROR %x", __func__, status); | 355 | dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status); |
357 | return status; | 356 | return status; |
358 | } | 357 | } |
359 | } | 358 | } |
360 | 359 | ||
361 | dbg("%s - start_address = %x, length = %d", | 360 | dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n", |
362 | __func__, start_address, length); | 361 | __func__, start_address, length); |
363 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 362 | usb_serial_debug_data(debug, &serial->serial->dev->dev, |
364 | __func__, length, buffer); | 363 | __func__, length, buffer); |
365 | 364 | ||
@@ -398,8 +397,7 @@ static int write_boot_mem(struct edgeport_serial *serial, | |||
398 | return status; | 397 | return status; |
399 | } | 398 | } |
400 | 399 | ||
401 | dbg("%s - start_sddr = %x, length = %d", | 400 | dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length); |
402 | __func__, start_address, length); | ||
403 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 401 | usb_serial_debug_data(debug, &serial->serial->dev->dev, |
404 | __func__, length, buffer); | 402 | __func__, length, buffer); |
405 | 403 | ||
@@ -411,6 +409,7 @@ static int write_boot_mem(struct edgeport_serial *serial, | |||
411 | static int write_i2c_mem(struct edgeport_serial *serial, | 409 | static int write_i2c_mem(struct edgeport_serial *serial, |
412 | int start_address, int length, __u8 address_type, __u8 *buffer) | 410 | int start_address, int length, __u8 address_type, __u8 *buffer) |
413 | { | 411 | { |
412 | struct device *dev = &serial->serial->dev->dev; | ||
414 | int status = 0; | 413 | int status = 0; |
415 | int write_length; | 414 | int write_length; |
416 | __be16 be_start_address; | 415 | __be16 be_start_address; |
@@ -424,10 +423,9 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
424 | if (write_length > length) | 423 | if (write_length > length) |
425 | write_length = length; | 424 | write_length = length; |
426 | 425 | ||
427 | dbg("%s - BytesInFirstPage Addr = %x, length = %d", | 426 | dev_dbg(dev, "%s - BytesInFirstPage Addr = %x, length = %d\n", |
428 | __func__, start_address, write_length); | 427 | __func__, start_address, write_length); |
429 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 428 | usb_serial_debug_data(debug, dev, __func__, write_length, buffer); |
430 | __func__, write_length, buffer); | ||
431 | 429 | ||
432 | /* Write first page */ | 430 | /* Write first page */ |
433 | be_start_address = cpu_to_be16(start_address); | 431 | be_start_address = cpu_to_be16(start_address); |
@@ -436,7 +434,7 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
436 | (__force __u16)be_start_address, | 434 | (__force __u16)be_start_address, |
437 | buffer, write_length); | 435 | buffer, write_length); |
438 | if (status) { | 436 | if (status) { |
439 | dbg("%s - ERROR %d", __func__, status); | 437 | dev_dbg(dev, "%s - ERROR %d\n", __func__, status); |
440 | return status; | 438 | return status; |
441 | } | 439 | } |
442 | 440 | ||
@@ -452,10 +450,9 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
452 | else | 450 | else |
453 | write_length = length; | 451 | write_length = length; |
454 | 452 | ||
455 | dbg("%s - Page Write Addr = %x, length = %d", | 453 | dev_dbg(dev, "%s - Page Write Addr = %x, length = %d\n", |
456 | __func__, start_address, write_length); | 454 | __func__, start_address, write_length); |
457 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 455 | usb_serial_debug_data(debug, dev, __func__, write_length, buffer); |
458 | __func__, write_length, buffer); | ||
459 | 456 | ||
460 | /* Write next page */ | 457 | /* Write next page */ |
461 | be_start_address = cpu_to_be16(start_address); | 458 | be_start_address = cpu_to_be16(start_address); |
@@ -464,8 +461,7 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
464 | (__force __u16)be_start_address, | 461 | (__force __u16)be_start_address, |
465 | buffer, write_length); | 462 | buffer, write_length); |
466 | if (status) { | 463 | if (status) { |
467 | dev_err(&serial->serial->dev->dev, "%s - ERROR %d\n", | 464 | dev_err(dev, "%s - ERROR %d\n", __func__, status); |
468 | __func__, status); | ||
469 | return status; | 465 | return status; |
470 | } | 466 | } |
471 | 467 | ||
@@ -508,7 +504,7 @@ static int tx_active(struct edgeport_port *port) | |||
508 | if (status) | 504 | if (status) |
509 | goto exit_is_tx_active; | 505 | goto exit_is_tx_active; |
510 | 506 | ||
511 | dbg("%s - XByteCount 0x%X", __func__, oedb->XByteCount); | 507 | dev_dbg(&port->port->dev, "%s - XByteCount 0x%X\n", __func__, oedb->XByteCount); |
512 | 508 | ||
513 | /* and the LSR */ | 509 | /* and the LSR */ |
514 | status = read_ram(port->port->serial->dev, | 510 | status = read_ram(port->port->serial->dev, |
@@ -516,7 +512,7 @@ static int tx_active(struct edgeport_port *port) | |||
516 | 512 | ||
517 | if (status) | 513 | if (status) |
518 | goto exit_is_tx_active; | 514 | goto exit_is_tx_active; |
519 | dbg("%s - LSR = 0x%X", __func__, *lsr); | 515 | dev_dbg(&port->port->dev, "%s - LSR = 0x%X\n", __func__, *lsr); |
520 | 516 | ||
521 | /* If either buffer has data or we are transmitting then return TRUE */ | 517 | /* If either buffer has data or we are transmitting then return TRUE */ |
522 | if ((oedb->XByteCount & 0x80) != 0) | 518 | if ((oedb->XByteCount & 0x80) != 0) |
@@ -527,7 +523,7 @@ static int tx_active(struct edgeport_port *port) | |||
527 | 523 | ||
528 | /* We return Not Active if we get any kind of error */ | 524 | /* We return Not Active if we get any kind of error */ |
529 | exit_is_tx_active: | 525 | exit_is_tx_active: |
530 | dbg("%s - return %d", __func__, bytes_left); | 526 | dev_dbg(&port->port->dev, "%s - return %d\n", __func__, bytes_left); |
531 | 527 | ||
532 | kfree(lsr); | 528 | kfree(lsr); |
533 | kfree(oedb); | 529 | kfree(oedb); |
@@ -599,14 +595,13 @@ static int choose_config(struct usb_device *dev) | |||
599 | * configuration # 1, which is Config Descriptor 0. | 595 | * configuration # 1, which is Config Descriptor 0. |
600 | */ | 596 | */ |
601 | 597 | ||
602 | dbg("%s - Number of Interfaces = %d", | 598 | dev_dbg(&dev->dev, "%s - Number of Interfaces = %d\n", |
603 | __func__, dev->config->desc.bNumInterfaces); | 599 | __func__, dev->config->desc.bNumInterfaces); |
604 | dbg("%s - MAX Power = %d", | 600 | dev_dbg(&dev->dev, "%s - MAX Power = %d\n", |
605 | __func__, dev->config->desc.bMaxPower * 2); | 601 | __func__, dev->config->desc.bMaxPower * 2); |
606 | 602 | ||
607 | if (dev->config->desc.bNumInterfaces != 1) { | 603 | if (dev->config->desc.bNumInterfaces != 1) { |
608 | dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", | 604 | dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __func__); |
609 | __func__); | ||
610 | return -ENODEV; | 605 | return -ENODEV; |
611 | } | 606 | } |
612 | 607 | ||
@@ -684,7 +679,7 @@ static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer) | |||
684 | cs = (__u8)(cs + buffer[i]); | 679 | cs = (__u8)(cs + buffer[i]); |
685 | 680 | ||
686 | if (cs != rom_desc->CheckSum) { | 681 | if (cs != rom_desc->CheckSum) { |
687 | dbg("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); | 682 | pr_debug("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); |
688 | return -EINVAL; | 683 | return -EINVAL; |
689 | } | 684 | } |
690 | return 0; | 685 | return 0; |
@@ -736,11 +731,11 @@ static int check_i2c_image(struct edgeport_serial *serial) | |||
736 | if ((start_address + sizeof(struct ti_i2c_desc) + | 731 | if ((start_address + sizeof(struct ti_i2c_desc) + |
737 | rom_desc->Size) > TI_MAX_I2C_SIZE) { | 732 | rom_desc->Size) > TI_MAX_I2C_SIZE) { |
738 | status = -ENODEV; | 733 | status = -ENODEV; |
739 | dbg("%s - structure too big, erroring out.", __func__); | 734 | dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__); |
740 | break; | 735 | break; |
741 | } | 736 | } |
742 | 737 | ||
743 | dbg("%s Type = 0x%x", __func__, rom_desc->Type); | 738 | dev_dbg(dev, "%s Type = 0x%x\n", __func__, rom_desc->Type); |
744 | 739 | ||
745 | /* Skip type 2 record */ | 740 | /* Skip type 2 record */ |
746 | ttype = rom_desc->Type & 0x0f; | 741 | ttype = rom_desc->Type & 0x0f; |
@@ -779,18 +774,18 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) | |||
779 | int start_address; | 774 | int start_address; |
780 | struct ti_i2c_desc *rom_desc; | 775 | struct ti_i2c_desc *rom_desc; |
781 | struct edge_ti_manuf_descriptor *desc; | 776 | struct edge_ti_manuf_descriptor *desc; |
777 | struct device *dev = &serial->serial->dev->dev; | ||
782 | 778 | ||
783 | rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); | 779 | rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); |
784 | if (!rom_desc) { | 780 | if (!rom_desc) { |
785 | dev_err(&serial->serial->dev->dev, "%s - out of memory\n", | 781 | dev_err(dev, "%s - out of memory\n", __func__); |
786 | __func__); | ||
787 | return -ENOMEM; | 782 | return -ENOMEM; |
788 | } | 783 | } |
789 | start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, | 784 | start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, |
790 | rom_desc); | 785 | rom_desc); |
791 | 786 | ||
792 | if (!start_address) { | 787 | if (!start_address) { |
793 | dbg("%s - Edge Descriptor not found in I2C", __func__); | 788 | dev_dbg(dev, "%s - Edge Descriptor not found in I2C\n", __func__); |
794 | status = -ENODEV; | 789 | status = -ENODEV; |
795 | goto exit; | 790 | goto exit; |
796 | } | 791 | } |
@@ -804,12 +799,12 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) | |||
804 | status = valid_csum(rom_desc, buffer); | 799 | status = valid_csum(rom_desc, buffer); |
805 | 800 | ||
806 | desc = (struct edge_ti_manuf_descriptor *)buffer; | 801 | desc = (struct edge_ti_manuf_descriptor *)buffer; |
807 | dbg("%s - IonConfig 0x%x", __func__, desc->IonConfig); | 802 | dev_dbg(dev, "%s - IonConfig 0x%x\n", __func__, desc->IonConfig); |
808 | dbg("%s - Version %d", __func__, desc->Version); | 803 | dev_dbg(dev, "%s - Version %d\n", __func__, desc->Version); |
809 | dbg("%s - Cpu/Board 0x%x", __func__, desc->CpuRev_BoardRev); | 804 | dev_dbg(dev, "%s - Cpu/Board 0x%x\n", __func__, desc->CpuRev_BoardRev); |
810 | dbg("%s - NumPorts %d", __func__, desc->NumPorts); | 805 | dev_dbg(dev, "%s - NumPorts %d\n", __func__, desc->NumPorts); |
811 | dbg("%s - NumVirtualPorts %d", __func__, desc->NumVirtualPorts); | 806 | dev_dbg(dev, "%s - NumVirtualPorts %d\n", __func__, desc->NumVirtualPorts); |
812 | dbg("%s - TotalPorts %d", __func__, desc->TotalPorts); | 807 | dev_dbg(dev, "%s - TotalPorts %d\n", __func__, desc->TotalPorts); |
813 | 808 | ||
814 | exit: | 809 | exit: |
815 | kfree(rom_desc); | 810 | kfree(rom_desc); |
@@ -903,13 +898,13 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev) | |||
903 | /* Try to figure out what type of I2c we have */ | 898 | /* Try to figure out what type of I2c we have */ |
904 | static int i2c_type_bootmode(struct edgeport_serial *serial) | 899 | static int i2c_type_bootmode(struct edgeport_serial *serial) |
905 | { | 900 | { |
901 | struct device *dev = &serial->serial->dev->dev; | ||
906 | int status; | 902 | int status; |
907 | u8 *data; | 903 | u8 *data; |
908 | 904 | ||
909 | data = kmalloc(1, GFP_KERNEL); | 905 | data = kmalloc(1, GFP_KERNEL); |
910 | if (!data) { | 906 | if (!data) { |
911 | dev_err(&serial->serial->dev->dev, | 907 | dev_err(dev, "%s - out of memory\n", __func__); |
912 | "%s - out of memory\n", __func__); | ||
913 | return -ENOMEM; | 908 | return -ENOMEM; |
914 | } | 909 | } |
915 | 910 | ||
@@ -917,11 +912,11 @@ static int i2c_type_bootmode(struct edgeport_serial *serial) | |||
917 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, | 912 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, |
918 | DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01); | 913 | DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01); |
919 | if (status) | 914 | if (status) |
920 | dbg("%s - read 2 status error = %d", __func__, status); | 915 | dev_dbg(dev, "%s - read 2 status error = %d\n", __func__, status); |
921 | else | 916 | else |
922 | dbg("%s - read 2 data = 0x%x", __func__, *data); | 917 | dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data); |
923 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { | 918 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { |
924 | dbg("%s - ROM_TYPE_II", __func__); | 919 | dev_dbg(dev, "%s - ROM_TYPE_II\n", __func__); |
925 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 920 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
926 | goto out; | 921 | goto out; |
927 | } | 922 | } |
@@ -930,16 +925,16 @@ static int i2c_type_bootmode(struct edgeport_serial *serial) | |||
930 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, | 925 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, |
931 | DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01); | 926 | DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01); |
932 | if (status) | 927 | if (status) |
933 | dbg("%s - read 3 status error = %d", __func__, status); | 928 | dev_dbg(dev, "%s - read 3 status error = %d\n", __func__, status); |
934 | else | 929 | else |
935 | dbg("%s - read 2 data = 0x%x", __func__, *data); | 930 | dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data); |
936 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { | 931 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { |
937 | dbg("%s - ROM_TYPE_III", __func__); | 932 | dev_dbg(dev, "%s - ROM_TYPE_III\n", __func__); |
938 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; | 933 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; |
939 | goto out; | 934 | goto out; |
940 | } | 935 | } |
941 | 936 | ||
942 | dbg("%s - Unknown", __func__); | 937 | dev_dbg(dev, "%s - Unknown\n", __func__); |
943 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 938 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
944 | status = -ENODEV; | 939 | status = -ENODEV; |
945 | out: | 940 | out: |
@@ -1050,11 +1045,11 @@ static int download_fw(struct edgeport_serial *serial) | |||
1050 | if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { | 1045 | if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { |
1051 | struct ti_i2c_desc *rom_desc; | 1046 | struct ti_i2c_desc *rom_desc; |
1052 | 1047 | ||
1053 | dbg("%s - RUNNING IN DOWNLOAD MODE", __func__); | 1048 | dev_dbg(dev, "%s - RUNNING IN DOWNLOAD MODE\n", __func__); |
1054 | 1049 | ||
1055 | status = check_i2c_image(serial); | 1050 | status = check_i2c_image(serial); |
1056 | if (status) { | 1051 | if (status) { |
1057 | dbg("%s - DOWNLOAD MODE -- BAD I2C", __func__); | 1052 | dev_dbg(dev, "%s - DOWNLOAD MODE -- BAD I2C\n", __func__); |
1058 | return status; | 1053 | return status; |
1059 | } | 1054 | } |
1060 | 1055 | ||
@@ -1074,7 +1069,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1074 | 1069 | ||
1075 | /* Check version number of ION descriptor */ | 1070 | /* Check version number of ION descriptor */ |
1076 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { | 1071 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { |
1077 | dbg("%s - Wrong CPU Rev %d (Must be 2)", | 1072 | dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n", |
1078 | __func__, ti_cpu_rev(ti_manuf_desc)); | 1073 | __func__, ti_cpu_rev(ti_manuf_desc)); |
1079 | kfree(ti_manuf_desc); | 1074 | kfree(ti_manuf_desc); |
1080 | return -EINVAL; | 1075 | return -EINVAL; |
@@ -1094,8 +1089,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1094 | struct ti_i2c_firmware_rec *firmware_version; | 1089 | struct ti_i2c_firmware_rec *firmware_version; |
1095 | u8 *record; | 1090 | u8 *record; |
1096 | 1091 | ||
1097 | dbg("%s - Found Type FIRMWARE (Type 2) record", | 1092 | dev_dbg(dev, "%s - Found Type FIRMWARE (Type 2) record\n", __func__); |
1098 | __func__); | ||
1099 | 1093 | ||
1100 | firmware_version = kmalloc(sizeof(*firmware_version), | 1094 | firmware_version = kmalloc(sizeof(*firmware_version), |
1101 | GFP_KERNEL); | 1095 | GFP_KERNEL); |
@@ -1127,22 +1121,21 @@ static int download_fw(struct edgeport_serial *serial) | |||
1127 | download_new_ver = (OperationalMajorVersion << 8) + | 1121 | download_new_ver = (OperationalMajorVersion << 8) + |
1128 | (OperationalMinorVersion); | 1122 | (OperationalMinorVersion); |
1129 | 1123 | ||
1130 | dbg("%s - >> FW Versions Device %d.%d Driver %d.%d", | 1124 | dev_dbg(dev, "%s - >> FW Versions Device %d.%d Driver %d.%d\n", |
1131 | __func__, | 1125 | __func__, firmware_version->Ver_Major, |
1132 | firmware_version->Ver_Major, | 1126 | firmware_version->Ver_Minor, |
1133 | firmware_version->Ver_Minor, | 1127 | OperationalMajorVersion, |
1134 | OperationalMajorVersion, | 1128 | OperationalMinorVersion); |
1135 | OperationalMinorVersion); | ||
1136 | 1129 | ||
1137 | /* Check if we have an old version in the I2C and | 1130 | /* Check if we have an old version in the I2C and |
1138 | update if necessary */ | 1131 | update if necessary */ |
1139 | if (download_cur_ver < download_new_ver) { | 1132 | if (download_cur_ver < download_new_ver) { |
1140 | dbg("%s - Update I2C dld from %d.%d to %d.%d", | 1133 | dev_dbg(dev, "%s - Update I2C dld from %d.%d to %d.%d\n", |
1141 | __func__, | 1134 | __func__, |
1142 | firmware_version->Ver_Major, | 1135 | firmware_version->Ver_Major, |
1143 | firmware_version->Ver_Minor, | 1136 | firmware_version->Ver_Minor, |
1144 | OperationalMajorVersion, | 1137 | OperationalMajorVersion, |
1145 | OperationalMinorVersion); | 1138 | OperationalMinorVersion); |
1146 | 1139 | ||
1147 | record = kmalloc(1, GFP_KERNEL); | 1140 | record = kmalloc(1, GFP_KERNEL); |
1148 | if (!record) { | 1141 | if (!record) { |
@@ -1196,9 +1189,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1196 | } | 1189 | } |
1197 | 1190 | ||
1198 | if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) { | 1191 | if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) { |
1199 | dev_err(dev, | 1192 | dev_err(dev, "%s - error resetting device\n", __func__); |
1200 | "%s - error resetting device\n", | ||
1201 | __func__); | ||
1202 | kfree(record); | 1193 | kfree(record); |
1203 | kfree(firmware_version); | 1194 | kfree(firmware_version); |
1204 | kfree(rom_desc); | 1195 | kfree(rom_desc); |
@@ -1206,15 +1197,14 @@ static int download_fw(struct edgeport_serial *serial) | |||
1206 | return -ENODEV; | 1197 | return -ENODEV; |
1207 | } | 1198 | } |
1208 | 1199 | ||
1209 | dbg("%s - HARDWARE RESET", __func__); | 1200 | dev_dbg(dev, "%s - HARDWARE RESET\n", __func__); |
1210 | 1201 | ||
1211 | /* Reset UMP -- Back to BOOT MODE */ | 1202 | /* Reset UMP -- Back to BOOT MODE */ |
1212 | status = ti_vsend_sync(serial->serial->dev, | 1203 | status = ti_vsend_sync(serial->serial->dev, |
1213 | UMPC_HARDWARE_RESET, | 1204 | UMPC_HARDWARE_RESET, |
1214 | 0, 0, NULL, 0); | 1205 | 0, 0, NULL, 0); |
1215 | 1206 | ||
1216 | dbg("%s - HARDWARE RESET return %d", | 1207 | dev_dbg(dev, "%s - HARDWARE RESET return %d\n", __func__, status); |
1217 | __func__, status); | ||
1218 | 1208 | ||
1219 | /* return an error on purpose. */ | 1209 | /* return an error on purpose. */ |
1220 | kfree(record); | 1210 | kfree(record); |
@@ -1249,8 +1239,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1249 | return -ENOMEM; | 1239 | return -ENOMEM; |
1250 | } | 1240 | } |
1251 | 1241 | ||
1252 | dbg("%s - Found Type BLANK FIRMWARE (Type F2) record", | 1242 | dev_dbg(dev, "%s - Found Type BLANK FIRMWARE (Type F2) record\n", __func__); |
1253 | __func__); | ||
1254 | 1243 | ||
1255 | /* | 1244 | /* |
1256 | * In order to update the I2C firmware we must change | 1245 | * In order to update the I2C firmware we must change |
@@ -1292,7 +1281,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1292 | HEADER_SIZE, vheader); | 1281 | HEADER_SIZE, vheader); |
1293 | 1282 | ||
1294 | if (status) { | 1283 | if (status) { |
1295 | dbg("%s - can't read header back", __func__); | 1284 | dev_dbg(dev, "%s - can't read header back\n", __func__); |
1296 | kfree(vheader); | 1285 | kfree(vheader); |
1297 | kfree(header); | 1286 | kfree(header); |
1298 | kfree(rom_desc); | 1287 | kfree(rom_desc); |
@@ -1300,8 +1289,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1300 | return status; | 1289 | return status; |
1301 | } | 1290 | } |
1302 | if (memcmp(vheader, header, HEADER_SIZE)) { | 1291 | if (memcmp(vheader, header, HEADER_SIZE)) { |
1303 | dbg("%s - write download record failed", | 1292 | dev_dbg(dev, "%s - write download record failed\n", __func__); |
1304 | __func__); | ||
1305 | kfree(vheader); | 1293 | kfree(vheader); |
1306 | kfree(header); | 1294 | kfree(header); |
1307 | kfree(rom_desc); | 1295 | kfree(rom_desc); |
@@ -1312,13 +1300,13 @@ static int download_fw(struct edgeport_serial *serial) | |||
1312 | kfree(vheader); | 1300 | kfree(vheader); |
1313 | kfree(header); | 1301 | kfree(header); |
1314 | 1302 | ||
1315 | dbg("%s - Start firmware update", __func__); | 1303 | dev_dbg(dev, "%s - Start firmware update\n", __func__); |
1316 | 1304 | ||
1317 | /* Tell firmware to copy download image into I2C */ | 1305 | /* Tell firmware to copy download image into I2C */ |
1318 | status = ti_vsend_sync(serial->serial->dev, | 1306 | status = ti_vsend_sync(serial->serial->dev, |
1319 | UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0); | 1307 | UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0); |
1320 | 1308 | ||
1321 | dbg("%s - Update complete 0x%x", __func__, status); | 1309 | dev_dbg(dev, "%s - Update complete 0x%x\n", __func__, status); |
1322 | if (status) { | 1310 | if (status) { |
1323 | dev_err(dev, | 1311 | dev_err(dev, |
1324 | "%s - UMPC_COPY_DNLD_TO_I2C failed\n", | 1312 | "%s - UMPC_COPY_DNLD_TO_I2C failed\n", |
@@ -1338,7 +1326,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1338 | /********************************************************************/ | 1326 | /********************************************************************/ |
1339 | /* Boot Mode */ | 1327 | /* Boot Mode */ |
1340 | /********************************************************************/ | 1328 | /********************************************************************/ |
1341 | dbg("%s - RUNNING IN BOOT MODE", __func__); | 1329 | dev_dbg(dev, "%s - RUNNING IN BOOT MODE\n", __func__); |
1342 | 1330 | ||
1343 | /* Configure the TI device so we can use the BULK pipes for download */ | 1331 | /* Configure the TI device so we can use the BULK pipes for download */ |
1344 | status = config_boot_dev(serial->serial->dev); | 1332 | status = config_boot_dev(serial->serial->dev); |
@@ -1347,8 +1335,8 @@ static int download_fw(struct edgeport_serial *serial) | |||
1347 | 1335 | ||
1348 | if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) | 1336 | if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) |
1349 | != USB_VENDOR_ID_ION) { | 1337 | != USB_VENDOR_ID_ION) { |
1350 | dbg("%s - VID = 0x%x", __func__, | 1338 | dev_dbg(dev, "%s - VID = 0x%x\n", __func__, |
1351 | le16_to_cpu(serial->serial->dev->descriptor.idVendor)); | 1339 | le16_to_cpu(serial->serial->dev->descriptor.idVendor)); |
1352 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 1340 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
1353 | goto stayinbootmode; | 1341 | goto stayinbootmode; |
1354 | } | 1342 | } |
@@ -1385,8 +1373,8 @@ static int download_fw(struct edgeport_serial *serial) | |||
1385 | 1373 | ||
1386 | /* Check for version 2 */ | 1374 | /* Check for version 2 */ |
1387 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { | 1375 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { |
1388 | dbg("%s - Wrong CPU Rev %d (Must be 2)", | 1376 | dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n", |
1389 | __func__, ti_cpu_rev(ti_manuf_desc)); | 1377 | __func__, ti_cpu_rev(ti_manuf_desc)); |
1390 | kfree(ti_manuf_desc); | 1378 | kfree(ti_manuf_desc); |
1391 | goto stayinbootmode; | 1379 | goto stayinbootmode; |
1392 | } | 1380 | } |
@@ -1442,23 +1430,20 @@ static int download_fw(struct edgeport_serial *serial) | |||
1442 | header->CheckSum = cs; | 1430 | header->CheckSum = cs; |
1443 | 1431 | ||
1444 | /* Download the operational code */ | 1432 | /* Download the operational code */ |
1445 | dbg("%s - Downloading operational code image (TI UMP)", | 1433 | dev_dbg(dev, "%s - Downloading operational code image (TI UMP)\n", __func__); |
1446 | __func__); | ||
1447 | status = download_code(serial, buffer, buffer_size); | 1434 | status = download_code(serial, buffer, buffer_size); |
1448 | 1435 | ||
1449 | kfree(buffer); | 1436 | kfree(buffer); |
1450 | 1437 | ||
1451 | if (status) { | 1438 | if (status) { |
1452 | dbg("%s - Error downloading operational code image", | 1439 | dev_dbg(dev, "%s - Error downloading operational code image\n", __func__); |
1453 | __func__); | ||
1454 | return status; | 1440 | return status; |
1455 | } | 1441 | } |
1456 | 1442 | ||
1457 | /* Device will reboot */ | 1443 | /* Device will reboot */ |
1458 | serial->product_info.TiMode = TI_MODE_TRANSITIONING; | 1444 | serial->product_info.TiMode = TI_MODE_TRANSITIONING; |
1459 | 1445 | ||
1460 | dbg("%s - Download successful -- Device rebooting...", | 1446 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); |
1461 | __func__); | ||
1462 | 1447 | ||
1463 | /* return an error on purpose */ | 1448 | /* return an error on purpose */ |
1464 | return -ENODEV; | 1449 | return -ENODEV; |
@@ -1466,7 +1451,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1466 | 1451 | ||
1467 | stayinbootmode: | 1452 | stayinbootmode: |
1468 | /* Eprom is invalid or blank stay in boot mode */ | 1453 | /* Eprom is invalid or blank stay in boot mode */ |
1469 | dbg("%s - STAYING IN BOOT MODE", __func__); | 1454 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); |
1470 | serial->product_info.TiMode = TI_MODE_BOOT; | 1455 | serial->product_info.TiMode = TI_MODE_BOOT; |
1471 | 1456 | ||
1472 | return 0; | 1457 | return 0; |
@@ -1487,7 +1472,7 @@ static int restore_mcr(struct edgeport_port *port, __u8 mcr) | |||
1487 | { | 1472 | { |
1488 | int status = 0; | 1473 | int status = 0; |
1489 | 1474 | ||
1490 | dbg("%s - %x", __func__, mcr); | 1475 | dev_dbg(&port->port->dev, "%s - %x\n", __func__, mcr); |
1491 | 1476 | ||
1492 | status = ti_do_config(port, UMPC_SET_CLR_DTR, mcr & MCR_DTR); | 1477 | status = ti_do_config(port, UMPC_SET_CLR_DTR, mcr & MCR_DTR); |
1493 | if (status) | 1478 | if (status) |
@@ -1524,7 +1509,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
1524 | struct async_icount *icount; | 1509 | struct async_icount *icount; |
1525 | struct tty_struct *tty; | 1510 | struct tty_struct *tty; |
1526 | 1511 | ||
1527 | dbg("%s - %02x", __func__, msr); | 1512 | dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, msr); |
1528 | 1513 | ||
1529 | if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | | 1514 | if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | |
1530 | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { | 1515 | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { |
@@ -1566,7 +1551,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, | |||
1566 | LSR_FRM_ERR | LSR_BREAK)); | 1551 | LSR_FRM_ERR | LSR_BREAK)); |
1567 | struct tty_struct *tty; | 1552 | struct tty_struct *tty; |
1568 | 1553 | ||
1569 | dbg("%s - %02x", __func__, new_lsr); | 1554 | dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr); |
1570 | 1555 | ||
1571 | edge_port->shadow_lsr = lsr; | 1556 | edge_port->shadow_lsr = lsr; |
1572 | 1557 | ||
@@ -1604,6 +1589,7 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1604 | struct edgeport_serial *edge_serial = urb->context; | 1589 | struct edgeport_serial *edge_serial = urb->context; |
1605 | struct usb_serial_port *port; | 1590 | struct usb_serial_port *port; |
1606 | struct edgeport_port *edge_port; | 1591 | struct edgeport_port *edge_port; |
1592 | struct device *dev; | ||
1607 | unsigned char *data = urb->transfer_buffer; | 1593 | unsigned char *data = urb->transfer_buffer; |
1608 | int length = urb->actual_length; | 1594 | int length = urb->actual_length; |
1609 | int port_number; | 1595 | int port_number; |
@@ -1613,8 +1599,6 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1613 | __u8 msr; | 1599 | __u8 msr; |
1614 | int status = urb->status; | 1600 | int status = urb->status; |
1615 | 1601 | ||
1616 | dbg("%s", __func__); | ||
1617 | |||
1618 | switch (status) { | 1602 | switch (status) { |
1619 | case 0: | 1603 | case 0: |
1620 | /* success */ | 1604 | /* success */ |
@@ -1623,7 +1607,7 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1623 | case -ENOENT: | 1607 | case -ENOENT: |
1624 | case -ESHUTDOWN: | 1608 | case -ESHUTDOWN: |
1625 | /* this urb is terminated, clean up */ | 1609 | /* this urb is terminated, clean up */ |
1626 | dbg("%s - urb shutting down with status: %d", | 1610 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", |
1627 | __func__, status); | 1611 | __func__, status); |
1628 | return; | 1612 | return; |
1629 | default: | 1613 | default: |
@@ -1633,27 +1617,26 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1633 | } | 1617 | } |
1634 | 1618 | ||
1635 | if (!length) { | 1619 | if (!length) { |
1636 | dbg("%s - no data in urb", __func__); | 1620 | dev_dbg(&urb->dev->dev, "%s - no data in urb\n", __func__); |
1637 | goto exit; | 1621 | goto exit; |
1638 | } | 1622 | } |
1639 | 1623 | ||
1640 | usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, | 1624 | dev = &edge_serial->serial->dev->dev; |
1641 | __func__, length, data); | 1625 | usb_serial_debug_data(debug, dev, __func__, length, data); |
1642 | 1626 | ||
1643 | if (length != 2) { | 1627 | if (length != 2) { |
1644 | dbg("%s - expecting packet of size 2, got %d", | 1628 | dev_dbg(dev, "%s - expecting packet of size 2, got %d\n", __func__, length); |
1645 | __func__, length); | ||
1646 | goto exit; | 1629 | goto exit; |
1647 | } | 1630 | } |
1648 | 1631 | ||
1649 | port_number = TIUMP_GET_PORT_FROM_CODE(data[0]); | 1632 | port_number = TIUMP_GET_PORT_FROM_CODE(data[0]); |
1650 | function = TIUMP_GET_FUNC_FROM_CODE(data[0]); | 1633 | function = TIUMP_GET_FUNC_FROM_CODE(data[0]); |
1651 | dbg("%s - port_number %d, function %d, info 0x%x", | 1634 | dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__, |
1652 | __func__, port_number, function, data[1]); | 1635 | port_number, function, data[1]); |
1653 | port = edge_serial->serial->port[port_number]; | 1636 | port = edge_serial->serial->port[port_number]; |
1654 | edge_port = usb_get_serial_port_data(port); | 1637 | edge_port = usb_get_serial_port_data(port); |
1655 | if (!edge_port) { | 1638 | if (!edge_port) { |
1656 | dbg("%s - edge_port not found", __func__); | 1639 | dev_dbg(dev, "%s - edge_port not found\n", __func__); |
1657 | return; | 1640 | return; |
1658 | } | 1641 | } |
1659 | switch (function) { | 1642 | switch (function) { |
@@ -1662,13 +1645,13 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1662 | if (lsr & UMP_UART_LSR_DATA_MASK) { | 1645 | if (lsr & UMP_UART_LSR_DATA_MASK) { |
1663 | /* Save the LSR event for bulk read | 1646 | /* Save the LSR event for bulk read |
1664 | completion routine */ | 1647 | completion routine */ |
1665 | dbg("%s - LSR Event Port %u LSR Status = %02x", | 1648 | dev_dbg(dev, "%s - LSR Event Port %u LSR Status = %02x\n", |
1666 | __func__, port_number, lsr); | 1649 | __func__, port_number, lsr); |
1667 | edge_port->lsr_event = 1; | 1650 | edge_port->lsr_event = 1; |
1668 | edge_port->lsr_mask = lsr; | 1651 | edge_port->lsr_mask = lsr; |
1669 | } else { | 1652 | } else { |
1670 | dbg("%s - ===== Port %d LSR Status = %02x ======", | 1653 | dev_dbg(dev, "%s - ===== Port %d LSR Status = %02x ======\n", |
1671 | __func__, port_number, lsr); | 1654 | __func__, port_number, lsr); |
1672 | handle_new_lsr(edge_port, 0, lsr, 0); | 1655 | handle_new_lsr(edge_port, 0, lsr, 0); |
1673 | } | 1656 | } |
1674 | break; | 1657 | break; |
@@ -1676,8 +1659,8 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1676 | case TIUMP_INTERRUPT_CODE_MSR: /* MSR */ | 1659 | case TIUMP_INTERRUPT_CODE_MSR: /* MSR */ |
1677 | /* Copy MSR from UMP */ | 1660 | /* Copy MSR from UMP */ |
1678 | msr = data[1]; | 1661 | msr = data[1]; |
1679 | dbg("%s - ===== Port %u MSR Status = %02x ======", | 1662 | dev_dbg(dev, "%s - ===== Port %u MSR Status = %02x ======\n", |
1680 | __func__, port_number, msr); | 1663 | __func__, port_number, msr); |
1681 | handle_new_msr(edge_port, msr); | 1664 | handle_new_msr(edge_port, msr); |
1682 | break; | 1665 | break; |
1683 | 1666 | ||
@@ -1700,14 +1683,13 @@ exit: | |||
1700 | static void edge_bulk_in_callback(struct urb *urb) | 1683 | static void edge_bulk_in_callback(struct urb *urb) |
1701 | { | 1684 | { |
1702 | struct edgeport_port *edge_port = urb->context; | 1685 | struct edgeport_port *edge_port = urb->context; |
1686 | struct device *dev = &edge_port->port->dev; | ||
1703 | unsigned char *data = urb->transfer_buffer; | 1687 | unsigned char *data = urb->transfer_buffer; |
1704 | struct tty_struct *tty; | 1688 | struct tty_struct *tty; |
1705 | int retval = 0; | 1689 | int retval = 0; |
1706 | int port_number; | 1690 | int port_number; |
1707 | int status = urb->status; | 1691 | int status = urb->status; |
1708 | 1692 | ||
1709 | dbg("%s", __func__); | ||
1710 | |||
1711 | switch (status) { | 1693 | switch (status) { |
1712 | case 0: | 1694 | case 0: |
1713 | /* success */ | 1695 | /* success */ |
@@ -1716,13 +1698,10 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1716 | case -ENOENT: | 1698 | case -ENOENT: |
1717 | case -ESHUTDOWN: | 1699 | case -ESHUTDOWN: |
1718 | /* this urb is terminated, clean up */ | 1700 | /* this urb is terminated, clean up */ |
1719 | dbg("%s - urb shutting down with status: %d", | 1701 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status); |
1720 | __func__, status); | ||
1721 | return; | 1702 | return; |
1722 | default: | 1703 | default: |
1723 | dev_err(&urb->dev->dev, | 1704 | dev_err(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", __func__, status); |
1724 | "%s - nonzero read bulk status received: %d\n", | ||
1725 | __func__, status); | ||
1726 | } | 1705 | } |
1727 | 1706 | ||
1728 | if (status == -EPIPE) | 1707 | if (status == -EPIPE) |
@@ -1737,8 +1716,8 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1737 | 1716 | ||
1738 | if (edge_port->lsr_event) { | 1717 | if (edge_port->lsr_event) { |
1739 | edge_port->lsr_event = 0; | 1718 | edge_port->lsr_event = 0; |
1740 | dbg("%s ===== Port %u LSR Status = %02x, Data = %02x ======", | 1719 | dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n", |
1741 | __func__, port_number, edge_port->lsr_mask, *data); | 1720 | __func__, port_number, edge_port->lsr_mask, *data); |
1742 | handle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data); | 1721 | handle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data); |
1743 | /* Adjust buffer length/pointer */ | 1722 | /* Adjust buffer length/pointer */ |
1744 | --urb->actual_length; | 1723 | --urb->actual_length; |
@@ -1747,14 +1726,12 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1747 | 1726 | ||
1748 | tty = tty_port_tty_get(&edge_port->port->port); | 1727 | tty = tty_port_tty_get(&edge_port->port->port); |
1749 | if (tty && urb->actual_length) { | 1728 | if (tty && urb->actual_length) { |
1750 | usb_serial_debug_data(debug, &edge_port->port->dev, | 1729 | usb_serial_debug_data(debug, dev, __func__, urb->actual_length, data); |
1751 | __func__, urb->actual_length, data); | ||
1752 | if (edge_port->close_pending) | 1730 | if (edge_port->close_pending) |
1753 | dbg("%s - close pending, dropping data on the floor", | 1731 | dev_dbg(dev, "%s - close pending, dropping data on the floor\n", |
1754 | __func__); | 1732 | __func__); |
1755 | else | 1733 | else |
1756 | edge_tty_recv(&edge_port->port->dev, tty, data, | 1734 | edge_tty_recv(dev, tty, data, urb->actual_length); |
1757 | urb->actual_length); | ||
1758 | edge_port->icount.rx += urb->actual_length; | 1735 | edge_port->icount.rx += urb->actual_length; |
1759 | } | 1736 | } |
1760 | tty_kref_put(tty); | 1737 | tty_kref_put(tty); |
@@ -1769,9 +1746,7 @@ exit: | |||
1769 | 1746 | ||
1770 | spin_unlock(&edge_port->ep_lock); | 1747 | spin_unlock(&edge_port->ep_lock); |
1771 | if (retval) | 1748 | if (retval) |
1772 | dev_err(&urb->dev->dev, | 1749 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); |
1773 | "%s - usb_submit_urb failed with result %d\n", | ||
1774 | __func__, retval); | ||
1775 | } | 1750 | } |
1776 | 1751 | ||
1777 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, | 1752 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, |
@@ -1793,8 +1768,6 @@ static void edge_bulk_out_callback(struct urb *urb) | |||
1793 | int status = urb->status; | 1768 | int status = urb->status; |
1794 | struct tty_struct *tty; | 1769 | struct tty_struct *tty; |
1795 | 1770 | ||
1796 | dbg("%s - port %d", __func__, port->number); | ||
1797 | |||
1798 | edge_port->ep_write_urb_in_use = 0; | 1771 | edge_port->ep_write_urb_in_use = 0; |
1799 | 1772 | ||
1800 | switch (status) { | 1773 | switch (status) { |
@@ -1805,7 +1778,7 @@ static void edge_bulk_out_callback(struct urb *urb) | |||
1805 | case -ENOENT: | 1778 | case -ENOENT: |
1806 | case -ESHUTDOWN: | 1779 | case -ESHUTDOWN: |
1807 | /* this urb is terminated, clean up */ | 1780 | /* this urb is terminated, clean up */ |
1808 | dbg("%s - urb shutting down with status: %d", | 1781 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", |
1809 | __func__, status); | 1782 | __func__, status); |
1810 | return; | 1783 | return; |
1811 | default: | 1784 | default: |
@@ -1830,8 +1803,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1830 | u16 open_settings; | 1803 | u16 open_settings; |
1831 | u8 transaction_timeout; | 1804 | u8 transaction_timeout; |
1832 | 1805 | ||
1833 | dbg("%s - port %d", __func__, port->number); | ||
1834 | |||
1835 | if (edge_port == NULL) | 1806 | if (edge_port == NULL) |
1836 | return -ENODEV; | 1807 | return -ENODEV; |
1837 | 1808 | ||
@@ -1850,9 +1821,8 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1850 | return -ENODEV; | 1821 | return -ENODEV; |
1851 | } | 1822 | } |
1852 | 1823 | ||
1853 | dbg("%s - port_number = %d, uart_base = %04x, dma_address = %04x", | 1824 | dev_dbg(&port->dev, "%s - port_number = %d, uart_base = %04x, dma_address = %04x\n", |
1854 | __func__, port_number, edge_port->uart_base, | 1825 | __func__, port_number, edge_port->uart_base, edge_port->dma_address); |
1855 | edge_port->dma_address); | ||
1856 | 1826 | ||
1857 | dev = port->serial->dev; | 1827 | dev = port->serial->dev; |
1858 | 1828 | ||
@@ -1885,7 +1855,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1885 | UMP_PIPE_TRANS_TIMEOUT_ENA | | 1855 | UMP_PIPE_TRANS_TIMEOUT_ENA | |
1886 | (transaction_timeout << 2)); | 1856 | (transaction_timeout << 2)); |
1887 | 1857 | ||
1888 | dbg("%s - Sending UMPC_OPEN_PORT", __func__); | 1858 | dev_dbg(&port->dev, "%s - Sending UMPC_OPEN_PORT\n", __func__); |
1889 | 1859 | ||
1890 | /* Tell TI to open and start the port */ | 1860 | /* Tell TI to open and start the port */ |
1891 | status = send_cmd(dev, UMPC_OPEN_PORT, | 1861 | status = send_cmd(dev, UMPC_OPEN_PORT, |
@@ -1924,11 +1894,11 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1924 | return status; | 1894 | return status; |
1925 | } | 1895 | } |
1926 | 1896 | ||
1927 | dbg("ShadowMSR 0x%X", edge_port->shadow_msr); | 1897 | dev_dbg(&port->dev, "ShadowMSR 0x%X\n", edge_port->shadow_msr); |
1928 | 1898 | ||
1929 | /* Set Initial MCR */ | 1899 | /* Set Initial MCR */ |
1930 | edge_port->shadow_mcr = MCR_RTS | MCR_DTR; | 1900 | edge_port->shadow_mcr = MCR_RTS | MCR_DTR; |
1931 | dbg("ShadowMCR 0x%X", edge_port->shadow_mcr); | 1901 | dev_dbg(&port->dev, "ShadowMCR 0x%X\n", edge_port->shadow_mcr); |
1932 | 1902 | ||
1933 | edge_serial = edge_port->edge_serial; | 1903 | edge_serial = edge_port->edge_serial; |
1934 | if (mutex_lock_interruptible(&edge_serial->es_lock)) | 1904 | if (mutex_lock_interruptible(&edge_serial->es_lock)) |
@@ -1980,8 +1950,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1980 | 1950 | ||
1981 | ++edge_serial->num_ports_open; | 1951 | ++edge_serial->num_ports_open; |
1982 | 1952 | ||
1983 | dbg("%s - exited", __func__); | ||
1984 | |||
1985 | goto release_es_lock; | 1953 | goto release_es_lock; |
1986 | 1954 | ||
1987 | unlink_int_urb: | 1955 | unlink_int_urb: |
@@ -1999,8 +1967,6 @@ static void edge_close(struct usb_serial_port *port) | |||
1999 | struct usb_serial *serial = port->serial; | 1967 | struct usb_serial *serial = port->serial; |
2000 | int port_number; | 1968 | int port_number; |
2001 | 1969 | ||
2002 | dbg("%s - port %d", __func__, port->number); | ||
2003 | |||
2004 | edge_serial = usb_get_serial_data(port->serial); | 1970 | edge_serial = usb_get_serial_data(port->serial); |
2005 | edge_port = usb_get_serial_port_data(port); | 1971 | edge_port = usb_get_serial_port_data(port); |
2006 | if (edge_serial == NULL || edge_port == NULL) | 1972 | if (edge_serial == NULL || edge_port == NULL) |
@@ -2019,7 +1985,7 @@ static void edge_close(struct usb_serial_port *port) | |||
2019 | 1985 | ||
2020 | /* assuming we can still talk to the device, | 1986 | /* assuming we can still talk to the device, |
2021 | * send a close port command to it */ | 1987 | * send a close port command to it */ |
2022 | dbg("%s - send umpc_close_port", __func__); | 1988 | dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__); |
2023 | port_number = port->number - port->serial->minor; | 1989 | port_number = port->number - port->serial->minor; |
2024 | 1990 | ||
2025 | mutex_lock(&serial->disc_mutex); | 1991 | mutex_lock(&serial->disc_mutex); |
@@ -2042,8 +2008,6 @@ static void edge_close(struct usb_serial_port *port) | |||
2042 | } | 2008 | } |
2043 | mutex_unlock(&edge_serial->es_lock); | 2009 | mutex_unlock(&edge_serial->es_lock); |
2044 | edge_port->close_pending = 0; | 2010 | edge_port->close_pending = 0; |
2045 | |||
2046 | dbg("%s - exited", __func__); | ||
2047 | } | 2011 | } |
2048 | 2012 | ||
2049 | static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, | 2013 | static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, |
@@ -2051,10 +2015,8 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
2051 | { | 2015 | { |
2052 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2016 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2053 | 2017 | ||
2054 | dbg("%s - port %d", __func__, port->number); | ||
2055 | |||
2056 | if (count == 0) { | 2018 | if (count == 0) { |
2057 | dbg("%s - write request of 0 bytes", __func__); | 2019 | dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__); |
2058 | return 0; | 2020 | return 0; |
2059 | } | 2021 | } |
2060 | 2022 | ||
@@ -2077,9 +2039,6 @@ static void edge_send(struct tty_struct *tty) | |||
2077 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2039 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2078 | unsigned long flags; | 2040 | unsigned long flags; |
2079 | 2041 | ||
2080 | |||
2081 | dbg("%s - port %d", __func__, port->number); | ||
2082 | |||
2083 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2042 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2084 | 2043 | ||
2085 | if (edge_port->ep_write_urb_in_use) { | 2044 | if (edge_port->ep_write_urb_in_use) { |
@@ -2130,8 +2089,6 @@ static int edge_write_room(struct tty_struct *tty) | |||
2130 | int room = 0; | 2089 | int room = 0; |
2131 | unsigned long flags; | 2090 | unsigned long flags; |
2132 | 2091 | ||
2133 | dbg("%s - port %d", __func__, port->number); | ||
2134 | |||
2135 | if (edge_port == NULL) | 2092 | if (edge_port == NULL) |
2136 | return 0; | 2093 | return 0; |
2137 | if (edge_port->close_pending == 1) | 2094 | if (edge_port->close_pending == 1) |
@@ -2141,7 +2098,7 @@ static int edge_write_room(struct tty_struct *tty) | |||
2141 | room = kfifo_avail(&edge_port->write_fifo); | 2098 | room = kfifo_avail(&edge_port->write_fifo); |
2142 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2099 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2143 | 2100 | ||
2144 | dbg("%s - returns %d", __func__, room); | 2101 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); |
2145 | return room; | 2102 | return room; |
2146 | } | 2103 | } |
2147 | 2104 | ||
@@ -2152,8 +2109,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2152 | int chars = 0; | 2109 | int chars = 0; |
2153 | unsigned long flags; | 2110 | unsigned long flags; |
2154 | 2111 | ||
2155 | dbg("%s - port %d", __func__, port->number); | ||
2156 | |||
2157 | if (edge_port == NULL) | 2112 | if (edge_port == NULL) |
2158 | return 0; | 2113 | return 0; |
2159 | if (edge_port->close_pending == 1) | 2114 | if (edge_port->close_pending == 1) |
@@ -2163,7 +2118,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2163 | chars = kfifo_len(&edge_port->write_fifo); | 2118 | chars = kfifo_len(&edge_port->write_fifo); |
2164 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2119 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2165 | 2120 | ||
2166 | dbg("%s - returns %d", __func__, chars); | 2121 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
2167 | return chars; | 2122 | return chars; |
2168 | } | 2123 | } |
2169 | 2124 | ||
@@ -2173,8 +2128,6 @@ static void edge_throttle(struct tty_struct *tty) | |||
2173 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2128 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2174 | int status; | 2129 | int status; |
2175 | 2130 | ||
2176 | dbg("%s - port %d", __func__, port->number); | ||
2177 | |||
2178 | if (edge_port == NULL) | 2131 | if (edge_port == NULL) |
2179 | return; | 2132 | return; |
2180 | 2133 | ||
@@ -2200,8 +2153,6 @@ static void edge_unthrottle(struct tty_struct *tty) | |||
2200 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2153 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2201 | int status; | 2154 | int status; |
2202 | 2155 | ||
2203 | dbg("%s - port %d", __func__, port->number); | ||
2204 | |||
2205 | if (edge_port == NULL) | 2156 | if (edge_port == NULL) |
2206 | return; | 2157 | return; |
2207 | 2158 | ||
@@ -2261,6 +2212,7 @@ static int restart_read(struct edgeport_port *edge_port) | |||
2261 | static void change_port_settings(struct tty_struct *tty, | 2212 | static void change_port_settings(struct tty_struct *tty, |
2262 | struct edgeport_port *edge_port, struct ktermios *old_termios) | 2213 | struct edgeport_port *edge_port, struct ktermios *old_termios) |
2263 | { | 2214 | { |
2215 | struct device *dev = &edge_port->port->dev; | ||
2264 | struct ump_uart_config *config; | 2216 | struct ump_uart_config *config; |
2265 | int baud; | 2217 | int baud; |
2266 | unsigned cflag; | 2218 | unsigned cflag; |
@@ -2268,13 +2220,12 @@ static void change_port_settings(struct tty_struct *tty, | |||
2268 | int port_number = edge_port->port->number - | 2220 | int port_number = edge_port->port->number - |
2269 | edge_port->port->serial->minor; | 2221 | edge_port->port->serial->minor; |
2270 | 2222 | ||
2271 | dbg("%s - port %d", __func__, edge_port->port->number); | 2223 | dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number); |
2272 | 2224 | ||
2273 | config = kmalloc (sizeof (*config), GFP_KERNEL); | 2225 | config = kmalloc (sizeof (*config), GFP_KERNEL); |
2274 | if (!config) { | 2226 | if (!config) { |
2275 | *tty->termios = *old_termios; | 2227 | *tty->termios = *old_termios; |
2276 | dev_err(&edge_port->port->dev, "%s - out of memory\n", | 2228 | dev_err(dev, "%s - out of memory\n", __func__); |
2277 | __func__); | ||
2278 | return; | 2229 | return; |
2279 | } | 2230 | } |
2280 | 2231 | ||
@@ -2290,20 +2241,20 @@ static void change_port_settings(struct tty_struct *tty, | |||
2290 | switch (cflag & CSIZE) { | 2241 | switch (cflag & CSIZE) { |
2291 | case CS5: | 2242 | case CS5: |
2292 | config->bDataBits = UMP_UART_CHAR5BITS; | 2243 | config->bDataBits = UMP_UART_CHAR5BITS; |
2293 | dbg("%s - data bits = 5", __func__); | 2244 | dev_dbg(dev, "%s - data bits = 5\n", __func__); |
2294 | break; | 2245 | break; |
2295 | case CS6: | 2246 | case CS6: |
2296 | config->bDataBits = UMP_UART_CHAR6BITS; | 2247 | config->bDataBits = UMP_UART_CHAR6BITS; |
2297 | dbg("%s - data bits = 6", __func__); | 2248 | dev_dbg(dev, "%s - data bits = 6\n", __func__); |
2298 | break; | 2249 | break; |
2299 | case CS7: | 2250 | case CS7: |
2300 | config->bDataBits = UMP_UART_CHAR7BITS; | 2251 | config->bDataBits = UMP_UART_CHAR7BITS; |
2301 | dbg("%s - data bits = 7", __func__); | 2252 | dev_dbg(dev, "%s - data bits = 7\n", __func__); |
2302 | break; | 2253 | break; |
2303 | default: | 2254 | default: |
2304 | case CS8: | 2255 | case CS8: |
2305 | config->bDataBits = UMP_UART_CHAR8BITS; | 2256 | config->bDataBits = UMP_UART_CHAR8BITS; |
2306 | dbg("%s - data bits = 8", __func__); | 2257 | dev_dbg(dev, "%s - data bits = 8\n", __func__); |
2307 | break; | 2258 | break; |
2308 | } | 2259 | } |
2309 | 2260 | ||
@@ -2311,32 +2262,32 @@ static void change_port_settings(struct tty_struct *tty, | |||
2311 | if (cflag & PARODD) { | 2262 | if (cflag & PARODD) { |
2312 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; | 2263 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; |
2313 | config->bParity = UMP_UART_ODDPARITY; | 2264 | config->bParity = UMP_UART_ODDPARITY; |
2314 | dbg("%s - parity = odd", __func__); | 2265 | dev_dbg(dev, "%s - parity = odd\n", __func__); |
2315 | } else { | 2266 | } else { |
2316 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; | 2267 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; |
2317 | config->bParity = UMP_UART_EVENPARITY; | 2268 | config->bParity = UMP_UART_EVENPARITY; |
2318 | dbg("%s - parity = even", __func__); | 2269 | dev_dbg(dev, "%s - parity = even\n", __func__); |
2319 | } | 2270 | } |
2320 | } else { | 2271 | } else { |
2321 | config->bParity = UMP_UART_NOPARITY; | 2272 | config->bParity = UMP_UART_NOPARITY; |
2322 | dbg("%s - parity = none", __func__); | 2273 | dev_dbg(dev, "%s - parity = none\n", __func__); |
2323 | } | 2274 | } |
2324 | 2275 | ||
2325 | if (cflag & CSTOPB) { | 2276 | if (cflag & CSTOPB) { |
2326 | config->bStopBits = UMP_UART_STOPBIT2; | 2277 | config->bStopBits = UMP_UART_STOPBIT2; |
2327 | dbg("%s - stop bits = 2", __func__); | 2278 | dev_dbg(dev, "%s - stop bits = 2\n", __func__); |
2328 | } else { | 2279 | } else { |
2329 | config->bStopBits = UMP_UART_STOPBIT1; | 2280 | config->bStopBits = UMP_UART_STOPBIT1; |
2330 | dbg("%s - stop bits = 1", __func__); | 2281 | dev_dbg(dev, "%s - stop bits = 1\n", __func__); |
2331 | } | 2282 | } |
2332 | 2283 | ||
2333 | /* figure out the flow control settings */ | 2284 | /* figure out the flow control settings */ |
2334 | if (cflag & CRTSCTS) { | 2285 | if (cflag & CRTSCTS) { |
2335 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW; | 2286 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW; |
2336 | config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW; | 2287 | config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW; |
2337 | dbg("%s - RTS/CTS is enabled", __func__); | 2288 | dev_dbg(dev, "%s - RTS/CTS is enabled\n", __func__); |
2338 | } else { | 2289 | } else { |
2339 | dbg("%s - RTS/CTS is disabled", __func__); | 2290 | dev_dbg(dev, "%s - RTS/CTS is disabled\n", __func__); |
2340 | tty->hw_stopped = 0; | 2291 | tty->hw_stopped = 0; |
2341 | restart_read(edge_port); | 2292 | restart_read(edge_port); |
2342 | } | 2293 | } |
@@ -2349,18 +2300,18 @@ static void change_port_settings(struct tty_struct *tty, | |||
2349 | /* if we are implementing INBOUND XON/XOFF */ | 2300 | /* if we are implementing INBOUND XON/XOFF */ |
2350 | if (I_IXOFF(tty)) { | 2301 | if (I_IXOFF(tty)) { |
2351 | config->wFlags |= UMP_MASK_UART_FLAGS_IN_X; | 2302 | config->wFlags |= UMP_MASK_UART_FLAGS_IN_X; |
2352 | dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", | 2303 | dev_dbg(dev, "%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n", |
2353 | __func__, config->cXon, config->cXoff); | 2304 | __func__, config->cXon, config->cXoff); |
2354 | } else | 2305 | } else |
2355 | dbg("%s - INBOUND XON/XOFF is disabled", __func__); | 2306 | dev_dbg(dev, "%s - INBOUND XON/XOFF is disabled\n", __func__); |
2356 | 2307 | ||
2357 | /* if we are implementing OUTBOUND XON/XOFF */ | 2308 | /* if we are implementing OUTBOUND XON/XOFF */ |
2358 | if (I_IXON(tty)) { | 2309 | if (I_IXON(tty)) { |
2359 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X; | 2310 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X; |
2360 | dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", | 2311 | dev_dbg(dev, "%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n", |
2361 | __func__, config->cXon, config->cXoff); | 2312 | __func__, config->cXon, config->cXoff); |
2362 | } else | 2313 | } else |
2363 | dbg("%s - OUTBOUND XON/XOFF is disabled", __func__); | 2314 | dev_dbg(dev, "%s - OUTBOUND XON/XOFF is disabled\n", __func__); |
2364 | 2315 | ||
2365 | tty->termios->c_cflag &= ~CMSPAR; | 2316 | tty->termios->c_cflag &= ~CMSPAR; |
2366 | 2317 | ||
@@ -2377,17 +2328,16 @@ static void change_port_settings(struct tty_struct *tty, | |||
2377 | 2328 | ||
2378 | /* FIXME: Recompute actual baud from divisor here */ | 2329 | /* FIXME: Recompute actual baud from divisor here */ |
2379 | 2330 | ||
2380 | dbg("%s - baud rate = %d, wBaudRate = %d", __func__, baud, | 2331 | dev_dbg(dev, "%s - baud rate = %d, wBaudRate = %d\n", __func__, baud, config->wBaudRate); |
2381 | config->wBaudRate); | ||
2382 | 2332 | ||
2383 | dbg("wBaudRate: %d", (int)(461550L / config->wBaudRate)); | 2333 | dev_dbg(dev, "wBaudRate: %d\n", (int)(461550L / config->wBaudRate)); |
2384 | dbg("wFlags: 0x%x", config->wFlags); | 2334 | dev_dbg(dev, "wFlags: 0x%x\n", config->wFlags); |
2385 | dbg("bDataBits: %d", config->bDataBits); | 2335 | dev_dbg(dev, "bDataBits: %d\n", config->bDataBits); |
2386 | dbg("bParity: %d", config->bParity); | 2336 | dev_dbg(dev, "bParity: %d\n", config->bParity); |
2387 | dbg("bStopBits: %d", config->bStopBits); | 2337 | dev_dbg(dev, "bStopBits: %d\n", config->bStopBits); |
2388 | dbg("cXon: %d", config->cXon); | 2338 | dev_dbg(dev, "cXon: %d\n", config->cXon); |
2389 | dbg("cXoff: %d", config->cXoff); | 2339 | dev_dbg(dev, "cXoff: %d\n", config->cXoff); |
2390 | dbg("bUartMode: %d", config->bUartMode); | 2340 | dev_dbg(dev, "bUartMode: %d\n", config->bUartMode); |
2391 | 2341 | ||
2392 | /* move the word values into big endian mode */ | 2342 | /* move the word values into big endian mode */ |
2393 | cpu_to_be16s(&config->wFlags); | 2343 | cpu_to_be16s(&config->wFlags); |
@@ -2397,8 +2347,8 @@ static void change_port_settings(struct tty_struct *tty, | |||
2397 | (__u8)(UMPM_UART1_PORT + port_number), | 2347 | (__u8)(UMPM_UART1_PORT + port_number), |
2398 | 0, (__u8 *)config, sizeof(*config)); | 2348 | 0, (__u8 *)config, sizeof(*config)); |
2399 | if (status) | 2349 | if (status) |
2400 | dbg("%s - error %d when trying to write config to device", | 2350 | dev_dbg(dev, "%s - error %d when trying to write config to device\n", |
2401 | __func__, status); | 2351 | __func__, status); |
2402 | kfree(config); | 2352 | kfree(config); |
2403 | } | 2353 | } |
2404 | 2354 | ||
@@ -2410,11 +2360,11 @@ static void edge_set_termios(struct tty_struct *tty, | |||
2410 | 2360 | ||
2411 | cflag = tty->termios->c_cflag; | 2361 | cflag = tty->termios->c_cflag; |
2412 | 2362 | ||
2413 | dbg("%s - clfag %08x iflag %08x", __func__, | 2363 | dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, |
2414 | tty->termios->c_cflag, tty->termios->c_iflag); | 2364 | tty->termios->c_cflag, tty->termios->c_iflag); |
2415 | dbg("%s - old clfag %08x old iflag %08x", __func__, | 2365 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, |
2416 | old_termios->c_cflag, old_termios->c_iflag); | 2366 | old_termios->c_cflag, old_termios->c_iflag); |
2417 | dbg("%s - port %d", __func__, port->number); | 2367 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); |
2418 | 2368 | ||
2419 | if (edge_port == NULL) | 2369 | if (edge_port == NULL) |
2420 | return; | 2370 | return; |
@@ -2430,8 +2380,6 @@ static int edge_tiocmset(struct tty_struct *tty, | |||
2430 | unsigned int mcr; | 2380 | unsigned int mcr; |
2431 | unsigned long flags; | 2381 | unsigned long flags; |
2432 | 2382 | ||
2433 | dbg("%s - port %d", __func__, port->number); | ||
2434 | |||
2435 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2383 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2436 | mcr = edge_port->shadow_mcr; | 2384 | mcr = edge_port->shadow_mcr; |
2437 | if (set & TIOCM_RTS) | 2385 | if (set & TIOCM_RTS) |
@@ -2464,8 +2412,6 @@ static int edge_tiocmget(struct tty_struct *tty) | |||
2464 | unsigned int mcr; | 2412 | unsigned int mcr; |
2465 | unsigned long flags; | 2413 | unsigned long flags; |
2466 | 2414 | ||
2467 | dbg("%s - port %d", __func__, port->number); | ||
2468 | |||
2469 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2415 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2470 | 2416 | ||
2471 | msr = edge_port->shadow_msr; | 2417 | msr = edge_port->shadow_msr; |
@@ -2478,7 +2424,7 @@ static int edge_tiocmget(struct tty_struct *tty) | |||
2478 | | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ | 2424 | | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ |
2479 | 2425 | ||
2480 | 2426 | ||
2481 | dbg("%s -- %x", __func__, result); | 2427 | dev_dbg(&port->dev, "%s -- %x\n", __func__, result); |
2482 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2428 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2483 | 2429 | ||
2484 | return result; | 2430 | return result; |
@@ -2538,15 +2484,15 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2538 | struct async_icount cnow; | 2484 | struct async_icount cnow; |
2539 | struct async_icount cprev; | 2485 | struct async_icount cprev; |
2540 | 2486 | ||
2541 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); | 2487 | dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); |
2542 | 2488 | ||
2543 | switch (cmd) { | 2489 | switch (cmd) { |
2544 | case TIOCGSERIAL: | 2490 | case TIOCGSERIAL: |
2545 | dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); | 2491 | dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__); |
2546 | return get_serial_info(edge_port, | 2492 | return get_serial_info(edge_port, |
2547 | (struct serial_struct __user *) arg); | 2493 | (struct serial_struct __user *) arg); |
2548 | case TIOCMIWAIT: | 2494 | case TIOCMIWAIT: |
2549 | dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); | 2495 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
2550 | cprev = edge_port->icount; | 2496 | cprev = edge_port->icount; |
2551 | while (1) { | 2497 | while (1) { |
2552 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2498 | interruptible_sleep_on(&edge_port->delta_msr_wait); |
@@ -2578,8 +2524,6 @@ static void edge_break(struct tty_struct *tty, int break_state) | |||
2578 | int status; | 2524 | int status; |
2579 | int bv = 0; /* Off */ | 2525 | int bv = 0; /* Off */ |
2580 | 2526 | ||
2581 | dbg("%s - state = %d", __func__, break_state); | ||
2582 | |||
2583 | /* chase the port close */ | 2527 | /* chase the port close */ |
2584 | chase_port(edge_port, 0, 0); | 2528 | chase_port(edge_port, 0, 0); |
2585 | 2529 | ||
@@ -2587,8 +2531,8 @@ static void edge_break(struct tty_struct *tty, int break_state) | |||
2587 | bv = 1; /* On */ | 2531 | bv = 1; /* On */ |
2588 | status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv); | 2532 | status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv); |
2589 | if (status) | 2533 | if (status) |
2590 | dbg("%s - error %d sending break set/clear command.", | 2534 | dev_dbg(&port->dev, "%s - error %d sending break set/clear command.\n", |
2591 | __func__, status); | 2535 | __func__, status); |
2592 | } | 2536 | } |
2593 | 2537 | ||
2594 | static int edge_startup(struct usb_serial *serial) | 2538 | static int edge_startup(struct usb_serial *serial) |
@@ -2655,7 +2599,6 @@ cleanup: | |||
2655 | 2599 | ||
2656 | static void edge_disconnect(struct usb_serial *serial) | 2600 | static void edge_disconnect(struct usb_serial *serial) |
2657 | { | 2601 | { |
2658 | dbg("%s", __func__); | ||
2659 | } | 2602 | } |
2660 | 2603 | ||
2661 | static void edge_release(struct usb_serial *serial) | 2604 | static void edge_release(struct usb_serial *serial) |
@@ -2663,8 +2606,6 @@ static void edge_release(struct usb_serial *serial) | |||
2663 | int i; | 2606 | int i; |
2664 | struct edgeport_port *edge_port; | 2607 | struct edgeport_port *edge_port; |
2665 | 2608 | ||
2666 | dbg("%s", __func__); | ||
2667 | |||
2668 | for (i = 0; i < serial->num_ports; ++i) { | 2609 | for (i = 0; i < serial->num_ports; ++i) { |
2669 | edge_port = usb_get_serial_port_data(serial->port[i]); | 2610 | edge_port = usb_get_serial_port_data(serial->port[i]); |
2670 | kfifo_free(&edge_port->write_fifo); | 2611 | kfifo_free(&edge_port->write_fifo); |
@@ -2692,7 +2633,7 @@ static ssize_t store_uart_mode(struct device *dev, | |||
2692 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2633 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2693 | unsigned int v = simple_strtoul(valbuf, NULL, 0); | 2634 | unsigned int v = simple_strtoul(valbuf, NULL, 0); |
2694 | 2635 | ||
2695 | dbg("%s: setting uart_mode = %d", __func__, v); | 2636 | dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v); |
2696 | 2637 | ||
2697 | if (v < 256) | 2638 | if (v < 256) |
2698 | edge_port->bUartMode = v; | 2639 | edge_port->bUartMode = v; |