diff options
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 408 |
1 files changed, 170 insertions, 238 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 765978ae752e..a2209cd45093 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -201,8 +201,6 @@ static unsigned char OperationalMajorVersion; | |||
201 | static unsigned char OperationalMinorVersion; | 201 | static unsigned char OperationalMinorVersion; |
202 | static unsigned short OperationalBuildNumber; | 202 | static unsigned short OperationalBuildNumber; |
203 | 203 | ||
204 | static bool debug; | ||
205 | |||
206 | static int closing_wait = EDGE_CLOSING_WAIT; | 204 | static int closing_wait = EDGE_CLOSING_WAIT; |
207 | static bool ignore_cpu_rev; | 205 | static bool ignore_cpu_rev; |
208 | static int default_uart_mode; /* RS232 */ | 206 | static int default_uart_mode; /* RS232 */ |
@@ -233,8 +231,8 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, | |||
233 | if (status < 0) | 231 | if (status < 0) |
234 | return status; | 232 | return status; |
235 | if (status != size) { | 233 | if (status != size) { |
236 | dbg("%s - wanted to write %d, but only wrote %d", | 234 | dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", |
237 | __func__, size, status); | 235 | __func__, size, status); |
238 | return -ECOMM; | 236 | return -ECOMM; |
239 | } | 237 | } |
240 | return 0; | 238 | return 0; |
@@ -251,8 +249,8 @@ static int ti_vsend_sync(struct usb_device *dev, __u8 request, | |||
251 | if (status < 0) | 249 | if (status < 0) |
252 | return status; | 250 | return status; |
253 | if (status != size) { | 251 | if (status != size) { |
254 | dbg("%s - wanted to write %d, but only wrote %d", | 252 | dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", |
255 | __func__, size, status); | 253 | __func__, size, status); |
256 | return -ECOMM; | 254 | return -ECOMM; |
257 | } | 255 | } |
258 | return 0; | 256 | return 0; |
@@ -270,7 +268,7 @@ static int purge_port(struct usb_serial_port *port, __u16 mask) | |||
270 | { | 268 | { |
271 | int port_number = port->number - port->serial->minor; | 269 | int port_number = port->number - port->serial->minor; |
272 | 270 | ||
273 | dbg("%s - port %d, mask %x", __func__, port_number, mask); | 271 | dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); |
274 | 272 | ||
275 | return send_cmd(port->serial->dev, | 273 | return send_cmd(port->serial->dev, |
276 | UMPC_PURGE_PORT, | 274 | UMPC_PURGE_PORT, |
@@ -295,7 +293,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
295 | __u8 read_length; | 293 | __u8 read_length; |
296 | __be16 be_start_address; | 294 | __be16 be_start_address; |
297 | 295 | ||
298 | dbg("%s - @ %x for %d", __func__, start_address, length); | 296 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length); |
299 | 297 | ||
300 | /* Read in blocks of 64 bytes | 298 | /* Read in blocks of 64 bytes |
301 | * (TI firmware can't handle more than 64 byte reads) | 299 | * (TI firmware can't handle more than 64 byte reads) |
@@ -307,8 +305,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
307 | read_length = (__u8)length; | 305 | read_length = (__u8)length; |
308 | 306 | ||
309 | if (read_length > 1) { | 307 | if (read_length > 1) { |
310 | dbg("%s - @ %x for %d", __func__, | 308 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length); |
311 | start_address, read_length); | ||
312 | } | 309 | } |
313 | be_start_address = cpu_to_be16(start_address); | 310 | be_start_address = cpu_to_be16(start_address); |
314 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, | 311 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, |
@@ -317,13 +314,12 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
317 | buffer, read_length); | 314 | buffer, read_length); |
318 | 315 | ||
319 | if (status) { | 316 | if (status) { |
320 | dbg("%s - ERROR %x", __func__, status); | 317 | dev_dbg(&dev->dev, "%s - ERROR %x\n", __func__, status); |
321 | return status; | 318 | return status; |
322 | } | 319 | } |
323 | 320 | ||
324 | if (read_length > 1) | 321 | if (read_length > 1) |
325 | usb_serial_debug_data(debug, &dev->dev, __func__, | 322 | usb_serial_debug_data(&dev->dev, __func__, read_length, buffer); |
326 | read_length, buffer); | ||
327 | 323 | ||
328 | /* Update pointers/length */ | 324 | /* Update pointers/length */ |
329 | start_address += read_length; | 325 | start_address += read_length; |
@@ -353,15 +349,14 @@ static int read_boot_mem(struct edgeport_serial *serial, | |||
353 | UMPC_MEMORY_READ, serial->TI_I2C_Type, | 349 | UMPC_MEMORY_READ, serial->TI_I2C_Type, |
354 | (__u16)(start_address+i), &buffer[i], 0x01); | 350 | (__u16)(start_address+i), &buffer[i], 0x01); |
355 | if (status) { | 351 | if (status) { |
356 | dbg("%s - ERROR %x", __func__, status); | 352 | dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status); |
357 | return status; | 353 | return status; |
358 | } | 354 | } |
359 | } | 355 | } |
360 | 356 | ||
361 | dbg("%s - start_address = %x, length = %d", | 357 | dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n", |
362 | __func__, start_address, length); | 358 | __func__, start_address, length); |
363 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 359 | usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); |
364 | __func__, length, buffer); | ||
365 | 360 | ||
366 | serial->TiReadI2C = 1; | 361 | serial->TiReadI2C = 1; |
367 | 362 | ||
@@ -398,10 +393,8 @@ static int write_boot_mem(struct edgeport_serial *serial, | |||
398 | return status; | 393 | return status; |
399 | } | 394 | } |
400 | 395 | ||
401 | dbg("%s - start_sddr = %x, length = %d", | 396 | dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length); |
402 | __func__, start_address, length); | 397 | usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); |
403 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | ||
404 | __func__, length, buffer); | ||
405 | 398 | ||
406 | return status; | 399 | return status; |
407 | } | 400 | } |
@@ -411,6 +404,7 @@ static int write_boot_mem(struct edgeport_serial *serial, | |||
411 | static int write_i2c_mem(struct edgeport_serial *serial, | 404 | static int write_i2c_mem(struct edgeport_serial *serial, |
412 | int start_address, int length, __u8 address_type, __u8 *buffer) | 405 | int start_address, int length, __u8 address_type, __u8 *buffer) |
413 | { | 406 | { |
407 | struct device *dev = &serial->serial->dev->dev; | ||
414 | int status = 0; | 408 | int status = 0; |
415 | int write_length; | 409 | int write_length; |
416 | __be16 be_start_address; | 410 | __be16 be_start_address; |
@@ -424,10 +418,9 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
424 | if (write_length > length) | 418 | if (write_length > length) |
425 | write_length = length; | 419 | write_length = length; |
426 | 420 | ||
427 | dbg("%s - BytesInFirstPage Addr = %x, length = %d", | 421 | dev_dbg(dev, "%s - BytesInFirstPage Addr = %x, length = %d\n", |
428 | __func__, start_address, write_length); | 422 | __func__, start_address, write_length); |
429 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 423 | usb_serial_debug_data(dev, __func__, write_length, buffer); |
430 | __func__, write_length, buffer); | ||
431 | 424 | ||
432 | /* Write first page */ | 425 | /* Write first page */ |
433 | be_start_address = cpu_to_be16(start_address); | 426 | be_start_address = cpu_to_be16(start_address); |
@@ -436,7 +429,7 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
436 | (__force __u16)be_start_address, | 429 | (__force __u16)be_start_address, |
437 | buffer, write_length); | 430 | buffer, write_length); |
438 | if (status) { | 431 | if (status) { |
439 | dbg("%s - ERROR %d", __func__, status); | 432 | dev_dbg(dev, "%s - ERROR %d\n", __func__, status); |
440 | return status; | 433 | return status; |
441 | } | 434 | } |
442 | 435 | ||
@@ -452,10 +445,9 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
452 | else | 445 | else |
453 | write_length = length; | 446 | write_length = length; |
454 | 447 | ||
455 | dbg("%s - Page Write Addr = %x, length = %d", | 448 | dev_dbg(dev, "%s - Page Write Addr = %x, length = %d\n", |
456 | __func__, start_address, write_length); | 449 | __func__, start_address, write_length); |
457 | usb_serial_debug_data(debug, &serial->serial->dev->dev, | 450 | usb_serial_debug_data(dev, __func__, write_length, buffer); |
458 | __func__, write_length, buffer); | ||
459 | 451 | ||
460 | /* Write next page */ | 452 | /* Write next page */ |
461 | be_start_address = cpu_to_be16(start_address); | 453 | be_start_address = cpu_to_be16(start_address); |
@@ -464,8 +456,7 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
464 | (__force __u16)be_start_address, | 456 | (__force __u16)be_start_address, |
465 | buffer, write_length); | 457 | buffer, write_length); |
466 | if (status) { | 458 | if (status) { |
467 | dev_err(&serial->serial->dev->dev, "%s - ERROR %d\n", | 459 | dev_err(dev, "%s - ERROR %d\n", __func__, status); |
468 | __func__, status); | ||
469 | return status; | 460 | return status; |
470 | } | 461 | } |
471 | 462 | ||
@@ -508,7 +499,7 @@ static int tx_active(struct edgeport_port *port) | |||
508 | if (status) | 499 | if (status) |
509 | goto exit_is_tx_active; | 500 | goto exit_is_tx_active; |
510 | 501 | ||
511 | dbg("%s - XByteCount 0x%X", __func__, oedb->XByteCount); | 502 | dev_dbg(&port->port->dev, "%s - XByteCount 0x%X\n", __func__, oedb->XByteCount); |
512 | 503 | ||
513 | /* and the LSR */ | 504 | /* and the LSR */ |
514 | status = read_ram(port->port->serial->dev, | 505 | status = read_ram(port->port->serial->dev, |
@@ -516,7 +507,7 @@ static int tx_active(struct edgeport_port *port) | |||
516 | 507 | ||
517 | if (status) | 508 | if (status) |
518 | goto exit_is_tx_active; | 509 | goto exit_is_tx_active; |
519 | dbg("%s - LSR = 0x%X", __func__, *lsr); | 510 | dev_dbg(&port->port->dev, "%s - LSR = 0x%X\n", __func__, *lsr); |
520 | 511 | ||
521 | /* If either buffer has data or we are transmitting then return TRUE */ | 512 | /* If either buffer has data or we are transmitting then return TRUE */ |
522 | if ((oedb->XByteCount & 0x80) != 0) | 513 | if ((oedb->XByteCount & 0x80) != 0) |
@@ -527,7 +518,7 @@ static int tx_active(struct edgeport_port *port) | |||
527 | 518 | ||
528 | /* We return Not Active if we get any kind of error */ | 519 | /* We return Not Active if we get any kind of error */ |
529 | exit_is_tx_active: | 520 | exit_is_tx_active: |
530 | dbg("%s - return %d", __func__, bytes_left); | 521 | dev_dbg(&port->port->dev, "%s - return %d\n", __func__, bytes_left); |
531 | 522 | ||
532 | kfree(lsr); | 523 | kfree(lsr); |
533 | kfree(oedb); | 524 | kfree(oedb); |
@@ -599,14 +590,13 @@ static int choose_config(struct usb_device *dev) | |||
599 | * configuration # 1, which is Config Descriptor 0. | 590 | * configuration # 1, which is Config Descriptor 0. |
600 | */ | 591 | */ |
601 | 592 | ||
602 | dbg("%s - Number of Interfaces = %d", | 593 | dev_dbg(&dev->dev, "%s - Number of Interfaces = %d\n", |
603 | __func__, dev->config->desc.bNumInterfaces); | 594 | __func__, dev->config->desc.bNumInterfaces); |
604 | dbg("%s - MAX Power = %d", | 595 | dev_dbg(&dev->dev, "%s - MAX Power = %d\n", |
605 | __func__, dev->config->desc.bMaxPower * 2); | 596 | __func__, dev->config->desc.bMaxPower * 2); |
606 | 597 | ||
607 | if (dev->config->desc.bNumInterfaces != 1) { | 598 | if (dev->config->desc.bNumInterfaces != 1) { |
608 | dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", | 599 | dev_err(&dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __func__); |
609 | __func__); | ||
610 | return -ENODEV; | 600 | return -ENODEV; |
611 | } | 601 | } |
612 | 602 | ||
@@ -684,7 +674,7 @@ static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer) | |||
684 | cs = (__u8)(cs + buffer[i]); | 674 | cs = (__u8)(cs + buffer[i]); |
685 | 675 | ||
686 | if (cs != rom_desc->CheckSum) { | 676 | if (cs != rom_desc->CheckSum) { |
687 | dbg("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); | 677 | pr_debug("%s - Mismatch %x - %x", __func__, rom_desc->CheckSum, cs); |
688 | return -EINVAL; | 678 | return -EINVAL; |
689 | } | 679 | } |
690 | return 0; | 680 | return 0; |
@@ -736,11 +726,11 @@ static int check_i2c_image(struct edgeport_serial *serial) | |||
736 | if ((start_address + sizeof(struct ti_i2c_desc) + | 726 | if ((start_address + sizeof(struct ti_i2c_desc) + |
737 | rom_desc->Size) > TI_MAX_I2C_SIZE) { | 727 | rom_desc->Size) > TI_MAX_I2C_SIZE) { |
738 | status = -ENODEV; | 728 | status = -ENODEV; |
739 | dbg("%s - structure too big, erroring out.", __func__); | 729 | dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__); |
740 | break; | 730 | break; |
741 | } | 731 | } |
742 | 732 | ||
743 | dbg("%s Type = 0x%x", __func__, rom_desc->Type); | 733 | dev_dbg(dev, "%s Type = 0x%x\n", __func__, rom_desc->Type); |
744 | 734 | ||
745 | /* Skip type 2 record */ | 735 | /* Skip type 2 record */ |
746 | ttype = rom_desc->Type & 0x0f; | 736 | ttype = rom_desc->Type & 0x0f; |
@@ -779,18 +769,18 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) | |||
779 | int start_address; | 769 | int start_address; |
780 | struct ti_i2c_desc *rom_desc; | 770 | struct ti_i2c_desc *rom_desc; |
781 | struct edge_ti_manuf_descriptor *desc; | 771 | struct edge_ti_manuf_descriptor *desc; |
772 | struct device *dev = &serial->serial->dev->dev; | ||
782 | 773 | ||
783 | rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); | 774 | rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); |
784 | if (!rom_desc) { | 775 | if (!rom_desc) { |
785 | dev_err(&serial->serial->dev->dev, "%s - out of memory\n", | 776 | dev_err(dev, "%s - out of memory\n", __func__); |
786 | __func__); | ||
787 | return -ENOMEM; | 777 | return -ENOMEM; |
788 | } | 778 | } |
789 | start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, | 779 | start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, |
790 | rom_desc); | 780 | rom_desc); |
791 | 781 | ||
792 | if (!start_address) { | 782 | if (!start_address) { |
793 | dbg("%s - Edge Descriptor not found in I2C", __func__); | 783 | dev_dbg(dev, "%s - Edge Descriptor not found in I2C\n", __func__); |
794 | status = -ENODEV; | 784 | status = -ENODEV; |
795 | goto exit; | 785 | goto exit; |
796 | } | 786 | } |
@@ -804,12 +794,12 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) | |||
804 | status = valid_csum(rom_desc, buffer); | 794 | status = valid_csum(rom_desc, buffer); |
805 | 795 | ||
806 | desc = (struct edge_ti_manuf_descriptor *)buffer; | 796 | desc = (struct edge_ti_manuf_descriptor *)buffer; |
807 | dbg("%s - IonConfig 0x%x", __func__, desc->IonConfig); | 797 | dev_dbg(dev, "%s - IonConfig 0x%x\n", __func__, desc->IonConfig); |
808 | dbg("%s - Version %d", __func__, desc->Version); | 798 | dev_dbg(dev, "%s - Version %d\n", __func__, desc->Version); |
809 | dbg("%s - Cpu/Board 0x%x", __func__, desc->CpuRev_BoardRev); | 799 | dev_dbg(dev, "%s - Cpu/Board 0x%x\n", __func__, desc->CpuRev_BoardRev); |
810 | dbg("%s - NumPorts %d", __func__, desc->NumPorts); | 800 | dev_dbg(dev, "%s - NumPorts %d\n", __func__, desc->NumPorts); |
811 | dbg("%s - NumVirtualPorts %d", __func__, desc->NumVirtualPorts); | 801 | dev_dbg(dev, "%s - NumVirtualPorts %d\n", __func__, desc->NumVirtualPorts); |
812 | dbg("%s - TotalPorts %d", __func__, desc->TotalPorts); | 802 | dev_dbg(dev, "%s - TotalPorts %d\n", __func__, desc->TotalPorts); |
813 | 803 | ||
814 | exit: | 804 | exit: |
815 | kfree(rom_desc); | 805 | kfree(rom_desc); |
@@ -855,8 +845,8 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev) | |||
855 | 845 | ||
856 | err = request_firmware(&fw, fw_name, dev); | 846 | err = request_firmware(&fw, fw_name, dev); |
857 | if (err) { | 847 | if (err) { |
858 | printk(KERN_ERR "Failed to load image \"%s\" err %d\n", | 848 | dev_err(dev, "Failed to load image \"%s\" err %d\n", |
859 | fw_name, err); | 849 | fw_name, err); |
860 | kfree(buffer); | 850 | kfree(buffer); |
861 | return err; | 851 | return err; |
862 | } | 852 | } |
@@ -903,13 +893,13 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev) | |||
903 | /* Try to figure out what type of I2c we have */ | 893 | /* Try to figure out what type of I2c we have */ |
904 | static int i2c_type_bootmode(struct edgeport_serial *serial) | 894 | static int i2c_type_bootmode(struct edgeport_serial *serial) |
905 | { | 895 | { |
896 | struct device *dev = &serial->serial->dev->dev; | ||
906 | int status; | 897 | int status; |
907 | u8 *data; | 898 | u8 *data; |
908 | 899 | ||
909 | data = kmalloc(1, GFP_KERNEL); | 900 | data = kmalloc(1, GFP_KERNEL); |
910 | if (!data) { | 901 | if (!data) { |
911 | dev_err(&serial->serial->dev->dev, | 902 | dev_err(dev, "%s - out of memory\n", __func__); |
912 | "%s - out of memory\n", __func__); | ||
913 | return -ENOMEM; | 903 | return -ENOMEM; |
914 | } | 904 | } |
915 | 905 | ||
@@ -917,11 +907,11 @@ static int i2c_type_bootmode(struct edgeport_serial *serial) | |||
917 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, | 907 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, |
918 | DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01); | 908 | DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01); |
919 | if (status) | 909 | if (status) |
920 | dbg("%s - read 2 status error = %d", __func__, status); | 910 | dev_dbg(dev, "%s - read 2 status error = %d\n", __func__, status); |
921 | else | 911 | else |
922 | dbg("%s - read 2 data = 0x%x", __func__, *data); | 912 | dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data); |
923 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { | 913 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { |
924 | dbg("%s - ROM_TYPE_II", __func__); | 914 | dev_dbg(dev, "%s - ROM_TYPE_II\n", __func__); |
925 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 915 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
926 | goto out; | 916 | goto out; |
927 | } | 917 | } |
@@ -930,16 +920,16 @@ static int i2c_type_bootmode(struct edgeport_serial *serial) | |||
930 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, | 920 | status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, |
931 | DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01); | 921 | DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01); |
932 | if (status) | 922 | if (status) |
933 | dbg("%s - read 3 status error = %d", __func__, status); | 923 | dev_dbg(dev, "%s - read 3 status error = %d\n", __func__, status); |
934 | else | 924 | else |
935 | dbg("%s - read 2 data = 0x%x", __func__, *data); | 925 | dev_dbg(dev, "%s - read 2 data = 0x%x\n", __func__, *data); |
936 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { | 926 | if ((!status) && (*data == UMP5152 || *data == UMP3410)) { |
937 | dbg("%s - ROM_TYPE_III", __func__); | 927 | dev_dbg(dev, "%s - ROM_TYPE_III\n", __func__); |
938 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; | 928 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; |
939 | goto out; | 929 | goto out; |
940 | } | 930 | } |
941 | 931 | ||
942 | dbg("%s - Unknown", __func__); | 932 | dev_dbg(dev, "%s - Unknown\n", __func__); |
943 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 933 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
944 | status = -ENODEV; | 934 | status = -ENODEV; |
945 | out: | 935 | out: |
@@ -1050,11 +1040,11 @@ static int download_fw(struct edgeport_serial *serial) | |||
1050 | if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { | 1040 | if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { |
1051 | struct ti_i2c_desc *rom_desc; | 1041 | struct ti_i2c_desc *rom_desc; |
1052 | 1042 | ||
1053 | dbg("%s - RUNNING IN DOWNLOAD MODE", __func__); | 1043 | dev_dbg(dev, "%s - RUNNING IN DOWNLOAD MODE\n", __func__); |
1054 | 1044 | ||
1055 | status = check_i2c_image(serial); | 1045 | status = check_i2c_image(serial); |
1056 | if (status) { | 1046 | if (status) { |
1057 | dbg("%s - DOWNLOAD MODE -- BAD I2C", __func__); | 1047 | dev_dbg(dev, "%s - DOWNLOAD MODE -- BAD I2C\n", __func__); |
1058 | return status; | 1048 | return status; |
1059 | } | 1049 | } |
1060 | 1050 | ||
@@ -1074,7 +1064,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1074 | 1064 | ||
1075 | /* Check version number of ION descriptor */ | 1065 | /* Check version number of ION descriptor */ |
1076 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { | 1066 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { |
1077 | dbg("%s - Wrong CPU Rev %d (Must be 2)", | 1067 | dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n", |
1078 | __func__, ti_cpu_rev(ti_manuf_desc)); | 1068 | __func__, ti_cpu_rev(ti_manuf_desc)); |
1079 | kfree(ti_manuf_desc); | 1069 | kfree(ti_manuf_desc); |
1080 | return -EINVAL; | 1070 | return -EINVAL; |
@@ -1094,8 +1084,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1094 | struct ti_i2c_firmware_rec *firmware_version; | 1084 | struct ti_i2c_firmware_rec *firmware_version; |
1095 | u8 *record; | 1085 | u8 *record; |
1096 | 1086 | ||
1097 | dbg("%s - Found Type FIRMWARE (Type 2) record", | 1087 | dev_dbg(dev, "%s - Found Type FIRMWARE (Type 2) record\n", __func__); |
1098 | __func__); | ||
1099 | 1088 | ||
1100 | firmware_version = kmalloc(sizeof(*firmware_version), | 1089 | firmware_version = kmalloc(sizeof(*firmware_version), |
1101 | GFP_KERNEL); | 1090 | GFP_KERNEL); |
@@ -1127,22 +1116,21 @@ static int download_fw(struct edgeport_serial *serial) | |||
1127 | download_new_ver = (OperationalMajorVersion << 8) + | 1116 | download_new_ver = (OperationalMajorVersion << 8) + |
1128 | (OperationalMinorVersion); | 1117 | (OperationalMinorVersion); |
1129 | 1118 | ||
1130 | dbg("%s - >> FW Versions Device %d.%d Driver %d.%d", | 1119 | dev_dbg(dev, "%s - >> FW Versions Device %d.%d Driver %d.%d\n", |
1131 | __func__, | 1120 | __func__, firmware_version->Ver_Major, |
1132 | firmware_version->Ver_Major, | 1121 | firmware_version->Ver_Minor, |
1133 | firmware_version->Ver_Minor, | 1122 | OperationalMajorVersion, |
1134 | OperationalMajorVersion, | 1123 | OperationalMinorVersion); |
1135 | OperationalMinorVersion); | ||
1136 | 1124 | ||
1137 | /* Check if we have an old version in the I2C and | 1125 | /* Check if we have an old version in the I2C and |
1138 | update if necessary */ | 1126 | update if necessary */ |
1139 | if (download_cur_ver < download_new_ver) { | 1127 | if (download_cur_ver < download_new_ver) { |
1140 | dbg("%s - Update I2C dld from %d.%d to %d.%d", | 1128 | dev_dbg(dev, "%s - Update I2C dld from %d.%d to %d.%d\n", |
1141 | __func__, | 1129 | __func__, |
1142 | firmware_version->Ver_Major, | 1130 | firmware_version->Ver_Major, |
1143 | firmware_version->Ver_Minor, | 1131 | firmware_version->Ver_Minor, |
1144 | OperationalMajorVersion, | 1132 | OperationalMajorVersion, |
1145 | OperationalMinorVersion); | 1133 | OperationalMinorVersion); |
1146 | 1134 | ||
1147 | record = kmalloc(1, GFP_KERNEL); | 1135 | record = kmalloc(1, GFP_KERNEL); |
1148 | if (!record) { | 1136 | if (!record) { |
@@ -1196,9 +1184,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1196 | } | 1184 | } |
1197 | 1185 | ||
1198 | if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) { | 1186 | if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) { |
1199 | dev_err(dev, | 1187 | dev_err(dev, "%s - error resetting device\n", __func__); |
1200 | "%s - error resetting device\n", | ||
1201 | __func__); | ||
1202 | kfree(record); | 1188 | kfree(record); |
1203 | kfree(firmware_version); | 1189 | kfree(firmware_version); |
1204 | kfree(rom_desc); | 1190 | kfree(rom_desc); |
@@ -1206,15 +1192,14 @@ static int download_fw(struct edgeport_serial *serial) | |||
1206 | return -ENODEV; | 1192 | return -ENODEV; |
1207 | } | 1193 | } |
1208 | 1194 | ||
1209 | dbg("%s - HARDWARE RESET", __func__); | 1195 | dev_dbg(dev, "%s - HARDWARE RESET\n", __func__); |
1210 | 1196 | ||
1211 | /* Reset UMP -- Back to BOOT MODE */ | 1197 | /* Reset UMP -- Back to BOOT MODE */ |
1212 | status = ti_vsend_sync(serial->serial->dev, | 1198 | status = ti_vsend_sync(serial->serial->dev, |
1213 | UMPC_HARDWARE_RESET, | 1199 | UMPC_HARDWARE_RESET, |
1214 | 0, 0, NULL, 0); | 1200 | 0, 0, NULL, 0); |
1215 | 1201 | ||
1216 | dbg("%s - HARDWARE RESET return %d", | 1202 | dev_dbg(dev, "%s - HARDWARE RESET return %d\n", __func__, status); |
1217 | __func__, status); | ||
1218 | 1203 | ||
1219 | /* return an error on purpose. */ | 1204 | /* return an error on purpose. */ |
1220 | kfree(record); | 1205 | kfree(record); |
@@ -1249,8 +1234,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1249 | return -ENOMEM; | 1234 | return -ENOMEM; |
1250 | } | 1235 | } |
1251 | 1236 | ||
1252 | dbg("%s - Found Type BLANK FIRMWARE (Type F2) record", | 1237 | dev_dbg(dev, "%s - Found Type BLANK FIRMWARE (Type F2) record\n", __func__); |
1253 | __func__); | ||
1254 | 1238 | ||
1255 | /* | 1239 | /* |
1256 | * In order to update the I2C firmware we must change | 1240 | * In order to update the I2C firmware we must change |
@@ -1292,7 +1276,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1292 | HEADER_SIZE, vheader); | 1276 | HEADER_SIZE, vheader); |
1293 | 1277 | ||
1294 | if (status) { | 1278 | if (status) { |
1295 | dbg("%s - can't read header back", __func__); | 1279 | dev_dbg(dev, "%s - can't read header back\n", __func__); |
1296 | kfree(vheader); | 1280 | kfree(vheader); |
1297 | kfree(header); | 1281 | kfree(header); |
1298 | kfree(rom_desc); | 1282 | kfree(rom_desc); |
@@ -1300,8 +1284,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1300 | return status; | 1284 | return status; |
1301 | } | 1285 | } |
1302 | if (memcmp(vheader, header, HEADER_SIZE)) { | 1286 | if (memcmp(vheader, header, HEADER_SIZE)) { |
1303 | dbg("%s - write download record failed", | 1287 | dev_dbg(dev, "%s - write download record failed\n", __func__); |
1304 | __func__); | ||
1305 | kfree(vheader); | 1288 | kfree(vheader); |
1306 | kfree(header); | 1289 | kfree(header); |
1307 | kfree(rom_desc); | 1290 | kfree(rom_desc); |
@@ -1312,13 +1295,13 @@ static int download_fw(struct edgeport_serial *serial) | |||
1312 | kfree(vheader); | 1295 | kfree(vheader); |
1313 | kfree(header); | 1296 | kfree(header); |
1314 | 1297 | ||
1315 | dbg("%s - Start firmware update", __func__); | 1298 | dev_dbg(dev, "%s - Start firmware update\n", __func__); |
1316 | 1299 | ||
1317 | /* Tell firmware to copy download image into I2C */ | 1300 | /* Tell firmware to copy download image into I2C */ |
1318 | status = ti_vsend_sync(serial->serial->dev, | 1301 | status = ti_vsend_sync(serial->serial->dev, |
1319 | UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0); | 1302 | UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0); |
1320 | 1303 | ||
1321 | dbg("%s - Update complete 0x%x", __func__, status); | 1304 | dev_dbg(dev, "%s - Update complete 0x%x\n", __func__, status); |
1322 | if (status) { | 1305 | if (status) { |
1323 | dev_err(dev, | 1306 | dev_err(dev, |
1324 | "%s - UMPC_COPY_DNLD_TO_I2C failed\n", | 1307 | "%s - UMPC_COPY_DNLD_TO_I2C failed\n", |
@@ -1338,7 +1321,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1338 | /********************************************************************/ | 1321 | /********************************************************************/ |
1339 | /* Boot Mode */ | 1322 | /* Boot Mode */ |
1340 | /********************************************************************/ | 1323 | /********************************************************************/ |
1341 | dbg("%s - RUNNING IN BOOT MODE", __func__); | 1324 | dev_dbg(dev, "%s - RUNNING IN BOOT MODE\n", __func__); |
1342 | 1325 | ||
1343 | /* Configure the TI device so we can use the BULK pipes for download */ | 1326 | /* Configure the TI device so we can use the BULK pipes for download */ |
1344 | status = config_boot_dev(serial->serial->dev); | 1327 | status = config_boot_dev(serial->serial->dev); |
@@ -1347,8 +1330,8 @@ static int download_fw(struct edgeport_serial *serial) | |||
1347 | 1330 | ||
1348 | if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) | 1331 | if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) |
1349 | != USB_VENDOR_ID_ION) { | 1332 | != USB_VENDOR_ID_ION) { |
1350 | dbg("%s - VID = 0x%x", __func__, | 1333 | dev_dbg(dev, "%s - VID = 0x%x\n", __func__, |
1351 | le16_to_cpu(serial->serial->dev->descriptor.idVendor)); | 1334 | le16_to_cpu(serial->serial->dev->descriptor.idVendor)); |
1352 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; | 1335 | serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; |
1353 | goto stayinbootmode; | 1336 | goto stayinbootmode; |
1354 | } | 1337 | } |
@@ -1385,8 +1368,8 @@ static int download_fw(struct edgeport_serial *serial) | |||
1385 | 1368 | ||
1386 | /* Check for version 2 */ | 1369 | /* Check for version 2 */ |
1387 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { | 1370 | if (!ignore_cpu_rev && ti_cpu_rev(ti_manuf_desc) < 2) { |
1388 | dbg("%s - Wrong CPU Rev %d (Must be 2)", | 1371 | dev_dbg(dev, "%s - Wrong CPU Rev %d (Must be 2)\n", |
1389 | __func__, ti_cpu_rev(ti_manuf_desc)); | 1372 | __func__, ti_cpu_rev(ti_manuf_desc)); |
1390 | kfree(ti_manuf_desc); | 1373 | kfree(ti_manuf_desc); |
1391 | goto stayinbootmode; | 1374 | goto stayinbootmode; |
1392 | } | 1375 | } |
@@ -1421,8 +1404,8 @@ static int download_fw(struct edgeport_serial *serial) | |||
1421 | 1404 | ||
1422 | err = request_firmware(&fw, fw_name, dev); | 1405 | err = request_firmware(&fw, fw_name, dev); |
1423 | if (err) { | 1406 | if (err) { |
1424 | printk(KERN_ERR "Failed to load image \"%s\" err %d\n", | 1407 | dev_err(dev, "Failed to load image \"%s\" err %d\n", |
1425 | fw_name, err); | 1408 | fw_name, err); |
1426 | kfree(buffer); | 1409 | kfree(buffer); |
1427 | return err; | 1410 | return err; |
1428 | } | 1411 | } |
@@ -1442,23 +1425,20 @@ static int download_fw(struct edgeport_serial *serial) | |||
1442 | header->CheckSum = cs; | 1425 | header->CheckSum = cs; |
1443 | 1426 | ||
1444 | /* Download the operational code */ | 1427 | /* Download the operational code */ |
1445 | dbg("%s - Downloading operational code image (TI UMP)", | 1428 | dev_dbg(dev, "%s - Downloading operational code image (TI UMP)\n", __func__); |
1446 | __func__); | ||
1447 | status = download_code(serial, buffer, buffer_size); | 1429 | status = download_code(serial, buffer, buffer_size); |
1448 | 1430 | ||
1449 | kfree(buffer); | 1431 | kfree(buffer); |
1450 | 1432 | ||
1451 | if (status) { | 1433 | if (status) { |
1452 | dbg("%s - Error downloading operational code image", | 1434 | dev_dbg(dev, "%s - Error downloading operational code image\n", __func__); |
1453 | __func__); | ||
1454 | return status; | 1435 | return status; |
1455 | } | 1436 | } |
1456 | 1437 | ||
1457 | /* Device will reboot */ | 1438 | /* Device will reboot */ |
1458 | serial->product_info.TiMode = TI_MODE_TRANSITIONING; | 1439 | serial->product_info.TiMode = TI_MODE_TRANSITIONING; |
1459 | 1440 | ||
1460 | dbg("%s - Download successful -- Device rebooting...", | 1441 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); |
1461 | __func__); | ||
1462 | 1442 | ||
1463 | /* return an error on purpose */ | 1443 | /* return an error on purpose */ |
1464 | return -ENODEV; | 1444 | return -ENODEV; |
@@ -1466,7 +1446,7 @@ static int download_fw(struct edgeport_serial *serial) | |||
1466 | 1446 | ||
1467 | stayinbootmode: | 1447 | stayinbootmode: |
1468 | /* Eprom is invalid or blank stay in boot mode */ | 1448 | /* Eprom is invalid or blank stay in boot mode */ |
1469 | dbg("%s - STAYING IN BOOT MODE", __func__); | 1449 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); |
1470 | serial->product_info.TiMode = TI_MODE_BOOT; | 1450 | serial->product_info.TiMode = TI_MODE_BOOT; |
1471 | 1451 | ||
1472 | return 0; | 1452 | return 0; |
@@ -1487,7 +1467,7 @@ static int restore_mcr(struct edgeport_port *port, __u8 mcr) | |||
1487 | { | 1467 | { |
1488 | int status = 0; | 1468 | int status = 0; |
1489 | 1469 | ||
1490 | dbg("%s - %x", __func__, mcr); | 1470 | dev_dbg(&port->port->dev, "%s - %x\n", __func__, mcr); |
1491 | 1471 | ||
1492 | status = ti_do_config(port, UMPC_SET_CLR_DTR, mcr & MCR_DTR); | 1472 | status = ti_do_config(port, UMPC_SET_CLR_DTR, mcr & MCR_DTR); |
1493 | if (status) | 1473 | if (status) |
@@ -1524,7 +1504,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
1524 | struct async_icount *icount; | 1504 | struct async_icount *icount; |
1525 | struct tty_struct *tty; | 1505 | struct tty_struct *tty; |
1526 | 1506 | ||
1527 | dbg("%s - %02x", __func__, msr); | 1507 | dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, msr); |
1528 | 1508 | ||
1529 | if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | | 1509 | if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | |
1530 | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { | 1510 | EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { |
@@ -1566,7 +1546,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, | |||
1566 | LSR_FRM_ERR | LSR_BREAK)); | 1546 | LSR_FRM_ERR | LSR_BREAK)); |
1567 | struct tty_struct *tty; | 1547 | struct tty_struct *tty; |
1568 | 1548 | ||
1569 | dbg("%s - %02x", __func__, new_lsr); | 1549 | dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr); |
1570 | 1550 | ||
1571 | edge_port->shadow_lsr = lsr; | 1551 | edge_port->shadow_lsr = lsr; |
1572 | 1552 | ||
@@ -1604,6 +1584,7 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1604 | struct edgeport_serial *edge_serial = urb->context; | 1584 | struct edgeport_serial *edge_serial = urb->context; |
1605 | struct usb_serial_port *port; | 1585 | struct usb_serial_port *port; |
1606 | struct edgeport_port *edge_port; | 1586 | struct edgeport_port *edge_port; |
1587 | struct device *dev; | ||
1607 | unsigned char *data = urb->transfer_buffer; | 1588 | unsigned char *data = urb->transfer_buffer; |
1608 | int length = urb->actual_length; | 1589 | int length = urb->actual_length; |
1609 | int port_number; | 1590 | int port_number; |
@@ -1613,8 +1594,6 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1613 | __u8 msr; | 1594 | __u8 msr; |
1614 | int status = urb->status; | 1595 | int status = urb->status; |
1615 | 1596 | ||
1616 | dbg("%s", __func__); | ||
1617 | |||
1618 | switch (status) { | 1597 | switch (status) { |
1619 | case 0: | 1598 | case 0: |
1620 | /* success */ | 1599 | /* success */ |
@@ -1623,7 +1602,7 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1623 | case -ENOENT: | 1602 | case -ENOENT: |
1624 | case -ESHUTDOWN: | 1603 | case -ESHUTDOWN: |
1625 | /* this urb is terminated, clean up */ | 1604 | /* this urb is terminated, clean up */ |
1626 | dbg("%s - urb shutting down with status: %d", | 1605 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", |
1627 | __func__, status); | 1606 | __func__, status); |
1628 | return; | 1607 | return; |
1629 | default: | 1608 | default: |
@@ -1633,27 +1612,26 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1633 | } | 1612 | } |
1634 | 1613 | ||
1635 | if (!length) { | 1614 | if (!length) { |
1636 | dbg("%s - no data in urb", __func__); | 1615 | dev_dbg(&urb->dev->dev, "%s - no data in urb\n", __func__); |
1637 | goto exit; | 1616 | goto exit; |
1638 | } | 1617 | } |
1639 | 1618 | ||
1640 | usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, | 1619 | dev = &edge_serial->serial->dev->dev; |
1641 | __func__, length, data); | 1620 | usb_serial_debug_data(dev, __func__, length, data); |
1642 | 1621 | ||
1643 | if (length != 2) { | 1622 | if (length != 2) { |
1644 | dbg("%s - expecting packet of size 2, got %d", | 1623 | dev_dbg(dev, "%s - expecting packet of size 2, got %d\n", __func__, length); |
1645 | __func__, length); | ||
1646 | goto exit; | 1624 | goto exit; |
1647 | } | 1625 | } |
1648 | 1626 | ||
1649 | port_number = TIUMP_GET_PORT_FROM_CODE(data[0]); | 1627 | port_number = TIUMP_GET_PORT_FROM_CODE(data[0]); |
1650 | function = TIUMP_GET_FUNC_FROM_CODE(data[0]); | 1628 | function = TIUMP_GET_FUNC_FROM_CODE(data[0]); |
1651 | dbg("%s - port_number %d, function %d, info 0x%x", | 1629 | dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__, |
1652 | __func__, port_number, function, data[1]); | 1630 | port_number, function, data[1]); |
1653 | port = edge_serial->serial->port[port_number]; | 1631 | port = edge_serial->serial->port[port_number]; |
1654 | edge_port = usb_get_serial_port_data(port); | 1632 | edge_port = usb_get_serial_port_data(port); |
1655 | if (!edge_port) { | 1633 | if (!edge_port) { |
1656 | dbg("%s - edge_port not found", __func__); | 1634 | dev_dbg(dev, "%s - edge_port not found\n", __func__); |
1657 | return; | 1635 | return; |
1658 | } | 1636 | } |
1659 | switch (function) { | 1637 | switch (function) { |
@@ -1662,13 +1640,13 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1662 | if (lsr & UMP_UART_LSR_DATA_MASK) { | 1640 | if (lsr & UMP_UART_LSR_DATA_MASK) { |
1663 | /* Save the LSR event for bulk read | 1641 | /* Save the LSR event for bulk read |
1664 | completion routine */ | 1642 | completion routine */ |
1665 | dbg("%s - LSR Event Port %u LSR Status = %02x", | 1643 | dev_dbg(dev, "%s - LSR Event Port %u LSR Status = %02x\n", |
1666 | __func__, port_number, lsr); | 1644 | __func__, port_number, lsr); |
1667 | edge_port->lsr_event = 1; | 1645 | edge_port->lsr_event = 1; |
1668 | edge_port->lsr_mask = lsr; | 1646 | edge_port->lsr_mask = lsr; |
1669 | } else { | 1647 | } else { |
1670 | dbg("%s - ===== Port %d LSR Status = %02x ======", | 1648 | dev_dbg(dev, "%s - ===== Port %d LSR Status = %02x ======\n", |
1671 | __func__, port_number, lsr); | 1649 | __func__, port_number, lsr); |
1672 | handle_new_lsr(edge_port, 0, lsr, 0); | 1650 | handle_new_lsr(edge_port, 0, lsr, 0); |
1673 | } | 1651 | } |
1674 | break; | 1652 | break; |
@@ -1676,8 +1654,8 @@ static void edge_interrupt_callback(struct urb *urb) | |||
1676 | case TIUMP_INTERRUPT_CODE_MSR: /* MSR */ | 1654 | case TIUMP_INTERRUPT_CODE_MSR: /* MSR */ |
1677 | /* Copy MSR from UMP */ | 1655 | /* Copy MSR from UMP */ |
1678 | msr = data[1]; | 1656 | msr = data[1]; |
1679 | dbg("%s - ===== Port %u MSR Status = %02x ======", | 1657 | dev_dbg(dev, "%s - ===== Port %u MSR Status = %02x ======\n", |
1680 | __func__, port_number, msr); | 1658 | __func__, port_number, msr); |
1681 | handle_new_msr(edge_port, msr); | 1659 | handle_new_msr(edge_port, msr); |
1682 | break; | 1660 | break; |
1683 | 1661 | ||
@@ -1700,14 +1678,13 @@ exit: | |||
1700 | static void edge_bulk_in_callback(struct urb *urb) | 1678 | static void edge_bulk_in_callback(struct urb *urb) |
1701 | { | 1679 | { |
1702 | struct edgeport_port *edge_port = urb->context; | 1680 | struct edgeport_port *edge_port = urb->context; |
1681 | struct device *dev = &edge_port->port->dev; | ||
1703 | unsigned char *data = urb->transfer_buffer; | 1682 | unsigned char *data = urb->transfer_buffer; |
1704 | struct tty_struct *tty; | 1683 | struct tty_struct *tty; |
1705 | int retval = 0; | 1684 | int retval = 0; |
1706 | int port_number; | 1685 | int port_number; |
1707 | int status = urb->status; | 1686 | int status = urb->status; |
1708 | 1687 | ||
1709 | dbg("%s", __func__); | ||
1710 | |||
1711 | switch (status) { | 1688 | switch (status) { |
1712 | case 0: | 1689 | case 0: |
1713 | /* success */ | 1690 | /* success */ |
@@ -1716,13 +1693,10 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1716 | case -ENOENT: | 1693 | case -ENOENT: |
1717 | case -ESHUTDOWN: | 1694 | case -ESHUTDOWN: |
1718 | /* this urb is terminated, clean up */ | 1695 | /* this urb is terminated, clean up */ |
1719 | dbg("%s - urb shutting down with status: %d", | 1696 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status); |
1720 | __func__, status); | ||
1721 | return; | 1697 | return; |
1722 | default: | 1698 | default: |
1723 | dev_err(&urb->dev->dev, | 1699 | 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 | } | 1700 | } |
1727 | 1701 | ||
1728 | if (status == -EPIPE) | 1702 | if (status == -EPIPE) |
@@ -1737,8 +1711,8 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1737 | 1711 | ||
1738 | if (edge_port->lsr_event) { | 1712 | if (edge_port->lsr_event) { |
1739 | edge_port->lsr_event = 0; | 1713 | edge_port->lsr_event = 0; |
1740 | dbg("%s ===== Port %u LSR Status = %02x, Data = %02x ======", | 1714 | dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n", |
1741 | __func__, port_number, edge_port->lsr_mask, *data); | 1715 | __func__, port_number, edge_port->lsr_mask, *data); |
1742 | handle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data); | 1716 | handle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data); |
1743 | /* Adjust buffer length/pointer */ | 1717 | /* Adjust buffer length/pointer */ |
1744 | --urb->actual_length; | 1718 | --urb->actual_length; |
@@ -1747,14 +1721,12 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1747 | 1721 | ||
1748 | tty = tty_port_tty_get(&edge_port->port->port); | 1722 | tty = tty_port_tty_get(&edge_port->port->port); |
1749 | if (tty && urb->actual_length) { | 1723 | if (tty && urb->actual_length) { |
1750 | usb_serial_debug_data(debug, &edge_port->port->dev, | 1724 | usb_serial_debug_data(dev, __func__, urb->actual_length, data); |
1751 | __func__, urb->actual_length, data); | ||
1752 | if (edge_port->close_pending) | 1725 | if (edge_port->close_pending) |
1753 | dbg("%s - close pending, dropping data on the floor", | 1726 | dev_dbg(dev, "%s - close pending, dropping data on the floor\n", |
1754 | __func__); | 1727 | __func__); |
1755 | else | 1728 | else |
1756 | edge_tty_recv(&edge_port->port->dev, tty, data, | 1729 | edge_tty_recv(dev, tty, data, urb->actual_length); |
1757 | urb->actual_length); | ||
1758 | edge_port->icount.rx += urb->actual_length; | 1730 | edge_port->icount.rx += urb->actual_length; |
1759 | } | 1731 | } |
1760 | tty_kref_put(tty); | 1732 | tty_kref_put(tty); |
@@ -1769,9 +1741,7 @@ exit: | |||
1769 | 1741 | ||
1770 | spin_unlock(&edge_port->ep_lock); | 1742 | spin_unlock(&edge_port->ep_lock); |
1771 | if (retval) | 1743 | if (retval) |
1772 | dev_err(&urb->dev->dev, | 1744 | 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 | } | 1745 | } |
1776 | 1746 | ||
1777 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, | 1747 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, |
@@ -1793,8 +1763,6 @@ static void edge_bulk_out_callback(struct urb *urb) | |||
1793 | int status = urb->status; | 1763 | int status = urb->status; |
1794 | struct tty_struct *tty; | 1764 | struct tty_struct *tty; |
1795 | 1765 | ||
1796 | dbg("%s - port %d", __func__, port->number); | ||
1797 | |||
1798 | edge_port->ep_write_urb_in_use = 0; | 1766 | edge_port->ep_write_urb_in_use = 0; |
1799 | 1767 | ||
1800 | switch (status) { | 1768 | switch (status) { |
@@ -1805,7 +1773,7 @@ static void edge_bulk_out_callback(struct urb *urb) | |||
1805 | case -ENOENT: | 1773 | case -ENOENT: |
1806 | case -ESHUTDOWN: | 1774 | case -ESHUTDOWN: |
1807 | /* this urb is terminated, clean up */ | 1775 | /* this urb is terminated, clean up */ |
1808 | dbg("%s - urb shutting down with status: %d", | 1776 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", |
1809 | __func__, status); | 1777 | __func__, status); |
1810 | return; | 1778 | return; |
1811 | default: | 1779 | default: |
@@ -1830,8 +1798,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1830 | u16 open_settings; | 1798 | u16 open_settings; |
1831 | u8 transaction_timeout; | 1799 | u8 transaction_timeout; |
1832 | 1800 | ||
1833 | dbg("%s - port %d", __func__, port->number); | ||
1834 | |||
1835 | if (edge_port == NULL) | 1801 | if (edge_port == NULL) |
1836 | return -ENODEV; | 1802 | return -ENODEV; |
1837 | 1803 | ||
@@ -1850,9 +1816,8 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1850 | return -ENODEV; | 1816 | return -ENODEV; |
1851 | } | 1817 | } |
1852 | 1818 | ||
1853 | dbg("%s - port_number = %d, uart_base = %04x, dma_address = %04x", | 1819 | dev_dbg(&port->dev, "%s - port_number = %d, uart_base = %04x, dma_address = %04x\n", |
1854 | __func__, port_number, edge_port->uart_base, | 1820 | __func__, port_number, edge_port->uart_base, edge_port->dma_address); |
1855 | edge_port->dma_address); | ||
1856 | 1821 | ||
1857 | dev = port->serial->dev; | 1822 | dev = port->serial->dev; |
1858 | 1823 | ||
@@ -1885,7 +1850,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1885 | UMP_PIPE_TRANS_TIMEOUT_ENA | | 1850 | UMP_PIPE_TRANS_TIMEOUT_ENA | |
1886 | (transaction_timeout << 2)); | 1851 | (transaction_timeout << 2)); |
1887 | 1852 | ||
1888 | dbg("%s - Sending UMPC_OPEN_PORT", __func__); | 1853 | dev_dbg(&port->dev, "%s - Sending UMPC_OPEN_PORT\n", __func__); |
1889 | 1854 | ||
1890 | /* Tell TI to open and start the port */ | 1855 | /* Tell TI to open and start the port */ |
1891 | status = send_cmd(dev, UMPC_OPEN_PORT, | 1856 | status = send_cmd(dev, UMPC_OPEN_PORT, |
@@ -1924,11 +1889,11 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1924 | return status; | 1889 | return status; |
1925 | } | 1890 | } |
1926 | 1891 | ||
1927 | dbg("ShadowMSR 0x%X", edge_port->shadow_msr); | 1892 | dev_dbg(&port->dev, "ShadowMSR 0x%X\n", edge_port->shadow_msr); |
1928 | 1893 | ||
1929 | /* Set Initial MCR */ | 1894 | /* Set Initial MCR */ |
1930 | edge_port->shadow_mcr = MCR_RTS | MCR_DTR; | 1895 | edge_port->shadow_mcr = MCR_RTS | MCR_DTR; |
1931 | dbg("ShadowMCR 0x%X", edge_port->shadow_mcr); | 1896 | dev_dbg(&port->dev, "ShadowMCR 0x%X\n", edge_port->shadow_mcr); |
1932 | 1897 | ||
1933 | edge_serial = edge_port->edge_serial; | 1898 | edge_serial = edge_port->edge_serial; |
1934 | if (mutex_lock_interruptible(&edge_serial->es_lock)) | 1899 | if (mutex_lock_interruptible(&edge_serial->es_lock)) |
@@ -1980,8 +1945,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1980 | 1945 | ||
1981 | ++edge_serial->num_ports_open; | 1946 | ++edge_serial->num_ports_open; |
1982 | 1947 | ||
1983 | dbg("%s - exited", __func__); | ||
1984 | |||
1985 | goto release_es_lock; | 1948 | goto release_es_lock; |
1986 | 1949 | ||
1987 | unlink_int_urb: | 1950 | unlink_int_urb: |
@@ -1999,8 +1962,6 @@ static void edge_close(struct usb_serial_port *port) | |||
1999 | struct usb_serial *serial = port->serial; | 1962 | struct usb_serial *serial = port->serial; |
2000 | int port_number; | 1963 | int port_number; |
2001 | 1964 | ||
2002 | dbg("%s - port %d", __func__, port->number); | ||
2003 | |||
2004 | edge_serial = usb_get_serial_data(port->serial); | 1965 | edge_serial = usb_get_serial_data(port->serial); |
2005 | edge_port = usb_get_serial_port_data(port); | 1966 | edge_port = usb_get_serial_port_data(port); |
2006 | if (edge_serial == NULL || edge_port == NULL) | 1967 | if (edge_serial == NULL || edge_port == NULL) |
@@ -2019,7 +1980,7 @@ static void edge_close(struct usb_serial_port *port) | |||
2019 | 1980 | ||
2020 | /* assuming we can still talk to the device, | 1981 | /* assuming we can still talk to the device, |
2021 | * send a close port command to it */ | 1982 | * send a close port command to it */ |
2022 | dbg("%s - send umpc_close_port", __func__); | 1983 | dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__); |
2023 | port_number = port->number - port->serial->minor; | 1984 | port_number = port->number - port->serial->minor; |
2024 | 1985 | ||
2025 | mutex_lock(&serial->disc_mutex); | 1986 | mutex_lock(&serial->disc_mutex); |
@@ -2042,8 +2003,6 @@ static void edge_close(struct usb_serial_port *port) | |||
2042 | } | 2003 | } |
2043 | mutex_unlock(&edge_serial->es_lock); | 2004 | mutex_unlock(&edge_serial->es_lock); |
2044 | edge_port->close_pending = 0; | 2005 | edge_port->close_pending = 0; |
2045 | |||
2046 | dbg("%s - exited", __func__); | ||
2047 | } | 2006 | } |
2048 | 2007 | ||
2049 | static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, | 2008 | static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, |
@@ -2051,10 +2010,8 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
2051 | { | 2010 | { |
2052 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2011 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2053 | 2012 | ||
2054 | dbg("%s - port %d", __func__, port->number); | ||
2055 | |||
2056 | if (count == 0) { | 2013 | if (count == 0) { |
2057 | dbg("%s - write request of 0 bytes", __func__); | 2014 | dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__); |
2058 | return 0; | 2015 | return 0; |
2059 | } | 2016 | } |
2060 | 2017 | ||
@@ -2077,9 +2034,6 @@ static void edge_send(struct tty_struct *tty) | |||
2077 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2034 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2078 | unsigned long flags; | 2035 | unsigned long flags; |
2079 | 2036 | ||
2080 | |||
2081 | dbg("%s - port %d", __func__, port->number); | ||
2082 | |||
2083 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2037 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2084 | 2038 | ||
2085 | if (edge_port->ep_write_urb_in_use) { | 2039 | if (edge_port->ep_write_urb_in_use) { |
@@ -2100,8 +2054,7 @@ static void edge_send(struct tty_struct *tty) | |||
2100 | 2054 | ||
2101 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2055 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2102 | 2056 | ||
2103 | usb_serial_debug_data(debug, &port->dev, __func__, count, | 2057 | usb_serial_debug_data(&port->dev, __func__, count, port->write_urb->transfer_buffer); |
2104 | port->write_urb->transfer_buffer); | ||
2105 | 2058 | ||
2106 | /* set up our urb */ | 2059 | /* set up our urb */ |
2107 | port->write_urb->transfer_buffer_length = count; | 2060 | port->write_urb->transfer_buffer_length = count; |
@@ -2130,8 +2083,6 @@ static int edge_write_room(struct tty_struct *tty) | |||
2130 | int room = 0; | 2083 | int room = 0; |
2131 | unsigned long flags; | 2084 | unsigned long flags; |
2132 | 2085 | ||
2133 | dbg("%s - port %d", __func__, port->number); | ||
2134 | |||
2135 | if (edge_port == NULL) | 2086 | if (edge_port == NULL) |
2136 | return 0; | 2087 | return 0; |
2137 | if (edge_port->close_pending == 1) | 2088 | if (edge_port->close_pending == 1) |
@@ -2141,7 +2092,7 @@ static int edge_write_room(struct tty_struct *tty) | |||
2141 | room = kfifo_avail(&edge_port->write_fifo); | 2092 | room = kfifo_avail(&edge_port->write_fifo); |
2142 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2093 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2143 | 2094 | ||
2144 | dbg("%s - returns %d", __func__, room); | 2095 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); |
2145 | return room; | 2096 | return room; |
2146 | } | 2097 | } |
2147 | 2098 | ||
@@ -2152,8 +2103,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2152 | int chars = 0; | 2103 | int chars = 0; |
2153 | unsigned long flags; | 2104 | unsigned long flags; |
2154 | 2105 | ||
2155 | dbg("%s - port %d", __func__, port->number); | ||
2156 | |||
2157 | if (edge_port == NULL) | 2106 | if (edge_port == NULL) |
2158 | return 0; | 2107 | return 0; |
2159 | if (edge_port->close_pending == 1) | 2108 | if (edge_port->close_pending == 1) |
@@ -2163,7 +2112,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2163 | chars = kfifo_len(&edge_port->write_fifo); | 2112 | chars = kfifo_len(&edge_port->write_fifo); |
2164 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2113 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2165 | 2114 | ||
2166 | dbg("%s - returns %d", __func__, chars); | 2115 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
2167 | return chars; | 2116 | return chars; |
2168 | } | 2117 | } |
2169 | 2118 | ||
@@ -2173,8 +2122,6 @@ static void edge_throttle(struct tty_struct *tty) | |||
2173 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2122 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2174 | int status; | 2123 | int status; |
2175 | 2124 | ||
2176 | dbg("%s - port %d", __func__, port->number); | ||
2177 | |||
2178 | if (edge_port == NULL) | 2125 | if (edge_port == NULL) |
2179 | return; | 2126 | return; |
2180 | 2127 | ||
@@ -2200,8 +2147,6 @@ static void edge_unthrottle(struct tty_struct *tty) | |||
2200 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2147 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2201 | int status; | 2148 | int status; |
2202 | 2149 | ||
2203 | dbg("%s - port %d", __func__, port->number); | ||
2204 | |||
2205 | if (edge_port == NULL) | 2150 | if (edge_port == NULL) |
2206 | return; | 2151 | return; |
2207 | 2152 | ||
@@ -2261,6 +2206,7 @@ static int restart_read(struct edgeport_port *edge_port) | |||
2261 | static void change_port_settings(struct tty_struct *tty, | 2206 | static void change_port_settings(struct tty_struct *tty, |
2262 | struct edgeport_port *edge_port, struct ktermios *old_termios) | 2207 | struct edgeport_port *edge_port, struct ktermios *old_termios) |
2263 | { | 2208 | { |
2209 | struct device *dev = &edge_port->port->dev; | ||
2264 | struct ump_uart_config *config; | 2210 | struct ump_uart_config *config; |
2265 | int baud; | 2211 | int baud; |
2266 | unsigned cflag; | 2212 | unsigned cflag; |
@@ -2268,13 +2214,12 @@ static void change_port_settings(struct tty_struct *tty, | |||
2268 | int port_number = edge_port->port->number - | 2214 | int port_number = edge_port->port->number - |
2269 | edge_port->port->serial->minor; | 2215 | edge_port->port->serial->minor; |
2270 | 2216 | ||
2271 | dbg("%s - port %d", __func__, edge_port->port->number); | 2217 | dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number); |
2272 | 2218 | ||
2273 | config = kmalloc (sizeof (*config), GFP_KERNEL); | 2219 | config = kmalloc (sizeof (*config), GFP_KERNEL); |
2274 | if (!config) { | 2220 | if (!config) { |
2275 | tty->termios = *old_termios; | 2221 | tty->termios = *old_termios; |
2276 | dev_err(&edge_port->port->dev, "%s - out of memory\n", | 2222 | dev_err(dev, "%s - out of memory\n", __func__); |
2277 | __func__); | ||
2278 | return; | 2223 | return; |
2279 | } | 2224 | } |
2280 | 2225 | ||
@@ -2290,20 +2235,20 @@ static void change_port_settings(struct tty_struct *tty, | |||
2290 | switch (cflag & CSIZE) { | 2235 | switch (cflag & CSIZE) { |
2291 | case CS5: | 2236 | case CS5: |
2292 | config->bDataBits = UMP_UART_CHAR5BITS; | 2237 | config->bDataBits = UMP_UART_CHAR5BITS; |
2293 | dbg("%s - data bits = 5", __func__); | 2238 | dev_dbg(dev, "%s - data bits = 5\n", __func__); |
2294 | break; | 2239 | break; |
2295 | case CS6: | 2240 | case CS6: |
2296 | config->bDataBits = UMP_UART_CHAR6BITS; | 2241 | config->bDataBits = UMP_UART_CHAR6BITS; |
2297 | dbg("%s - data bits = 6", __func__); | 2242 | dev_dbg(dev, "%s - data bits = 6\n", __func__); |
2298 | break; | 2243 | break; |
2299 | case CS7: | 2244 | case CS7: |
2300 | config->bDataBits = UMP_UART_CHAR7BITS; | 2245 | config->bDataBits = UMP_UART_CHAR7BITS; |
2301 | dbg("%s - data bits = 7", __func__); | 2246 | dev_dbg(dev, "%s - data bits = 7\n", __func__); |
2302 | break; | 2247 | break; |
2303 | default: | 2248 | default: |
2304 | case CS8: | 2249 | case CS8: |
2305 | config->bDataBits = UMP_UART_CHAR8BITS; | 2250 | config->bDataBits = UMP_UART_CHAR8BITS; |
2306 | dbg("%s - data bits = 8", __func__); | 2251 | dev_dbg(dev, "%s - data bits = 8\n", __func__); |
2307 | break; | 2252 | break; |
2308 | } | 2253 | } |
2309 | 2254 | ||
@@ -2311,32 +2256,32 @@ static void change_port_settings(struct tty_struct *tty, | |||
2311 | if (cflag & PARODD) { | 2256 | if (cflag & PARODD) { |
2312 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; | 2257 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; |
2313 | config->bParity = UMP_UART_ODDPARITY; | 2258 | config->bParity = UMP_UART_ODDPARITY; |
2314 | dbg("%s - parity = odd", __func__); | 2259 | dev_dbg(dev, "%s - parity = odd\n", __func__); |
2315 | } else { | 2260 | } else { |
2316 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; | 2261 | config->wFlags |= UMP_MASK_UART_FLAGS_PARITY; |
2317 | config->bParity = UMP_UART_EVENPARITY; | 2262 | config->bParity = UMP_UART_EVENPARITY; |
2318 | dbg("%s - parity = even", __func__); | 2263 | dev_dbg(dev, "%s - parity = even\n", __func__); |
2319 | } | 2264 | } |
2320 | } else { | 2265 | } else { |
2321 | config->bParity = UMP_UART_NOPARITY; | 2266 | config->bParity = UMP_UART_NOPARITY; |
2322 | dbg("%s - parity = none", __func__); | 2267 | dev_dbg(dev, "%s - parity = none\n", __func__); |
2323 | } | 2268 | } |
2324 | 2269 | ||
2325 | if (cflag & CSTOPB) { | 2270 | if (cflag & CSTOPB) { |
2326 | config->bStopBits = UMP_UART_STOPBIT2; | 2271 | config->bStopBits = UMP_UART_STOPBIT2; |
2327 | dbg("%s - stop bits = 2", __func__); | 2272 | dev_dbg(dev, "%s - stop bits = 2\n", __func__); |
2328 | } else { | 2273 | } else { |
2329 | config->bStopBits = UMP_UART_STOPBIT1; | 2274 | config->bStopBits = UMP_UART_STOPBIT1; |
2330 | dbg("%s - stop bits = 1", __func__); | 2275 | dev_dbg(dev, "%s - stop bits = 1\n", __func__); |
2331 | } | 2276 | } |
2332 | 2277 | ||
2333 | /* figure out the flow control settings */ | 2278 | /* figure out the flow control settings */ |
2334 | if (cflag & CRTSCTS) { | 2279 | if (cflag & CRTSCTS) { |
2335 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW; | 2280 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X_CTS_FLOW; |
2336 | config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW; | 2281 | config->wFlags |= UMP_MASK_UART_FLAGS_RTS_FLOW; |
2337 | dbg("%s - RTS/CTS is enabled", __func__); | 2282 | dev_dbg(dev, "%s - RTS/CTS is enabled\n", __func__); |
2338 | } else { | 2283 | } else { |
2339 | dbg("%s - RTS/CTS is disabled", __func__); | 2284 | dev_dbg(dev, "%s - RTS/CTS is disabled\n", __func__); |
2340 | tty->hw_stopped = 0; | 2285 | tty->hw_stopped = 0; |
2341 | restart_read(edge_port); | 2286 | restart_read(edge_port); |
2342 | } | 2287 | } |
@@ -2349,18 +2294,18 @@ static void change_port_settings(struct tty_struct *tty, | |||
2349 | /* if we are implementing INBOUND XON/XOFF */ | 2294 | /* if we are implementing INBOUND XON/XOFF */ |
2350 | if (I_IXOFF(tty)) { | 2295 | if (I_IXOFF(tty)) { |
2351 | config->wFlags |= UMP_MASK_UART_FLAGS_IN_X; | 2296 | config->wFlags |= UMP_MASK_UART_FLAGS_IN_X; |
2352 | dbg("%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", | 2297 | dev_dbg(dev, "%s - INBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n", |
2353 | __func__, config->cXon, config->cXoff); | 2298 | __func__, config->cXon, config->cXoff); |
2354 | } else | 2299 | } else |
2355 | dbg("%s - INBOUND XON/XOFF is disabled", __func__); | 2300 | dev_dbg(dev, "%s - INBOUND XON/XOFF is disabled\n", __func__); |
2356 | 2301 | ||
2357 | /* if we are implementing OUTBOUND XON/XOFF */ | 2302 | /* if we are implementing OUTBOUND XON/XOFF */ |
2358 | if (I_IXON(tty)) { | 2303 | if (I_IXON(tty)) { |
2359 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X; | 2304 | config->wFlags |= UMP_MASK_UART_FLAGS_OUT_X; |
2360 | dbg("%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x", | 2305 | dev_dbg(dev, "%s - OUTBOUND XON/XOFF is enabled, XON = %2x, XOFF = %2x\n", |
2361 | __func__, config->cXon, config->cXoff); | 2306 | __func__, config->cXon, config->cXoff); |
2362 | } else | 2307 | } else |
2363 | dbg("%s - OUTBOUND XON/XOFF is disabled", __func__); | 2308 | dev_dbg(dev, "%s - OUTBOUND XON/XOFF is disabled\n", __func__); |
2364 | 2309 | ||
2365 | tty->termios.c_cflag &= ~CMSPAR; | 2310 | tty->termios.c_cflag &= ~CMSPAR; |
2366 | 2311 | ||
@@ -2377,17 +2322,16 @@ static void change_port_settings(struct tty_struct *tty, | |||
2377 | 2322 | ||
2378 | /* FIXME: Recompute actual baud from divisor here */ | 2323 | /* FIXME: Recompute actual baud from divisor here */ |
2379 | 2324 | ||
2380 | dbg("%s - baud rate = %d, wBaudRate = %d", __func__, baud, | 2325 | dev_dbg(dev, "%s - baud rate = %d, wBaudRate = %d\n", __func__, baud, config->wBaudRate); |
2381 | config->wBaudRate); | ||
2382 | 2326 | ||
2383 | dbg("wBaudRate: %d", (int)(461550L / config->wBaudRate)); | 2327 | dev_dbg(dev, "wBaudRate: %d\n", (int)(461550L / config->wBaudRate)); |
2384 | dbg("wFlags: 0x%x", config->wFlags); | 2328 | dev_dbg(dev, "wFlags: 0x%x\n", config->wFlags); |
2385 | dbg("bDataBits: %d", config->bDataBits); | 2329 | dev_dbg(dev, "bDataBits: %d\n", config->bDataBits); |
2386 | dbg("bParity: %d", config->bParity); | 2330 | dev_dbg(dev, "bParity: %d\n", config->bParity); |
2387 | dbg("bStopBits: %d", config->bStopBits); | 2331 | dev_dbg(dev, "bStopBits: %d\n", config->bStopBits); |
2388 | dbg("cXon: %d", config->cXon); | 2332 | dev_dbg(dev, "cXon: %d\n", config->cXon); |
2389 | dbg("cXoff: %d", config->cXoff); | 2333 | dev_dbg(dev, "cXoff: %d\n", config->cXoff); |
2390 | dbg("bUartMode: %d", config->bUartMode); | 2334 | dev_dbg(dev, "bUartMode: %d\n", config->bUartMode); |
2391 | 2335 | ||
2392 | /* move the word values into big endian mode */ | 2336 | /* move the word values into big endian mode */ |
2393 | cpu_to_be16s(&config->wFlags); | 2337 | cpu_to_be16s(&config->wFlags); |
@@ -2397,8 +2341,8 @@ static void change_port_settings(struct tty_struct *tty, | |||
2397 | (__u8)(UMPM_UART1_PORT + port_number), | 2341 | (__u8)(UMPM_UART1_PORT + port_number), |
2398 | 0, (__u8 *)config, sizeof(*config)); | 2342 | 0, (__u8 *)config, sizeof(*config)); |
2399 | if (status) | 2343 | if (status) |
2400 | dbg("%s - error %d when trying to write config to device", | 2344 | dev_dbg(dev, "%s - error %d when trying to write config to device\n", |
2401 | __func__, status); | 2345 | __func__, status); |
2402 | kfree(config); | 2346 | kfree(config); |
2403 | } | 2347 | } |
2404 | 2348 | ||
@@ -2410,11 +2354,11 @@ static void edge_set_termios(struct tty_struct *tty, | |||
2410 | 2354 | ||
2411 | cflag = tty->termios.c_cflag; | 2355 | cflag = tty->termios.c_cflag; |
2412 | 2356 | ||
2413 | dbg("%s - clfag %08x iflag %08x", __func__, | 2357 | dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, |
2414 | tty->termios.c_cflag, tty->termios.c_iflag); | 2358 | tty->termios.c_cflag, tty->termios.c_iflag); |
2415 | dbg("%s - old clfag %08x old iflag %08x", __func__, | 2359 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, |
2416 | old_termios->c_cflag, old_termios->c_iflag); | 2360 | old_termios->c_cflag, old_termios->c_iflag); |
2417 | dbg("%s - port %d", __func__, port->number); | 2361 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); |
2418 | 2362 | ||
2419 | if (edge_port == NULL) | 2363 | if (edge_port == NULL) |
2420 | return; | 2364 | return; |
@@ -2430,8 +2374,6 @@ static int edge_tiocmset(struct tty_struct *tty, | |||
2430 | unsigned int mcr; | 2374 | unsigned int mcr; |
2431 | unsigned long flags; | 2375 | unsigned long flags; |
2432 | 2376 | ||
2433 | dbg("%s - port %d", __func__, port->number); | ||
2434 | |||
2435 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2377 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2436 | mcr = edge_port->shadow_mcr; | 2378 | mcr = edge_port->shadow_mcr; |
2437 | if (set & TIOCM_RTS) | 2379 | if (set & TIOCM_RTS) |
@@ -2464,8 +2406,6 @@ static int edge_tiocmget(struct tty_struct *tty) | |||
2464 | unsigned int mcr; | 2406 | unsigned int mcr; |
2465 | unsigned long flags; | 2407 | unsigned long flags; |
2466 | 2408 | ||
2467 | dbg("%s - port %d", __func__, port->number); | ||
2468 | |||
2469 | spin_lock_irqsave(&edge_port->ep_lock, flags); | 2409 | spin_lock_irqsave(&edge_port->ep_lock, flags); |
2470 | 2410 | ||
2471 | msr = edge_port->shadow_msr; | 2411 | msr = edge_port->shadow_msr; |
@@ -2478,7 +2418,7 @@ static int edge_tiocmget(struct tty_struct *tty) | |||
2478 | | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ | 2418 | | ((msr & EDGEPORT_MSR_DSR) ? TIOCM_DSR: 0); /* 0x100 */ |
2479 | 2419 | ||
2480 | 2420 | ||
2481 | dbg("%s -- %x", __func__, result); | 2421 | dev_dbg(&port->dev, "%s -- %x\n", __func__, result); |
2482 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2422 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2483 | 2423 | ||
2484 | return result; | 2424 | return result; |
@@ -2538,15 +2478,15 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2538 | struct async_icount cnow; | 2478 | struct async_icount cnow; |
2539 | struct async_icount cprev; | 2479 | struct async_icount cprev; |
2540 | 2480 | ||
2541 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); | 2481 | dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); |
2542 | 2482 | ||
2543 | switch (cmd) { | 2483 | switch (cmd) { |
2544 | case TIOCGSERIAL: | 2484 | case TIOCGSERIAL: |
2545 | dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); | 2485 | dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__); |
2546 | return get_serial_info(edge_port, | 2486 | return get_serial_info(edge_port, |
2547 | (struct serial_struct __user *) arg); | 2487 | (struct serial_struct __user *) arg); |
2548 | case TIOCMIWAIT: | 2488 | case TIOCMIWAIT: |
2549 | dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); | 2489 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
2550 | cprev = edge_port->icount; | 2490 | cprev = edge_port->icount; |
2551 | while (1) { | 2491 | while (1) { |
2552 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2492 | interruptible_sleep_on(&edge_port->delta_msr_wait); |
@@ -2578,8 +2518,6 @@ static void edge_break(struct tty_struct *tty, int break_state) | |||
2578 | int status; | 2518 | int status; |
2579 | int bv = 0; /* Off */ | 2519 | int bv = 0; /* Off */ |
2580 | 2520 | ||
2581 | dbg("%s - state = %d", __func__, break_state); | ||
2582 | |||
2583 | /* chase the port close */ | 2521 | /* chase the port close */ |
2584 | chase_port(edge_port, 0, 0); | 2522 | chase_port(edge_port, 0, 0); |
2585 | 2523 | ||
@@ -2587,8 +2525,8 @@ static void edge_break(struct tty_struct *tty, int break_state) | |||
2587 | bv = 1; /* On */ | 2525 | bv = 1; /* On */ |
2588 | status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv); | 2526 | status = ti_do_config(edge_port, UMPC_SET_CLR_BREAK, bv); |
2589 | if (status) | 2527 | if (status) |
2590 | dbg("%s - error %d sending break set/clear command.", | 2528 | dev_dbg(&port->dev, "%s - error %d sending break set/clear command.\n", |
2591 | __func__, status); | 2529 | __func__, status); |
2592 | } | 2530 | } |
2593 | 2531 | ||
2594 | static int edge_startup(struct usb_serial *serial) | 2532 | static int edge_startup(struct usb_serial *serial) |
@@ -2655,7 +2593,6 @@ cleanup: | |||
2655 | 2593 | ||
2656 | static void edge_disconnect(struct usb_serial *serial) | 2594 | static void edge_disconnect(struct usb_serial *serial) |
2657 | { | 2595 | { |
2658 | dbg("%s", __func__); | ||
2659 | } | 2596 | } |
2660 | 2597 | ||
2661 | static void edge_release(struct usb_serial *serial) | 2598 | static void edge_release(struct usb_serial *serial) |
@@ -2663,8 +2600,6 @@ static void edge_release(struct usb_serial *serial) | |||
2663 | int i; | 2600 | int i; |
2664 | struct edgeport_port *edge_port; | 2601 | struct edgeport_port *edge_port; |
2665 | 2602 | ||
2666 | dbg("%s", __func__); | ||
2667 | |||
2668 | for (i = 0; i < serial->num_ports; ++i) { | 2603 | for (i = 0; i < serial->num_ports; ++i) { |
2669 | edge_port = usb_get_serial_port_data(serial->port[i]); | 2604 | edge_port = usb_get_serial_port_data(serial->port[i]); |
2670 | kfifo_free(&edge_port->write_fifo); | 2605 | kfifo_free(&edge_port->write_fifo); |
@@ -2692,7 +2627,7 @@ static ssize_t store_uart_mode(struct device *dev, | |||
2692 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2627 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2693 | unsigned int v = simple_strtoul(valbuf, NULL, 0); | 2628 | unsigned int v = simple_strtoul(valbuf, NULL, 0); |
2694 | 2629 | ||
2695 | dbg("%s: setting uart_mode = %d", __func__, v); | 2630 | dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v); |
2696 | 2631 | ||
2697 | if (v < 256) | 2632 | if (v < 256) |
2698 | edge_port->bUartMode = v; | 2633 | edge_port->bUartMode = v; |
@@ -2789,9 +2724,6 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
2789 | MODULE_LICENSE("GPL"); | 2724 | MODULE_LICENSE("GPL"); |
2790 | MODULE_FIRMWARE("edgeport/down3.bin"); | 2725 | MODULE_FIRMWARE("edgeport/down3.bin"); |
2791 | 2726 | ||
2792 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
2793 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
2794 | |||
2795 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); | 2727 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); |
2796 | MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); | 2728 | MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); |
2797 | 2729 | ||