diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-22 18:25:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-22 18:25:26 -0400 |
commit | 09091a4d5f2dd378dcf71de50b48cdacc58a8ac0 (patch) | |
tree | d50e37ebb5591fa1e723f32bde077dbdf726b78b | |
parent | 66f75a5d028beaf67c931435fdc3e7823125730c (diff) | |
parent | 3a1c2a82204f5376f484d82cb18189afc2145c77 (diff) |
Merge 3.4-rc4 into usb-next.
This resolves the conflict in:
drivers/usb/host/ehci-fsl.c
And picks up loads of xhci bugfixes to make it easier for others to test
with.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
62 files changed, 1740 insertions, 1255 deletions
diff --git a/Documentation/devicetree/bindings/usb/spear-usb.txt b/Documentation/devicetree/bindings/usb/spear-usb.txt new file mode 100644 index 000000000000..f8a464a25653 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/spear-usb.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | ST SPEAr SoC USB controllers: | ||
2 | ----------------------------- | ||
3 | |||
4 | EHCI: | ||
5 | ----- | ||
6 | |||
7 | Required properties: | ||
8 | - compatible: "st,spear600-ehci" | ||
9 | - interrupt-parent: Should be the phandle for the interrupt controller | ||
10 | that services interrupts for this device | ||
11 | - interrupts: Should contain the EHCI interrupt | ||
12 | |||
13 | Example: | ||
14 | |||
15 | ehci@e1800000 { | ||
16 | compatible = "st,spear600-ehci", "usb-ehci"; | ||
17 | reg = <0xe1800000 0x1000>; | ||
18 | interrupt-parent = <&vic1>; | ||
19 | interrupts = <27>; | ||
20 | }; | ||
21 | |||
22 | |||
23 | OHCI: | ||
24 | ----- | ||
25 | |||
26 | Required properties: | ||
27 | - compatible: "st,spear600-ohci" | ||
28 | - interrupt-parent: Should be the phandle for the interrupt controller | ||
29 | that services interrupts for this device | ||
30 | - interrupts: Should contain the OHCI interrupt | ||
31 | |||
32 | Example: | ||
33 | |||
34 | ohci@e1900000 { | ||
35 | compatible = "st,spear600-ohci", "usb-ohci"; | ||
36 | reg = <0xe1800000 0x1000>; | ||
37 | interrupt-parent = <&vic1>; | ||
38 | interrupts = <26>; | ||
39 | }; | ||
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index f94cccccfa56..3bea7fe25b20 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -297,6 +297,23 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
297 | return -EILSEQ; | 297 | return -EILSEQ; |
298 | } | 298 | } |
299 | 299 | ||
300 | /* First Slave Address Descriptor should be port 0: | ||
301 | * the main register space for the core | ||
302 | */ | ||
303 | tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); | ||
304 | if (tmp <= 0) { | ||
305 | /* Try again to see if it is a bridge */ | ||
306 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | ||
307 | SCAN_ADDR_TYPE_BRIDGE, 0); | ||
308 | if (tmp <= 0) { | ||
309 | return -EILSEQ; | ||
310 | } else { | ||
311 | pr_info("Bridge found\n"); | ||
312 | return -ENXIO; | ||
313 | } | ||
314 | } | ||
315 | core->addr = tmp; | ||
316 | |||
300 | /* get & parse slave ports */ | 317 | /* get & parse slave ports */ |
301 | for (i = 0; i < ports[1]; i++) { | 318 | for (i = 0; i < ports[1]; i++) { |
302 | for (j = 0; ; j++) { | 319 | for (j = 0; ; j++) { |
@@ -309,7 +326,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
309 | break; | 326 | break; |
310 | } else { | 327 | } else { |
311 | if (i == 0 && j == 0) | 328 | if (i == 0 && j == 0) |
312 | core->addr = tmp; | 329 | core->addr1 = tmp; |
313 | } | 330 | } |
314 | } | 331 | } |
315 | } | 332 | } |
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 83549d9cfefc..510d79639217 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
@@ -782,20 +782,20 @@ static int __init asus_oled_init(void) | |||
782 | oled_class = class_create(THIS_MODULE, ASUS_OLED_UNDERSCORE_NAME); | 782 | oled_class = class_create(THIS_MODULE, ASUS_OLED_UNDERSCORE_NAME); |
783 | 783 | ||
784 | if (IS_ERR(oled_class)) { | 784 | if (IS_ERR(oled_class)) { |
785 | err("Error creating " ASUS_OLED_UNDERSCORE_NAME " class"); | 785 | printk(KERN_ERR "Error creating " ASUS_OLED_UNDERSCORE_NAME " class\n"); |
786 | return PTR_ERR(oled_class); | 786 | return PTR_ERR(oled_class); |
787 | } | 787 | } |
788 | 788 | ||
789 | retval = class_create_file(oled_class, &class_attr_version.attr); | 789 | retval = class_create_file(oled_class, &class_attr_version.attr); |
790 | if (retval) { | 790 | if (retval) { |
791 | err("Error creating class version file"); | 791 | printk(KERN_ERR "Error creating class version file\n"); |
792 | goto error; | 792 | goto error; |
793 | } | 793 | } |
794 | 794 | ||
795 | retval = usb_register(&oled_driver); | 795 | retval = usb_register(&oled_driver); |
796 | 796 | ||
797 | if (retval) { | 797 | if (retval) { |
798 | err("usb_register failed. Error number %d", retval); | 798 | printk(KERN_ERR "usb_register failed. Error number %d\n", retval); |
799 | goto error; | 799 | goto error; |
800 | } | 800 | } |
801 | 801 | ||
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index e86ab5862895..89a49dda4482 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c | |||
@@ -547,7 +547,7 @@ static void dt9812_configure_gain(struct usb_dt9812 *dev, | |||
547 | rmw->or_value = F020_MASK_ADC0CF_AMP0GN2; | 547 | rmw->or_value = F020_MASK_ADC0CF_AMP0GN2; |
548 | break; | 548 | break; |
549 | default: | 549 | default: |
550 | err("Illegal gain %d\n", gain); | 550 | dev_err(&dev->interface->dev, "Illegal gain %d\n", gain); |
551 | 551 | ||
552 | } | 552 | } |
553 | } | 553 | } |
@@ -715,7 +715,7 @@ static int dt9812_probe(struct usb_interface *interface, | |||
715 | iface_desc = interface->cur_altsetting; | 715 | iface_desc = interface->cur_altsetting; |
716 | 716 | ||
717 | if (iface_desc->desc.bNumEndpoints != 5) { | 717 | if (iface_desc->desc.bNumEndpoints != 5) { |
718 | err("Wrong number of endpints."); | 718 | dev_err(&interface->dev, "Wrong number of endpoints.\n"); |
719 | retval = -ENODEV; | 719 | retval = -ENODEV; |
720 | goto error; | 720 | goto error; |
721 | } | 721 | } |
@@ -781,22 +781,22 @@ static int dt9812_probe(struct usb_interface *interface, | |||
781 | } | 781 | } |
782 | 782 | ||
783 | if (dt9812_read_info(dev, 1, &dev->vendor, sizeof(dev->vendor)) != 0) { | 783 | if (dt9812_read_info(dev, 1, &dev->vendor, sizeof(dev->vendor)) != 0) { |
784 | err("Failed to read vendor."); | 784 | dev_err(&interface->dev, "Failed to read vendor.\n"); |
785 | retval = -ENODEV; | 785 | retval = -ENODEV; |
786 | goto error; | 786 | goto error; |
787 | } | 787 | } |
788 | if (dt9812_read_info(dev, 3, &dev->product, sizeof(dev->product)) != 0) { | 788 | if (dt9812_read_info(dev, 3, &dev->product, sizeof(dev->product)) != 0) { |
789 | err("Failed to read product."); | 789 | dev_err(&interface->dev, "Failed to read product.\n"); |
790 | retval = -ENODEV; | 790 | retval = -ENODEV; |
791 | goto error; | 791 | goto error; |
792 | } | 792 | } |
793 | if (dt9812_read_info(dev, 5, &dev->device, sizeof(dev->device)) != 0) { | 793 | if (dt9812_read_info(dev, 5, &dev->device, sizeof(dev->device)) != 0) { |
794 | err("Failed to read device."); | 794 | dev_err(&interface->dev, "Failed to read device.\n"); |
795 | retval = -ENODEV; | 795 | retval = -ENODEV; |
796 | goto error; | 796 | goto error; |
797 | } | 797 | } |
798 | if (dt9812_read_info(dev, 7, &dev->serial, sizeof(dev->serial)) != 0) { | 798 | if (dt9812_read_info(dev, 7, &dev->serial, sizeof(dev->serial)) != 0) { |
799 | err("Failed to read serial."); | 799 | dev_err(&interface->dev, "Failed to read serial.\n"); |
800 | retval = -ENODEV; | 800 | retval = -ENODEV; |
801 | goto error; | 801 | goto error; |
802 | } | 802 | } |
@@ -1146,7 +1146,9 @@ static int __init usb_dt9812_init(void) | |||
1146 | result = comedi_driver_register(&dt9812_comedi_driver); | 1146 | result = comedi_driver_register(&dt9812_comedi_driver); |
1147 | if (result) { | 1147 | if (result) { |
1148 | usb_deregister(&dt9812_usb_driver); | 1148 | usb_deregister(&dt9812_usb_driver); |
1149 | err("comedi_driver_register failed. Error number %d", result); | 1149 | printk(KERN_ERR KBUILD_MODNAME |
1150 | ": comedi_driver_register failed. Error number %d\n", | ||
1151 | result); | ||
1150 | } | 1152 | } |
1151 | 1153 | ||
1152 | return result; | 1154 | return result; |
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 3d13ca6e1670..2dba3efdacfa 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c | |||
@@ -295,7 +295,9 @@ resubmit: | |||
295 | if (!usb_submit_urb(urb, GFP_KERNEL)) | 295 | if (!usb_submit_urb(urb, GFP_KERNEL)) |
296 | goto exit; | 296 | goto exit; |
297 | 297 | ||
298 | err("comedi#: vmk80xx: %s - submit urb failed\n", __func__); | 298 | dev_err(&urb->dev->dev, |
299 | "comedi#: vmk80xx: %s - submit urb failed\n", | ||
300 | __func__); | ||
299 | 301 | ||
300 | usb_unanchor_urb(urb); | 302 | usb_unanchor_urb(urb); |
301 | } | 303 | } |
diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index 3bf0f40e97fd..acbb2cc510f9 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c | |||
@@ -333,8 +333,8 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file) | |||
333 | interface = usb_find_interface(&usb_alphatrack_driver, subminor); | 333 | interface = usb_find_interface(&usb_alphatrack_driver, subminor); |
334 | 334 | ||
335 | if (!interface) { | 335 | if (!interface) { |
336 | err("%s - error, can't find device for minor %d\n", | 336 | printk(KERN_ERR "%s - error, can't find device for minor %d\n", |
337 | __func__, subminor); | 337 | __func__, subminor); |
338 | retval = -ENODEV; | 338 | retval = -ENODEV; |
339 | goto unlock_disconnect_exit; | 339 | goto unlock_disconnect_exit; |
340 | } | 340 | } |
@@ -494,7 +494,8 @@ static ssize_t usb_alphatrack_read(struct file *file, char __user *buffer, | |||
494 | /* verify that the device wasn't unplugged */ | 494 | /* verify that the device wasn't unplugged */ |
495 | if (dev->intf == NULL) { | 495 | if (dev->intf == NULL) { |
496 | retval = -ENODEV; | 496 | retval = -ENODEV; |
497 | err("No device or device unplugged %d\n", retval); | 497 | printk(KERN_ERR "%s: No device or device unplugged %d\n", |
498 | __func__, retval); | ||
498 | goto unlock_exit; | 499 | goto unlock_exit; |
499 | } | 500 | } |
500 | 501 | ||
@@ -564,7 +565,8 @@ static ssize_t usb_alphatrack_write(struct file *file, | |||
564 | /* verify that the device wasn't unplugged */ | 565 | /* verify that the device wasn't unplugged */ |
565 | if (dev->intf == NULL) { | 566 | if (dev->intf == NULL) { |
566 | retval = -ENODEV; | 567 | retval = -ENODEV; |
567 | err("No device or device unplugged %d\n", retval); | 568 | printk(KERN_ERR "%s: No device or device unplugged %d\n", |
569 | __func__, retval); | ||
568 | goto unlock_exit; | 570 | goto unlock_exit; |
569 | } | 571 | } |
570 | 572 | ||
@@ -599,7 +601,7 @@ static ssize_t usb_alphatrack_write(struct file *file, | |||
599 | } | 601 | } |
600 | 602 | ||
601 | if (dev->interrupt_out_endpoint == NULL) { | 603 | if (dev->interrupt_out_endpoint == NULL) { |
602 | err("Endpoint should not be be null!\n"); | 604 | dev_err(&dev->intf->dev, "Endpoint should not be be null!\n"); |
603 | goto unlock_exit; | 605 | goto unlock_exit; |
604 | } | 606 | } |
605 | 607 | ||
@@ -619,7 +621,8 @@ static ssize_t usb_alphatrack_write(struct file *file, | |||
619 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | 621 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); |
620 | if (retval) { | 622 | if (retval) { |
621 | dev->interrupt_out_busy = 0; | 623 | dev->interrupt_out_busy = 0; |
622 | err("Couldn't submit interrupt_out_urb %d\n", retval); | 624 | dev_err(&dev->intf->dev, |
625 | "Couldn't submit interrupt_out_urb %d\n", retval); | ||
623 | atomic_dec(&dev->writes_pending); | 626 | atomic_dec(&dev->writes_pending); |
624 | goto unlock_exit; | 627 | goto unlock_exit; |
625 | } | 628 | } |
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 29e99bbcae48..376706f1c712 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c | |||
@@ -353,7 +353,7 @@ static int usb_tranzport_open(struct inode *inode, struct file *file) | |||
353 | interface = usb_find_interface(&usb_tranzport_driver, subminor); | 353 | interface = usb_find_interface(&usb_tranzport_driver, subminor); |
354 | 354 | ||
355 | if (!interface) { | 355 | if (!interface) { |
356 | err("%s - error, can't find device for minor %d\n", | 356 | printk(KERN_ERR "%s - error, can't find device for minor %d\n", |
357 | __func__, subminor); | 357 | __func__, subminor); |
358 | retval = -ENODEV; | 358 | retval = -ENODEV; |
359 | goto unlock_disconnect_exit; | 359 | goto unlock_disconnect_exit; |
@@ -517,9 +517,11 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, | |||
517 | goto exit; | 517 | goto exit; |
518 | } | 518 | } |
519 | 519 | ||
520 | /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { | 520 | /* verify that the device wasn't unplugged */ |
521 | if (dev->intf == NULL) { | ||
521 | retval = -ENODEV; | 522 | retval = -ENODEV; |
522 | err("No device or device unplugged %d\n", retval); | 523 | printk(KERN_ERR "%s: No device or device unplugged %d\n", |
524 | __func__, retval); | ||
523 | goto unlock_exit; | 525 | goto unlock_exit; |
524 | } | 526 | } |
525 | 527 | ||
@@ -691,7 +693,8 @@ static ssize_t usb_tranzport_write(struct file *file, | |||
691 | /* verify that the device wasn't unplugged */ | 693 | /* verify that the device wasn't unplugged */ |
692 | if (dev->intf == NULL) { | 694 | if (dev->intf == NULL) { |
693 | retval = -ENODEV; | 695 | retval = -ENODEV; |
694 | err("No device or device unplugged %d\n", retval); | 696 | printk(KERN_ERR "%s: No device or device unplugged %d\n", |
697 | __func__, retval); | ||
695 | goto unlock_exit; | 698 | goto unlock_exit; |
696 | } | 699 | } |
697 | 700 | ||
@@ -726,7 +729,7 @@ static ssize_t usb_tranzport_write(struct file *file, | |||
726 | } | 729 | } |
727 | 730 | ||
728 | if (dev->interrupt_out_endpoint == NULL) { | 731 | if (dev->interrupt_out_endpoint == NULL) { |
729 | err("Endpoint should not be be null!\n"); | 732 | dev_err(&dev->intf->dev, "Endpoint should not be be null!\n"); |
730 | goto unlock_exit; | 733 | goto unlock_exit; |
731 | } | 734 | } |
732 | 735 | ||
@@ -746,7 +749,8 @@ static ssize_t usb_tranzport_write(struct file *file, | |||
746 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | 749 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); |
747 | if (retval) { | 750 | if (retval) { |
748 | dev->interrupt_out_busy = 0; | 751 | dev->interrupt_out_busy = 0; |
749 | err("Couldn't submit interrupt_out_urb %d\n", retval); | 752 | dev_err(&dev->intf->dev, |
753 | "Couldn't submit interrupt_out_urb %d\n", retval); | ||
750 | goto unlock_exit; | 754 | goto unlock_exit; |
751 | } | 755 | } |
752 | retval = bytes_to_write; | 756 | retval = bytes_to_write; |
diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index e8023afd3656..2e602e192b07 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c | |||
@@ -1307,7 +1307,8 @@ static int __init line6_init(void) | |||
1307 | retval = usb_register(&line6_driver); | 1307 | retval = usb_register(&line6_driver); |
1308 | 1308 | ||
1309 | if (retval) { | 1309 | if (retval) { |
1310 | err("usb_register failed. Error number %d", retval); | 1310 | printk(KERN_ERR KBUILD_MODNAME |
1311 | ": usb_register failed. Error number %d\n", retval); | ||
1311 | return retval; | 1312 | return retval; |
1312 | } | 1313 | } |
1313 | 1314 | ||
@@ -1315,7 +1316,7 @@ static int __init line6_init(void) | |||
1315 | GFP_KERNEL); | 1316 | GFP_KERNEL); |
1316 | 1317 | ||
1317 | if (line6_request_version == NULL) { | 1318 | if (line6_request_version == NULL) { |
1318 | err("Out of memory"); | 1319 | printk(KERN_ERR KBUILD_MODNAME ":Out of memory\n"); |
1319 | return -ENOMEM; | 1320 | return -ENOMEM; |
1320 | } | 1321 | } |
1321 | 1322 | ||
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index b754f69a29c4..31b624b63425 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c | |||
@@ -168,7 +168,7 @@ static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) | |||
168 | cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); | 168 | cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); |
169 | 169 | ||
170 | if (ret < 0) { | 170 | if (ret < 0) { |
171 | err("send failed (error %d)\n", ret); | 171 | dev_err(&usbdev->dev, "send failed (error %d)\n", ret); |
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
174 | 174 | ||
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 01ea5d7421d4..d7e422dc0ef7 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -1357,10 +1357,8 @@ static int uea_stat_e1(struct uea_softc *sc) | |||
1357 | /* release the dsp firmware as it is not needed until | 1357 | /* release the dsp firmware as it is not needed until |
1358 | * the next failure | 1358 | * the next failure |
1359 | */ | 1359 | */ |
1360 | if (sc->dsp_firm) { | 1360 | release_firmware(sc->dsp_firm); |
1361 | release_firmware(sc->dsp_firm); | 1361 | sc->dsp_firm = NULL; |
1362 | sc->dsp_firm = NULL; | ||
1363 | } | ||
1364 | } | 1362 | } |
1365 | 1363 | ||
1366 | /* always update it as atm layer could not be init when we switch to | 1364 | /* always update it as atm layer could not be init when we switch to |
@@ -1496,10 +1494,8 @@ static int uea_stat_e4(struct uea_softc *sc) | |||
1496 | /* release the dsp firmware as it is not needed until | 1494 | /* release the dsp firmware as it is not needed until |
1497 | * the next failure | 1495 | * the next failure |
1498 | */ | 1496 | */ |
1499 | if (sc->dsp_firm) { | 1497 | release_firmware(sc->dsp_firm); |
1500 | release_firmware(sc->dsp_firm); | 1498 | sc->dsp_firm = NULL; |
1501 | sc->dsp_firm = NULL; | ||
1502 | } | ||
1503 | } | 1499 | } |
1504 | 1500 | ||
1505 | /* always update it as atm layer could not be init when we switch to | 1501 | /* always update it as atm layer could not be init when we switch to |
@@ -2240,8 +2236,7 @@ static void uea_stop(struct uea_softc *sc) | |||
2240 | /* flush the work item, when no one can schedule it */ | 2236 | /* flush the work item, when no one can schedule it */ |
2241 | flush_work_sync(&sc->task); | 2237 | flush_work_sync(&sc->task); |
2242 | 2238 | ||
2243 | if (sc->dsp_firm) | 2239 | release_firmware(sc->dsp_firm); |
2244 | release_firmware(sc->dsp_firm); | ||
2245 | uea_leaves(INS_TO_USBDEV(sc)); | 2240 | uea_leaves(INS_TO_USBDEV(sc)); |
2246 | } | 2241 | } |
2247 | 2242 | ||
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c index b2113420b806..3b3932c55361 100644 --- a/drivers/usb/gadget/f_hid.c +++ b/drivers/usb/gadget/f_hid.c | |||
@@ -374,7 +374,7 @@ static int hidg_setup(struct usb_function *f, | |||
374 | break; | 374 | break; |
375 | 375 | ||
376 | default: | 376 | default: |
377 | VDBG(cdev, "Unknown decriptor request 0x%x\n", | 377 | VDBG(cdev, "Unknown descriptor request 0x%x\n", |
378 | value >> 8); | 378 | value >> 8); |
379 | goto stall; | 379 | goto stall; |
380 | break; | 380 | break; |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 55abfb6bd612..0d9b2fa45af3 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004-2007,2011 Freescale Semiconductor, Inc. | 2 | * Copyright (C) 2004-2007,2011-2012 Freescale Semiconductor, Inc. |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * Author: Li Yang <leoli@freescale.com> | 5 | * Author: Li Yang <leoli@freescale.com> |
@@ -58,9 +58,8 @@ static const char driver_name[] = "fsl-usb2-udc"; | |||
58 | static const char driver_desc[] = DRIVER_DESC; | 58 | static const char driver_desc[] = DRIVER_DESC; |
59 | 59 | ||
60 | static struct usb_dr_device *dr_regs; | 60 | static struct usb_dr_device *dr_regs; |
61 | #ifndef CONFIG_ARCH_MXC | 61 | |
62 | static struct usb_sys_interface *usb_sys_regs; | 62 | static struct usb_sys_interface *usb_sys_regs; |
63 | #endif | ||
64 | 63 | ||
65 | /* it is initialized in probe() */ | 64 | /* it is initialized in probe() */ |
66 | static struct fsl_udc *udc_controller = NULL; | 65 | static struct fsl_udc *udc_controller = NULL; |
@@ -244,10 +243,9 @@ static int dr_controller_setup(struct fsl_udc *udc) | |||
244 | { | 243 | { |
245 | unsigned int tmp, portctrl, ep_num; | 244 | unsigned int tmp, portctrl, ep_num; |
246 | unsigned int max_no_of_ep; | 245 | unsigned int max_no_of_ep; |
247 | #ifndef CONFIG_ARCH_MXC | ||
248 | unsigned int ctrl; | 246 | unsigned int ctrl; |
249 | #endif | ||
250 | unsigned long timeout; | 247 | unsigned long timeout; |
248 | |||
251 | #define FSL_UDC_RESET_TIMEOUT 1000 | 249 | #define FSL_UDC_RESET_TIMEOUT 1000 |
252 | 250 | ||
253 | /* Config PHY interface */ | 251 | /* Config PHY interface */ |
@@ -255,12 +253,32 @@ static int dr_controller_setup(struct fsl_udc *udc) | |||
255 | portctrl &= ~(PORTSCX_PHY_TYPE_SEL | PORTSCX_PORT_WIDTH); | 253 | portctrl &= ~(PORTSCX_PHY_TYPE_SEL | PORTSCX_PORT_WIDTH); |
256 | switch (udc->phy_mode) { | 254 | switch (udc->phy_mode) { |
257 | case FSL_USB2_PHY_ULPI: | 255 | case FSL_USB2_PHY_ULPI: |
256 | if (udc->pdata->have_sysif_regs) { | ||
257 | if (udc->pdata->controller_ver) { | ||
258 | /* controller version 1.6 or above */ | ||
259 | ctrl = __raw_readl(&usb_sys_regs->control); | ||
260 | ctrl &= ~USB_CTRL_UTMI_PHY_EN; | ||
261 | ctrl |= USB_CTRL_USB_EN; | ||
262 | __raw_writel(ctrl, &usb_sys_regs->control); | ||
263 | } | ||
264 | } | ||
258 | portctrl |= PORTSCX_PTS_ULPI; | 265 | portctrl |= PORTSCX_PTS_ULPI; |
259 | break; | 266 | break; |
260 | case FSL_USB2_PHY_UTMI_WIDE: | 267 | case FSL_USB2_PHY_UTMI_WIDE: |
261 | portctrl |= PORTSCX_PTW_16BIT; | 268 | portctrl |= PORTSCX_PTW_16BIT; |
262 | /* fall through */ | 269 | /* fall through */ |
263 | case FSL_USB2_PHY_UTMI: | 270 | case FSL_USB2_PHY_UTMI: |
271 | if (udc->pdata->have_sysif_regs) { | ||
272 | if (udc->pdata->controller_ver) { | ||
273 | /* controller version 1.6 or above */ | ||
274 | ctrl = __raw_readl(&usb_sys_regs->control); | ||
275 | ctrl |= (USB_CTRL_UTMI_PHY_EN | | ||
276 | USB_CTRL_USB_EN); | ||
277 | __raw_writel(ctrl, &usb_sys_regs->control); | ||
278 | mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI | ||
279 | PHY CLK to become stable - 10ms*/ | ||
280 | } | ||
281 | } | ||
264 | portctrl |= PORTSCX_PTS_UTMI; | 282 | portctrl |= PORTSCX_PTS_UTMI; |
265 | break; | 283 | break; |
266 | case FSL_USB2_PHY_SERIAL: | 284 | case FSL_USB2_PHY_SERIAL: |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index e651469fd39b..1212646841a3 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h | |||
@@ -1,4 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004,2012 Freescale Semiconductor, Inc | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
2 | * Freescale USB device/endpoint management registers | 10 | * Freescale USB device/endpoint management registers |
3 | */ | 11 | */ |
4 | #ifndef __FSL_USB2_UDC_H | 12 | #ifndef __FSL_USB2_UDC_H |
@@ -348,6 +356,9 @@ struct usb_sys_interface { | |||
348 | /* control Register Bit Masks */ | 356 | /* control Register Bit Masks */ |
349 | #define USB_CTRL_IOENB 0x00000004 | 357 | #define USB_CTRL_IOENB 0x00000004 |
350 | #define USB_CTRL_ULPI_INT0EN 0x00000001 | 358 | #define USB_CTRL_ULPI_INT0EN 0x00000001 |
359 | #define USB_CTRL_UTMI_PHY_EN 0x00000200 | ||
360 | #define USB_CTRL_USB_EN 0x00000004 | ||
361 | #define USB_CTRL_ULPI_PHY_CLK_SEL 0x00000400 | ||
351 | 362 | ||
352 | /* Endpoint Queue Head data struct | 363 | /* Endpoint Queue Head data struct |
353 | * Rem: all the variables of qh are LittleEndian Mode | 364 | * Rem: all the variables of qh are LittleEndian Mode |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f788eb86707c..896fc91c54ab 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -110,13 +110,14 @@ config USB_EHCI_BIG_ENDIAN_MMIO | |||
110 | depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ | 110 | depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ |
111 | ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ | 111 | ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ |
112 | PPC_MPC512x || CPU_CAVIUM_OCTEON || \ | 112 | PPC_MPC512x || CPU_CAVIUM_OCTEON || \ |
113 | PMC_MSP || SPARC_LEON) | 113 | PMC_MSP || SPARC_LEON || MIPS_SEAD3) |
114 | default y | 114 | default y |
115 | 115 | ||
116 | config USB_EHCI_BIG_ENDIAN_DESC | 116 | config USB_EHCI_BIG_ENDIAN_DESC |
117 | bool | 117 | bool |
118 | depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ | 118 | depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ |
119 | PPC_MPC512x || PMC_MSP || SPARC_LEON) | 119 | PPC_MPC512x || PMC_MSP || SPARC_LEON || \ |
120 | MIPS_SEAD3) | ||
120 | default y | 121 | default y |
121 | 122 | ||
122 | config XPS_USB_HCD_XILINX | 123 | config XPS_USB_HCD_XILINX |
@@ -373,10 +374,15 @@ config USB_OHCI_HCD_PCI | |||
373 | If unsure, say Y. | 374 | If unsure, say Y. |
374 | 375 | ||
375 | config USB_OHCI_HCD_SSB | 376 | config USB_OHCI_HCD_SSB |
376 | bool "OHCI support for Broadcom SSB OHCI core" | 377 | bool "OHCI support for Broadcom SSB OHCI core (DEPRECATED)" |
377 | depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL | 378 | depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL |
379 | select USB_HCD_SSB | ||
380 | select USB_OHCI_HCD_PLATFORM | ||
378 | default n | 381 | default n |
379 | ---help--- | 382 | ---help--- |
383 | This option is deprecated now and the driver was removed, use | ||
384 | USB_HCD_SSB and USB_OHCI_HCD_PLATFORM instead. | ||
385 | |||
380 | Support for the Sonics Silicon Backplane (SSB) attached | 386 | Support for the Sonics Silicon Backplane (SSB) attached |
381 | Broadcom USB OHCI core. | 387 | Broadcom USB OHCI core. |
382 | 388 | ||
@@ -638,3 +644,27 @@ config USB_OCTEON_OHCI | |||
638 | config USB_OCTEON2_COMMON | 644 | config USB_OCTEON2_COMMON |
639 | bool | 645 | bool |
640 | default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI | 646 | default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI |
647 | |||
648 | config USB_HCD_BCMA | ||
649 | tristate "BCMA usb host driver" | ||
650 | depends on BCMA && EXPERIMENTAL | ||
651 | select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD | ||
652 | select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD | ||
653 | help | ||
654 | Enbale support for the EHCI and OCHI host controller on an bcma bus. | ||
655 | It converts the bcma driver into two platform device drivers | ||
656 | for ehci and ohci. | ||
657 | |||
658 | If unsure, say N. | ||
659 | |||
660 | config USB_HCD_SSB | ||
661 | tristate "SSB usb host driver" | ||
662 | depends on SSB && EXPERIMENTAL | ||
663 | select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD | ||
664 | select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD | ||
665 | help | ||
666 | Enbale support for the EHCI and OCHI host controller on an bcma bus. | ||
667 | It converts the bcma driver into two platform device drivers | ||
668 | for ehci and ohci. | ||
669 | |||
670 | If unsure, say N. | ||
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 0982bcc140bd..9e0a89ced15c 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile | |||
@@ -41,3 +41,5 @@ obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o | |||
41 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o | 41 | obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o |
42 | obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o | 42 | obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o |
43 | obj-$(CONFIG_MIPS_ALCHEMY) += alchemy-common.o | 43 | obj-$(CONFIG_MIPS_ALCHEMY) += alchemy-common.o |
44 | obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o | ||
45 | obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o | ||
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c new file mode 100644 index 000000000000..0b35d422fa4e --- /dev/null +++ b/drivers/usb/host/bcma-hcd.c | |||
@@ -0,0 +1,334 @@ | |||
1 | /* | ||
2 | * Broadcom specific Advanced Microcontroller Bus | ||
3 | * Broadcom USB-core driver (BCMA bus glue) | ||
4 | * | ||
5 | * Copyright 2011-2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
6 | * | ||
7 | * Based on ssb-ohci driver | ||
8 | * Copyright 2007 Michael Buesch <m@bues.ch> | ||
9 | * | ||
10 | * Derived from the OHCI-PCI driver | ||
11 | * Copyright 1999 Roman Weissgaerber | ||
12 | * Copyright 2000-2002 David Brownell | ||
13 | * Copyright 1999 Linus Torvalds | ||
14 | * Copyright 1999 Gregory P. Smith | ||
15 | * | ||
16 | * Derived from the USBcore related parts of Broadcom-SB | ||
17 | * Copyright 2005-2011 Broadcom Corporation | ||
18 | * | ||
19 | * Licensed under the GNU/GPL. See COPYING for details. | ||
20 | */ | ||
21 | #include <linux/bcma/bcma.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/usb/ehci_pdriver.h> | ||
26 | #include <linux/usb/ohci_pdriver.h> | ||
27 | |||
28 | MODULE_AUTHOR("Hauke Mehrtens"); | ||
29 | MODULE_DESCRIPTION("Common USB driver for BCMA Bus"); | ||
30 | MODULE_LICENSE("GPL"); | ||
31 | |||
32 | struct bcma_hcd_device { | ||
33 | struct platform_device *ehci_dev; | ||
34 | struct platform_device *ohci_dev; | ||
35 | }; | ||
36 | |||
37 | /* Wait for bitmask in a register to get set or cleared. | ||
38 | * timeout is in units of ten-microseconds. | ||
39 | */ | ||
40 | static int bcma_wait_bits(struct bcma_device *dev, u16 reg, u32 bitmask, | ||
41 | int timeout) | ||
42 | { | ||
43 | int i; | ||
44 | u32 val; | ||
45 | |||
46 | for (i = 0; i < timeout; i++) { | ||
47 | val = bcma_read32(dev, reg); | ||
48 | if ((val & bitmask) == bitmask) | ||
49 | return 0; | ||
50 | udelay(10); | ||
51 | } | ||
52 | |||
53 | return -ETIMEDOUT; | ||
54 | } | ||
55 | |||
56 | static void __devinit bcma_hcd_4716wa(struct bcma_device *dev) | ||
57 | { | ||
58 | #ifdef CONFIG_BCMA_DRIVER_MIPS | ||
59 | /* Work around for 4716 failures. */ | ||
60 | if (dev->bus->chipinfo.id == 0x4716) { | ||
61 | u32 tmp; | ||
62 | |||
63 | tmp = bcma_cpu_clock(&dev->bus->drv_mips); | ||
64 | if (tmp >= 480000000) | ||
65 | tmp = 0x1846b; /* set CDR to 0x11(fast) */ | ||
66 | else if (tmp == 453000000) | ||
67 | tmp = 0x1046b; /* set CDR to 0x10(slow) */ | ||
68 | else | ||
69 | tmp = 0; | ||
70 | |||
71 | /* Change Shim mdio control reg to fix host not acking at | ||
72 | * high frequencies | ||
73 | */ | ||
74 | if (tmp) { | ||
75 | bcma_write32(dev, 0x524, 0x1); /* write sel to enable */ | ||
76 | udelay(500); | ||
77 | |||
78 | bcma_write32(dev, 0x524, tmp); | ||
79 | udelay(500); | ||
80 | bcma_write32(dev, 0x524, 0x4ab); | ||
81 | udelay(500); | ||
82 | bcma_read32(dev, 0x528); | ||
83 | bcma_write32(dev, 0x528, 0x80000000); | ||
84 | } | ||
85 | } | ||
86 | #endif /* CONFIG_BCMA_DRIVER_MIPS */ | ||
87 | } | ||
88 | |||
89 | /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */ | ||
90 | static void __devinit bcma_hcd_init_chip(struct bcma_device *dev) | ||
91 | { | ||
92 | u32 tmp; | ||
93 | |||
94 | /* | ||
95 | * USB 2.0 special considerations: | ||
96 | * | ||
97 | * 1. Since the core supports both OHCI and EHCI functions, it must | ||
98 | * only be reset once. | ||
99 | * | ||
100 | * 2. In addition to the standard SI reset sequence, the Host Control | ||
101 | * Register must be programmed to bring the USB core and various | ||
102 | * phy components out of reset. | ||
103 | */ | ||
104 | if (!bcma_core_is_enabled(dev)) { | ||
105 | bcma_core_enable(dev, 0); | ||
106 | mdelay(10); | ||
107 | if (dev->id.rev >= 5) { | ||
108 | /* Enable Misc PLL */ | ||
109 | tmp = bcma_read32(dev, 0x1e0); | ||
110 | tmp |= 0x100; | ||
111 | bcma_write32(dev, 0x1e0, tmp); | ||
112 | if (bcma_wait_bits(dev, 0x1e0, 1 << 24, 100)) | ||
113 | printk(KERN_EMERG "Failed to enable misc PPL!\n"); | ||
114 | |||
115 | /* Take out of resets */ | ||
116 | bcma_write32(dev, 0x200, 0x4ff); | ||
117 | udelay(25); | ||
118 | bcma_write32(dev, 0x200, 0x6ff); | ||
119 | udelay(25); | ||
120 | |||
121 | /* Make sure digital and AFE are locked in USB PHY */ | ||
122 | bcma_write32(dev, 0x524, 0x6b); | ||
123 | udelay(50); | ||
124 | tmp = bcma_read32(dev, 0x524); | ||
125 | udelay(50); | ||
126 | bcma_write32(dev, 0x524, 0xab); | ||
127 | udelay(50); | ||
128 | tmp = bcma_read32(dev, 0x524); | ||
129 | udelay(50); | ||
130 | bcma_write32(dev, 0x524, 0x2b); | ||
131 | udelay(50); | ||
132 | tmp = bcma_read32(dev, 0x524); | ||
133 | udelay(50); | ||
134 | bcma_write32(dev, 0x524, 0x10ab); | ||
135 | udelay(50); | ||
136 | tmp = bcma_read32(dev, 0x524); | ||
137 | |||
138 | if (bcma_wait_bits(dev, 0x528, 0xc000, 10000)) { | ||
139 | tmp = bcma_read32(dev, 0x528); | ||
140 | printk(KERN_EMERG | ||
141 | "USB20H mdio_rddata 0x%08x\n", tmp); | ||
142 | } | ||
143 | bcma_write32(dev, 0x528, 0x80000000); | ||
144 | tmp = bcma_read32(dev, 0x314); | ||
145 | udelay(265); | ||
146 | bcma_write32(dev, 0x200, 0x7ff); | ||
147 | udelay(10); | ||
148 | |||
149 | /* Take USB and HSIC out of non-driving modes */ | ||
150 | bcma_write32(dev, 0x510, 0); | ||
151 | } else { | ||
152 | bcma_write32(dev, 0x200, 0x7ff); | ||
153 | |||
154 | udelay(1); | ||
155 | } | ||
156 | |||
157 | bcma_hcd_4716wa(dev); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | static const struct usb_ehci_pdata ehci_pdata = { | ||
162 | }; | ||
163 | |||
164 | static const struct usb_ohci_pdata ohci_pdata = { | ||
165 | }; | ||
166 | |||
167 | static struct platform_device * __devinit | ||
168 | bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr) | ||
169 | { | ||
170 | struct platform_device *hci_dev; | ||
171 | struct resource hci_res[2]; | ||
172 | int ret = -ENOMEM; | ||
173 | |||
174 | memset(hci_res, 0, sizeof(hci_res)); | ||
175 | |||
176 | hci_res[0].start = addr; | ||
177 | hci_res[0].end = hci_res[0].start + 0x1000 - 1; | ||
178 | hci_res[0].flags = IORESOURCE_MEM; | ||
179 | |||
180 | hci_res[1].start = dev->irq; | ||
181 | hci_res[1].flags = IORESOURCE_IRQ; | ||
182 | |||
183 | hci_dev = platform_device_alloc(ohci ? "ohci-platform" : | ||
184 | "ehci-platform" , 0); | ||
185 | if (!hci_dev) | ||
186 | return NULL; | ||
187 | |||
188 | hci_dev->dev.parent = &dev->dev; | ||
189 | hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; | ||
190 | |||
191 | ret = platform_device_add_resources(hci_dev, hci_res, | ||
192 | ARRAY_SIZE(hci_res)); | ||
193 | if (ret) | ||
194 | goto err_alloc; | ||
195 | if (ohci) | ||
196 | ret = platform_device_add_data(hci_dev, &ohci_pdata, | ||
197 | sizeof(ohci_pdata)); | ||
198 | else | ||
199 | ret = platform_device_add_data(hci_dev, &ehci_pdata, | ||
200 | sizeof(ehci_pdata)); | ||
201 | if (ret) | ||
202 | goto err_alloc; | ||
203 | ret = platform_device_add(hci_dev); | ||
204 | if (ret) | ||
205 | goto err_alloc; | ||
206 | |||
207 | return hci_dev; | ||
208 | |||
209 | err_alloc: | ||
210 | platform_device_put(hci_dev); | ||
211 | return ERR_PTR(ret); | ||
212 | } | ||
213 | |||
214 | static int __devinit bcma_hcd_probe(struct bcma_device *dev) | ||
215 | { | ||
216 | int err; | ||
217 | u16 chipid_top; | ||
218 | u32 ohci_addr; | ||
219 | struct bcma_hcd_device *usb_dev; | ||
220 | struct bcma_chipinfo *chipinfo; | ||
221 | |||
222 | chipinfo = &dev->bus->chipinfo; | ||
223 | /* USBcores are only connected on embedded devices. */ | ||
224 | chipid_top = (chipinfo->id & 0xFF00); | ||
225 | if (chipid_top != 0x4700 && chipid_top != 0x5300) | ||
226 | return -ENODEV; | ||
227 | |||
228 | /* TODO: Probably need checks here; is the core connected? */ | ||
229 | |||
230 | if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || | ||
231 | dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32))) | ||
232 | return -EOPNOTSUPP; | ||
233 | |||
234 | usb_dev = kzalloc(sizeof(struct bcma_hcd_device), GFP_KERNEL); | ||
235 | if (!usb_dev) | ||
236 | return -ENOMEM; | ||
237 | |||
238 | bcma_hcd_init_chip(dev); | ||
239 | |||
240 | /* In AI chips EHCI is addrspace 0, OHCI is 1 */ | ||
241 | ohci_addr = dev->addr1; | ||
242 | if ((chipinfo->id == 0x5357 || chipinfo->id == 0x4749) | ||
243 | && chipinfo->rev == 0) | ||
244 | ohci_addr = 0x18009000; | ||
245 | |||
246 | usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr); | ||
247 | if (IS_ERR(usb_dev->ohci_dev)) { | ||
248 | err = PTR_ERR(usb_dev->ohci_dev); | ||
249 | goto err_free_usb_dev; | ||
250 | } | ||
251 | |||
252 | usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr); | ||
253 | if (IS_ERR(usb_dev->ehci_dev)) { | ||
254 | err = PTR_ERR(usb_dev->ehci_dev); | ||
255 | goto err_unregister_ohci_dev; | ||
256 | } | ||
257 | |||
258 | bcma_set_drvdata(dev, usb_dev); | ||
259 | return 0; | ||
260 | |||
261 | err_unregister_ohci_dev: | ||
262 | platform_device_unregister(usb_dev->ohci_dev); | ||
263 | err_free_usb_dev: | ||
264 | kfree(usb_dev); | ||
265 | return err; | ||
266 | } | ||
267 | |||
268 | static void __devexit bcma_hcd_remove(struct bcma_device *dev) | ||
269 | { | ||
270 | struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); | ||
271 | struct platform_device *ohci_dev = usb_dev->ohci_dev; | ||
272 | struct platform_device *ehci_dev = usb_dev->ehci_dev; | ||
273 | |||
274 | if (ohci_dev) | ||
275 | platform_device_unregister(ohci_dev); | ||
276 | if (ehci_dev) | ||
277 | platform_device_unregister(ehci_dev); | ||
278 | |||
279 | bcma_core_disable(dev, 0); | ||
280 | } | ||
281 | |||
282 | static void bcma_hcd_shutdown(struct bcma_device *dev) | ||
283 | { | ||
284 | bcma_core_disable(dev, 0); | ||
285 | } | ||
286 | |||
287 | #ifdef CONFIG_PM | ||
288 | |||
289 | static int bcma_hcd_suspend(struct bcma_device *dev) | ||
290 | { | ||
291 | bcma_core_disable(dev, 0); | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | static int bcma_hcd_resume(struct bcma_device *dev) | ||
297 | { | ||
298 | bcma_core_enable(dev, 0); | ||
299 | |||
300 | return 0; | ||
301 | } | ||
302 | |||
303 | #else /* !CONFIG_PM */ | ||
304 | #define bcma_hcd_suspend NULL | ||
305 | #define bcma_hcd_resume NULL | ||
306 | #endif /* CONFIG_PM */ | ||
307 | |||
308 | static const struct bcma_device_id bcma_hcd_table[] __devinitconst = { | ||
309 | BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS), | ||
310 | BCMA_CORETABLE_END | ||
311 | }; | ||
312 | MODULE_DEVICE_TABLE(bcma, bcma_hcd_table); | ||
313 | |||
314 | static struct bcma_driver bcma_hcd_driver = { | ||
315 | .name = KBUILD_MODNAME, | ||
316 | .id_table = bcma_hcd_table, | ||
317 | .probe = bcma_hcd_probe, | ||
318 | .remove = __devexit_p(bcma_hcd_remove), | ||
319 | .shutdown = bcma_hcd_shutdown, | ||
320 | .suspend = bcma_hcd_suspend, | ||
321 | .resume = bcma_hcd_resume, | ||
322 | }; | ||
323 | |||
324 | static int __init bcma_hcd_init(void) | ||
325 | { | ||
326 | return bcma_driver_register(&bcma_hcd_driver); | ||
327 | } | ||
328 | module_init(bcma_hcd_init); | ||
329 | |||
330 | static void __exit bcma_hcd_exit(void) | ||
331 | { | ||
332 | bcma_driver_unregister(&bcma_hcd_driver); | ||
333 | } | ||
334 | module_exit(bcma_hcd_exit); | ||
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index d0a84bd3f3eb..34acfcee7405 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2005-2009 MontaVista Software, Inc. | 2 | * Copyright 2005-2009 MontaVista Software, Inc. |
3 | * Copyright 2008 Freescale Semiconductor, Inc. | 3 | * Copyright 2008,2012 Freescale Semiconductor, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License as published by the | 6 | * under the terms of the GNU General Public License as published by the |
@@ -211,22 +211,32 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd, | |||
211 | usb_put_hcd(hcd); | 211 | usb_put_hcd(hcd); |
212 | } | 212 | } |
213 | 213 | ||
214 | static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | 214 | static void ehci_fsl_setup_phy(struct usb_hcd *hcd, |
215 | enum fsl_usb2_phy_modes phy_mode, | 215 | enum fsl_usb2_phy_modes phy_mode, |
216 | unsigned int port_offset) | 216 | unsigned int port_offset) |
217 | { | 217 | { |
218 | u32 portsc; | 218 | u32 portsc, temp; |
219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | 219 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
220 | void __iomem *non_ehci = hcd->regs; | 220 | void __iomem *non_ehci = hcd->regs; |
221 | struct fsl_usb2_platform_data *pdata; | 221 | struct device *dev = hcd->self.controller; |
222 | struct fsl_usb2_platform_data *pdata = dev->platform_data; | ||
222 | 223 | ||
223 | pdata = hcd->self.controller->platform_data; | 224 | if (pdata->controller_ver < 0) { |
225 | dev_warn(hcd->self.controller, "Could not get controller version\n"); | ||
226 | return; | ||
227 | } | ||
224 | 228 | ||
225 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 229 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
226 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); | 230 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
227 | 231 | ||
228 | switch (phy_mode) { | 232 | switch (phy_mode) { |
229 | case FSL_USB2_PHY_ULPI: | 233 | case FSL_USB2_PHY_ULPI: |
234 | if (pdata->controller_ver) { | ||
235 | /* controller version 1.6 or above */ | ||
236 | temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); | ||
237 | out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | | ||
238 | USB_CTRL_USB_EN | ULPI_PHY_CLK_SEL); | ||
239 | } | ||
230 | portsc |= PORT_PTS_ULPI; | 240 | portsc |= PORT_PTS_ULPI; |
231 | break; | 241 | break; |
232 | case FSL_USB2_PHY_SERIAL: | 242 | case FSL_USB2_PHY_SERIAL: |
@@ -236,6 +246,14 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
236 | portsc |= PORT_PTS_PTW; | 246 | portsc |= PORT_PTS_PTW; |
237 | /* fall through */ | 247 | /* fall through */ |
238 | case FSL_USB2_PHY_UTMI: | 248 | case FSL_USB2_PHY_UTMI: |
249 | if (pdata->controller_ver) { | ||
250 | /* controller version 1.6 or above */ | ||
251 | temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); | ||
252 | out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | | ||
253 | UTMI_PHY_EN | USB_CTRL_USB_EN); | ||
254 | mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to | ||
255 | become stable - 10ms*/ | ||
256 | } | ||
239 | /* enable UTMI PHY */ | 257 | /* enable UTMI PHY */ |
240 | if (pdata->have_sysif_regs) | 258 | if (pdata->have_sysif_regs) |
241 | setbits32(non_ehci + FSL_SOC_USB_CTRL, | 259 | setbits32(non_ehci + FSL_SOC_USB_CTRL, |
@@ -276,7 +294,7 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci) | |||
276 | 294 | ||
277 | if ((pdata->operating_mode == FSL_USB2_DR_HOST) || | 295 | if ((pdata->operating_mode == FSL_USB2_DR_HOST) || |
278 | (pdata->operating_mode == FSL_USB2_DR_OTG)) | 296 | (pdata->operating_mode == FSL_USB2_DR_OTG)) |
279 | ehci_fsl_setup_phy(ehci, pdata->phy_mode, 0); | 297 | ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0); |
280 | 298 | ||
281 | if (pdata->operating_mode == FSL_USB2_MPH_HOST) { | 299 | if (pdata->operating_mode == FSL_USB2_MPH_HOST) { |
282 | unsigned int chip, rev, svr; | 300 | unsigned int chip, rev, svr; |
@@ -290,9 +308,9 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci) | |||
290 | ehci->has_fsl_port_bug = 1; | 308 | ehci->has_fsl_port_bug = 1; |
291 | 309 | ||
292 | if (pdata->port_enables & FSL_USB2_PORT0_ENABLED) | 310 | if (pdata->port_enables & FSL_USB2_PORT0_ENABLED) |
293 | ehci_fsl_setup_phy(ehci, pdata->phy_mode, 0); | 311 | ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0); |
294 | if (pdata->port_enables & FSL_USB2_PORT1_ENABLED) | 312 | if (pdata->port_enables & FSL_USB2_PORT1_ENABLED) |
295 | ehci_fsl_setup_phy(ehci, pdata->phy_mode, 1); | 313 | ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1); |
296 | } | 314 | } |
297 | 315 | ||
298 | if (pdata->have_sysif_regs) { | 316 | if (pdata->have_sysif_regs) { |
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index 863fb0c080d7..88403684d10b 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2005-2010 Freescale Semiconductor, Inc. | 1 | /* Copyright (C) 2005-2010,2012 Freescale Semiconductor, Inc. |
2 | * Copyright (c) 2005 MontaVista Software | 2 | * Copyright (c) 2005 MontaVista Software |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
@@ -50,4 +50,15 @@ | |||
50 | #define CTRL_UTMI_PHY_EN (1<<9) | 50 | #define CTRL_UTMI_PHY_EN (1<<9) |
51 | #define CTRL_PHY_CLK_VALID (1 << 17) | 51 | #define CTRL_PHY_CLK_VALID (1 << 17) |
52 | #define SNOOP_SIZE_2GB 0x1e | 52 | #define SNOOP_SIZE_2GB 0x1e |
53 | |||
54 | /* control Register Bit Masks */ | ||
55 | #define ULPI_INT_EN (1<<0) | ||
56 | #define WU_INT_EN (1<<1) | ||
57 | #define USB_CTRL_USB_EN (1<<2) | ||
58 | #define LINE_STATE_FILTER__EN (1<<3) | ||
59 | #define KEEP_OTG_ON (1<<4) | ||
60 | #define OTG_PORT (1<<5) | ||
61 | #define PLL_RESET (1<<8) | ||
62 | #define UTMI_PHY_EN (1<<9) | ||
63 | #define ULPI_PHY_CLK_SEL (1<<10) | ||
53 | #endif /* _EHCI_FSL_H */ | 64 | #endif /* _EHCI_FSL_H */ |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 4a3bc5b7a06f..a87c0573c860 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -417,9 +417,6 @@ static void ehci_iaa_watchdog(unsigned long param) | |||
417 | * CMD_IAAD when it sets STS_IAA.) | 417 | * CMD_IAAD when it sets STS_IAA.) |
418 | */ | 418 | */ |
419 | cmd = ehci_readl(ehci, &ehci->regs->command); | 419 | cmd = ehci_readl(ehci, &ehci->regs->command); |
420 | if (cmd & CMD_IAAD) | ||
421 | ehci_writel(ehci, cmd & ~CMD_IAAD, | ||
422 | &ehci->regs->command); | ||
423 | 420 | ||
424 | /* If IAA is set here it either legitimately triggered | 421 | /* If IAA is set here it either legitimately triggered |
425 | * before we cleared IAAD above (but _way_ late, so we'll | 422 | * before we cleared IAAD above (but _way_ late, so we'll |
@@ -894,11 +891,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
894 | /* complete the unlinking of some qh [4.15.2.3] */ | 891 | /* complete the unlinking of some qh [4.15.2.3] */ |
895 | if (status & STS_IAA) { | 892 | if (status & STS_IAA) { |
896 | /* guard against (alleged) silicon errata */ | 893 | /* guard against (alleged) silicon errata */ |
897 | if (cmd & CMD_IAAD) { | 894 | if (cmd & CMD_IAAD) |
898 | ehci_writel(ehci, cmd & ~CMD_IAAD, | ||
899 | &ehci->regs->command); | ||
900 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); | 895 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); |
901 | } | ||
902 | if (ehci->reclaim) { | 896 | if (ehci->reclaim) { |
903 | COUNT(ehci->stats.reclaim); | 897 | COUNT(ehci->stats.reclaim); |
904 | end_unlink_async(ehci); | 898 | end_unlink_async(ehci); |
@@ -1378,6 +1372,11 @@ MODULE_LICENSE ("GPL"); | |||
1378 | #define PLATFORM_DRIVER ehci_ls1x_driver | 1372 | #define PLATFORM_DRIVER ehci_ls1x_driver |
1379 | #endif | 1373 | #endif |
1380 | 1374 | ||
1375 | #ifdef CONFIG_MIPS_SEAD3 | ||
1376 | #include "ehci-sead3.c" | ||
1377 | #define PLATFORM_DRIVER ehci_hcd_sead3_driver | ||
1378 | #endif | ||
1379 | |||
1381 | #ifdef CONFIG_USB_EHCI_HCD_PLATFORM | 1380 | #ifdef CONFIG_USB_EHCI_HCD_PLATFORM |
1382 | #include "ehci-platform.c" | 1381 | #include "ehci-platform.c" |
1383 | #define PLATFORM_DRIVER ehci_platform_driver | 1382 | #define PLATFORM_DRIVER ehci_platform_driver |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 38fe07623152..402e766df2fe 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -531,7 +531,8 @@ static int check_reset_complete ( | |||
531 | if (ehci->has_amcc_usb23) | 531 | if (ehci->has_amcc_usb23) |
532 | set_ohci_hcfs(ehci, 1); | 532 | set_ohci_hcfs(ehci, 1); |
533 | } else { | 533 | } else { |
534 | ehci_dbg (ehci, "port %d high speed\n", index + 1); | 534 | ehci_dbg(ehci, "port %d reset complete, port enabled\n", |
535 | index + 1); | ||
535 | /* ensure 440EPx ohci controller state is suspended */ | 536 | /* ensure 440EPx ohci controller state is suspended */ |
536 | if (ehci->has_amcc_usb23) | 537 | if (ehci->has_amcc_usb23) |
537 | set_ohci_hcfs(ehci, 0); | 538 | set_ohci_hcfs(ehci, 0); |
@@ -699,6 +700,7 @@ static int ehci_hub_control ( | |||
699 | goto error; | 700 | goto error; |
700 | wIndex--; | 701 | wIndex--; |
701 | temp = ehci_readl(ehci, status_reg); | 702 | temp = ehci_readl(ehci, status_reg); |
703 | temp &= ~PORT_RWC_BITS; | ||
702 | 704 | ||
703 | /* | 705 | /* |
704 | * Even if OWNER is set, so the port is owned by the | 706 | * Even if OWNER is set, so the port is owned by the |
@@ -712,8 +714,7 @@ static int ehci_hub_control ( | |||
712 | ehci_writel(ehci, temp & ~PORT_PE, status_reg); | 714 | ehci_writel(ehci, temp & ~PORT_PE, status_reg); |
713 | break; | 715 | break; |
714 | case USB_PORT_FEAT_C_ENABLE: | 716 | case USB_PORT_FEAT_C_ENABLE: |
715 | ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_PEC, | 717 | ehci_writel(ehci, temp | PORT_PEC, status_reg); |
716 | status_reg); | ||
717 | break; | 718 | break; |
718 | case USB_PORT_FEAT_SUSPEND: | 719 | case USB_PORT_FEAT_SUSPEND: |
719 | if (temp & PORT_RESET) | 720 | if (temp & PORT_RESET) |
@@ -742,7 +743,7 @@ static int ehci_hub_control ( | |||
742 | spin_lock_irqsave(&ehci->lock, flags); | 743 | spin_lock_irqsave(&ehci->lock, flags); |
743 | } | 744 | } |
744 | /* resume signaling for 20 msec */ | 745 | /* resume signaling for 20 msec */ |
745 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); | 746 | temp &= ~PORT_WAKE_BITS; |
746 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); | 747 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); |
747 | ehci->reset_done[wIndex] = jiffies | 748 | ehci->reset_done[wIndex] = jiffies |
748 | + msecs_to_jiffies(20); | 749 | + msecs_to_jiffies(20); |
@@ -752,9 +753,8 @@ static int ehci_hub_control ( | |||
752 | break; | 753 | break; |
753 | case USB_PORT_FEAT_POWER: | 754 | case USB_PORT_FEAT_POWER: |
754 | if (HCS_PPC (ehci->hcs_params)) | 755 | if (HCS_PPC (ehci->hcs_params)) |
755 | ehci_writel(ehci, | 756 | ehci_writel(ehci, temp & ~PORT_POWER, |
756 | temp & ~(PORT_RWC_BITS | PORT_POWER), | 757 | status_reg); |
757 | status_reg); | ||
758 | break; | 758 | break; |
759 | case USB_PORT_FEAT_C_CONNECTION: | 759 | case USB_PORT_FEAT_C_CONNECTION: |
760 | if (ehci->has_lpm) { | 760 | if (ehci->has_lpm) { |
@@ -762,12 +762,10 @@ static int ehci_hub_control ( | |||
762 | temp &= ~PORT_LPM; | 762 | temp &= ~PORT_LPM; |
763 | temp &= ~PORT_DEV_ADDR; | 763 | temp &= ~PORT_DEV_ADDR; |
764 | } | 764 | } |
765 | ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_CSC, | 765 | ehci_writel(ehci, temp | PORT_CSC, status_reg); |
766 | status_reg); | ||
767 | break; | 766 | break; |
768 | case USB_PORT_FEAT_C_OVER_CURRENT: | 767 | case USB_PORT_FEAT_C_OVER_CURRENT: |
769 | ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_OCC, | 768 | ehci_writel(ehci, temp | PORT_OCC, status_reg); |
770 | status_reg); | ||
771 | break; | 769 | break; |
772 | case USB_PORT_FEAT_C_RESET: | 770 | case USB_PORT_FEAT_C_RESET: |
773 | /* GetPortStatus clears reset */ | 771 | /* GetPortStatus clears reset */ |
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index d238b4e24bb6..23c530ae5aa3 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -94,12 +94,12 @@ static int __devinit ehci_platform_probe(struct platform_device *dev) | |||
94 | 94 | ||
95 | irq = platform_get_irq(dev, 0); | 95 | irq = platform_get_irq(dev, 0); |
96 | if (irq < 0) { | 96 | if (irq < 0) { |
97 | pr_err("no irq provieded"); | 97 | pr_err("no irq provided"); |
98 | return irq; | 98 | return irq; |
99 | } | 99 | } |
100 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); | 100 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
101 | if (!res_mem) { | 101 | if (!res_mem) { |
102 | pr_err("no memory recourse provieded"); | 102 | pr_err("no memory recourse provided"); |
103 | return -ENXIO; | 103 | return -ENXIO; |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index f098e2a291a0..c474cec064e4 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
@@ -232,6 +232,8 @@ static int s5p_ehci_suspend(struct device *dev) | |||
232 | if (pdata && pdata->phy_exit) | 232 | if (pdata && pdata->phy_exit) |
233 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); | 233 | pdata->phy_exit(pdev, S5P_USB_PHY_HOST); |
234 | 234 | ||
235 | clk_disable(s5p_ehci->clk); | ||
236 | |||
235 | return rc; | 237 | return rc; |
236 | } | 238 | } |
237 | 239 | ||
@@ -243,6 +245,8 @@ static int s5p_ehci_resume(struct device *dev) | |||
243 | struct platform_device *pdev = to_platform_device(dev); | 245 | struct platform_device *pdev = to_platform_device(dev); |
244 | struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; | 246 | struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; |
245 | 247 | ||
248 | clk_enable(s5p_ehci->clk); | ||
249 | |||
246 | if (pdata && pdata->phy_init) | 250 | if (pdata && pdata->phy_init) |
247 | pdata->phy_init(pdev, S5P_USB_PHY_HOST); | 251 | pdata->phy_init(pdev, S5P_USB_PHY_HOST); |
248 | 252 | ||
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c new file mode 100644 index 000000000000..4c164308ed20 --- /dev/null +++ b/drivers/usb/host/ehci-sead3.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * MIPS CI13320A EHCI Host Controller driver | ||
3 | * Based on "ehci-au1xxx.c" by K.Boge <karsten.boge@amd.com> | ||
4 | * | ||
5 | * Copyright (C) 2012 MIPS Technologies, Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
15 | * for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software Foundation, | ||
19 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/platform_device.h> | ||
23 | |||
24 | static int ehci_sead3_setup(struct usb_hcd *hcd) | ||
25 | { | ||
26 | int ret; | ||
27 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
28 | |||
29 | ehci->caps = hcd->regs + 0x100; | ||
30 | |||
31 | ret = ehci_setup(hcd); | ||
32 | if (ret) | ||
33 | return ret; | ||
34 | |||
35 | ehci->need_io_watchdog = 0; | ||
36 | |||
37 | #ifdef __BIG_ENDIAN | ||
38 | ehci->big_endian_mmio = 1; | ||
39 | ehci->big_endian_desc = 1; | ||
40 | #endif | ||
41 | |||
42 | /* Set burst length to 16 words. */ | ||
43 | ehci_writel(ehci, 0x1010, &ehci->regs->reserved[1]); | ||
44 | |||
45 | return ret; | ||
46 | } | ||
47 | |||
48 | const struct hc_driver ehci_sead3_hc_driver = { | ||
49 | .description = hcd_name, | ||
50 | .product_desc = "SEAD-3 EHCI", | ||
51 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
52 | |||
53 | /* | ||
54 | * generic hardware linkage | ||
55 | */ | ||
56 | .irq = ehci_irq, | ||
57 | .flags = HCD_MEMORY | HCD_USB2, | ||
58 | |||
59 | /* | ||
60 | * basic lifecycle operations | ||
61 | * | ||
62 | */ | ||
63 | .reset = ehci_sead3_setup, | ||
64 | .start = ehci_run, | ||
65 | .stop = ehci_stop, | ||
66 | .shutdown = ehci_shutdown, | ||
67 | |||
68 | /* | ||
69 | * managing i/o requests and associated device resources | ||
70 | */ | ||
71 | .urb_enqueue = ehci_urb_enqueue, | ||
72 | .urb_dequeue = ehci_urb_dequeue, | ||
73 | .endpoint_disable = ehci_endpoint_disable, | ||
74 | .endpoint_reset = ehci_endpoint_reset, | ||
75 | |||
76 | /* | ||
77 | * scheduling support | ||
78 | */ | ||
79 | .get_frame_number = ehci_get_frame, | ||
80 | |||
81 | /* | ||
82 | * root hub support | ||
83 | */ | ||
84 | .hub_status_data = ehci_hub_status_data, | ||
85 | .hub_control = ehci_hub_control, | ||
86 | .bus_suspend = ehci_bus_suspend, | ||
87 | .bus_resume = ehci_bus_resume, | ||
88 | .relinquish_port = ehci_relinquish_port, | ||
89 | .port_handed_over = ehci_port_handed_over, | ||
90 | |||
91 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
92 | }; | ||
93 | |||
94 | static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) | ||
95 | { | ||
96 | struct usb_hcd *hcd; | ||
97 | struct resource *res; | ||
98 | int ret; | ||
99 | |||
100 | if (usb_disabled()) | ||
101 | return -ENODEV; | ||
102 | |||
103 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | ||
104 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | ||
105 | return -ENOMEM; | ||
106 | } | ||
107 | hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3"); | ||
108 | if (!hcd) | ||
109 | return -ENOMEM; | ||
110 | |||
111 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
112 | hcd->rsrc_start = res->start; | ||
113 | hcd->rsrc_len = resource_size(res); | ||
114 | |||
115 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
116 | pr_debug("request_mem_region failed"); | ||
117 | ret = -EBUSY; | ||
118 | goto err1; | ||
119 | } | ||
120 | |||
121 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
122 | if (!hcd->regs) { | ||
123 | pr_debug("ioremap failed"); | ||
124 | ret = -ENOMEM; | ||
125 | goto err2; | ||
126 | } | ||
127 | |||
128 | /* Root hub has integrated TT. */ | ||
129 | hcd->has_tt = 1; | ||
130 | |||
131 | ret = usb_add_hcd(hcd, pdev->resource[1].start, | ||
132 | IRQF_SHARED); | ||
133 | if (ret == 0) { | ||
134 | platform_set_drvdata(pdev, hcd); | ||
135 | return ret; | ||
136 | } | ||
137 | |||
138 | iounmap(hcd->regs); | ||
139 | err2: | ||
140 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
141 | err1: | ||
142 | usb_put_hcd(hcd); | ||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | static int ehci_hcd_sead3_drv_remove(struct platform_device *pdev) | ||
147 | { | ||
148 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
149 | |||
150 | usb_remove_hcd(hcd); | ||
151 | iounmap(hcd->regs); | ||
152 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
153 | usb_put_hcd(hcd); | ||
154 | platform_set_drvdata(pdev, NULL); | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | #ifdef CONFIG_PM | ||
160 | static int ehci_hcd_sead3_drv_suspend(struct device *dev) | ||
161 | { | ||
162 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
163 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
164 | unsigned long flags; | ||
165 | int rc = 0; | ||
166 | |||
167 | if (time_before(jiffies, ehci->next_statechange)) | ||
168 | msleep(20); | ||
169 | |||
170 | /* Root hub was already suspended. Disable irq emission and | ||
171 | * mark HW unaccessible. The PM and USB cores make sure that | ||
172 | * the root hub is either suspended or stopped. | ||
173 | */ | ||
174 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); | ||
175 | spin_lock_irqsave(&ehci->lock, flags); | ||
176 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | ||
177 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | ||
178 | |||
179 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
180 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
181 | |||
182 | /* could save FLADJ in case of Vaux power loss | ||
183 | * ... we'd only use it to handle clock skew | ||
184 | */ | ||
185 | |||
186 | return rc; | ||
187 | } | ||
188 | |||
189 | static int ehci_hcd_sead3_drv_resume(struct device *dev) | ||
190 | { | ||
191 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
192 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
193 | |||
194 | /* maybe restore FLADJ. */ | ||
195 | |||
196 | if (time_before(jiffies, ehci->next_statechange)) | ||
197 | msleep(100); | ||
198 | |||
199 | /* Mark hardware accessible again as we are out of D3 state by now */ | ||
200 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
201 | |||
202 | /* If CF is still set, we maintained PCI Vaux power. | ||
203 | * Just undo the effect of ehci_pci_suspend(). | ||
204 | */ | ||
205 | if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) { | ||
206 | int mask = INTR_MASK; | ||
207 | |||
208 | ehci_prepare_ports_for_controller_resume(ehci); | ||
209 | if (!hcd->self.root_hub->do_remote_wakeup) | ||
210 | mask &= ~STS_PCD; | ||
211 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); | ||
212 | ehci_readl(ehci, &ehci->regs->intr_enable); | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | ehci_dbg(ehci, "lost power, restarting\n"); | ||
217 | usb_root_hub_lost_power(hcd->self.root_hub); | ||
218 | |||
219 | /* Else reset, to cope with power loss or flush-to-storage | ||
220 | * style "resume" having let BIOS kick in during reboot. | ||
221 | */ | ||
222 | (void) ehci_halt(ehci); | ||
223 | (void) ehci_reset(ehci); | ||
224 | |||
225 | /* emptying the schedule aborts any urbs */ | ||
226 | spin_lock_irq(&ehci->lock); | ||
227 | if (ehci->reclaim) | ||
228 | end_unlink_async(ehci); | ||
229 | ehci_work(ehci); | ||
230 | spin_unlock_irq(&ehci->lock); | ||
231 | |||
232 | ehci_writel(ehci, ehci->command, &ehci->regs->command); | ||
233 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); | ||
234 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | ||
235 | |||
236 | /* here we "know" root ports should always stay powered */ | ||
237 | ehci_port_power(ehci, 1); | ||
238 | |||
239 | ehci->rh_state = EHCI_RH_SUSPENDED; | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static const struct dev_pm_ops sead3_ehci_pmops = { | ||
245 | .suspend = ehci_hcd_sead3_drv_suspend, | ||
246 | .resume = ehci_hcd_sead3_drv_resume, | ||
247 | }; | ||
248 | |||
249 | #define SEAD3_EHCI_PMOPS (&sead3_ehci_pmops) | ||
250 | |||
251 | #else | ||
252 | #define SEAD3_EHCI_PMOPS NULL | ||
253 | #endif | ||
254 | |||
255 | static struct platform_driver ehci_hcd_sead3_driver = { | ||
256 | .probe = ehci_hcd_sead3_drv_probe, | ||
257 | .remove = ehci_hcd_sead3_drv_remove, | ||
258 | .shutdown = usb_hcd_platform_shutdown, | ||
259 | .driver = { | ||
260 | .name = "sead3-ehci", | ||
261 | .owner = THIS_MODULE, | ||
262 | .pm = SEAD3_EHCI_PMOPS, | ||
263 | } | ||
264 | }; | ||
265 | |||
266 | MODULE_ALIAS("platform:sead3-ehci"); | ||
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 9d9cf47d80da..ca819cdd0c5e 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/platform_data/ehci-sh.h> | ||
14 | 15 | ||
15 | struct ehci_sh_priv { | 16 | struct ehci_sh_priv { |
16 | struct clk *iclk, *fclk; | 17 | struct clk *iclk, *fclk; |
@@ -100,6 +101,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
100 | const struct hc_driver *driver = &ehci_sh_hc_driver; | 101 | const struct hc_driver *driver = &ehci_sh_hc_driver; |
101 | struct resource *res; | 102 | struct resource *res; |
102 | struct ehci_sh_priv *priv; | 103 | struct ehci_sh_priv *priv; |
104 | struct ehci_sh_platdata *pdata; | ||
103 | struct usb_hcd *hcd; | 105 | struct usb_hcd *hcd; |
104 | int irq, ret; | 106 | int irq, ret; |
105 | 107 | ||
@@ -124,6 +126,9 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
124 | goto fail_create_hcd; | 126 | goto fail_create_hcd; |
125 | } | 127 | } |
126 | 128 | ||
129 | if (pdev->dev.platform_data != NULL) | ||
130 | pdata = pdev->dev.platform_data; | ||
131 | |||
127 | /* initialize hcd */ | 132 | /* initialize hcd */ |
128 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, | 133 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, |
129 | dev_name(&pdev->dev)); | 134 | dev_name(&pdev->dev)); |
@@ -168,6 +173,9 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
168 | clk_enable(priv->fclk); | 173 | clk_enable(priv->fclk); |
169 | clk_enable(priv->iclk); | 174 | clk_enable(priv->iclk); |
170 | 175 | ||
176 | if (pdata && pdata->phy_init) | ||
177 | pdata->phy_init(); | ||
178 | |||
171 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 179 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
172 | if (ret != 0) { | 180 | if (ret != 0) { |
173 | dev_err(&pdev->dev, "Failed to add hcd"); | 181 | dev_err(&pdev->dev, "Failed to add hcd"); |
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 6e928559169c..37ba8c8d2fd0 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/jiffies.h> | 15 | #include <linux/jiffies.h> |
16 | #include <linux/of.h> | ||
16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
17 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
18 | 19 | ||
@@ -25,12 +26,12 @@ struct spear_ehci { | |||
25 | 26 | ||
26 | static void spear_start_ehci(struct spear_ehci *ehci) | 27 | static void spear_start_ehci(struct spear_ehci *ehci) |
27 | { | 28 | { |
28 | clk_enable(ehci->clk); | 29 | clk_prepare_enable(ehci->clk); |
29 | } | 30 | } |
30 | 31 | ||
31 | static void spear_stop_ehci(struct spear_ehci *ehci) | 32 | static void spear_stop_ehci(struct spear_ehci *ehci) |
32 | { | 33 | { |
33 | clk_disable(ehci->clk); | 34 | clk_disable_unprepare(ehci->clk); |
34 | } | 35 | } |
35 | 36 | ||
36 | static int ehci_spear_setup(struct usb_hcd *hcd) | 37 | static int ehci_spear_setup(struct usb_hcd *hcd) |
@@ -168,6 +169,8 @@ static int ehci_spear_drv_resume(struct device *dev) | |||
168 | static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, | 169 | static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, |
169 | ehci_spear_drv_resume); | 170 | ehci_spear_drv_resume); |
170 | 171 | ||
172 | static u64 spear_ehci_dma_mask = DMA_BIT_MASK(32); | ||
173 | |||
171 | static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | 174 | static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) |
172 | { | 175 | { |
173 | struct usb_hcd *hcd ; | 176 | struct usb_hcd *hcd ; |
@@ -175,12 +178,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | |||
175 | struct resource *res; | 178 | struct resource *res; |
176 | struct clk *usbh_clk; | 179 | struct clk *usbh_clk; |
177 | const struct hc_driver *driver = &ehci_spear_hc_driver; | 180 | const struct hc_driver *driver = &ehci_spear_hc_driver; |
178 | int *pdata = pdev->dev.platform_data; | ||
179 | int irq, retval; | 181 | int irq, retval; |
180 | char clk_name[20] = "usbh_clk"; | 182 | char clk_name[20] = "usbh_clk"; |
181 | 183 | static int instance = -1; | |
182 | if (pdata == NULL) | ||
183 | return -EFAULT; | ||
184 | 184 | ||
185 | if (usb_disabled()) | 185 | if (usb_disabled()) |
186 | return -ENODEV; | 186 | return -ENODEV; |
@@ -191,8 +191,22 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | |||
191 | goto fail_irq_get; | 191 | goto fail_irq_get; |
192 | } | 192 | } |
193 | 193 | ||
194 | if (*pdata >= 0) | 194 | /* |
195 | sprintf(clk_name, "usbh.%01d_clk", *pdata); | 195 | * Right now device-tree probed devices don't get dma_mask set. |
196 | * Since shared usb code relies on it, set it here for now. | ||
197 | * Once we have dma capability bindings this can go away. | ||
198 | */ | ||
199 | if (!pdev->dev.dma_mask) | ||
200 | pdev->dev.dma_mask = &spear_ehci_dma_mask; | ||
201 | |||
202 | /* | ||
203 | * Increment the device instance, when probing via device-tree | ||
204 | */ | ||
205 | if (pdev->id < 0) | ||
206 | instance++; | ||
207 | else | ||
208 | instance = pdev->id; | ||
209 | sprintf(clk_name, "usbh.%01d_clk", instance); | ||
196 | 210 | ||
197 | usbh_clk = clk_get(NULL, clk_name); | 211 | usbh_clk = clk_get(NULL, clk_name); |
198 | if (IS_ERR(usbh_clk)) { | 212 | if (IS_ERR(usbh_clk)) { |
@@ -277,6 +291,11 @@ static int spear_ehci_hcd_drv_remove(struct platform_device *pdev) | |||
277 | return 0; | 291 | return 0; |
278 | } | 292 | } |
279 | 293 | ||
294 | static struct of_device_id spear_ehci_id_table[] __devinitdata = { | ||
295 | { .compatible = "st,spear600-ehci", }, | ||
296 | { }, | ||
297 | }; | ||
298 | |||
280 | static struct platform_driver spear_ehci_hcd_driver = { | 299 | static struct platform_driver spear_ehci_hcd_driver = { |
281 | .probe = spear_ehci_hcd_drv_probe, | 300 | .probe = spear_ehci_hcd_drv_probe, |
282 | .remove = spear_ehci_hcd_drv_remove, | 301 | .remove = spear_ehci_hcd_drv_remove, |
@@ -285,6 +304,7 @@ static struct platform_driver spear_ehci_hcd_driver = { | |||
285 | .name = "spear-ehci", | 304 | .name = "spear-ehci", |
286 | .bus = &platform_bus_type, | 305 | .bus = &platform_bus_type, |
287 | .pm = &ehci_spear_pm_ops, | 306 | .pm = &ehci_spear_pm_ops, |
307 | .of_match_table = of_match_ptr(spear_ehci_id_table), | ||
288 | } | 308 | } |
289 | }; | 309 | }; |
290 | 310 | ||
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 86183366647f..43bb0a9f1f73 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -148,18 +148,7 @@ static int tegra_ehci_hub_control( | |||
148 | 148 | ||
149 | spin_lock_irqsave(&ehci->lock, flags); | 149 | spin_lock_irqsave(&ehci->lock, flags); |
150 | 150 | ||
151 | /* | 151 | if (typeReq == GetPortStatus) { |
152 | * In ehci_hub_control() for USB_PORT_FEAT_ENABLE clears the other bits | ||
153 | * that are write on clear, by writing back the register read value, so | ||
154 | * USB_PORT_FEAT_ENABLE is handled by masking the set on clear bits | ||
155 | */ | ||
156 | if (typeReq == ClearPortFeature && wValue == USB_PORT_FEAT_ENABLE) { | ||
157 | temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS; | ||
158 | ehci_writel(ehci, temp & ~PORT_PE, status_reg); | ||
159 | goto done; | ||
160 | } | ||
161 | |||
162 | else if (typeReq == GetPortStatus) { | ||
163 | temp = ehci_readl(ehci, status_reg); | 152 | temp = ehci_readl(ehci, status_reg); |
164 | if (tegra->port_resuming && !(temp & PORT_SUSPEND)) { | 153 | if (tegra->port_resuming && !(temp & PORT_SUSPEND)) { |
165 | /* Resume completed, re-enable disconnect detection */ | 154 | /* Resume completed, re-enable disconnect detection */ |
@@ -464,26 +453,23 @@ static int tegra_ehci_bus_resume(struct usb_hcd *hcd) | |||
464 | } | 453 | } |
465 | #endif | 454 | #endif |
466 | 455 | ||
467 | struct temp_buffer { | 456 | struct dma_aligned_buffer { |
468 | void *kmalloc_ptr; | 457 | void *kmalloc_ptr; |
469 | void *old_xfer_buffer; | 458 | void *old_xfer_buffer; |
470 | u8 data[0]; | 459 | u8 data[0]; |
471 | }; | 460 | }; |
472 | 461 | ||
473 | static void free_temp_buffer(struct urb *urb) | 462 | static void free_dma_aligned_buffer(struct urb *urb) |
474 | { | 463 | { |
475 | enum dma_data_direction dir; | 464 | struct dma_aligned_buffer *temp; |
476 | struct temp_buffer *temp; | ||
477 | 465 | ||
478 | if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER)) | 466 | if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER)) |
479 | return; | 467 | return; |
480 | 468 | ||
481 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 469 | temp = container_of(urb->transfer_buffer, |
482 | 470 | struct dma_aligned_buffer, data); | |
483 | temp = container_of(urb->transfer_buffer, struct temp_buffer, | ||
484 | data); | ||
485 | 471 | ||
486 | if (dir == DMA_FROM_DEVICE) | 472 | if (usb_urb_dir_in(urb)) |
487 | memcpy(temp->old_xfer_buffer, temp->data, | 473 | memcpy(temp->old_xfer_buffer, temp->data, |
488 | urb->transfer_buffer_length); | 474 | urb->transfer_buffer_length); |
489 | urb->transfer_buffer = temp->old_xfer_buffer; | 475 | urb->transfer_buffer = temp->old_xfer_buffer; |
@@ -492,10 +478,9 @@ static void free_temp_buffer(struct urb *urb) | |||
492 | urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER; | 478 | urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER; |
493 | } | 479 | } |
494 | 480 | ||
495 | static int alloc_temp_buffer(struct urb *urb, gfp_t mem_flags) | 481 | static int alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags) |
496 | { | 482 | { |
497 | enum dma_data_direction dir; | 483 | struct dma_aligned_buffer *temp, *kmalloc_ptr; |
498 | struct temp_buffer *temp, *kmalloc_ptr; | ||
499 | size_t kmalloc_size; | 484 | size_t kmalloc_size; |
500 | 485 | ||
501 | if (urb->num_sgs || urb->sg || | 486 | if (urb->num_sgs || urb->sg || |
@@ -503,22 +488,19 @@ static int alloc_temp_buffer(struct urb *urb, gfp_t mem_flags) | |||
503 | !((uintptr_t)urb->transfer_buffer & (TEGRA_USB_DMA_ALIGN - 1))) | 488 | !((uintptr_t)urb->transfer_buffer & (TEGRA_USB_DMA_ALIGN - 1))) |
504 | return 0; | 489 | return 0; |
505 | 490 | ||
506 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
507 | |||
508 | /* Allocate a buffer with enough padding for alignment */ | 491 | /* Allocate a buffer with enough padding for alignment */ |
509 | kmalloc_size = urb->transfer_buffer_length + | 492 | kmalloc_size = urb->transfer_buffer_length + |
510 | sizeof(struct temp_buffer) + TEGRA_USB_DMA_ALIGN - 1; | 493 | sizeof(struct dma_aligned_buffer) + TEGRA_USB_DMA_ALIGN - 1; |
511 | 494 | ||
512 | kmalloc_ptr = kmalloc(kmalloc_size, mem_flags); | 495 | kmalloc_ptr = kmalloc(kmalloc_size, mem_flags); |
513 | if (!kmalloc_ptr) | 496 | if (!kmalloc_ptr) |
514 | return -ENOMEM; | 497 | return -ENOMEM; |
515 | 498 | ||
516 | /* Position our struct temp_buffer such that data is aligned */ | 499 | /* Position our struct dma_aligned_buffer such that data is aligned */ |
517 | temp = PTR_ALIGN(kmalloc_ptr + 1, TEGRA_USB_DMA_ALIGN) - 1; | 500 | temp = PTR_ALIGN(kmalloc_ptr + 1, TEGRA_USB_DMA_ALIGN) - 1; |
518 | |||
519 | temp->kmalloc_ptr = kmalloc_ptr; | 501 | temp->kmalloc_ptr = kmalloc_ptr; |
520 | temp->old_xfer_buffer = urb->transfer_buffer; | 502 | temp->old_xfer_buffer = urb->transfer_buffer; |
521 | if (dir == DMA_TO_DEVICE) | 503 | if (usb_urb_dir_out(urb)) |
522 | memcpy(temp->data, urb->transfer_buffer, | 504 | memcpy(temp->data, urb->transfer_buffer, |
523 | urb->transfer_buffer_length); | 505 | urb->transfer_buffer_length); |
524 | urb->transfer_buffer = temp->data; | 506 | urb->transfer_buffer = temp->data; |
@@ -533,13 +515,13 @@ static int tegra_ehci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | |||
533 | { | 515 | { |
534 | int ret; | 516 | int ret; |
535 | 517 | ||
536 | ret = alloc_temp_buffer(urb, mem_flags); | 518 | ret = alloc_dma_aligned_buffer(urb, mem_flags); |
537 | if (ret) | 519 | if (ret) |
538 | return ret; | 520 | return ret; |
539 | 521 | ||
540 | ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); | 522 | ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); |
541 | if (ret) | 523 | if (ret) |
542 | free_temp_buffer(urb); | 524 | free_dma_aligned_buffer(urb); |
543 | 525 | ||
544 | return ret; | 526 | return ret; |
545 | } | 527 | } |
@@ -547,38 +529,39 @@ static int tegra_ehci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | |||
547 | static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | 529 | static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) |
548 | { | 530 | { |
549 | usb_hcd_unmap_urb_for_dma(hcd, urb); | 531 | usb_hcd_unmap_urb_for_dma(hcd, urb); |
550 | free_temp_buffer(urb); | 532 | free_dma_aligned_buffer(urb); |
551 | } | 533 | } |
552 | 534 | ||
553 | static const struct hc_driver tegra_ehci_hc_driver = { | 535 | static const struct hc_driver tegra_ehci_hc_driver = { |
554 | .description = hcd_name, | 536 | .description = hcd_name, |
555 | .product_desc = "Tegra EHCI Host Controller", | 537 | .product_desc = "Tegra EHCI Host Controller", |
556 | .hcd_priv_size = sizeof(struct ehci_hcd), | 538 | .hcd_priv_size = sizeof(struct ehci_hcd), |
557 | |||
558 | .flags = HCD_USB2 | HCD_MEMORY, | 539 | .flags = HCD_USB2 | HCD_MEMORY, |
559 | 540 | ||
560 | .reset = tegra_ehci_setup, | 541 | /* standard ehci functions */ |
561 | .irq = ehci_irq, | 542 | .irq = ehci_irq, |
562 | |||
563 | .start = ehci_run, | 543 | .start = ehci_run, |
564 | .stop = ehci_stop, | 544 | .stop = ehci_stop, |
565 | .shutdown = tegra_ehci_shutdown, | ||
566 | .urb_enqueue = ehci_urb_enqueue, | 545 | .urb_enqueue = ehci_urb_enqueue, |
567 | .urb_dequeue = ehci_urb_dequeue, | 546 | .urb_dequeue = ehci_urb_dequeue, |
568 | .map_urb_for_dma = tegra_ehci_map_urb_for_dma, | ||
569 | .unmap_urb_for_dma = tegra_ehci_unmap_urb_for_dma, | ||
570 | .endpoint_disable = ehci_endpoint_disable, | 547 | .endpoint_disable = ehci_endpoint_disable, |
571 | .endpoint_reset = ehci_endpoint_reset, | 548 | .endpoint_reset = ehci_endpoint_reset, |
572 | .get_frame_number = ehci_get_frame, | 549 | .get_frame_number = ehci_get_frame, |
573 | .hub_status_data = ehci_hub_status_data, | 550 | .hub_status_data = ehci_hub_status_data, |
574 | .hub_control = tegra_ehci_hub_control, | ||
575 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 551 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
552 | .relinquish_port = ehci_relinquish_port, | ||
553 | .port_handed_over = ehci_port_handed_over, | ||
554 | |||
555 | /* modified ehci functions for tegra */ | ||
556 | .reset = tegra_ehci_setup, | ||
557 | .shutdown = tegra_ehci_shutdown, | ||
558 | .map_urb_for_dma = tegra_ehci_map_urb_for_dma, | ||
559 | .unmap_urb_for_dma = tegra_ehci_unmap_urb_for_dma, | ||
560 | .hub_control = tegra_ehci_hub_control, | ||
576 | #ifdef CONFIG_PM | 561 | #ifdef CONFIG_PM |
577 | .bus_suspend = tegra_ehci_bus_suspend, | 562 | .bus_suspend = tegra_ehci_bus_suspend, |
578 | .bus_resume = tegra_ehci_bus_resume, | 563 | .bus_resume = tegra_ehci_bus_resume, |
579 | #endif | 564 | #endif |
580 | .relinquish_port = ehci_relinquish_port, | ||
581 | .port_handed_over = ehci_port_handed_over, | ||
582 | }; | 565 | }; |
583 | 566 | ||
584 | static int setup_vbus_gpio(struct platform_device *pdev) | 567 | static int setup_vbus_gpio(struct platform_device *pdev) |
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c index 0ea577bfca2a..c5ed88199292 100644 --- a/drivers/usb/host/fhci-tds.c +++ b/drivers/usb/host/fhci-tds.c | |||
@@ -155,7 +155,7 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
155 | struct endpoint *ep; | 155 | struct endpoint *ep; |
156 | struct usb_td __iomem *td; | 156 | struct usb_td __iomem *td; |
157 | unsigned long ep_offset; | 157 | unsigned long ep_offset; |
158 | char *err_for = "enpoint PRAM"; | 158 | char *err_for = "endpoint PRAM"; |
159 | int ep_mem_size; | 159 | int ep_mem_size; |
160 | u32 i; | 160 | u32 i; |
161 | 161 | ||
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index ab333ac6071d..22ff6b3a676f 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
@@ -119,6 +119,39 @@ error: | |||
119 | 119 | ||
120 | static const struct of_device_id fsl_usb2_mph_dr_of_match[]; | 120 | static const struct of_device_id fsl_usb2_mph_dr_of_match[]; |
121 | 121 | ||
122 | static int usb_get_ver_info(struct device_node *np) | ||
123 | { | ||
124 | int ver = -1; | ||
125 | |||
126 | /* | ||
127 | * returns 1 for usb controller version 1.6 | ||
128 | * returns 2 for usb controller version 2.2 | ||
129 | * returns 0 otherwise | ||
130 | */ | ||
131 | if (of_device_is_compatible(np, "fsl-usb2-dr")) { | ||
132 | if (of_device_is_compatible(np, "fsl-usb2-dr-v1.6")) | ||
133 | ver = FSL_USB_VER_1_6; | ||
134 | else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.2")) | ||
135 | ver = FSL_USB_VER_2_2; | ||
136 | else /* for previous controller versions */ | ||
137 | ver = FSL_USB_VER_OLD; | ||
138 | |||
139 | if (ver > -1) | ||
140 | return ver; | ||
141 | } | ||
142 | |||
143 | if (of_device_is_compatible(np, "fsl-usb2-mph")) { | ||
144 | if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6")) | ||
145 | ver = FSL_USB_VER_1_6; | ||
146 | else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.2")) | ||
147 | ver = FSL_USB_VER_2_2; | ||
148 | else /* for previous controller versions */ | ||
149 | ver = FSL_USB_VER_OLD; | ||
150 | } | ||
151 | |||
152 | return ver; | ||
153 | } | ||
154 | |||
122 | static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) | 155 | static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) |
123 | { | 156 | { |
124 | struct device_node *np = ofdev->dev.of_node; | 157 | struct device_node *np = ofdev->dev.of_node; |
@@ -166,6 +199,14 @@ static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) | |||
166 | 199 | ||
167 | prop = of_get_property(np, "phy_type", NULL); | 200 | prop = of_get_property(np, "phy_type", NULL); |
168 | pdata->phy_mode = determine_usb_phy(prop); | 201 | pdata->phy_mode = determine_usb_phy(prop); |
202 | pdata->controller_ver = usb_get_ver_info(np); | ||
203 | |||
204 | if (pdata->have_sysif_regs) { | ||
205 | if (pdata->controller_ver < 0) { | ||
206 | dev_warn(&ofdev->dev, "Could not get controller version\n"); | ||
207 | return -ENODEV; | ||
208 | } | ||
209 | } | ||
169 | 210 | ||
170 | for (i = 0; i < ARRAY_SIZE(dev_data->drivers); i++) { | 211 | for (i = 0; i < ARRAY_SIZE(dev_data->drivers); i++) { |
171 | if (!dev_data->drivers[i]) | 212 | if (!dev_data->drivers[i]) |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index fc72d44bf787..a35bbddf8968 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1562,11 +1562,14 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
1562 | 1562 | ||
1563 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { | 1563 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { |
1564 | retval = -ESHUTDOWN; | 1564 | retval = -ESHUTDOWN; |
1565 | qtd_list_free(&new_qtds); | ||
1565 | goto out; | 1566 | goto out; |
1566 | } | 1567 | } |
1567 | retval = usb_hcd_link_urb_to_ep(hcd, urb); | 1568 | retval = usb_hcd_link_urb_to_ep(hcd, urb); |
1568 | if (retval) | 1569 | if (retval) { |
1570 | qtd_list_free(&new_qtds); | ||
1569 | goto out; | 1571 | goto out; |
1572 | } | ||
1570 | 1573 | ||
1571 | qh = urb->ep->hcpriv; | 1574 | qh = urb->ep->hcpriv; |
1572 | if (qh) { | 1575 | if (qh) { |
@@ -1584,6 +1587,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
1584 | if (!qh) { | 1587 | if (!qh) { |
1585 | retval = -ENOMEM; | 1588 | retval = -ENOMEM; |
1586 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 1589 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
1590 | qtd_list_free(&new_qtds); | ||
1587 | goto out; | 1591 | goto out; |
1588 | } | 1592 | } |
1589 | list_add_tail(&qh->qh_list, ep_queue); | 1593 | list_add_tail(&qh->qh_list, ep_queue); |
@@ -1683,6 +1687,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1683 | list_for_each_entry(qtd, &qh->qtd_list, qtd_list) | 1687 | list_for_each_entry(qtd, &qh->qtd_list, qtd_list) |
1684 | if (qtd->urb == urb) { | 1688 | if (qtd->urb == urb) { |
1685 | dequeue_urb_from_qtd(hcd, qh, qtd); | 1689 | dequeue_urb_from_qtd(hcd, qh, qtd); |
1690 | list_move(&qtd->qtd_list, &qh->qtd_list); | ||
1686 | break; | 1691 | break; |
1687 | } | 1692 | } |
1688 | 1693 | ||
@@ -2176,7 +2181,7 @@ static const struct hc_driver isp1760_hc_driver = { | |||
2176 | 2181 | ||
2177 | int __init init_kmem_once(void) | 2182 | int __init init_kmem_once(void) |
2178 | { | 2183 | { |
2179 | urb_listitem_cachep = kmem_cache_create("isp1760 urb_listitem", | 2184 | urb_listitem_cachep = kmem_cache_create("isp1760_urb_listitem", |
2180 | sizeof(struct urb_listitem), 0, SLAB_TEMPORARY | | 2185 | sizeof(struct urb_listitem), 0, SLAB_TEMPORARY | |
2181 | SLAB_MEM_SPREAD, NULL); | 2186 | SLAB_MEM_SPREAD, NULL); |
2182 | 2187 | ||
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 4592dc17a9f9..fff114fd5461 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -398,6 +398,9 @@ static int __devinit isp1760_plat_probe(struct platform_device *pdev) | |||
398 | hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, | 398 | hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, |
399 | irqflags, -ENOENT, | 399 | irqflags, -ENOENT, |
400 | &pdev->dev, dev_name(&pdev->dev), devflags); | 400 | &pdev->dev, dev_name(&pdev->dev), devflags); |
401 | |||
402 | dev_set_drvdata(&pdev->dev, hcd); | ||
403 | |||
401 | if (IS_ERR(hcd)) { | 404 | if (IS_ERR(hcd)) { |
402 | pr_warning("isp1760: Failed to register the HCD device\n"); | 405 | pr_warning("isp1760: Failed to register the HCD device\n"); |
403 | ret = -ENODEV; | 406 | ret = -ENODEV; |
@@ -417,11 +420,16 @@ static int __devexit isp1760_plat_remove(struct platform_device *pdev) | |||
417 | { | 420 | { |
418 | struct resource *mem_res; | 421 | struct resource *mem_res; |
419 | resource_size_t mem_size; | 422 | resource_size_t mem_size; |
423 | struct usb_hcd *hcd = dev_get_drvdata(&pdev->dev); | ||
424 | |||
425 | usb_remove_hcd(hcd); | ||
420 | 426 | ||
421 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 427 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
422 | mem_size = resource_size(mem_res); | 428 | mem_size = resource_size(mem_res); |
423 | release_mem_region(mem_res->start, mem_size); | 429 | release_mem_region(mem_res->start, mem_size); |
424 | 430 | ||
431 | usb_put_hcd(hcd); | ||
432 | |||
425 | return 0; | 433 | return 0; |
426 | } | 434 | } |
427 | 435 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 235171f29460..e0adf5c0cf55 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -1080,11 +1080,6 @@ MODULE_LICENSE ("GPL"); | |||
1080 | #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver | 1080 | #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver |
1081 | #endif | 1081 | #endif |
1082 | 1082 | ||
1083 | #ifdef CONFIG_USB_OHCI_HCD_SSB | ||
1084 | #include "ohci-ssb.c" | ||
1085 | #define SSB_OHCI_DRIVER ssb_ohci_driver | ||
1086 | #endif | ||
1087 | |||
1088 | #ifdef CONFIG_MFD_SM501 | 1083 | #ifdef CONFIG_MFD_SM501 |
1089 | #include "ohci-sm501.c" | 1084 | #include "ohci-sm501.c" |
1090 | #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver | 1085 | #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver |
@@ -1128,8 +1123,7 @@ MODULE_LICENSE ("GPL"); | |||
1128 | !defined(SA1111_DRIVER) && \ | 1123 | !defined(SA1111_DRIVER) && \ |
1129 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ | 1124 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ |
1130 | !defined(SM501_OHCI_DRIVER) && \ | 1125 | !defined(SM501_OHCI_DRIVER) && \ |
1131 | !defined(TMIO_OHCI_DRIVER) && \ | 1126 | !defined(TMIO_OHCI_DRIVER) |
1132 | !defined(SSB_OHCI_DRIVER) | ||
1133 | #error "missing bus glue for ohci-hcd" | 1127 | #error "missing bus glue for ohci-hcd" |
1134 | #endif | 1128 | #endif |
1135 | 1129 | ||
@@ -1195,12 +1189,6 @@ static int __init ohci_hcd_mod_init(void) | |||
1195 | goto error_pci; | 1189 | goto error_pci; |
1196 | #endif | 1190 | #endif |
1197 | 1191 | ||
1198 | #ifdef SSB_OHCI_DRIVER | ||
1199 | retval = ssb_driver_register(&SSB_OHCI_DRIVER); | ||
1200 | if (retval) | ||
1201 | goto error_ssb; | ||
1202 | #endif | ||
1203 | |||
1204 | #ifdef SM501_OHCI_DRIVER | 1192 | #ifdef SM501_OHCI_DRIVER |
1205 | retval = platform_driver_register(&SM501_OHCI_DRIVER); | 1193 | retval = platform_driver_register(&SM501_OHCI_DRIVER); |
1206 | if (retval < 0) | 1194 | if (retval < 0) |
@@ -1224,10 +1212,6 @@ static int __init ohci_hcd_mod_init(void) | |||
1224 | platform_driver_unregister(&SM501_OHCI_DRIVER); | 1212 | platform_driver_unregister(&SM501_OHCI_DRIVER); |
1225 | error_sm501: | 1213 | error_sm501: |
1226 | #endif | 1214 | #endif |
1227 | #ifdef SSB_OHCI_DRIVER | ||
1228 | ssb_driver_unregister(&SSB_OHCI_DRIVER); | ||
1229 | error_ssb: | ||
1230 | #endif | ||
1231 | #ifdef PCI_DRIVER | 1215 | #ifdef PCI_DRIVER |
1232 | pci_unregister_driver(&PCI_DRIVER); | 1216 | pci_unregister_driver(&PCI_DRIVER); |
1233 | error_pci: | 1217 | error_pci: |
@@ -1275,9 +1259,6 @@ static void __exit ohci_hcd_mod_exit(void) | |||
1275 | #ifdef SM501_OHCI_DRIVER | 1259 | #ifdef SM501_OHCI_DRIVER |
1276 | platform_driver_unregister(&SM501_OHCI_DRIVER); | 1260 | platform_driver_unregister(&SM501_OHCI_DRIVER); |
1277 | #endif | 1261 | #endif |
1278 | #ifdef SSB_OHCI_DRIVER | ||
1279 | ssb_driver_unregister(&SSB_OHCI_DRIVER); | ||
1280 | #endif | ||
1281 | #ifdef PCI_DRIVER | 1262 | #ifdef PCI_DRIVER |
1282 | pci_unregister_driver(&PCI_DRIVER); | 1263 | pci_unregister_driver(&PCI_DRIVER); |
1283 | #endif | 1264 | #endif |
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index ec5c6791c8b4..670c7059c9ae 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c | |||
@@ -93,13 +93,13 @@ static int __devinit ohci_platform_probe(struct platform_device *dev) | |||
93 | 93 | ||
94 | irq = platform_get_irq(dev, 0); | 94 | irq = platform_get_irq(dev, 0); |
95 | if (irq < 0) { | 95 | if (irq < 0) { |
96 | pr_err("no irq provieded"); | 96 | pr_err("no irq provided"); |
97 | return irq; | 97 | return irq; |
98 | } | 98 | } |
99 | 99 | ||
100 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); | 100 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
101 | if (!res_mem) { | 101 | if (!res_mem) { |
102 | pr_err("no memory recourse provieded"); | 102 | pr_err("no memory recourse provided"); |
103 | return -ENXIO; | 103 | return -ENXIO; |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index d24cc89de16f..b2b5767cb37f 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -236,7 +236,7 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match); | |||
236 | 236 | ||
237 | #if !defined(CONFIG_USB_OHCI_HCD_PPC_OF_BE) && \ | 237 | #if !defined(CONFIG_USB_OHCI_HCD_PPC_OF_BE) && \ |
238 | !defined(CONFIG_USB_OHCI_HCD_PPC_OF_LE) | 238 | !defined(CONFIG_USB_OHCI_HCD_PPC_OF_LE) |
239 | #error "No endianess selected for ppc-of-ohci" | 239 | #error "No endianness selected for ppc-of-ohci" |
240 | #endif | 240 | #endif |
241 | 241 | ||
242 | 242 | ||
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 95c16489e883..fc7305ee3c9c 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/of.h> | ||
17 | 18 | ||
18 | struct spear_ohci { | 19 | struct spear_ohci { |
19 | struct ohci_hcd ohci; | 20 | struct ohci_hcd ohci; |
@@ -24,12 +25,12 @@ struct spear_ohci { | |||
24 | 25 | ||
25 | static void spear_start_ohci(struct spear_ohci *ohci) | 26 | static void spear_start_ohci(struct spear_ohci *ohci) |
26 | { | 27 | { |
27 | clk_enable(ohci->clk); | 28 | clk_prepare_enable(ohci->clk); |
28 | } | 29 | } |
29 | 30 | ||
30 | static void spear_stop_ohci(struct spear_ohci *ohci) | 31 | static void spear_stop_ohci(struct spear_ohci *ohci) |
31 | { | 32 | { |
32 | clk_disable(ohci->clk); | 33 | clk_disable_unprepare(ohci->clk); |
33 | } | 34 | } |
34 | 35 | ||
35 | static int __devinit ohci_spear_start(struct usb_hcd *hcd) | 36 | static int __devinit ohci_spear_start(struct usb_hcd *hcd) |
@@ -90,6 +91,8 @@ static const struct hc_driver ohci_spear_hc_driver = { | |||
90 | .start_port_reset = ohci_start_port_reset, | 91 | .start_port_reset = ohci_start_port_reset, |
91 | }; | 92 | }; |
92 | 93 | ||
94 | static u64 spear_ohci_dma_mask = DMA_BIT_MASK(32); | ||
95 | |||
93 | static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | 96 | static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) |
94 | { | 97 | { |
95 | const struct hc_driver *driver = &ohci_spear_hc_driver; | 98 | const struct hc_driver *driver = &ohci_spear_hc_driver; |
@@ -98,11 +101,8 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | |||
98 | struct spear_ohci *ohci_p; | 101 | struct spear_ohci *ohci_p; |
99 | struct resource *res; | 102 | struct resource *res; |
100 | int retval, irq; | 103 | int retval, irq; |
101 | int *pdata = pdev->dev.platform_data; | ||
102 | char clk_name[20] = "usbh_clk"; | 104 | char clk_name[20] = "usbh_clk"; |
103 | 105 | static int instance = -1; | |
104 | if (pdata == NULL) | ||
105 | return -EFAULT; | ||
106 | 106 | ||
107 | irq = platform_get_irq(pdev, 0); | 107 | irq = platform_get_irq(pdev, 0); |
108 | if (irq < 0) { | 108 | if (irq < 0) { |
@@ -110,8 +110,22 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | |||
110 | goto fail_irq_get; | 110 | goto fail_irq_get; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (*pdata >= 0) | 113 | /* |
114 | sprintf(clk_name, "usbh.%01d_clk", *pdata); | 114 | * Right now device-tree probed devices don't get dma_mask set. |
115 | * Since shared usb code relies on it, set it here for now. | ||
116 | * Once we have dma capability bindings this can go away. | ||
117 | */ | ||
118 | if (!pdev->dev.dma_mask) | ||
119 | pdev->dev.dma_mask = &spear_ohci_dma_mask; | ||
120 | |||
121 | /* | ||
122 | * Increment the device instance, when probing via device-tree | ||
123 | */ | ||
124 | if (pdev->id < 0) | ||
125 | instance++; | ||
126 | else | ||
127 | instance = pdev->id; | ||
128 | sprintf(clk_name, "usbh.%01d_clk", instance); | ||
115 | 129 | ||
116 | usbh_clk = clk_get(NULL, clk_name); | 130 | usbh_clk = clk_get(NULL, clk_name); |
117 | if (IS_ERR(usbh_clk)) { | 131 | if (IS_ERR(usbh_clk)) { |
@@ -222,6 +236,11 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev) | |||
222 | } | 236 | } |
223 | #endif | 237 | #endif |
224 | 238 | ||
239 | static struct of_device_id spear_ohci_id_table[] __devinitdata = { | ||
240 | { .compatible = "st,spear600-ohci", }, | ||
241 | { }, | ||
242 | }; | ||
243 | |||
225 | /* Driver definition to register with the platform bus */ | 244 | /* Driver definition to register with the platform bus */ |
226 | static struct platform_driver spear_ohci_hcd_driver = { | 245 | static struct platform_driver spear_ohci_hcd_driver = { |
227 | .probe = spear_ohci_hcd_drv_probe, | 246 | .probe = spear_ohci_hcd_drv_probe, |
@@ -233,6 +252,7 @@ static struct platform_driver spear_ohci_hcd_driver = { | |||
233 | .driver = { | 252 | .driver = { |
234 | .owner = THIS_MODULE, | 253 | .owner = THIS_MODULE, |
235 | .name = "spear-ohci", | 254 | .name = "spear-ohci", |
255 | .of_match_table = of_match_ptr(spear_ohci_id_table), | ||
236 | }, | 256 | }, |
237 | }; | 257 | }; |
238 | 258 | ||
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c deleted file mode 100644 index 5ba18595d6f7..000000000000 --- a/drivers/usb/host/ohci-ssb.c +++ /dev/null | |||
@@ -1,260 +0,0 @@ | |||
1 | /* | ||
2 | * Sonics Silicon Backplane | ||
3 | * Broadcom USB-core OHCI driver | ||
4 | * | ||
5 | * Copyright 2007 Michael Buesch <m@bues.ch> | ||
6 | * | ||
7 | * Derived from the OHCI-PCI driver | ||
8 | * Copyright 1999 Roman Weissgaerber | ||
9 | * Copyright 2000-2002 David Brownell | ||
10 | * Copyright 1999 Linus Torvalds | ||
11 | * Copyright 1999 Gregory P. Smith | ||
12 | * | ||
13 | * Derived from the USBcore related parts of Broadcom-SB | ||
14 | * Copyright 2005 Broadcom Corporation | ||
15 | * | ||
16 | * Licensed under the GNU/GPL. See COPYING for details. | ||
17 | */ | ||
18 | #include <linux/ssb/ssb.h> | ||
19 | |||
20 | |||
21 | #define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29) | ||
22 | |||
23 | struct ssb_ohci_device { | ||
24 | struct ohci_hcd ohci; /* _must_ be at the beginning. */ | ||
25 | |||
26 | u32 enable_flags; | ||
27 | }; | ||
28 | |||
29 | static inline | ||
30 | struct ssb_ohci_device *hcd_to_ssb_ohci(struct usb_hcd *hcd) | ||
31 | { | ||
32 | return (struct ssb_ohci_device *)(hcd->hcd_priv); | ||
33 | } | ||
34 | |||
35 | |||
36 | static int ssb_ohci_reset(struct usb_hcd *hcd) | ||
37 | { | ||
38 | struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd); | ||
39 | struct ohci_hcd *ohci = &ohcidev->ohci; | ||
40 | int err; | ||
41 | |||
42 | ohci_hcd_init(ohci); | ||
43 | err = ohci_init(ohci); | ||
44 | |||
45 | return err; | ||
46 | } | ||
47 | |||
48 | static int ssb_ohci_start(struct usb_hcd *hcd) | ||
49 | { | ||
50 | struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd); | ||
51 | struct ohci_hcd *ohci = &ohcidev->ohci; | ||
52 | int err; | ||
53 | |||
54 | err = ohci_run(ohci); | ||
55 | if (err < 0) { | ||
56 | ohci_err(ohci, "can't start\n"); | ||
57 | ohci_stop(hcd); | ||
58 | } | ||
59 | |||
60 | return err; | ||
61 | } | ||
62 | |||
63 | static const struct hc_driver ssb_ohci_hc_driver = { | ||
64 | .description = "ssb-usb-ohci", | ||
65 | .product_desc = "SSB OHCI Controller", | ||
66 | .hcd_priv_size = sizeof(struct ssb_ohci_device), | ||
67 | |||
68 | .irq = ohci_irq, | ||
69 | .flags = HCD_MEMORY | HCD_USB11, | ||
70 | |||
71 | .reset = ssb_ohci_reset, | ||
72 | .start = ssb_ohci_start, | ||
73 | .stop = ohci_stop, | ||
74 | .shutdown = ohci_shutdown, | ||
75 | |||
76 | .urb_enqueue = ohci_urb_enqueue, | ||
77 | .urb_dequeue = ohci_urb_dequeue, | ||
78 | .endpoint_disable = ohci_endpoint_disable, | ||
79 | |||
80 | .get_frame_number = ohci_get_frame, | ||
81 | |||
82 | .hub_status_data = ohci_hub_status_data, | ||
83 | .hub_control = ohci_hub_control, | ||
84 | #ifdef CONFIG_PM | ||
85 | .bus_suspend = ohci_bus_suspend, | ||
86 | .bus_resume = ohci_bus_resume, | ||
87 | #endif | ||
88 | |||
89 | .start_port_reset = ohci_start_port_reset, | ||
90 | }; | ||
91 | |||
92 | static void ssb_ohci_detach(struct ssb_device *dev) | ||
93 | { | ||
94 | struct usb_hcd *hcd = ssb_get_drvdata(dev); | ||
95 | |||
96 | if (hcd->driver->shutdown) | ||
97 | hcd->driver->shutdown(hcd); | ||
98 | usb_remove_hcd(hcd); | ||
99 | iounmap(hcd->regs); | ||
100 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
101 | usb_put_hcd(hcd); | ||
102 | ssb_device_disable(dev, 0); | ||
103 | } | ||
104 | |||
105 | static int ssb_ohci_attach(struct ssb_device *dev) | ||
106 | { | ||
107 | struct ssb_ohci_device *ohcidev; | ||
108 | struct usb_hcd *hcd; | ||
109 | int err = -ENOMEM; | ||
110 | u32 tmp, flags = 0; | ||
111 | |||
112 | if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || | ||
113 | dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32))) | ||
114 | return -EOPNOTSUPP; | ||
115 | |||
116 | if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) { | ||
117 | /* Put the device into host-mode. */ | ||
118 | flags |= SSB_OHCI_TMSLOW_HOSTMODE; | ||
119 | ssb_device_enable(dev, flags); | ||
120 | } else if (dev->id.coreid == SSB_DEV_USB20_HOST) { | ||
121 | /* | ||
122 | * USB 2.0 special considerations: | ||
123 | * | ||
124 | * In addition to the standard SSB reset sequence, the Host | ||
125 | * Control Register must be programmed to bring the USB core | ||
126 | * and various phy components out of reset. | ||
127 | */ | ||
128 | ssb_device_enable(dev, 0); | ||
129 | ssb_write32(dev, 0x200, 0x7ff); | ||
130 | |||
131 | /* Change Flush control reg */ | ||
132 | tmp = ssb_read32(dev, 0x400); | ||
133 | tmp &= ~8; | ||
134 | ssb_write32(dev, 0x400, tmp); | ||
135 | tmp = ssb_read32(dev, 0x400); | ||
136 | |||
137 | /* Change Shim control reg */ | ||
138 | tmp = ssb_read32(dev, 0x304); | ||
139 | tmp &= ~0x100; | ||
140 | ssb_write32(dev, 0x304, tmp); | ||
141 | tmp = ssb_read32(dev, 0x304); | ||
142 | |||
143 | udelay(1); | ||
144 | |||
145 | /* Work around for 5354 failures */ | ||
146 | if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { | ||
147 | /* Change syn01 reg */ | ||
148 | tmp = 0x00fe00fe; | ||
149 | ssb_write32(dev, 0x894, tmp); | ||
150 | |||
151 | /* Change syn03 reg */ | ||
152 | tmp = ssb_read32(dev, 0x89c); | ||
153 | tmp |= 0x1; | ||
154 | ssb_write32(dev, 0x89c, tmp); | ||
155 | } | ||
156 | } else | ||
157 | ssb_device_enable(dev, 0); | ||
158 | |||
159 | hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, | ||
160 | dev_name(dev->dev)); | ||
161 | if (!hcd) | ||
162 | goto err_dev_disable; | ||
163 | ohcidev = hcd_to_ssb_ohci(hcd); | ||
164 | ohcidev->enable_flags = flags; | ||
165 | |||
166 | tmp = ssb_read32(dev, SSB_ADMATCH0); | ||
167 | hcd->rsrc_start = ssb_admatch_base(tmp); | ||
168 | hcd->rsrc_len = ssb_admatch_size(tmp); | ||
169 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | ||
170 | if (!hcd->regs) | ||
171 | goto err_put_hcd; | ||
172 | err = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); | ||
173 | if (err) | ||
174 | goto err_iounmap; | ||
175 | |||
176 | ssb_set_drvdata(dev, hcd); | ||
177 | |||
178 | return err; | ||
179 | |||
180 | err_iounmap: | ||
181 | iounmap(hcd->regs); | ||
182 | err_put_hcd: | ||
183 | usb_put_hcd(hcd); | ||
184 | err_dev_disable: | ||
185 | ssb_device_disable(dev, flags); | ||
186 | return err; | ||
187 | } | ||
188 | |||
189 | static int ssb_ohci_probe(struct ssb_device *dev, | ||
190 | const struct ssb_device_id *id) | ||
191 | { | ||
192 | int err; | ||
193 | u16 chipid_top; | ||
194 | |||
195 | /* USBcores are only connected on embedded devices. */ | ||
196 | chipid_top = (dev->bus->chip_id & 0xFF00); | ||
197 | if (chipid_top != 0x4700 && chipid_top != 0x5300) | ||
198 | return -ENODEV; | ||
199 | |||
200 | /* TODO: Probably need checks here; is the core connected? */ | ||
201 | |||
202 | if (usb_disabled()) | ||
203 | return -ENODEV; | ||
204 | |||
205 | /* We currently always attach SSB_DEV_USB11_HOSTDEV | ||
206 | * as HOST OHCI. If we want to attach it as Client device, | ||
207 | * we must branch here and call into the (yet to | ||
208 | * be written) Client mode driver. Same for remove(). */ | ||
209 | |||
210 | err = ssb_ohci_attach(dev); | ||
211 | |||
212 | return err; | ||
213 | } | ||
214 | |||
215 | static void ssb_ohci_remove(struct ssb_device *dev) | ||
216 | { | ||
217 | ssb_ohci_detach(dev); | ||
218 | } | ||
219 | |||
220 | #ifdef CONFIG_PM | ||
221 | |||
222 | static int ssb_ohci_suspend(struct ssb_device *dev, pm_message_t state) | ||
223 | { | ||
224 | ssb_device_disable(dev, 0); | ||
225 | |||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static int ssb_ohci_resume(struct ssb_device *dev) | ||
230 | { | ||
231 | struct usb_hcd *hcd = ssb_get_drvdata(dev); | ||
232 | struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd); | ||
233 | |||
234 | ssb_device_enable(dev, ohcidev->enable_flags); | ||
235 | |||
236 | ohci_finish_controller_resume(hcd); | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | #else /* !CONFIG_PM */ | ||
241 | #define ssb_ohci_suspend NULL | ||
242 | #define ssb_ohci_resume NULL | ||
243 | #endif /* CONFIG_PM */ | ||
244 | |||
245 | static const struct ssb_device_id ssb_ohci_table[] = { | ||
246 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV), | ||
247 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV), | ||
248 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV), | ||
249 | SSB_DEVTABLE_END | ||
250 | }; | ||
251 | MODULE_DEVICE_TABLE(ssb, ssb_ohci_table); | ||
252 | |||
253 | static struct ssb_driver ssb_ohci_driver = { | ||
254 | .name = KBUILD_MODNAME, | ||
255 | .id_table = ssb_ohci_table, | ||
256 | .probe = ssb_ohci_probe, | ||
257 | .remove = ssb_ohci_remove, | ||
258 | .suspend = ssb_ohci_suspend, | ||
259 | .resume = ssb_ohci_resume, | ||
260 | }; | ||
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index 3b38030b02a8..77a52256eb34 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -2991,8 +2991,9 @@ static int oxu_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
2991 | /* shouldn't happen often, but ... | 2991 | /* shouldn't happen often, but ... |
2992 | * FIXME kill those tds' urbs | 2992 | * FIXME kill those tds' urbs |
2993 | */ | 2993 | */ |
2994 | err("can't reschedule qh %p, err %d", | 2994 | dev_err(hcd->self.controller, |
2995 | qh, status); | 2995 | "can't reschedule qh %p, err %d\n", qh, |
2996 | status); | ||
2996 | } | 2997 | } |
2997 | return status; | 2998 | return status; |
2998 | } | 2999 | } |
diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c new file mode 100644 index 000000000000..c2e73433b306 --- /dev/null +++ b/drivers/usb/host/ssb-hcd.c | |||
@@ -0,0 +1,279 @@ | |||
1 | /* | ||
2 | * Sonics Silicon Backplane | ||
3 | * Broadcom USB-core driver (SSB bus glue) | ||
4 | * | ||
5 | * Copyright 2011-2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
6 | * | ||
7 | * Based on ssb-ohci driver | ||
8 | * Copyright 2007 Michael Buesch <m@bues.ch> | ||
9 | * | ||
10 | * Derived from the OHCI-PCI driver | ||
11 | * Copyright 1999 Roman Weissgaerber | ||
12 | * Copyright 2000-2002 David Brownell | ||
13 | * Copyright 1999 Linus Torvalds | ||
14 | * Copyright 1999 Gregory P. Smith | ||
15 | * | ||
16 | * Derived from the USBcore related parts of Broadcom-SB | ||
17 | * Copyright 2005-2011 Broadcom Corporation | ||
18 | * | ||
19 | * Licensed under the GNU/GPL. See COPYING for details. | ||
20 | */ | ||
21 | #include <linux/ssb/ssb.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/usb/ehci_pdriver.h> | ||
26 | #include <linux/usb/ohci_pdriver.h> | ||
27 | |||
28 | MODULE_AUTHOR("Hauke Mehrtens"); | ||
29 | MODULE_DESCRIPTION("Common USB driver for SSB Bus"); | ||
30 | MODULE_LICENSE("GPL"); | ||
31 | |||
32 | #define SSB_HCD_TMSLOW_HOSTMODE (1 << 29) | ||
33 | |||
34 | struct ssb_hcd_device { | ||
35 | struct platform_device *ehci_dev; | ||
36 | struct platform_device *ohci_dev; | ||
37 | |||
38 | u32 enable_flags; | ||
39 | }; | ||
40 | |||
41 | static void __devinit ssb_hcd_5354wa(struct ssb_device *dev) | ||
42 | { | ||
43 | #ifdef CONFIG_SSB_DRIVER_MIPS | ||
44 | /* Work around for 5354 failures */ | ||
45 | if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { | ||
46 | /* Change syn01 reg */ | ||
47 | ssb_write32(dev, 0x894, 0x00fe00fe); | ||
48 | |||
49 | /* Change syn03 reg */ | ||
50 | ssb_write32(dev, 0x89c, ssb_read32(dev, 0x89c) | 0x1); | ||
51 | } | ||
52 | #endif | ||
53 | } | ||
54 | |||
55 | static void __devinit ssb_hcd_usb20wa(struct ssb_device *dev) | ||
56 | { | ||
57 | if (dev->id.coreid == SSB_DEV_USB20_HOST) { | ||
58 | /* | ||
59 | * USB 2.0 special considerations: | ||
60 | * | ||
61 | * In addition to the standard SSB reset sequence, the Host | ||
62 | * Control Register must be programmed to bring the USB core | ||
63 | * and various phy components out of reset. | ||
64 | */ | ||
65 | ssb_write32(dev, 0x200, 0x7ff); | ||
66 | |||
67 | /* Change Flush control reg */ | ||
68 | ssb_write32(dev, 0x400, ssb_read32(dev, 0x400) & ~8); | ||
69 | ssb_read32(dev, 0x400); | ||
70 | |||
71 | /* Change Shim control reg */ | ||
72 | ssb_write32(dev, 0x304, ssb_read32(dev, 0x304) & ~0x100); | ||
73 | ssb_read32(dev, 0x304); | ||
74 | |||
75 | udelay(1); | ||
76 | |||
77 | ssb_hcd_5354wa(dev); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */ | ||
82 | static u32 __devinit ssb_hcd_init_chip(struct ssb_device *dev) | ||
83 | { | ||
84 | u32 flags = 0; | ||
85 | |||
86 | if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) | ||
87 | /* Put the device into host-mode. */ | ||
88 | flags |= SSB_HCD_TMSLOW_HOSTMODE; | ||
89 | |||
90 | ssb_device_enable(dev, flags); | ||
91 | |||
92 | ssb_hcd_usb20wa(dev); | ||
93 | |||
94 | return flags; | ||
95 | } | ||
96 | |||
97 | static const struct usb_ehci_pdata ehci_pdata = { | ||
98 | }; | ||
99 | |||
100 | static const struct usb_ohci_pdata ohci_pdata = { | ||
101 | }; | ||
102 | |||
103 | static struct platform_device * __devinit | ||
104 | ssb_hcd_create_pdev(struct ssb_device *dev, bool ohci, u32 addr, u32 len) | ||
105 | { | ||
106 | struct platform_device *hci_dev; | ||
107 | struct resource hci_res[2]; | ||
108 | int ret = -ENOMEM; | ||
109 | |||
110 | memset(hci_res, 0, sizeof(hci_res)); | ||
111 | |||
112 | hci_res[0].start = addr; | ||
113 | hci_res[0].end = hci_res[0].start + len - 1; | ||
114 | hci_res[0].flags = IORESOURCE_MEM; | ||
115 | |||
116 | hci_res[1].start = dev->irq; | ||
117 | hci_res[1].flags = IORESOURCE_IRQ; | ||
118 | |||
119 | hci_dev = platform_device_alloc(ohci ? "ohci-platform" : | ||
120 | "ehci-platform" , 0); | ||
121 | if (!hci_dev) | ||
122 | return NULL; | ||
123 | |||
124 | hci_dev->dev.parent = dev->dev; | ||
125 | hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; | ||
126 | |||
127 | ret = platform_device_add_resources(hci_dev, hci_res, | ||
128 | ARRAY_SIZE(hci_res)); | ||
129 | if (ret) | ||
130 | goto err_alloc; | ||
131 | if (ohci) | ||
132 | ret = platform_device_add_data(hci_dev, &ohci_pdata, | ||
133 | sizeof(ohci_pdata)); | ||
134 | else | ||
135 | ret = platform_device_add_data(hci_dev, &ehci_pdata, | ||
136 | sizeof(ehci_pdata)); | ||
137 | if (ret) | ||
138 | goto err_alloc; | ||
139 | ret = platform_device_add(hci_dev); | ||
140 | if (ret) | ||
141 | goto err_alloc; | ||
142 | |||
143 | return hci_dev; | ||
144 | |||
145 | err_alloc: | ||
146 | platform_device_put(hci_dev); | ||
147 | return ERR_PTR(ret); | ||
148 | } | ||
149 | |||
150 | static int __devinit ssb_hcd_probe(struct ssb_device *dev, | ||
151 | const struct ssb_device_id *id) | ||
152 | { | ||
153 | int err, tmp; | ||
154 | int start, len; | ||
155 | u16 chipid_top; | ||
156 | u16 coreid = dev->id.coreid; | ||
157 | struct ssb_hcd_device *usb_dev; | ||
158 | |||
159 | /* USBcores are only connected on embedded devices. */ | ||
160 | chipid_top = (dev->bus->chip_id & 0xFF00); | ||
161 | if (chipid_top != 0x4700 && chipid_top != 0x5300) | ||
162 | return -ENODEV; | ||
163 | |||
164 | /* TODO: Probably need checks here; is the core connected? */ | ||
165 | |||
166 | if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || | ||
167 | dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32))) | ||
168 | return -EOPNOTSUPP; | ||
169 | |||
170 | usb_dev = kzalloc(sizeof(struct ssb_hcd_device), GFP_KERNEL); | ||
171 | if (!usb_dev) | ||
172 | return -ENOMEM; | ||
173 | |||
174 | /* We currently always attach SSB_DEV_USB11_HOSTDEV | ||
175 | * as HOST OHCI. If we want to attach it as Client device, | ||
176 | * we must branch here and call into the (yet to | ||
177 | * be written) Client mode driver. Same for remove(). */ | ||
178 | usb_dev->enable_flags = ssb_hcd_init_chip(dev); | ||
179 | |||
180 | tmp = ssb_read32(dev, SSB_ADMATCH0); | ||
181 | |||
182 | start = ssb_admatch_base(tmp); | ||
183 | len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp); | ||
184 | usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, true, start, len); | ||
185 | if (IS_ERR(usb_dev->ohci_dev)) { | ||
186 | err = PTR_ERR(usb_dev->ohci_dev); | ||
187 | goto err_free_usb_dev; | ||
188 | } | ||
189 | |||
190 | if (coreid == SSB_DEV_USB20_HOST) { | ||
191 | start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */ | ||
192 | usb_dev->ehci_dev = ssb_hcd_create_pdev(dev, false, start, len); | ||
193 | if (IS_ERR(usb_dev->ehci_dev)) { | ||
194 | err = PTR_ERR(usb_dev->ehci_dev); | ||
195 | goto err_unregister_ohci_dev; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | ssb_set_drvdata(dev, usb_dev); | ||
200 | return 0; | ||
201 | |||
202 | err_unregister_ohci_dev: | ||
203 | platform_device_unregister(usb_dev->ohci_dev); | ||
204 | err_free_usb_dev: | ||
205 | kfree(usb_dev); | ||
206 | return err; | ||
207 | } | ||
208 | |||
209 | static void __devexit ssb_hcd_remove(struct ssb_device *dev) | ||
210 | { | ||
211 | struct ssb_hcd_device *usb_dev = ssb_get_drvdata(dev); | ||
212 | struct platform_device *ohci_dev = usb_dev->ohci_dev; | ||
213 | struct platform_device *ehci_dev = usb_dev->ehci_dev; | ||
214 | |||
215 | if (ohci_dev) | ||
216 | platform_device_unregister(ohci_dev); | ||
217 | if (ehci_dev) | ||
218 | platform_device_unregister(ehci_dev); | ||
219 | |||
220 | ssb_device_disable(dev, 0); | ||
221 | } | ||
222 | |||
223 | static void __devexit ssb_hcd_shutdown(struct ssb_device *dev) | ||
224 | { | ||
225 | ssb_device_disable(dev, 0); | ||
226 | } | ||
227 | |||
228 | #ifdef CONFIG_PM | ||
229 | |||
230 | static int ssb_hcd_suspend(struct ssb_device *dev, pm_message_t state) | ||
231 | { | ||
232 | ssb_device_disable(dev, 0); | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static int ssb_hcd_resume(struct ssb_device *dev) | ||
238 | { | ||
239 | struct ssb_hcd_device *usb_dev = ssb_get_drvdata(dev); | ||
240 | |||
241 | ssb_device_enable(dev, usb_dev->enable_flags); | ||
242 | |||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | #else /* !CONFIG_PM */ | ||
247 | #define ssb_hcd_suspend NULL | ||
248 | #define ssb_hcd_resume NULL | ||
249 | #endif /* CONFIG_PM */ | ||
250 | |||
251 | static const struct ssb_device_id ssb_hcd_table[] __devinitconst = { | ||
252 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV), | ||
253 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV), | ||
254 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV), | ||
255 | SSB_DEVTABLE_END | ||
256 | }; | ||
257 | MODULE_DEVICE_TABLE(ssb, ssb_hcd_table); | ||
258 | |||
259 | static struct ssb_driver ssb_hcd_driver = { | ||
260 | .name = KBUILD_MODNAME, | ||
261 | .id_table = ssb_hcd_table, | ||
262 | .probe = ssb_hcd_probe, | ||
263 | .remove = __devexit_p(ssb_hcd_remove), | ||
264 | .shutdown = ssb_hcd_shutdown, | ||
265 | .suspend = ssb_hcd_suspend, | ||
266 | .resume = ssb_hcd_resume, | ||
267 | }; | ||
268 | |||
269 | static int __init ssb_hcd_init(void) | ||
270 | { | ||
271 | return ssb_driver_register(&ssb_hcd_driver); | ||
272 | } | ||
273 | module_init(ssb_hcd_init); | ||
274 | |||
275 | static void __exit ssb_hcd_exit(void) | ||
276 | { | ||
277 | ssb_driver_unregister(&ssb_hcd_driver); | ||
278 | } | ||
279 | module_exit(ssb_hcd_exit); | ||
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index da97dcec1f32..d65984dee751 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c | |||
@@ -78,18 +78,14 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
78 | const struct firmware *bitstream_fw = NULL; | 78 | const struct firmware *bitstream_fw = NULL; |
79 | const struct firmware *firmware_fw = NULL; | 79 | const struct firmware *firmware_fw = NULL; |
80 | const struct ihex_binrec *rec; | 80 | const struct ihex_binrec *rec; |
81 | int err; | 81 | int err = -ENOMEM; |
82 | int i; | 82 | int i; |
83 | __u32 addr; /* Address to write */ | 83 | __u32 addr; /* Address to write */ |
84 | __u8 *buf; | 84 | __u8 *buf; |
85 | 85 | ||
86 | buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); | 86 | buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); |
87 | if (!buf) { | 87 | if (!buf) |
88 | dev_err(&dev->dev, "%s - error loading firmware: error = %d\n", | ||
89 | __func__, -ENOMEM); | ||
90 | err = -ENOMEM; | ||
91 | goto wraperr; | 88 | goto wraperr; |
92 | } | ||
93 | 89 | ||
94 | err = request_ihex_firmware(&loader_fw, "emi26/loader.fw", &dev->dev); | 90 | err = request_ihex_firmware(&loader_fw, "emi26/loader.fw", &dev->dev); |
95 | if (err) | 91 | if (err) |
@@ -111,11 +107,8 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
111 | 107 | ||
112 | /* Assert reset (stop the CPU in the EMI) */ | 108 | /* Assert reset (stop the CPU in the EMI) */ |
113 | err = emi26_set_reset(dev,1); | 109 | err = emi26_set_reset(dev,1); |
114 | if (err < 0) { | 110 | if (err < 0) |
115 | dev_err(&dev->dev,"%s - error loading firmware: error = %d\n", | ||
116 | __func__, err); | ||
117 | goto wraperr; | 111 | goto wraperr; |
118 | } | ||
119 | 112 | ||
120 | rec = (const struct ihex_binrec *)loader_fw->data; | 113 | rec = (const struct ihex_binrec *)loader_fw->data; |
121 | /* 1. We need to put the loader for the FPGA into the EZ-USB */ | 114 | /* 1. We need to put the loader for the FPGA into the EZ-USB */ |
@@ -123,19 +116,15 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
123 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), | 116 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), |
124 | rec->data, be16_to_cpu(rec->len), | 117 | rec->data, be16_to_cpu(rec->len), |
125 | ANCHOR_LOAD_INTERNAL); | 118 | ANCHOR_LOAD_INTERNAL); |
126 | if (err < 0) { | 119 | if (err < 0) |
127 | err("%s - error loading firmware: error = %d", __func__, err); | ||
128 | goto wraperr; | 120 | goto wraperr; |
129 | } | ||
130 | rec = ihex_next_binrec(rec); | 121 | rec = ihex_next_binrec(rec); |
131 | } | 122 | } |
132 | 123 | ||
133 | /* De-assert reset (let the CPU run) */ | 124 | /* De-assert reset (let the CPU run) */ |
134 | err = emi26_set_reset(dev,0); | 125 | err = emi26_set_reset(dev,0); |
135 | if (err < 0) { | 126 | if (err < 0) |
136 | err("%s - error loading firmware: error = %d", __func__, err); | ||
137 | goto wraperr; | 127 | goto wraperr; |
138 | } | ||
139 | msleep(250); /* let device settle */ | 128 | msleep(250); /* let device settle */ |
140 | 129 | ||
141 | /* 2. We upload the FPGA firmware into the EMI | 130 | /* 2. We upload the FPGA firmware into the EMI |
@@ -153,18 +142,14 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
153 | rec = ihex_next_binrec(rec); | 142 | rec = ihex_next_binrec(rec); |
154 | } | 143 | } |
155 | err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); | 144 | err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); |
156 | if (err < 0) { | 145 | if (err < 0) |
157 | err("%s - error loading firmware: error = %d", __func__, err); | ||
158 | goto wraperr; | 146 | goto wraperr; |
159 | } | ||
160 | } while (rec); | 147 | } while (rec); |
161 | 148 | ||
162 | /* Assert reset (stop the CPU in the EMI) */ | 149 | /* Assert reset (stop the CPU in the EMI) */ |
163 | err = emi26_set_reset(dev,1); | 150 | err = emi26_set_reset(dev,1); |
164 | if (err < 0) { | 151 | if (err < 0) |
165 | err("%s - error loading firmware: error = %d", __func__, err); | ||
166 | goto wraperr; | 152 | goto wraperr; |
167 | } | ||
168 | 153 | ||
169 | /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ | 154 | /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ |
170 | for (rec = (const struct ihex_binrec *)loader_fw->data; | 155 | for (rec = (const struct ihex_binrec *)loader_fw->data; |
@@ -172,19 +157,15 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
172 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), | 157 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), |
173 | rec->data, be16_to_cpu(rec->len), | 158 | rec->data, be16_to_cpu(rec->len), |
174 | ANCHOR_LOAD_INTERNAL); | 159 | ANCHOR_LOAD_INTERNAL); |
175 | if (err < 0) { | 160 | if (err < 0) |
176 | err("%s - error loading firmware: error = %d", __func__, err); | ||
177 | goto wraperr; | 161 | goto wraperr; |
178 | } | ||
179 | } | 162 | } |
180 | msleep(250); /* let device settle */ | 163 | msleep(250); /* let device settle */ |
181 | 164 | ||
182 | /* De-assert reset (let the CPU run) */ | 165 | /* De-assert reset (let the CPU run) */ |
183 | err = emi26_set_reset(dev,0); | 166 | err = emi26_set_reset(dev,0); |
184 | if (err < 0) { | 167 | if (err < 0) |
185 | err("%s - error loading firmware: error = %d", __func__, err); | ||
186 | goto wraperr; | 168 | goto wraperr; |
187 | } | ||
188 | 169 | ||
189 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ | 170 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ |
190 | 171 | ||
@@ -194,19 +175,15 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
194 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), | 175 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), |
195 | rec->data, be16_to_cpu(rec->len), | 176 | rec->data, be16_to_cpu(rec->len), |
196 | ANCHOR_LOAD_EXTERNAL); | 177 | ANCHOR_LOAD_EXTERNAL); |
197 | if (err < 0) { | 178 | if (err < 0) |
198 | err("%s - error loading firmware: error = %d", __func__, err); | ||
199 | goto wraperr; | 179 | goto wraperr; |
200 | } | ||
201 | } | 180 | } |
202 | } | 181 | } |
203 | 182 | ||
204 | /* Assert reset (stop the CPU in the EMI) */ | 183 | /* Assert reset (stop the CPU in the EMI) */ |
205 | err = emi26_set_reset(dev,1); | 184 | err = emi26_set_reset(dev,1); |
206 | if (err < 0) { | 185 | if (err < 0) |
207 | err("%s - error loading firmware: error = %d", __func__, err); | ||
208 | goto wraperr; | 186 | goto wraperr; |
209 | } | ||
210 | 187 | ||
211 | for (rec = (const struct ihex_binrec *)firmware_fw->data; | 188 | for (rec = (const struct ihex_binrec *)firmware_fw->data; |
212 | rec; rec = ihex_next_binrec(rec)) { | 189 | rec; rec = ihex_next_binrec(rec)) { |
@@ -214,19 +191,15 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
214 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), | 191 | err = emi26_writememory(dev, be32_to_cpu(rec->addr), |
215 | rec->data, be16_to_cpu(rec->len), | 192 | rec->data, be16_to_cpu(rec->len), |
216 | ANCHOR_LOAD_INTERNAL); | 193 | ANCHOR_LOAD_INTERNAL); |
217 | if (err < 0) { | 194 | if (err < 0) |
218 | err("%s - error loading firmware: error = %d", __func__, err); | ||
219 | goto wraperr; | 195 | goto wraperr; |
220 | } | ||
221 | } | 196 | } |
222 | } | 197 | } |
223 | 198 | ||
224 | /* De-assert reset (let the CPU run) */ | 199 | /* De-assert reset (let the CPU run) */ |
225 | err = emi26_set_reset(dev,0); | 200 | err = emi26_set_reset(dev,0); |
226 | if (err < 0) { | 201 | if (err < 0) |
227 | err("%s - error loading firmware: error = %d", __func__, err); | ||
228 | goto wraperr; | 202 | goto wraperr; |
229 | } | ||
230 | msleep(250); /* let device settle */ | 203 | msleep(250); /* let device settle */ |
231 | 204 | ||
232 | /* return 1 to fail the driver inialization | 205 | /* return 1 to fail the driver inialization |
@@ -234,6 +207,10 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
234 | err = 1; | 207 | err = 1; |
235 | 208 | ||
236 | wraperr: | 209 | wraperr: |
210 | if (err < 0) | ||
211 | dev_err(&dev->dev,"%s - error loading firmware: error = %d\n", | ||
212 | __func__, err); | ||
213 | |||
237 | release_firmware(loader_fw); | 214 | release_firmware(loader_fw); |
238 | release_firmware(bitstream_fw); | 215 | release_firmware(bitstream_fw); |
239 | release_firmware(firmware_fw); | 216 | release_firmware(firmware_fw); |
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index 4e0f167a6c4e..ff08015b230c 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c | |||
@@ -56,7 +56,7 @@ static int emi62_writememory(struct usb_device *dev, int address, | |||
56 | unsigned char *buffer = kmemdup(data, length, GFP_KERNEL); | 56 | unsigned char *buffer = kmemdup(data, length, GFP_KERNEL); |
57 | 57 | ||
58 | if (!buffer) { | 58 | if (!buffer) { |
59 | err("emi62: kmalloc(%d) failed.", length); | 59 | dev_err(&dev->dev, "kmalloc(%d) failed.\n", length); |
60 | return -ENOMEM; | 60 | return -ENOMEM; |
61 | } | 61 | } |
62 | /* Note: usb_control_msg returns negative value on error or length of the | 62 | /* Note: usb_control_msg returns negative value on error or length of the |
@@ -73,9 +73,8 @@ static int emi62_set_reset (struct usb_device *dev, unsigned char reset_bit) | |||
73 | dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit); | 73 | dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit); |
74 | 74 | ||
75 | response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); | 75 | response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); |
76 | if (response < 0) { | 76 | if (response < 0) |
77 | err("emi62: set_reset (%d) failed", reset_bit); | 77 | dev_err(&dev->dev, "set_reset (%d) failed\n", reset_bit); |
78 | } | ||
79 | return response; | 78 | return response; |
80 | } | 79 | } |
81 | 80 | ||
@@ -87,18 +86,15 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
87 | const struct firmware *bitstream_fw = NULL; | 86 | const struct firmware *bitstream_fw = NULL; |
88 | const struct firmware *firmware_fw = NULL; | 87 | const struct firmware *firmware_fw = NULL; |
89 | const struct ihex_binrec *rec; | 88 | const struct ihex_binrec *rec; |
90 | int err; | 89 | int err = -ENOMEM; |
91 | int i; | 90 | int i; |
92 | __u32 addr; /* Address to write */ | 91 | __u32 addr; /* Address to write */ |
93 | __u8 *buf; | 92 | __u8 *buf; |
94 | 93 | ||
95 | dev_dbg(&dev->dev, "load_firmware\n"); | 94 | dev_dbg(&dev->dev, "load_firmware\n"); |
96 | buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); | 95 | buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); |
97 | if (!buf) { | 96 | if (!buf) |
98 | err( "%s - error loading firmware: error = %d", __func__, -ENOMEM); | ||
99 | err = -ENOMEM; | ||
100 | goto wraperr; | 97 | goto wraperr; |
101 | } | ||
102 | 98 | ||
103 | err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev); | 99 | err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev); |
104 | if (err) | 100 | if (err) |
@@ -112,16 +108,13 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
112 | err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev); | 108 | err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev); |
113 | if (err) { | 109 | if (err) { |
114 | nofw: | 110 | nofw: |
115 | err( "%s - request_firmware() failed", __func__); | ||
116 | goto wraperr; | 111 | goto wraperr; |
117 | } | 112 | } |
118 | 113 | ||
119 | /* Assert reset (stop the CPU in the EMI) */ | 114 | /* Assert reset (stop the CPU in the EMI) */ |
120 | err = emi62_set_reset(dev,1); | 115 | err = emi62_set_reset(dev,1); |
121 | if (err < 0) { | 116 | if (err < 0) |
122 | err("%s - error loading firmware: error = %d", __func__, err); | ||
123 | goto wraperr; | 117 | goto wraperr; |
124 | } | ||
125 | 118 | ||
126 | rec = (const struct ihex_binrec *)loader_fw->data; | 119 | rec = (const struct ihex_binrec *)loader_fw->data; |
127 | 120 | ||
@@ -130,19 +123,15 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
130 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), | 123 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), |
131 | rec->data, be16_to_cpu(rec->len), | 124 | rec->data, be16_to_cpu(rec->len), |
132 | ANCHOR_LOAD_INTERNAL); | 125 | ANCHOR_LOAD_INTERNAL); |
133 | if (err < 0) { | 126 | if (err < 0) |
134 | err("%s - error loading firmware: error = %d", __func__, err); | ||
135 | goto wraperr; | 127 | goto wraperr; |
136 | } | ||
137 | rec = ihex_next_binrec(rec); | 128 | rec = ihex_next_binrec(rec); |
138 | } | 129 | } |
139 | 130 | ||
140 | /* De-assert reset (let the CPU run) */ | 131 | /* De-assert reset (let the CPU run) */ |
141 | err = emi62_set_reset(dev,0); | 132 | err = emi62_set_reset(dev,0); |
142 | if (err < 0) { | 133 | if (err < 0) |
143 | err("%s - error loading firmware: error = %d", __func__, err); | ||
144 | goto wraperr; | 134 | goto wraperr; |
145 | } | ||
146 | msleep(250); /* let device settle */ | 135 | msleep(250); /* let device settle */ |
147 | 136 | ||
148 | /* 2. We upload the FPGA firmware into the EMI | 137 | /* 2. We upload the FPGA firmware into the EMI |
@@ -160,18 +149,14 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
160 | rec = ihex_next_binrec(rec); | 149 | rec = ihex_next_binrec(rec); |
161 | } | 150 | } |
162 | err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); | 151 | err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); |
163 | if (err < 0) { | 152 | if (err < 0) |
164 | err("%s - error loading firmware: error = %d", __func__, err); | ||
165 | goto wraperr; | 153 | goto wraperr; |
166 | } | ||
167 | } while (rec); | 154 | } while (rec); |
168 | 155 | ||
169 | /* Assert reset (stop the CPU in the EMI) */ | 156 | /* Assert reset (stop the CPU in the EMI) */ |
170 | err = emi62_set_reset(dev,1); | 157 | err = emi62_set_reset(dev,1); |
171 | if (err < 0) { | 158 | if (err < 0) |
172 | err("%s - error loading firmware: error = %d", __func__, err); | ||
173 | goto wraperr; | 159 | goto wraperr; |
174 | } | ||
175 | 160 | ||
176 | /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ | 161 | /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ |
177 | for (rec = (const struct ihex_binrec *)loader_fw->data; | 162 | for (rec = (const struct ihex_binrec *)loader_fw->data; |
@@ -179,18 +164,14 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
179 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), | 164 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), |
180 | rec->data, be16_to_cpu(rec->len), | 165 | rec->data, be16_to_cpu(rec->len), |
181 | ANCHOR_LOAD_INTERNAL); | 166 | ANCHOR_LOAD_INTERNAL); |
182 | if (err < 0) { | 167 | if (err < 0) |
183 | err("%s - error loading firmware: error = %d", __func__, err); | ||
184 | goto wraperr; | 168 | goto wraperr; |
185 | } | ||
186 | } | 169 | } |
187 | 170 | ||
188 | /* De-assert reset (let the CPU run) */ | 171 | /* De-assert reset (let the CPU run) */ |
189 | err = emi62_set_reset(dev,0); | 172 | err = emi62_set_reset(dev,0); |
190 | if (err < 0) { | 173 | if (err < 0) |
191 | err("%s - error loading firmware: error = %d", __func__, err); | ||
192 | goto wraperr; | 174 | goto wraperr; |
193 | } | ||
194 | msleep(250); /* let device settle */ | 175 | msleep(250); /* let device settle */ |
195 | 176 | ||
196 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ | 177 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ |
@@ -201,19 +182,15 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
201 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), | 182 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), |
202 | rec->data, be16_to_cpu(rec->len), | 183 | rec->data, be16_to_cpu(rec->len), |
203 | ANCHOR_LOAD_EXTERNAL); | 184 | ANCHOR_LOAD_EXTERNAL); |
204 | if (err < 0) { | 185 | if (err < 0) |
205 | err("%s - error loading firmware: error = %d", __func__, err); | ||
206 | goto wraperr; | 186 | goto wraperr; |
207 | } | ||
208 | } | 187 | } |
209 | } | 188 | } |
210 | 189 | ||
211 | /* Assert reset (stop the CPU in the EMI) */ | 190 | /* Assert reset (stop the CPU in the EMI) */ |
212 | err = emi62_set_reset(dev,1); | 191 | err = emi62_set_reset(dev,1); |
213 | if (err < 0) { | 192 | if (err < 0) |
214 | err("%s - error loading firmware: error = %d", __func__, err); | ||
215 | goto wraperr; | 193 | goto wraperr; |
216 | } | ||
217 | 194 | ||
218 | for (rec = (const struct ihex_binrec *)firmware_fw->data; | 195 | for (rec = (const struct ihex_binrec *)firmware_fw->data; |
219 | rec; rec = ihex_next_binrec(rec)) { | 196 | rec; rec = ihex_next_binrec(rec)) { |
@@ -221,19 +198,15 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
221 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), | 198 | err = emi62_writememory(dev, be32_to_cpu(rec->addr), |
222 | rec->data, be16_to_cpu(rec->len), | 199 | rec->data, be16_to_cpu(rec->len), |
223 | ANCHOR_LOAD_EXTERNAL); | 200 | ANCHOR_LOAD_EXTERNAL); |
224 | if (err < 0) { | 201 | if (err < 0) |
225 | err("%s - error loading firmware: error = %d", __func__, err); | ||
226 | goto wraperr; | 202 | goto wraperr; |
227 | } | ||
228 | } | 203 | } |
229 | } | 204 | } |
230 | 205 | ||
231 | /* De-assert reset (let the CPU run) */ | 206 | /* De-assert reset (let the CPU run) */ |
232 | err = emi62_set_reset(dev,0); | 207 | err = emi62_set_reset(dev,0); |
233 | if (err < 0) { | 208 | if (err < 0) |
234 | err("%s - error loading firmware: error = %d", __func__, err); | ||
235 | goto wraperr; | 209 | goto wraperr; |
236 | } | ||
237 | msleep(250); /* let device settle */ | 210 | msleep(250); /* let device settle */ |
238 | 211 | ||
239 | release_firmware(loader_fw); | 212 | release_firmware(loader_fw); |
@@ -247,6 +220,9 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
247 | return 1; | 220 | return 1; |
248 | 221 | ||
249 | wraperr: | 222 | wraperr: |
223 | if (err < 0) | ||
224 | dev_err(&dev->dev,"%s - error loading firmware: error = %d\n", | ||
225 | __func__, err); | ||
250 | release_firmware(loader_fw); | 226 | release_firmware(loader_fw); |
251 | release_firmware(bitstream_fw); | 227 | release_firmware(bitstream_fw); |
252 | release_firmware(firmware_fw); | 228 | release_firmware(firmware_fw); |
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 0dee24698504..c00fcd74d39d 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c | |||
@@ -366,14 +366,14 @@ static int idmouse_probe(struct usb_interface *interface, | |||
366 | kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL); | 366 | kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL); |
367 | 367 | ||
368 | if (!dev->bulk_in_buffer) { | 368 | if (!dev->bulk_in_buffer) { |
369 | err("Unable to allocate input buffer."); | 369 | dev_err(&interface->dev, "Unable to allocate input buffer.\n"); |
370 | idmouse_delete(dev); | 370 | idmouse_delete(dev); |
371 | return -ENOMEM; | 371 | return -ENOMEM; |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | if (!(dev->bulk_in_endpointAddr)) { | 375 | if (!(dev->bulk_in_endpointAddr)) { |
376 | err("Unable to find bulk-in endpoint."); | 376 | dev_err(&interface->dev, "Unable to find bulk-in endpoint.\n"); |
377 | idmouse_delete(dev); | 377 | idmouse_delete(dev); |
378 | return -ENODEV; | 378 | return -ENODEV; |
379 | } | 379 | } |
@@ -385,7 +385,7 @@ static int idmouse_probe(struct usb_interface *interface, | |||
385 | result = usb_register_dev(interface, &idmouse_class); | 385 | result = usb_register_dev(interface, &idmouse_class); |
386 | if (result) { | 386 | if (result) { |
387 | /* something prevented us from registering this device */ | 387 | /* something prevented us from registering this device */ |
388 | err("Unble to allocate minor number."); | 388 | dev_err(&interface->dev, "Unble to allocate minor number.\n"); |
389 | usb_set_intfdata(interface, NULL); | 389 | usb_set_intfdata(interface, NULL); |
390 | idmouse_delete(dev); | 390 | idmouse_delete(dev); |
391 | return result; | 391 | return result; |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 4fd0dc835ae5..db46143c67a6 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -610,8 +610,8 @@ static int iowarrior_open(struct inode *inode, struct file *file) | |||
610 | interface = usb_find_interface(&iowarrior_driver, subminor); | 610 | interface = usb_find_interface(&iowarrior_driver, subminor); |
611 | if (!interface) { | 611 | if (!interface) { |
612 | mutex_unlock(&iowarrior_mutex); | 612 | mutex_unlock(&iowarrior_mutex); |
613 | err("%s - error, can't find device for minor %d", __func__, | 613 | printk(KERN_ERR "%s - error, can't find device for minor %d\n", |
614 | subminor); | 614 | __func__, subminor); |
615 | return -ENODEV; | 615 | return -ENODEV; |
616 | } | 616 | } |
617 | 617 | ||
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 5db4ab52061e..ac762299eaa8 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
@@ -334,8 +334,8 @@ static int ld_usb_open(struct inode *inode, struct file *file) | |||
334 | interface = usb_find_interface(&ld_usb_driver, subminor); | 334 | interface = usb_find_interface(&ld_usb_driver, subminor); |
335 | 335 | ||
336 | if (!interface) { | 336 | if (!interface) { |
337 | err("%s - error, can't find device for minor %d\n", | 337 | printk(KERN_ERR "%s - error, can't find device for minor %d\n", |
338 | __func__, subminor); | 338 | __func__, subminor); |
339 | return -ENODEV; | 339 | return -ENODEV; |
340 | } | 340 | } |
341 | 341 | ||
@@ -485,7 +485,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, | |||
485 | /* verify that the device wasn't unplugged */ | 485 | /* verify that the device wasn't unplugged */ |
486 | if (dev->intf == NULL) { | 486 | if (dev->intf == NULL) { |
487 | retval = -ENODEV; | 487 | retval = -ENODEV; |
488 | err("No device or device unplugged %d\n", retval); | 488 | printk(KERN_ERR "ldusb: No device or device unplugged %d\n", retval); |
489 | goto unlock_exit; | 489 | goto unlock_exit; |
490 | } | 490 | } |
491 | 491 | ||
@@ -565,7 +565,7 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, | |||
565 | /* verify that the device wasn't unplugged */ | 565 | /* verify that the device wasn't unplugged */ |
566 | if (dev->intf == NULL) { | 566 | if (dev->intf == NULL) { |
567 | retval = -ENODEV; | 567 | retval = -ENODEV; |
568 | err("No device or device unplugged %d\n", retval); | 568 | printk(KERN_ERR "ldusb: No device or device unplugged %d\n", retval); |
569 | goto unlock_exit; | 569 | goto unlock_exit; |
570 | } | 570 | } |
571 | 571 | ||
@@ -603,7 +603,9 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, | |||
603 | bytes_to_write, | 603 | bytes_to_write, |
604 | USB_CTRL_SET_TIMEOUT * HZ); | 604 | USB_CTRL_SET_TIMEOUT * HZ); |
605 | if (retval < 0) | 605 | if (retval < 0) |
606 | err("Couldn't submit HID_REQ_SET_REPORT %d\n", retval); | 606 | dev_err(&dev->intf->dev, |
607 | "Couldn't submit HID_REQ_SET_REPORT %d\n", | ||
608 | retval); | ||
607 | goto unlock_exit; | 609 | goto unlock_exit; |
608 | } | 610 | } |
609 | 611 | ||
@@ -624,7 +626,8 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, | |||
624 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | 626 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); |
625 | if (retval) { | 627 | if (retval) { |
626 | dev->interrupt_out_busy = 0; | 628 | dev->interrupt_out_busy = 0; |
627 | err("Couldn't submit interrupt_out_urb %d\n", retval); | 629 | dev_err(&dev->intf->dev, |
630 | "Couldn't submit interrupt_out_urb %d\n", retval); | ||
628 | goto unlock_exit; | 631 | goto unlock_exit; |
629 | } | 632 | } |
630 | retval = bytes_to_write; | 633 | retval = bytes_to_write; |
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 575222042767..a2702cbfe804 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -354,8 +354,8 @@ static int tower_open (struct inode *inode, struct file *file) | |||
354 | interface = usb_find_interface (&tower_driver, subminor); | 354 | interface = usb_find_interface (&tower_driver, subminor); |
355 | 355 | ||
356 | if (!interface) { | 356 | if (!interface) { |
357 | err ("%s - error, can't find device for minor %d", | 357 | printk(KERN_ERR "%s - error, can't find device for minor %d\n", |
358 | __func__, subminor); | 358 | __func__, subminor); |
359 | retval = -ENODEV; | 359 | retval = -ENODEV; |
360 | goto exit; | 360 | goto exit; |
361 | } | 361 | } |
@@ -397,7 +397,8 @@ static int tower_open (struct inode *inode, struct file *file) | |||
397 | sizeof(reset_reply), | 397 | sizeof(reset_reply), |
398 | 1000); | 398 | 1000); |
399 | if (result < 0) { | 399 | if (result < 0) { |
400 | err("LEGO USB Tower reset control request failed"); | 400 | dev_err(&dev->udev->dev, |
401 | "LEGO USB Tower reset control request failed\n"); | ||
401 | retval = result; | 402 | retval = result; |
402 | goto unlock_exit; | 403 | goto unlock_exit; |
403 | } | 404 | } |
@@ -420,7 +421,8 @@ static int tower_open (struct inode *inode, struct file *file) | |||
420 | 421 | ||
421 | retval = usb_submit_urb (dev->interrupt_in_urb, GFP_KERNEL); | 422 | retval = usb_submit_urb (dev->interrupt_in_urb, GFP_KERNEL); |
422 | if (retval) { | 423 | if (retval) { |
423 | err("Couldn't submit interrupt_in_urb %d", retval); | 424 | dev_err(&dev->udev->dev, |
425 | "Couldn't submit interrupt_in_urb %d\n", retval); | ||
424 | dev->interrupt_in_running = 0; | 426 | dev->interrupt_in_running = 0; |
425 | dev->open_count = 0; | 427 | dev->open_count = 0; |
426 | goto unlock_exit; | 428 | goto unlock_exit; |
@@ -608,7 +610,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, | |||
608 | /* verify that the device wasn't unplugged */ | 610 | /* verify that the device wasn't unplugged */ |
609 | if (dev->udev == NULL) { | 611 | if (dev->udev == NULL) { |
610 | retval = -ENODEV; | 612 | retval = -ENODEV; |
611 | err("No device or device unplugged %d", retval); | 613 | printk(KERN_ERR "legousbtower: No device or device unplugged %d\n", retval); |
612 | goto unlock_exit; | 614 | goto unlock_exit; |
613 | } | 615 | } |
614 | 616 | ||
@@ -697,7 +699,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t | |||
697 | /* verify that the device wasn't unplugged */ | 699 | /* verify that the device wasn't unplugged */ |
698 | if (dev->udev == NULL) { | 700 | if (dev->udev == NULL) { |
699 | retval = -ENODEV; | 701 | retval = -ENODEV; |
700 | err("No device or device unplugged %d", retval); | 702 | printk(KERN_ERR "legousbtower: No device or device unplugged %d\n", retval); |
701 | goto unlock_exit; | 703 | goto unlock_exit; |
702 | } | 704 | } |
703 | 705 | ||
@@ -744,7 +746,8 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t | |||
744 | retval = usb_submit_urb (dev->interrupt_out_urb, GFP_KERNEL); | 746 | retval = usb_submit_urb (dev->interrupt_out_urb, GFP_KERNEL); |
745 | if (retval) { | 747 | if (retval) { |
746 | dev->interrupt_out_busy = 0; | 748 | dev->interrupt_out_busy = 0; |
747 | err("Couldn't submit interrupt_out_urb %d", retval); | 749 | dev_err(&dev->udev->dev, |
750 | "Couldn't submit interrupt_out_urb %d\n", retval); | ||
748 | goto unlock_exit; | 751 | goto unlock_exit; |
749 | } | 752 | } |
750 | retval = bytes_to_write; | 753 | retval = bytes_to_write; |
@@ -803,9 +806,10 @@ resubmit: | |||
803 | /* resubmit if we're still running */ | 806 | /* resubmit if we're still running */ |
804 | if (dev->interrupt_in_running && dev->udev) { | 807 | if (dev->interrupt_in_running && dev->udev) { |
805 | retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); | 808 | retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); |
806 | if (retval) { | 809 | if (retval) |
807 | err("%s: usb_submit_urb failed (%d)", __func__, retval); | 810 | dev_err(&dev->udev->dev, |
808 | } | 811 | "%s: usb_submit_urb failed (%d)\n", |
812 | __func__, retval); | ||
809 | } | 813 | } |
810 | 814 | ||
811 | exit: | 815 | exit: |
@@ -852,6 +856,7 @@ static void tower_interrupt_out_callback (struct urb *urb) | |||
852 | */ | 856 | */ |
853 | static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id) | 857 | static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id) |
854 | { | 858 | { |
859 | struct device *idev = &interface->dev; | ||
855 | struct usb_device *udev = interface_to_usbdev(interface); | 860 | struct usb_device *udev = interface_to_usbdev(interface); |
856 | struct lego_usb_tower *dev = NULL; | 861 | struct lego_usb_tower *dev = NULL; |
857 | struct usb_host_interface *iface_desc; | 862 | struct usb_host_interface *iface_desc; |
@@ -871,7 +876,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device | |||
871 | dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); | 876 | dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); |
872 | 877 | ||
873 | if (dev == NULL) { | 878 | if (dev == NULL) { |
874 | err ("Out of memory"); | 879 | dev_err(idev, "Out of memory\n"); |
875 | goto exit; | 880 | goto exit; |
876 | } | 881 | } |
877 | 882 | ||
@@ -915,37 +920,37 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device | |||
915 | } | 920 | } |
916 | } | 921 | } |
917 | if(dev->interrupt_in_endpoint == NULL) { | 922 | if(dev->interrupt_in_endpoint == NULL) { |
918 | err("interrupt in endpoint not found"); | 923 | dev_err(idev, "interrupt in endpoint not found\n"); |
919 | goto error; | 924 | goto error; |
920 | } | 925 | } |
921 | if (dev->interrupt_out_endpoint == NULL) { | 926 | if (dev->interrupt_out_endpoint == NULL) { |
922 | err("interrupt out endpoint not found"); | 927 | dev_err(idev, "interrupt out endpoint not found\n"); |
923 | goto error; | 928 | goto error; |
924 | } | 929 | } |
925 | 930 | ||
926 | dev->read_buffer = kmalloc (read_buffer_size, GFP_KERNEL); | 931 | dev->read_buffer = kmalloc (read_buffer_size, GFP_KERNEL); |
927 | if (!dev->read_buffer) { | 932 | if (!dev->read_buffer) { |
928 | err("Couldn't allocate read_buffer"); | 933 | dev_err(idev, "Couldn't allocate read_buffer\n"); |
929 | goto error; | 934 | goto error; |
930 | } | 935 | } |
931 | dev->interrupt_in_buffer = kmalloc (usb_endpoint_maxp(dev->interrupt_in_endpoint), GFP_KERNEL); | 936 | dev->interrupt_in_buffer = kmalloc (usb_endpoint_maxp(dev->interrupt_in_endpoint), GFP_KERNEL); |
932 | if (!dev->interrupt_in_buffer) { | 937 | if (!dev->interrupt_in_buffer) { |
933 | err("Couldn't allocate interrupt_in_buffer"); | 938 | dev_err(idev, "Couldn't allocate interrupt_in_buffer\n"); |
934 | goto error; | 939 | goto error; |
935 | } | 940 | } |
936 | dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); | 941 | dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); |
937 | if (!dev->interrupt_in_urb) { | 942 | if (!dev->interrupt_in_urb) { |
938 | err("Couldn't allocate interrupt_in_urb"); | 943 | dev_err(idev, "Couldn't allocate interrupt_in_urb\n"); |
939 | goto error; | 944 | goto error; |
940 | } | 945 | } |
941 | dev->interrupt_out_buffer = kmalloc (write_buffer_size, GFP_KERNEL); | 946 | dev->interrupt_out_buffer = kmalloc (write_buffer_size, GFP_KERNEL); |
942 | if (!dev->interrupt_out_buffer) { | 947 | if (!dev->interrupt_out_buffer) { |
943 | err("Couldn't allocate interrupt_out_buffer"); | 948 | dev_err(idev, "Couldn't allocate interrupt_out_buffer\n"); |
944 | goto error; | 949 | goto error; |
945 | } | 950 | } |
946 | dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); | 951 | dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); |
947 | if (!dev->interrupt_out_urb) { | 952 | if (!dev->interrupt_out_urb) { |
948 | err("Couldn't allocate interrupt_out_urb"); | 953 | dev_err(idev, "Couldn't allocate interrupt_out_urb\n"); |
949 | goto error; | 954 | goto error; |
950 | } | 955 | } |
951 | dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; | 956 | dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; |
@@ -958,7 +963,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device | |||
958 | 963 | ||
959 | if (retval) { | 964 | if (retval) { |
960 | /* something prevented us from registering this driver */ | 965 | /* something prevented us from registering this driver */ |
961 | err ("Not able to get a minor for this device."); | 966 | dev_err(idev, "Not able to get a minor for this device.\n"); |
962 | usb_set_intfdata (interface, NULL); | 967 | usb_set_intfdata (interface, NULL); |
963 | goto error; | 968 | goto error; |
964 | } | 969 | } |
@@ -980,7 +985,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device | |||
980 | sizeof(get_version_reply), | 985 | sizeof(get_version_reply), |
981 | 1000); | 986 | 1000); |
982 | if (result < 0) { | 987 | if (result < 0) { |
983 | err("LEGO USB Tower get version control request failed"); | 988 | dev_err(idev, "LEGO USB Tower get version control request failed\n"); |
984 | retval = result; | 989 | retval = result; |
985 | goto error; | 990 | goto error; |
986 | } | 991 | } |
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 487a8ce0775e..cb55dc5330df 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -171,7 +171,9 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
171 | if (result == -ETIMEDOUT) | 171 | if (result == -ETIMEDOUT) |
172 | retries--; | 172 | retries--; |
173 | else if (result < 0) { | 173 | else if (result < 0) { |
174 | err("Error executing ioctrl. code = %d", result); | 174 | dev_err(&rio->rio_dev->dev, |
175 | "Error executing ioctrl. code = %d\n", | ||
176 | result); | ||
175 | retries = 0; | 177 | retries = 0; |
176 | } else { | 178 | } else { |
177 | dbg("Executed ioctl. Result = %d (data=%02x)", | 179 | dbg("Executed ioctl. Result = %d (data=%02x)", |
@@ -238,7 +240,9 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
238 | if (result == -ETIMEDOUT) | 240 | if (result == -ETIMEDOUT) |
239 | retries--; | 241 | retries--; |
240 | else if (result < 0) { | 242 | else if (result < 0) { |
241 | err("Error executing ioctrl. code = %d", result); | 243 | dev_err(&rio->rio_dev->dev, |
244 | "Error executing ioctrl. code = %d\n", | ||
245 | result); | ||
242 | retries = 0; | 246 | retries = 0; |
243 | } else { | 247 | } else { |
244 | dbg("Executed ioctl. Result = %d", result); | 248 | dbg("Executed ioctl. Result = %d", result); |
@@ -332,7 +336,8 @@ write_rio(struct file *file, const char __user *buffer, | |||
332 | break; | 336 | break; |
333 | }; | 337 | }; |
334 | if (result) { | 338 | if (result) { |
335 | err("Write Whoops - %x", result); | 339 | dev_err(&rio->rio_dev->dev, "Write Whoops - %x\n", |
340 | result); | ||
336 | errn = -EIO; | 341 | errn = -EIO; |
337 | goto error; | 342 | goto error; |
338 | } | 343 | } |
@@ -401,7 +406,8 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
401 | } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ | 406 | } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ |
402 | if (!maxretry--) { | 407 | if (!maxretry--) { |
403 | mutex_unlock(&(rio->lock)); | 408 | mutex_unlock(&(rio->lock)); |
404 | err("read_rio: maxretry timeout"); | 409 | dev_err(&rio->rio_dev->dev, |
410 | "read_rio: maxretry timeout\n"); | ||
405 | return -ETIME; | 411 | return -ETIME; |
406 | } | 412 | } |
407 | prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); | 413 | prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); |
@@ -410,8 +416,9 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
410 | continue; | 416 | continue; |
411 | } else if (result != -EREMOTEIO) { | 417 | } else if (result != -EREMOTEIO) { |
412 | mutex_unlock(&(rio->lock)); | 418 | mutex_unlock(&(rio->lock)); |
413 | err("Read Whoops - result:%u partial:%u this_read:%u", | 419 | dev_err(&rio->rio_dev->dev, |
414 | result, partial, this_read); | 420 | "Read Whoops - result:%u partial:%u this_read:%u\n", |
421 | result, partial, this_read); | ||
415 | return -EIO; | 422 | return -EIO; |
416 | } else { | 423 | } else { |
417 | mutex_unlock(&(rio->lock)); | 424 | mutex_unlock(&(rio->lock)); |
@@ -459,21 +466,24 @@ static int probe_rio(struct usb_interface *intf, | |||
459 | 466 | ||
460 | retval = usb_register_dev(intf, &usb_rio_class); | 467 | retval = usb_register_dev(intf, &usb_rio_class); |
461 | if (retval) { | 468 | if (retval) { |
462 | err("Not able to get a minor for this device."); | 469 | dev_err(&dev->dev, |
470 | "Not able to get a minor for this device.\n"); | ||
463 | return -ENOMEM; | 471 | return -ENOMEM; |
464 | } | 472 | } |
465 | 473 | ||
466 | rio->rio_dev = dev; | 474 | rio->rio_dev = dev; |
467 | 475 | ||
468 | if (!(rio->obuf = kmalloc(OBUF_SIZE, GFP_KERNEL))) { | 476 | if (!(rio->obuf = kmalloc(OBUF_SIZE, GFP_KERNEL))) { |
469 | err("probe_rio: Not enough memory for the output buffer"); | 477 | dev_err(&dev->dev, |
478 | "probe_rio: Not enough memory for the output buffer\n"); | ||
470 | usb_deregister_dev(intf, &usb_rio_class); | 479 | usb_deregister_dev(intf, &usb_rio_class); |
471 | return -ENOMEM; | 480 | return -ENOMEM; |
472 | } | 481 | } |
473 | dbg("probe_rio: obuf address:%p", rio->obuf); | 482 | dbg("probe_rio: obuf address:%p", rio->obuf); |
474 | 483 | ||
475 | if (!(rio->ibuf = kmalloc(IBUF_SIZE, GFP_KERNEL))) { | 484 | if (!(rio->ibuf = kmalloc(IBUF_SIZE, GFP_KERNEL))) { |
476 | err("probe_rio: Not enough memory for the input buffer"); | 485 | dev_err(&dev->dev, |
486 | "probe_rio: Not enough memory for the input buffer\n"); | ||
477 | usb_deregister_dev(intf, &usb_rio_class); | 487 | usb_deregister_dev(intf, &usb_rio_class); |
478 | kfree(rio->obuf); | 488 | kfree(rio->obuf); |
479 | return -ENOMEM; | 489 | return -ENOMEM; |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index e2b4bd31c2b6..c4ef9a1d5efd 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -87,8 +87,8 @@ static int lcd_open(struct inode *inode, struct file *file) | |||
87 | interface = usb_find_interface(&lcd_driver, subminor); | 87 | interface = usb_find_interface(&lcd_driver, subminor); |
88 | if (!interface) { | 88 | if (!interface) { |
89 | mutex_unlock(&lcd_mutex); | 89 | mutex_unlock(&lcd_mutex); |
90 | err("USBLCD: %s - error, can't find device for minor %d", | 90 | printk(KERN_ERR "USBLCD: %s - error, can't find device for minor %d\n", |
91 | __func__, subminor); | 91 | __func__, subminor); |
92 | return -ENODEV; | 92 | return -ENODEV; |
93 | } | 93 | } |
94 | 94 | ||
@@ -268,8 +268,9 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, | |||
268 | /* send the data out the bulk port */ | 268 | /* send the data out the bulk port */ |
269 | retval = usb_submit_urb(urb, GFP_KERNEL); | 269 | retval = usb_submit_urb(urb, GFP_KERNEL); |
270 | if (retval) { | 270 | if (retval) { |
271 | err("USBLCD: %s - failed submitting write urb, error %d", | 271 | dev_err(&dev->udev->dev, |
272 | __func__, retval); | 272 | "%s - failed submitting write urb, error %d\n", |
273 | __func__, retval); | ||
273 | goto error_unanchor; | 274 | goto error_unanchor; |
274 | } | 275 | } |
275 | 276 | ||
@@ -322,7 +323,7 @@ static int lcd_probe(struct usb_interface *interface, | |||
322 | /* allocate memory for our device state and initialize it */ | 323 | /* allocate memory for our device state and initialize it */ |
323 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 324 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
324 | if (dev == NULL) { | 325 | if (dev == NULL) { |
325 | err("Out of memory"); | 326 | dev_err(&interface->dev, "Out of memory\n"); |
326 | goto error; | 327 | goto error; |
327 | } | 328 | } |
328 | kref_init(&dev->kref); | 329 | kref_init(&dev->kref); |
@@ -352,7 +353,8 @@ static int lcd_probe(struct usb_interface *interface, | |||
352 | dev->bulk_in_endpointAddr = endpoint->bEndpointAddress; | 353 | dev->bulk_in_endpointAddr = endpoint->bEndpointAddress; |
353 | dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); | 354 | dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); |
354 | if (!dev->bulk_in_buffer) { | 355 | if (!dev->bulk_in_buffer) { |
355 | err("Could not allocate bulk_in_buffer"); | 356 | dev_err(&interface->dev, |
357 | "Could not allocate bulk_in_buffer\n"); | ||
356 | goto error; | 358 | goto error; |
357 | } | 359 | } |
358 | } | 360 | } |
@@ -364,7 +366,8 @@ static int lcd_probe(struct usb_interface *interface, | |||
364 | } | 366 | } |
365 | } | 367 | } |
366 | if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) { | 368 | if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) { |
367 | err("Could not find both bulk-in and bulk-out endpoints"); | 369 | dev_err(&interface->dev, |
370 | "Could not find both bulk-in and bulk-out endpoints\n"); | ||
368 | goto error; | 371 | goto error; |
369 | } | 372 | } |
370 | 373 | ||
@@ -375,7 +378,8 @@ static int lcd_probe(struct usb_interface *interface, | |||
375 | retval = usb_register_dev(interface, &lcd_class); | 378 | retval = usb_register_dev(interface, &lcd_class); |
376 | if (retval) { | 379 | if (retval) { |
377 | /* something prevented us from registering this driver */ | 380 | /* something prevented us from registering this driver */ |
378 | err("Not able to get a minor for this device."); | 381 | dev_err(&interface->dev, |
382 | "Not able to get a minor for this device.\n"); | ||
379 | usb_set_intfdata(interface, NULL); | 383 | usb_set_intfdata(interface, NULL); |
380 | goto error; | 384 | goto error; |
381 | } | 385 | } |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 8b1d94a76914..7f64147ea229 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -118,7 +118,8 @@ static void async_complete(struct urb *urb) | |||
118 | priv = rq->priv; | 118 | priv = rq->priv; |
119 | pp = priv->pp; | 119 | pp = priv->pp; |
120 | if (status) { | 120 | if (status) { |
121 | err("async_complete: urb error %d", status); | 121 | dev_err(&urb->dev->dev, "async_complete: urb error %d\n", |
122 | status); | ||
122 | } else if (rq->dr.bRequest == 3) { | 123 | } else if (rq->dr.bRequest == 3) { |
123 | memcpy(priv->reg, rq->reg, sizeof(priv->reg)); | 124 | memcpy(priv->reg, rq->reg, sizeof(priv->reg)); |
124 | #if 0 | 125 | #if 0 |
@@ -151,7 +152,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p | |||
151 | return NULL; | 152 | return NULL; |
152 | rq = kmalloc(sizeof(struct uss720_async_request), mem_flags); | 153 | rq = kmalloc(sizeof(struct uss720_async_request), mem_flags); |
153 | if (!rq) { | 154 | if (!rq) { |
154 | err("submit_async_request out of memory"); | 155 | dev_err(&usbdev->dev, "submit_async_request out of memory\n"); |
155 | return NULL; | 156 | return NULL; |
156 | } | 157 | } |
157 | kref_init(&rq->ref_count); | 158 | kref_init(&rq->ref_count); |
@@ -162,7 +163,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p | |||
162 | rq->urb = usb_alloc_urb(0, mem_flags); | 163 | rq->urb = usb_alloc_urb(0, mem_flags); |
163 | if (!rq->urb) { | 164 | if (!rq->urb) { |
164 | kref_put(&rq->ref_count, destroy_async); | 165 | kref_put(&rq->ref_count, destroy_async); |
165 | err("submit_async_request out of memory"); | 166 | dev_err(&usbdev->dev, "submit_async_request out of memory\n"); |
166 | return NULL; | 167 | return NULL; |
167 | } | 168 | } |
168 | rq->dr.bRequestType = requesttype; | 169 | rq->dr.bRequestType = requesttype; |
@@ -182,7 +183,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p | |||
182 | if (!ret) | 183 | if (!ret) |
183 | return rq; | 184 | return rq; |
184 | destroy_async(&rq->ref_count); | 185 | destroy_async(&rq->ref_count); |
185 | err("submit_async_request submit_urb failed with %d", ret); | 186 | dev_err(&usbdev->dev, "submit_async_request submit_urb failed with %d\n", ret); |
186 | return NULL; | 187 | return NULL; |
187 | } | 188 | } |
188 | 189 | ||
@@ -217,7 +218,8 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha | |||
217 | priv = pp->private_data; | 218 | priv = pp->private_data; |
218 | rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags); | 219 | rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags); |
219 | if (!rq) { | 220 | if (!rq) { |
220 | err("get_1284_register(%u) failed", (unsigned int)reg); | 221 | dev_err(&priv->usbdev->dev, "get_1284_register(%u) failed", |
222 | (unsigned int)reg); | ||
221 | return -EIO; | 223 | return -EIO; |
222 | } | 224 | } |
223 | if (!val) { | 225 | if (!val) { |
@@ -248,7 +250,8 @@ static int set_1284_register(struct parport *pp, unsigned char reg, unsigned cha | |||
248 | priv = pp->private_data; | 250 | priv = pp->private_data; |
249 | rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags); | 251 | rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags); |
250 | if (!rq) { | 252 | if (!rq) { |
251 | err("set_1284_register(%u,%u) failed", (unsigned int)reg, (unsigned int)val); | 253 | dev_err(&priv->usbdev->dev, "set_1284_register(%u,%u) failed", |
254 | (unsigned int)reg, (unsigned int)val); | ||
252 | return -EIO; | 255 | return -EIO; |
253 | } | 256 | } |
254 | kref_put(&rq->ref_count, destroy_async); | 257 | kref_put(&rq->ref_count, destroy_async); |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 70201462e19c..1d8ad4c5b99e 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -83,7 +83,8 @@ static void yurex_control_callback(struct urb *urb) | |||
83 | int status = urb->status; | 83 | int status = urb->status; |
84 | 84 | ||
85 | if (status) { | 85 | if (status) { |
86 | err("%s - control failed: %d\n", __func__, status); | 86 | dev_err(&urb->dev->dev, "%s - control failed: %d\n", |
87 | __func__, status); | ||
87 | wake_up_interruptible(&dev->waitq); | 88 | wake_up_interruptible(&dev->waitq); |
88 | return; | 89 | return; |
89 | } | 90 | } |
@@ -137,8 +138,9 @@ static void yurex_interrupt(struct urb *urb) | |||
137 | case 0: /*success*/ | 138 | case 0: /*success*/ |
138 | break; | 139 | break; |
139 | case -EOVERFLOW: | 140 | case -EOVERFLOW: |
140 | err("%s - overflow with length %d, actual length is %d", | 141 | dev_err(&dev->interface->dev, |
141 | __func__, YUREX_BUF_SIZE, dev->urb->actual_length); | 142 | "%s - overflow with length %d, actual length is %d\n", |
143 | __func__, YUREX_BUF_SIZE, dev->urb->actual_length); | ||
142 | case -ECONNRESET: | 144 | case -ECONNRESET: |
143 | case -ENOENT: | 145 | case -ENOENT: |
144 | case -ESHUTDOWN: | 146 | case -ESHUTDOWN: |
@@ -146,7 +148,8 @@ static void yurex_interrupt(struct urb *urb) | |||
146 | /* The device is terminated, clean up */ | 148 | /* The device is terminated, clean up */ |
147 | return; | 149 | return; |
148 | default: | 150 | default: |
149 | err("%s - unknown status received: %d", __func__, status); | 151 | dev_err(&dev->interface->dev, |
152 | "%s - unknown status received: %d\n", __func__, status); | ||
150 | goto exit; | 153 | goto exit; |
151 | } | 154 | } |
152 | 155 | ||
@@ -179,7 +182,7 @@ static void yurex_interrupt(struct urb *urb) | |||
179 | exit: | 182 | exit: |
180 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 183 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
181 | if (retval) { | 184 | if (retval) { |
182 | err("%s - usb_submit_urb failed: %d", | 185 | dev_err(&dev->interface->dev, "%s - usb_submit_urb failed: %d\n", |
183 | __func__, retval); | 186 | __func__, retval); |
184 | } | 187 | } |
185 | } | 188 | } |
@@ -196,7 +199,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
196 | /* allocate memory for our device state and initialize it */ | 199 | /* allocate memory for our device state and initialize it */ |
197 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 200 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
198 | if (!dev) { | 201 | if (!dev) { |
199 | err("Out of memory"); | 202 | dev_err(&interface->dev, "Out of memory\n"); |
200 | goto error; | 203 | goto error; |
201 | } | 204 | } |
202 | kref_init(&dev->kref); | 205 | kref_init(&dev->kref); |
@@ -219,7 +222,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
219 | } | 222 | } |
220 | if (!dev->int_in_endpointAddr) { | 223 | if (!dev->int_in_endpointAddr) { |
221 | retval = -ENODEV; | 224 | retval = -ENODEV; |
222 | err("Could not find endpoints"); | 225 | dev_err(&interface->dev, "Could not find endpoints\n"); |
223 | goto error; | 226 | goto error; |
224 | } | 227 | } |
225 | 228 | ||
@@ -227,14 +230,14 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
227 | /* allocate control URB */ | 230 | /* allocate control URB */ |
228 | dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL); | 231 | dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL); |
229 | if (!dev->cntl_urb) { | 232 | if (!dev->cntl_urb) { |
230 | err("Could not allocate control URB"); | 233 | dev_err(&interface->dev, "Could not allocate control URB\n"); |
231 | goto error; | 234 | goto error; |
232 | } | 235 | } |
233 | 236 | ||
234 | /* allocate buffer for control req */ | 237 | /* allocate buffer for control req */ |
235 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); | 238 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); |
236 | if (!dev->cntl_req) { | 239 | if (!dev->cntl_req) { |
237 | err("Could not allocate cntl_req"); | 240 | dev_err(&interface->dev, "Could not allocate cntl_req\n"); |
238 | goto error; | 241 | goto error; |
239 | } | 242 | } |
240 | 243 | ||
@@ -243,7 +246,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
243 | GFP_KERNEL, | 246 | GFP_KERNEL, |
244 | &dev->cntl_urb->transfer_dma); | 247 | &dev->cntl_urb->transfer_dma); |
245 | if (!dev->cntl_buffer) { | 248 | if (!dev->cntl_buffer) { |
246 | err("Could not allocate cntl_buffer"); | 249 | dev_err(&interface->dev, "Could not allocate cntl_buffer\n"); |
247 | goto error; | 250 | goto error; |
248 | } | 251 | } |
249 | 252 | ||
@@ -265,7 +268,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
265 | /* allocate interrupt URB */ | 268 | /* allocate interrupt URB */ |
266 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); | 269 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); |
267 | if (!dev->urb) { | 270 | if (!dev->urb) { |
268 | err("Could not allocate URB"); | 271 | dev_err(&interface->dev, "Could not allocate URB\n"); |
269 | goto error; | 272 | goto error; |
270 | } | 273 | } |
271 | 274 | ||
@@ -273,7 +276,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
273 | dev->int_buffer = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | 276 | dev->int_buffer = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, |
274 | GFP_KERNEL, &dev->urb->transfer_dma); | 277 | GFP_KERNEL, &dev->urb->transfer_dma); |
275 | if (!dev->int_buffer) { | 278 | if (!dev->int_buffer) { |
276 | err("Could not allocate int_buffer"); | 279 | dev_err(&interface->dev, "Could not allocate int_buffer\n"); |
277 | goto error; | 280 | goto error; |
278 | } | 281 | } |
279 | 282 | ||
@@ -285,7 +288,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
285 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 288 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
286 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | 289 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { |
287 | retval = -EIO; | 290 | retval = -EIO; |
288 | err("Could not submitting URB"); | 291 | dev_err(&interface->dev, "Could not submitting URB\n"); |
289 | goto error; | 292 | goto error; |
290 | } | 293 | } |
291 | 294 | ||
@@ -295,7 +298,8 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
295 | /* we can register the device now, as it is ready */ | 298 | /* we can register the device now, as it is ready */ |
296 | retval = usb_register_dev(interface, &yurex_class); | 299 | retval = usb_register_dev(interface, &yurex_class); |
297 | if (retval) { | 300 | if (retval) { |
298 | err("Not able to get a minor for this device."); | 301 | dev_err(&interface->dev, |
302 | "Not able to get a minor for this device.\n"); | ||
299 | usb_set_intfdata(interface, NULL); | 303 | usb_set_intfdata(interface, NULL); |
300 | goto error; | 304 | goto error; |
301 | } | 305 | } |
@@ -368,8 +372,8 @@ static int yurex_open(struct inode *inode, struct file *file) | |||
368 | 372 | ||
369 | interface = usb_find_interface(&yurex_driver, subminor); | 373 | interface = usb_find_interface(&yurex_driver, subminor); |
370 | if (!interface) { | 374 | if (!interface) { |
371 | err("%s - error, can't find device for minor %d", | 375 | printk(KERN_ERR "%s - error, can't find device for minor %d", |
372 | __func__, subminor); | 376 | __func__, subminor); |
373 | retval = -ENODEV; | 377 | retval = -ENODEV; |
374 | goto exit; | 378 | goto exit; |
375 | } | 379 | } |
@@ -514,7 +518,9 @@ static ssize_t yurex_write(struct file *file, const char *user_buffer, size_t co | |||
514 | mutex_unlock(&dev->io_mutex); | 518 | mutex_unlock(&dev->io_mutex); |
515 | 519 | ||
516 | if (retval < 0) { | 520 | if (retval < 0) { |
517 | err("%s - failed to send bulk msg, error %d", __func__, retval); | 521 | dev_err(&dev->interface->dev, |
522 | "%s - failed to send bulk msg, error %d\n", | ||
523 | __func__, retval); | ||
518 | goto error; | 524 | goto error; |
519 | } | 525 | } |
520 | if (set && timeout) | 526 | if (set && timeout) |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 1ee6b2ab0f89..b9cca6dcde07 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -113,7 +113,8 @@ static int usb_console_setup(struct console *co, char *options) | |||
113 | serial = usb_serial_get_by_index(co->index); | 113 | serial = usb_serial_get_by_index(co->index); |
114 | if (serial == NULL) { | 114 | if (serial == NULL) { |
115 | /* no device is connected yet, sorry :( */ | 115 | /* no device is connected yet, sorry :( */ |
116 | err("No USB device connected to ttyUSB%i", co->index); | 116 | printk(KERN_ERR "No USB device connected to ttyUSB%i\n", |
117 | co->index); | ||
117 | return -ENODEV; | 118 | return -ENODEV; |
118 | } | 119 | } |
119 | 120 | ||
@@ -137,7 +138,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
137 | tty = kzalloc(sizeof(*tty), GFP_KERNEL); | 138 | tty = kzalloc(sizeof(*tty), GFP_KERNEL); |
138 | if (!tty) { | 139 | if (!tty) { |
139 | retval = -ENOMEM; | 140 | retval = -ENOMEM; |
140 | err("no more memory"); | 141 | dev_err(&port->dev, "no more memory\n"); |
141 | goto reset_open_count; | 142 | goto reset_open_count; |
142 | } | 143 | } |
143 | kref_init(&tty->kref); | 144 | kref_init(&tty->kref); |
@@ -146,7 +147,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
146 | tty->index = co->index; | 147 | tty->index = co->index; |
147 | if (tty_init_termios(tty)) { | 148 | if (tty_init_termios(tty)) { |
148 | retval = -ENOMEM; | 149 | retval = -ENOMEM; |
149 | err("no more memory"); | 150 | dev_err(&port->dev, "no more memory\n"); |
150 | goto free_tty; | 151 | goto free_tty; |
151 | } | 152 | } |
152 | } | 153 | } |
@@ -159,7 +160,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
159 | retval = usb_serial_generic_open(NULL, port); | 160 | retval = usb_serial_generic_open(NULL, port); |
160 | 161 | ||
161 | if (retval) { | 162 | if (retval) { |
162 | err("could not open USB console port"); | 163 | dev_err(&port->dev, "could not open USB console port\n"); |
163 | goto fail; | 164 | goto fail; |
164 | } | 165 | } |
165 | 166 | ||
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 40a95a7fe383..5e4b47194819 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -547,6 +547,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout, | |||
547 | { | 547 | { |
548 | int baud_rate; | 548 | int baud_rate; |
549 | struct tty_struct *tty = tty_port_tty_get(&port->port->port); | 549 | struct tty_struct *tty = tty_port_tty_get(&port->port->port); |
550 | struct usb_serial *serial = port->port->serial; | ||
550 | wait_queue_t wait; | 551 | wait_queue_t wait; |
551 | unsigned long flags; | 552 | unsigned long flags; |
552 | 553 | ||
@@ -561,7 +562,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout, | |||
561 | set_current_state(TASK_INTERRUPTIBLE); | 562 | set_current_state(TASK_INTERRUPTIBLE); |
562 | if (kfifo_len(&port->write_fifo) == 0 | 563 | if (kfifo_len(&port->write_fifo) == 0 |
563 | || timeout == 0 || signal_pending(current) | 564 | || timeout == 0 || signal_pending(current) |
564 | || !usb_get_intfdata(port->port->serial->interface)) | 565 | || serial->disconnected) |
565 | /* disconnect */ | 566 | /* disconnect */ |
566 | break; | 567 | break; |
567 | spin_unlock_irqrestore(&port->ep_lock, flags); | 568 | spin_unlock_irqrestore(&port->ep_lock, flags); |
@@ -578,7 +579,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout, | |||
578 | /* wait for data to drain from the device */ | 579 | /* wait for data to drain from the device */ |
579 | timeout += jiffies; | 580 | timeout += jiffies; |
580 | while ((long)(jiffies - timeout) < 0 && !signal_pending(current) | 581 | while ((long)(jiffies - timeout) < 0 && !signal_pending(current) |
581 | && usb_get_intfdata(port->port->serial->interface)) { | 582 | && !serial->disconnected) { |
582 | /* not disconnected */ | 583 | /* not disconnected */ |
583 | if (!tx_active(port)) | 584 | if (!tx_active(port)) |
584 | break; | 585 | break; |
@@ -586,7 +587,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout, | |||
586 | } | 587 | } |
587 | 588 | ||
588 | /* disconnected */ | 589 | /* disconnected */ |
589 | if (!usb_get_intfdata(port->port->serial->interface)) | 590 | if (serial->disconnected) |
590 | return; | 591 | return; |
591 | 592 | ||
592 | /* wait one more character time, based on baud rate */ | 593 | /* wait one more character time, based on baud rate */ |
@@ -2003,8 +2004,8 @@ static void edge_close(struct usb_serial_port *port) | |||
2003 | { | 2004 | { |
2004 | struct edgeport_serial *edge_serial; | 2005 | struct edgeport_serial *edge_serial; |
2005 | struct edgeport_port *edge_port; | 2006 | struct edgeport_port *edge_port; |
2007 | struct usb_serial *serial = port->serial; | ||
2006 | int port_number; | 2008 | int port_number; |
2007 | int status; | ||
2008 | 2009 | ||
2009 | dbg("%s - port %d", __func__, port->number); | 2010 | dbg("%s - port %d", __func__, port->number); |
2010 | 2011 | ||
@@ -2028,12 +2029,18 @@ static void edge_close(struct usb_serial_port *port) | |||
2028 | * send a close port command to it */ | 2029 | * send a close port command to it */ |
2029 | dbg("%s - send umpc_close_port", __func__); | 2030 | dbg("%s - send umpc_close_port", __func__); |
2030 | port_number = port->number - port->serial->minor; | 2031 | port_number = port->number - port->serial->minor; |
2031 | status = send_cmd(port->serial->dev, | 2032 | |
2033 | mutex_lock(&serial->disc_mutex); | ||
2034 | if (!serial->disconnected) { | ||
2035 | send_cmd(serial->dev, | ||
2032 | UMPC_CLOSE_PORT, | 2036 | UMPC_CLOSE_PORT, |
2033 | (__u8)(UMPM_UART1_PORT + port_number), | 2037 | (__u8)(UMPM_UART1_PORT + port_number), |
2034 | 0, | 2038 | 0, |
2035 | NULL, | 2039 | NULL, |
2036 | 0); | 2040 | 0); |
2041 | } | ||
2042 | mutex_unlock(&serial->disc_mutex); | ||
2043 | |||
2037 | mutex_lock(&edge_serial->es_lock); | 2044 | mutex_lock(&edge_serial->es_lock); |
2038 | --edge_port->edge_serial->num_ports_open; | 2045 | --edge_port->edge_serial->num_ports_open; |
2039 | if (edge_port->edge_serial->num_ports_open <= 0) { | 2046 | if (edge_port->edge_serial->num_ports_open <= 0) { |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 10c02b8b5664..61e200ffe6b4 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #define DRIVER_AUTHOR "Ganesh Varadarajan <ganesh@veritas.com>" | 33 | #define DRIVER_AUTHOR "Ganesh Varadarajan <ganesh@veritas.com>" |
34 | #define DRIVER_DESC "USB PocketPC PDA driver" | 34 | #define DRIVER_DESC "USB PocketPC PDA driver" |
35 | 35 | ||
36 | static __u16 product, vendor; | ||
37 | static bool debug; | 36 | static bool debug; |
38 | static int connect_retries = KP_RETRIES; | 37 | static int connect_retries = KP_RETRIES; |
39 | static int initial_wait; | 38 | static int initial_wait; |
@@ -45,8 +44,6 @@ static int ipaq_calc_num_ports(struct usb_serial *serial); | |||
45 | static int ipaq_startup(struct usb_serial *serial); | 44 | static int ipaq_startup(struct usb_serial *serial); |
46 | 45 | ||
47 | static struct usb_device_id ipaq_id_table [] = { | 46 | static struct usb_device_id ipaq_id_table [] = { |
48 | /* The first entry is a placeholder for the insmod-specified device */ | ||
49 | { USB_DEVICE(0x049F, 0x0003) }, | ||
50 | { USB_DEVICE(0x0104, 0x00BE) }, /* Socket USB Sync */ | 47 | { USB_DEVICE(0x0104, 0x00BE) }, /* Socket USB Sync */ |
51 | { USB_DEVICE(0x03F0, 0x1016) }, /* HP USB Sync */ | 48 | { USB_DEVICE(0x03F0, 0x1016) }, /* HP USB Sync */ |
52 | { USB_DEVICE(0x03F0, 0x1116) }, /* HP USB Sync 1611 */ | 49 | { USB_DEVICE(0x03F0, 0x1116) }, /* HP USB Sync 1611 */ |
@@ -623,30 +620,7 @@ static int ipaq_startup(struct usb_serial *serial) | |||
623 | return usb_reset_configuration(serial->dev); | 620 | return usb_reset_configuration(serial->dev); |
624 | } | 621 | } |
625 | 622 | ||
626 | static int __init ipaq_init(void) | 623 | module_usb_serial_driver(ipaq_driver, serial_drivers); |
627 | { | ||
628 | int retval; | ||
629 | |||
630 | if (vendor) { | ||
631 | ipaq_id_table[0].idVendor = vendor; | ||
632 | ipaq_id_table[0].idProduct = product; | ||
633 | } | ||
634 | |||
635 | retval = usb_serial_register_drivers(&ipaq_driver, serial_drivers); | ||
636 | if (retval == 0) | ||
637 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
638 | DRIVER_DESC "\n"); | ||
639 | return retval; | ||
640 | } | ||
641 | |||
642 | static void __exit ipaq_exit(void) | ||
643 | { | ||
644 | usb_serial_deregister_drivers(&ipaq_driver, serial_drivers); | ||
645 | } | ||
646 | |||
647 | |||
648 | module_init(ipaq_init); | ||
649 | module_exit(ipaq_exit); | ||
650 | 624 | ||
651 | MODULE_AUTHOR(DRIVER_AUTHOR); | 625 | MODULE_AUTHOR(DRIVER_AUTHOR); |
652 | MODULE_DESCRIPTION(DRIVER_DESC); | 626 | MODULE_DESCRIPTION(DRIVER_DESC); |
@@ -655,12 +629,6 @@ MODULE_LICENSE("GPL"); | |||
655 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 629 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
656 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 630 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
657 | 631 | ||
658 | module_param(vendor, ushort, 0); | ||
659 | MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | ||
660 | |||
661 | module_param(product, ushort, 0); | ||
662 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | ||
663 | |||
664 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | 632 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); |
665 | MODULE_PARM_DESC(connect_retries, | 633 | MODULE_PARM_DESC(connect_retries, |
666 | "Maximum number of connect retries (one second each)"); | 634 | "Maximum number of connect retries (one second each)"); |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 08d16e8c002d..d17c8677a293 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/tty_flip.h> | 17 | #include <linux/tty_flip.h> |
18 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/errno.h> | ||
21 | #include <linux/uaccess.h> | 20 | #include <linux/uaccess.h> |
22 | #include <linux/usb/serial.h> | 21 | #include <linux/usb/serial.h> |
23 | 22 | ||
@@ -56,6 +55,47 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
56 | /* Input parameter constants. */ | 55 | /* Input parameter constants. */ |
57 | static bool debug; | 56 | static bool debug; |
58 | 57 | ||
58 | /* UNI-Directional mode commands for device configure */ | ||
59 | #define UNI_CMD_OPEN 0x80 | ||
60 | #define UNI_CMD_CLOSE 0xFF | ||
61 | |||
62 | inline int metrousb_is_unidirectional_mode(struct usb_serial_port *port) | ||
63 | { | ||
64 | __u16 product_id = le16_to_cpu( | ||
65 | port->serial->dev->descriptor.idProduct); | ||
66 | |||
67 | return product_id == FOCUS_PRODUCT_ID_UNI; | ||
68 | } | ||
69 | |||
70 | static int metrousb_send_unidirectional_cmd(u8 cmd, struct usb_serial_port *port) | ||
71 | { | ||
72 | int ret; | ||
73 | int actual_len; | ||
74 | u8 *buffer_cmd = NULL; | ||
75 | |||
76 | if (!metrousb_is_unidirectional_mode(port)) | ||
77 | return 0; | ||
78 | |||
79 | buffer_cmd = kzalloc(sizeof(cmd), GFP_KERNEL); | ||
80 | if (!buffer_cmd) | ||
81 | return -ENOMEM; | ||
82 | |||
83 | *buffer_cmd = cmd; | ||
84 | |||
85 | ret = usb_interrupt_msg(port->serial->dev, | ||
86 | usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress), | ||
87 | buffer_cmd, sizeof(cmd), | ||
88 | &actual_len, USB_CTRL_SET_TIMEOUT); | ||
89 | |||
90 | kfree(buffer_cmd); | ||
91 | |||
92 | if (ret < 0) | ||
93 | return ret; | ||
94 | else if (actual_len != sizeof(cmd)) | ||
95 | return -EIO; | ||
96 | return 0; | ||
97 | } | ||
98 | |||
59 | static void metrousb_read_int_callback(struct urb *urb) | 99 | static void metrousb_read_int_callback(struct urb *urb) |
60 | { | 100 | { |
61 | struct usb_serial_port *port = urb->context; | 101 | struct usb_serial_port *port = urb->context; |
@@ -78,12 +118,12 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
78 | /* urb has been terminated. */ | 118 | /* urb has been terminated. */ |
79 | dev_dbg(&port->dev, | 119 | dev_dbg(&port->dev, |
80 | "%s - urb shutting down, error code=%d\n", | 120 | "%s - urb shutting down, error code=%d\n", |
81 | __func__, result); | 121 | __func__, urb->status); |
82 | return; | 122 | return; |
83 | default: | 123 | default: |
84 | dev_dbg(&port->dev, | 124 | dev_dbg(&port->dev, |
85 | "%s - non-zero urb received, error code=%d\n", | 125 | "%s - non-zero urb received, error code=%d\n", |
86 | __func__, result); | 126 | __func__, urb->status); |
87 | goto exit; | 127 | goto exit; |
88 | } | 128 | } |
89 | 129 | ||
@@ -91,7 +131,7 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
91 | /* Set the data read from the usb port into the serial port buffer. */ | 131 | /* Set the data read from the usb port into the serial port buffer. */ |
92 | tty = tty_port_tty_get(&port->port); | 132 | tty = tty_port_tty_get(&port->port); |
93 | if (!tty) { | 133 | if (!tty) { |
94 | dev_dbg(&port->dev, "%s - bad tty pointer - exiting\n", | 134 | dev_err(&port->dev, "%s - bad tty pointer - exiting\n", |
95 | __func__); | 135 | __func__); |
96 | return; | 136 | return; |
97 | } | 137 | } |
@@ -121,7 +161,7 @@ static void metrousb_read_int_callback(struct urb *urb) | |||
121 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 161 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
122 | 162 | ||
123 | if (result) | 163 | if (result) |
124 | dev_dbg(&port->dev, | 164 | dev_err(&port->dev, |
125 | "%s - failed submitting interrupt in urb, error code=%d\n", | 165 | "%s - failed submitting interrupt in urb, error code=%d\n", |
126 | __func__, result); | 166 | __func__, result); |
127 | } | 167 | } |
@@ -131,11 +171,19 @@ exit: | |||
131 | /* Try to resubmit the urb. */ | 171 | /* Try to resubmit the urb. */ |
132 | result = usb_submit_urb(urb, GFP_ATOMIC); | 172 | result = usb_submit_urb(urb, GFP_ATOMIC); |
133 | if (result) | 173 | if (result) |
134 | dev_dbg(&port->dev, | 174 | dev_err(&port->dev, |
135 | "%s - failed submitting interrupt in urb, error code=%d\n", | 175 | "%s - failed submitting interrupt in urb, error code=%d\n", |
136 | __func__, result); | 176 | __func__, result); |
137 | } | 177 | } |
138 | 178 | ||
179 | static void metrousb_write_int_callback(struct urb *urb) | ||
180 | { | ||
181 | struct usb_serial_port *port = urb->context; | ||
182 | |||
183 | dev_warn(&port->dev, "%s not implemented yet.\n", | ||
184 | __func__); | ||
185 | } | ||
186 | |||
139 | static void metrousb_cleanup(struct usb_serial_port *port) | 187 | static void metrousb_cleanup(struct usb_serial_port *port) |
140 | { | 188 | { |
141 | dev_dbg(&port->dev, "%s\n", __func__); | 189 | dev_dbg(&port->dev, "%s\n", __func__); |
@@ -146,6 +194,9 @@ static void metrousb_cleanup(struct usb_serial_port *port) | |||
146 | usb_unlink_urb(port->interrupt_in_urb); | 194 | usb_unlink_urb(port->interrupt_in_urb); |
147 | usb_kill_urb(port->interrupt_in_urb); | 195 | usb_kill_urb(port->interrupt_in_urb); |
148 | } | 196 | } |
197 | |||
198 | /* Send deactivate cmd to device */ | ||
199 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); | ||
149 | } | 200 | } |
150 | } | 201 | } |
151 | 202 | ||
@@ -160,7 +211,7 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
160 | 211 | ||
161 | /* Make sure the urb is initialized. */ | 212 | /* Make sure the urb is initialized. */ |
162 | if (!port->interrupt_in_urb) { | 213 | if (!port->interrupt_in_urb) { |
163 | dev_dbg(&port->dev, "%s - interrupt urb not initialized\n", | 214 | dev_err(&port->dev, "%s - interrupt urb not initialized\n", |
164 | __func__); | 215 | __func__); |
165 | return -ENODEV; | 216 | return -ENODEV; |
166 | } | 217 | } |
@@ -191,12 +242,21 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
191 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 242 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
192 | 243 | ||
193 | if (result) { | 244 | if (result) { |
194 | dev_dbg(&port->dev, | 245 | dev_err(&port->dev, |
195 | "%s - failed submitting interrupt in urb, error code=%d\n", | 246 | "%s - failed submitting interrupt in urb, error code=%d\n", |
196 | __func__, result); | 247 | __func__, result); |
197 | goto exit; | 248 | goto exit; |
198 | } | 249 | } |
199 | 250 | ||
251 | /* Send activate cmd to device */ | ||
252 | result = metrousb_send_unidirectional_cmd(UNI_CMD_OPEN, port); | ||
253 | if (result) { | ||
254 | dev_err(&port->dev, | ||
255 | "%s - failed to configure device for port number=%d, error code=%d\n", | ||
256 | __func__, port->number, result); | ||
257 | goto exit; | ||
258 | } | ||
259 | |||
200 | dev_dbg(&port->dev, "%s - port open\n", __func__); | 260 | dev_dbg(&port->dev, "%s - port open\n", __func__); |
201 | exit: | 261 | exit: |
202 | return result; | 262 | return result; |
@@ -221,7 +281,7 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
221 | METROUSB_SET_REQUEST_TYPE, METROUSB_SET_MODEM_CTRL_REQUEST, | 281 | METROUSB_SET_REQUEST_TYPE, METROUSB_SET_MODEM_CTRL_REQUEST, |
222 | control_state, 0, NULL, 0, WDR_TIMEOUT); | 282 | control_state, 0, NULL, 0, WDR_TIMEOUT); |
223 | if (retval < 0) | 283 | if (retval < 0) |
224 | dev_dbg(&serial->dev->dev, | 284 | dev_err(&serial->dev->dev, |
225 | "%s - set modem ctrl=0x%x failed, error code=%d\n", | 285 | "%s - set modem ctrl=0x%x failed, error code=%d\n", |
226 | __func__, mcr, retval); | 286 | __func__, mcr, retval); |
227 | 287 | ||
@@ -354,7 +414,7 @@ static void metrousb_unthrottle(struct tty_struct *tty) | |||
354 | port->interrupt_in_urb->dev = port->serial->dev; | 414 | port->interrupt_in_urb->dev = port->serial->dev; |
355 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 415 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
356 | if (result) | 416 | if (result) |
357 | dev_dbg(tty->dev, | 417 | dev_err(tty->dev, |
358 | "failed submitting interrupt in urb error code=%d\n", | 418 | "failed submitting interrupt in urb error code=%d\n", |
359 | result); | 419 | result); |
360 | } | 420 | } |
@@ -371,12 +431,13 @@ static struct usb_serial_driver metrousb_device = { | |||
371 | .owner = THIS_MODULE, | 431 | .owner = THIS_MODULE, |
372 | .name = "metro-usb", | 432 | .name = "metro-usb", |
373 | }, | 433 | }, |
374 | .description = "Metrologic USB to serial converter.", | 434 | .description = "Metrologic USB to Serial", |
375 | .id_table = id_table, | 435 | .id_table = id_table, |
376 | .num_ports = 1, | 436 | .num_ports = 1, |
377 | .open = metrousb_open, | 437 | .open = metrousb_open, |
378 | .close = metrousb_cleanup, | 438 | .close = metrousb_cleanup, |
379 | .read_int_callback = metrousb_read_int_callback, | 439 | .read_int_callback = metrousb_read_int_callback, |
440 | .write_int_callback = metrousb_write_int_callback, | ||
380 | .attach = metrousb_startup, | 441 | .attach = metrousb_startup, |
381 | .release = metrousb_shutdown, | 442 | .release = metrousb_shutdown, |
382 | .throttle = metrousb_throttle, | 443 | .throttle = metrousb_throttle, |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index c526550694a0..aaef523955e0 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -114,6 +114,7 @@ | |||
114 | #define USB_VENDOR_ID_MOSCHIP 0x9710 | 114 | #define USB_VENDOR_ID_MOSCHIP 0x9710 |
115 | #define MOSCHIP_DEVICE_ID_7840 0x7840 | 115 | #define MOSCHIP_DEVICE_ID_7840 0x7840 |
116 | #define MOSCHIP_DEVICE_ID_7820 0x7820 | 116 | #define MOSCHIP_DEVICE_ID_7820 0x7820 |
117 | #define MOSCHIP_DEVICE_ID_7810 0x7810 | ||
117 | /* The native component can have its vendor/device id's overridden | 118 | /* The native component can have its vendor/device id's overridden |
118 | * in vendor-specific implementations. Such devices can be handled | 119 | * in vendor-specific implementations. Such devices can be handled |
119 | * by making a change here, in moschip_port_id_table, and in | 120 | * by making a change here, in moschip_port_id_table, and in |
@@ -184,10 +185,16 @@ | |||
184 | #define NUM_URBS 16 /* URB Count */ | 185 | #define NUM_URBS 16 /* URB Count */ |
185 | #define URB_TRANSFER_BUFFER_SIZE 32 /* URB Size */ | 186 | #define URB_TRANSFER_BUFFER_SIZE 32 /* URB Size */ |
186 | 187 | ||
188 | /* LED on/off milliseconds*/ | ||
189 | #define LED_ON_MS 500 | ||
190 | #define LED_OFF_MS 500 | ||
191 | |||
192 | static int device_type; | ||
187 | 193 | ||
188 | static const struct usb_device_id moschip_port_id_table[] = { | 194 | static const struct usb_device_id moschip_port_id_table[] = { |
189 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, | 195 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
190 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, | 196 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
197 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)}, | ||
191 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, | 198 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, |
192 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, | 199 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, |
193 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, | 200 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, |
@@ -209,6 +216,7 @@ static const struct usb_device_id moschip_port_id_table[] = { | |||
209 | static const struct usb_device_id moschip_id_table_combined[] __devinitconst = { | 216 | static const struct usb_device_id moschip_id_table_combined[] __devinitconst = { |
210 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, | 217 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
211 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, | 218 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
219 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)}, | ||
212 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, | 220 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, |
213 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, | 221 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, |
214 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, | 222 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, |
@@ -261,8 +269,13 @@ struct moschip_port { | |||
261 | struct urb *write_urb_pool[NUM_URBS]; | 269 | struct urb *write_urb_pool[NUM_URBS]; |
262 | char busy[NUM_URBS]; | 270 | char busy[NUM_URBS]; |
263 | bool read_urb_busy; | 271 | bool read_urb_busy; |
264 | }; | ||
265 | 272 | ||
273 | /* For device(s) with LED indicator */ | ||
274 | bool has_led; | ||
275 | bool led_flag; | ||
276 | struct timer_list led_timer1; /* Timer for LED on */ | ||
277 | struct timer_list led_timer2; /* Timer for LED off */ | ||
278 | }; | ||
266 | 279 | ||
267 | static bool debug; | 280 | static bool debug; |
268 | 281 | ||
@@ -572,6 +585,69 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | |||
572 | return ret; | 585 | return ret; |
573 | } | 586 | } |
574 | 587 | ||
588 | static void mos7840_set_led_callback(struct urb *urb) | ||
589 | { | ||
590 | switch (urb->status) { | ||
591 | case 0: | ||
592 | /* Success */ | ||
593 | break; | ||
594 | case -ECONNRESET: | ||
595 | case -ENOENT: | ||
596 | case -ESHUTDOWN: | ||
597 | /* This urb is terminated, clean up */ | ||
598 | dbg("%s - urb shutting down with status: %d", __func__, | ||
599 | urb->status); | ||
600 | break; | ||
601 | default: | ||
602 | dbg("%s - nonzero urb status received: %d", __func__, | ||
603 | urb->status); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, | ||
608 | __u16 reg) | ||
609 | { | ||
610 | struct usb_device *dev = mcs->port->serial->dev; | ||
611 | struct usb_ctrlrequest *dr = mcs->dr; | ||
612 | |||
613 | dr->bRequestType = MCS_WR_RTYPE; | ||
614 | dr->bRequest = MCS_WRREQ; | ||
615 | dr->wValue = cpu_to_le16(wval); | ||
616 | dr->wIndex = cpu_to_le16(reg); | ||
617 | dr->wLength = cpu_to_le16(0); | ||
618 | |||
619 | usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0), | ||
620 | (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); | ||
621 | |||
622 | usb_submit_urb(mcs->control_urb, GFP_ATOMIC); | ||
623 | } | ||
624 | |||
625 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, | ||
626 | __u16 val) | ||
627 | { | ||
628 | struct usb_device *dev = port->serial->dev; | ||
629 | |||
630 | usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, MCS_WR_RTYPE, | ||
631 | val, reg, NULL, 0, MOS_WDR_TIMEOUT); | ||
632 | } | ||
633 | |||
634 | static void mos7840_led_off(unsigned long arg) | ||
635 | { | ||
636 | struct moschip_port *mcs = (struct moschip_port *) arg; | ||
637 | |||
638 | /* Turn off LED */ | ||
639 | mos7840_set_led_async(mcs, 0x0300, MODEM_CONTROL_REGISTER); | ||
640 | mod_timer(&mcs->led_timer2, | ||
641 | jiffies + msecs_to_jiffies(LED_OFF_MS)); | ||
642 | } | ||
643 | |||
644 | static void mos7840_led_flag_off(unsigned long arg) | ||
645 | { | ||
646 | struct moschip_port *mcs = (struct moschip_port *) arg; | ||
647 | |||
648 | mcs->led_flag = false; | ||
649 | } | ||
650 | |||
575 | /***************************************************************************** | 651 | /***************************************************************************** |
576 | * mos7840_interrupt_callback | 652 | * mos7840_interrupt_callback |
577 | * this is the callback function for when we have received data on the | 653 | * this is the callback function for when we have received data on the |
@@ -792,6 +868,14 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
792 | return; | 868 | return; |
793 | } | 869 | } |
794 | 870 | ||
871 | /* Turn on LED */ | ||
872 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | ||
873 | mos7840_port->led_flag = true; | ||
874 | mos7840_set_led_async(mos7840_port, 0x0301, | ||
875 | MODEM_CONTROL_REGISTER); | ||
876 | mod_timer(&mos7840_port->led_timer1, | ||
877 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
878 | } | ||
795 | 879 | ||
796 | mos7840_port->read_urb_busy = true; | 880 | mos7840_port->read_urb_busy = true; |
797 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 881 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
@@ -1554,6 +1638,14 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1554 | data1 = urb->transfer_buffer; | 1638 | data1 = urb->transfer_buffer; |
1555 | dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress); | 1639 | dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress); |
1556 | 1640 | ||
1641 | /* Turn on LED */ | ||
1642 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | ||
1643 | mos7840_port->led_flag = true; | ||
1644 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301); | ||
1645 | mod_timer(&mos7840_port->led_timer1, | ||
1646 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
1647 | } | ||
1648 | |||
1557 | /* send it down the pipe */ | 1649 | /* send it down the pipe */ |
1558 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1650 | status = usb_submit_urb(urb, GFP_ATOMIC); |
1559 | 1651 | ||
@@ -2327,28 +2419,74 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2327 | return -ENOIOCTLCMD; | 2419 | return -ENOIOCTLCMD; |
2328 | } | 2420 | } |
2329 | 2421 | ||
2422 | static int mos7810_check(struct usb_serial *serial) | ||
2423 | { | ||
2424 | int i, pass_count = 0; | ||
2425 | __u16 data = 0, mcr_data = 0; | ||
2426 | __u16 test_pattern = 0x55AA; | ||
2427 | |||
2428 | /* Store MCR setting */ | ||
2429 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
2430 | MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, | ||
2431 | &mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | ||
2432 | |||
2433 | for (i = 0; i < 16; i++) { | ||
2434 | /* Send the 1-bit test pattern out to MCS7810 test pin */ | ||
2435 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | ||
2436 | MCS_WRREQ, MCS_WR_RTYPE, | ||
2437 | (0x0300 | (((test_pattern >> i) & 0x0001) << 1)), | ||
2438 | MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); | ||
2439 | |||
2440 | /* Read the test pattern back */ | ||
2441 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
2442 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, | ||
2443 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | ||
2444 | |||
2445 | /* If this is a MCS7810 device, both test patterns must match */ | ||
2446 | if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) | ||
2447 | break; | ||
2448 | |||
2449 | pass_count++; | ||
2450 | } | ||
2451 | |||
2452 | /* Restore MCR setting */ | ||
2453 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), MCS_WRREQ, | ||
2454 | MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, | ||
2455 | 0, MOS_WDR_TIMEOUT); | ||
2456 | |||
2457 | if (pass_count == 16) | ||
2458 | return 1; | ||
2459 | |||
2460 | return 0; | ||
2461 | } | ||
2462 | |||
2330 | static int mos7840_calc_num_ports(struct usb_serial *serial) | 2463 | static int mos7840_calc_num_ports(struct usb_serial *serial) |
2331 | { | 2464 | { |
2332 | __u16 Data = 0x00; | 2465 | __u16 data = 0x00; |
2333 | int ret = 0; | ||
2334 | int mos7840_num_ports; | 2466 | int mos7840_num_ports; |
2335 | 2467 | ||
2336 | ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2468 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2337 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &Data, | 2469 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, |
2338 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2470 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2339 | 2471 | ||
2340 | if ((Data & 0x01) == 0) { | 2472 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || |
2341 | mos7840_num_ports = 2; | 2473 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { |
2342 | serial->num_bulk_in = 2; | 2474 | device_type = serial->dev->descriptor.idProduct; |
2343 | serial->num_bulk_out = 2; | ||
2344 | serial->num_ports = 2; | ||
2345 | } else { | 2475 | } else { |
2346 | mos7840_num_ports = 4; | 2476 | /* For a MCS7840 device GPIO0 must be set to 1 */ |
2347 | serial->num_bulk_in = 4; | 2477 | if ((data & 0x01) == 1) |
2348 | serial->num_bulk_out = 4; | 2478 | device_type = MOSCHIP_DEVICE_ID_7840; |
2349 | serial->num_ports = 4; | 2479 | else if (mos7810_check(serial)) |
2480 | device_type = MOSCHIP_DEVICE_ID_7810; | ||
2481 | else | ||
2482 | device_type = MOSCHIP_DEVICE_ID_7820; | ||
2350 | } | 2483 | } |
2351 | 2484 | ||
2485 | mos7840_num_ports = (device_type >> 4) & 0x000F; | ||
2486 | serial->num_bulk_in = mos7840_num_ports; | ||
2487 | serial->num_bulk_out = mos7840_num_ports; | ||
2488 | serial->num_ports = mos7840_num_ports; | ||
2489 | |||
2352 | return mos7840_num_ports; | 2490 | return mos7840_num_ports; |
2353 | } | 2491 | } |
2354 | 2492 | ||
@@ -2563,6 +2701,34 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2563 | status = -ENOMEM; | 2701 | status = -ENOMEM; |
2564 | goto error; | 2702 | goto error; |
2565 | } | 2703 | } |
2704 | |||
2705 | mos7840_port->has_led = false; | ||
2706 | |||
2707 | /* Initialize LED timers */ | ||
2708 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | ||
2709 | mos7840_port->has_led = true; | ||
2710 | |||
2711 | init_timer(&mos7840_port->led_timer1); | ||
2712 | mos7840_port->led_timer1.function = mos7840_led_off; | ||
2713 | mos7840_port->led_timer1.expires = | ||
2714 | jiffies + msecs_to_jiffies(LED_ON_MS); | ||
2715 | mos7840_port->led_timer1.data = | ||
2716 | (unsigned long)mos7840_port; | ||
2717 | |||
2718 | init_timer(&mos7840_port->led_timer2); | ||
2719 | mos7840_port->led_timer2.function = | ||
2720 | mos7840_led_flag_off; | ||
2721 | mos7840_port->led_timer2.expires = | ||
2722 | jiffies + msecs_to_jiffies(LED_OFF_MS); | ||
2723 | mos7840_port->led_timer2.data = | ||
2724 | (unsigned long)mos7840_port; | ||
2725 | |||
2726 | mos7840_port->led_flag = false; | ||
2727 | |||
2728 | /* Turn off LED */ | ||
2729 | mos7840_set_led_sync(serial->port[i], | ||
2730 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2731 | } | ||
2566 | } | 2732 | } |
2567 | dbg ("mos7840_startup: all ports configured..........."); | 2733 | dbg ("mos7840_startup: all ports configured..........."); |
2568 | 2734 | ||
@@ -2654,6 +2820,14 @@ static void mos7840_release(struct usb_serial *serial) | |||
2654 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2820 | mos7840_port = mos7840_get_port_private(serial->port[i]); |
2655 | dbg("mos7840_port %d = %p", i, mos7840_port); | 2821 | dbg("mos7840_port %d = %p", i, mos7840_port); |
2656 | if (mos7840_port) { | 2822 | if (mos7840_port) { |
2823 | if (mos7840_port->has_led) { | ||
2824 | /* Turn off LED */ | ||
2825 | mos7840_set_led_sync(mos7840_port->port, | ||
2826 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2827 | |||
2828 | del_timer_sync(&mos7840_port->led_timer1); | ||
2829 | del_timer_sync(&mos7840_port->led_timer2); | ||
2830 | } | ||
2657 | kfree(mos7840_port->ctrl_buf); | 2831 | kfree(mos7840_port->ctrl_buf); |
2658 | kfree(mos7840_port->dr); | 2832 | kfree(mos7840_port->dr); |
2659 | kfree(mos7840_port); | 2833 | kfree(mos7840_port); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f4465ccddc35..9ea5f4b39757 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1413,7 +1413,7 @@ static void option_instat_callback(struct urb *urb) | |||
1413 | req_pkt->bRequestType, req_pkt->bRequest); | 1413 | req_pkt->bRequestType, req_pkt->bRequest); |
1414 | } | 1414 | } |
1415 | } else | 1415 | } else |
1416 | err("%s: error %d", __func__, status); | 1416 | dev_err(&port->dev, "%s: error %d\n", __func__, status); |
1417 | 1417 | ||
1418 | /* Resubmit urb so we continue receiving IRQ data */ | 1418 | /* Resubmit urb so we continue receiving IRQ data */ |
1419 | if (status != -ESHUTDOWN && status != -ENOENT) { | 1419 | if (status != -ESHUTDOWN && status != -ENOENT) { |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index ab74123d658e..82116f42e6fd 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -394,7 +394,9 @@ static int ti_startup(struct usb_serial *serial) | |||
394 | 394 | ||
395 | /* if we have only 1 configuration, download firmware */ | 395 | /* if we have only 1 configuration, download firmware */ |
396 | if (dev->descriptor.bNumConfigurations == 1) { | 396 | if (dev->descriptor.bNumConfigurations == 1) { |
397 | if ((status = ti_download_firmware(tdev)) != 0) | 397 | status = ti_download_firmware(tdev); |
398 | |||
399 | if (status != 0) | ||
398 | goto free_tdev; | 400 | goto free_tdev; |
399 | 401 | ||
400 | /* 3410 must be reset, 5052 resets itself */ | 402 | /* 3410 must be reset, 5052 resets itself */ |
@@ -1683,7 +1685,9 @@ static int ti_download_firmware(struct ti_device *tdev) | |||
1683 | /* try ID specific firmware first, then try generic firmware */ | 1685 | /* try ID specific firmware first, then try generic firmware */ |
1684 | sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, | 1686 | sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, |
1685 | dev->descriptor.idProduct); | 1687 | dev->descriptor.idProduct); |
1686 | if ((status = request_firmware(&fw_p, buf, &dev->dev)) != 0) { | 1688 | status = request_firmware(&fw_p, buf, &dev->dev); |
1689 | |||
1690 | if (status != 0) { | ||
1687 | buf[0] = '\0'; | 1691 | buf[0] = '\0'; |
1688 | if (dev->descriptor.idVendor == MTS_VENDOR_ID) { | 1692 | if (dev->descriptor.idVendor == MTS_VENDOR_ID) { |
1689 | switch (dev->descriptor.idProduct) { | 1693 | switch (dev->descriptor.idProduct) { |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index c88657dd31c8..194c5461290d 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -725,8 +725,8 @@ int usb_wwan_resume(struct usb_serial *serial) | |||
725 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | 725 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
726 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); | 726 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); |
727 | if (err < 0) { | 727 | if (err < 0) { |
728 | err("%s: Error %d for interrupt URB of port%d", | 728 | dev_err(&port->dev, "%s: Error %d for interrupt URB\n", |
729 | __func__, err, i); | 729 | __func__, err); |
730 | goto err_out; | 730 | goto err_out; |
731 | } | 731 | } |
732 | } | 732 | } |
@@ -747,8 +747,8 @@ int usb_wwan_resume(struct usb_serial *serial) | |||
747 | urb = portdata->in_urbs[j]; | 747 | urb = portdata->in_urbs[j]; |
748 | err = usb_submit_urb(urb, GFP_ATOMIC); | 748 | err = usb_submit_urb(urb, GFP_ATOMIC); |
749 | if (err < 0) { | 749 | if (err < 0) { |
750 | err("%s: Error %d for bulk URB %d", | 750 | dev_err(&port->dev, "%s: Error %d for bulk URB %d\n", |
751 | __func__, err, i); | 751 | __func__, err, i); |
752 | spin_unlock_irq(&intfdata->susp_lock); | 752 | spin_unlock_irq(&intfdata->susp_lock); |
753 | goto err_out; | 753 | goto err_out; |
754 | } | 754 | } |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 71d696474f24..aa8911dc4154 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -53,8 +53,6 @@ static int palm_os_4_probe(struct usb_serial *serial, | |||
53 | 53 | ||
54 | /* Parameters that may be passed into the module. */ | 54 | /* Parameters that may be passed into the module. */ |
55 | static bool debug; | 55 | static bool debug; |
56 | static __u16 vendor; | ||
57 | static __u16 product; | ||
58 | 56 | ||
59 | static struct usb_device_id id_table [] = { | 57 | static struct usb_device_id id_table [] = { |
60 | { USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID), | 58 | { USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID), |
@@ -115,14 +113,12 @@ static struct usb_device_id id_table [] = { | |||
115 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 113 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
116 | { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID), | 114 | { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID), |
117 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 115 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
118 | { }, /* optional parameter entry */ | ||
119 | { } /* Terminating entry */ | 116 | { } /* Terminating entry */ |
120 | }; | 117 | }; |
121 | 118 | ||
122 | static struct usb_device_id clie_id_5_table [] = { | 119 | static struct usb_device_id clie_id_5_table [] = { |
123 | { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_UX50_ID), | 120 | { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_UX50_ID), |
124 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 121 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
125 | { }, /* optional parameter entry */ | ||
126 | { } /* Terminating entry */ | 122 | { } /* Terminating entry */ |
127 | }; | 123 | }; |
128 | 124 | ||
@@ -162,7 +158,6 @@ static struct usb_device_id id_table_combined [] = { | |||
162 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, | 158 | { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, |
163 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, | 159 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, |
164 | { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID) }, | 160 | { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID) }, |
165 | { }, /* optional parameter entry */ | ||
166 | { } /* Terminating entry */ | 161 | { } /* Terminating entry */ |
167 | }; | 162 | }; |
168 | 163 | ||
@@ -648,59 +643,7 @@ static int clie_5_attach(struct usb_serial *serial) | |||
648 | return 0; | 643 | return 0; |
649 | } | 644 | } |
650 | 645 | ||
651 | static int __init visor_init(void) | 646 | module_usb_serial_driver(visor_driver, serial_drivers); |
652 | { | ||
653 | int i, retval; | ||
654 | /* Only if parameters were passed to us */ | ||
655 | if (vendor > 0 && product > 0) { | ||
656 | struct usb_device_id usb_dev_temp[] = { | ||
657 | { | ||
658 | USB_DEVICE(vendor, product), | ||
659 | .driver_info = | ||
660 | (kernel_ulong_t) &palm_os_4_probe | ||
661 | } | ||
662 | }; | ||
663 | |||
664 | /* Find the last entry in id_table */ | ||
665 | for (i = 0;; i++) { | ||
666 | if (id_table[i].idVendor == 0) { | ||
667 | id_table[i] = usb_dev_temp[0]; | ||
668 | break; | ||
669 | } | ||
670 | } | ||
671 | /* Find the last entry in id_table_combined */ | ||
672 | for (i = 0;; i++) { | ||
673 | if (id_table_combined[i].idVendor == 0) { | ||
674 | id_table_combined[i] = usb_dev_temp[0]; | ||
675 | break; | ||
676 | } | ||
677 | } | ||
678 | printk(KERN_INFO KBUILD_MODNAME | ||
679 | ": Untested USB device specified at time of module insertion\n"); | ||
680 | printk(KERN_INFO KBUILD_MODNAME | ||
681 | ": Warning: This is not guaranteed to work\n"); | ||
682 | printk(KERN_INFO KBUILD_MODNAME | ||
683 | ": Using a newer kernel is preferred to this method\n"); | ||
684 | printk(KERN_INFO KBUILD_MODNAME | ||
685 | ": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n", | ||
686 | vendor, product); | ||
687 | } | ||
688 | |||
689 | retval = usb_serial_register_drivers(&visor_driver, serial_drivers); | ||
690 | if (retval == 0) | ||
691 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n"); | ||
692 | return retval; | ||
693 | } | ||
694 | |||
695 | |||
696 | static void __exit visor_exit (void) | ||
697 | { | ||
698 | usb_serial_deregister_drivers(&visor_driver, serial_drivers); | ||
699 | } | ||
700 | |||
701 | |||
702 | module_init(visor_init); | ||
703 | module_exit(visor_exit); | ||
704 | 647 | ||
705 | MODULE_AUTHOR(DRIVER_AUTHOR); | 648 | MODULE_AUTHOR(DRIVER_AUTHOR); |
706 | MODULE_DESCRIPTION(DRIVER_DESC); | 649 | MODULE_DESCRIPTION(DRIVER_DESC); |
@@ -708,9 +651,3 @@ MODULE_LICENSE("GPL"); | |||
708 | 651 | ||
709 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 652 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
710 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 653 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
711 | |||
712 | module_param(vendor, ushort, 0); | ||
713 | MODULE_PARM_DESC(vendor, "User specified vendor ID"); | ||
714 | module_param(product, ushort, 0); | ||
715 | MODULE_PARM_DESC(product, "User specified product ID"); | ||
716 | |||
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 407e23c87946..c141b472b6a2 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -45,7 +45,6 @@ static bool debug; | |||
45 | /* | 45 | /* |
46 | * Version Information | 46 | * Version Information |
47 | */ | 47 | */ |
48 | #define DRIVER_VERSION "v2.0" | ||
49 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Stuart MacDonald <stuartm@connecttech.com>" | 48 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Stuart MacDonald <stuartm@connecttech.com>" |
50 | #define DRIVER_DESC "USB ConnectTech WhiteHEAT driver" | 49 | #define DRIVER_DESC "USB ConnectTech WhiteHEAT driver" |
51 | 50 | ||
@@ -96,10 +95,6 @@ static void whiteheat_release(struct usb_serial *serial); | |||
96 | static int whiteheat_open(struct tty_struct *tty, | 95 | static int whiteheat_open(struct tty_struct *tty, |
97 | struct usb_serial_port *port); | 96 | struct usb_serial_port *port); |
98 | static void whiteheat_close(struct usb_serial_port *port); | 97 | static void whiteheat_close(struct usb_serial_port *port); |
99 | static int whiteheat_write(struct tty_struct *tty, | ||
100 | struct usb_serial_port *port, | ||
101 | const unsigned char *buf, int count); | ||
102 | static int whiteheat_write_room(struct tty_struct *tty); | ||
103 | static int whiteheat_ioctl(struct tty_struct *tty, | 98 | static int whiteheat_ioctl(struct tty_struct *tty, |
104 | unsigned int cmd, unsigned long arg); | 99 | unsigned int cmd, unsigned long arg); |
105 | static void whiteheat_set_termios(struct tty_struct *tty, | 100 | static void whiteheat_set_termios(struct tty_struct *tty, |
@@ -108,11 +103,6 @@ static int whiteheat_tiocmget(struct tty_struct *tty); | |||
108 | static int whiteheat_tiocmset(struct tty_struct *tty, | 103 | static int whiteheat_tiocmset(struct tty_struct *tty, |
109 | unsigned int set, unsigned int clear); | 104 | unsigned int set, unsigned int clear); |
110 | static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); | 105 | static void whiteheat_break_ctl(struct tty_struct *tty, int break_state); |
111 | static int whiteheat_chars_in_buffer(struct tty_struct *tty); | ||
112 | static void whiteheat_throttle(struct tty_struct *tty); | ||
113 | static void whiteheat_unthrottle(struct tty_struct *tty); | ||
114 | static void whiteheat_read_callback(struct urb *urb); | ||
115 | static void whiteheat_write_callback(struct urb *urb); | ||
116 | 106 | ||
117 | static struct usb_serial_driver whiteheat_fake_device = { | 107 | static struct usb_serial_driver whiteheat_fake_device = { |
118 | .driver = { | 108 | .driver = { |
@@ -138,18 +128,13 @@ static struct usb_serial_driver whiteheat_device = { | |||
138 | .release = whiteheat_release, | 128 | .release = whiteheat_release, |
139 | .open = whiteheat_open, | 129 | .open = whiteheat_open, |
140 | .close = whiteheat_close, | 130 | .close = whiteheat_close, |
141 | .write = whiteheat_write, | ||
142 | .write_room = whiteheat_write_room, | ||
143 | .ioctl = whiteheat_ioctl, | 131 | .ioctl = whiteheat_ioctl, |
144 | .set_termios = whiteheat_set_termios, | 132 | .set_termios = whiteheat_set_termios, |
145 | .break_ctl = whiteheat_break_ctl, | 133 | .break_ctl = whiteheat_break_ctl, |
146 | .tiocmget = whiteheat_tiocmget, | 134 | .tiocmget = whiteheat_tiocmget, |
147 | .tiocmset = whiteheat_tiocmset, | 135 | .tiocmset = whiteheat_tiocmset, |
148 | .chars_in_buffer = whiteheat_chars_in_buffer, | 136 | .throttle = usb_serial_generic_throttle, |
149 | .throttle = whiteheat_throttle, | 137 | .unthrottle = usb_serial_generic_unthrottle, |
150 | .unthrottle = whiteheat_unthrottle, | ||
151 | .read_bulk_callback = whiteheat_read_callback, | ||
152 | .write_bulk_callback = whiteheat_write_callback, | ||
153 | }; | 138 | }; |
154 | 139 | ||
155 | static struct usb_serial_driver * const serial_drivers[] = { | 140 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -166,29 +151,8 @@ struct whiteheat_command_private { | |||
166 | __u8 result_buffer[64]; | 151 | __u8 result_buffer[64]; |
167 | }; | 152 | }; |
168 | 153 | ||
169 | |||
170 | #define THROTTLED 0x01 | ||
171 | #define ACTUALLY_THROTTLED 0x02 | ||
172 | |||
173 | static int urb_pool_size = 8; | ||
174 | |||
175 | struct whiteheat_urb_wrap { | ||
176 | struct list_head list; | ||
177 | struct urb *urb; | ||
178 | }; | ||
179 | |||
180 | struct whiteheat_private { | 154 | struct whiteheat_private { |
181 | spinlock_t lock; | ||
182 | __u8 flags; | ||
183 | __u8 mcr; /* FIXME: no locking on mcr */ | 155 | __u8 mcr; /* FIXME: no locking on mcr */ |
184 | struct list_head rx_urbs_free; | ||
185 | struct list_head rx_urbs_submitted; | ||
186 | struct list_head rx_urb_q; | ||
187 | struct work_struct rx_work; | ||
188 | struct usb_serial_port *port; | ||
189 | struct list_head tx_urbs_free; | ||
190 | struct list_head tx_urbs_submitted; | ||
191 | struct mutex deathwarrant; | ||
192 | }; | 156 | }; |
193 | 157 | ||
194 | 158 | ||
@@ -198,12 +162,6 @@ static void stop_command_port(struct usb_serial *serial); | |||
198 | static void command_port_write_callback(struct urb *urb); | 162 | static void command_port_write_callback(struct urb *urb); |
199 | static void command_port_read_callback(struct urb *urb); | 163 | static void command_port_read_callback(struct urb *urb); |
200 | 164 | ||
201 | static int start_port_read(struct usb_serial_port *port); | ||
202 | static struct whiteheat_urb_wrap *urb_to_wrap(struct urb *urb, | ||
203 | struct list_head *head); | ||
204 | static struct list_head *list_first(struct list_head *head); | ||
205 | static void rx_data_softint(struct work_struct *work); | ||
206 | |||
207 | static int firm_send_command(struct usb_serial_port *port, __u8 command, | 165 | static int firm_send_command(struct usb_serial_port *port, __u8 command, |
208 | __u8 *data, __u8 datasize); | 166 | __u8 *data, __u8 datasize); |
209 | static int firm_open(struct usb_serial_port *port); | 167 | static int firm_open(struct usb_serial_port *port); |
@@ -349,11 +307,6 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
349 | __u8 *command; | 307 | __u8 *command; |
350 | __u8 *result; | 308 | __u8 *result; |
351 | int i; | 309 | int i; |
352 | int j; | ||
353 | struct urb *urb; | ||
354 | int buf_size; | ||
355 | struct whiteheat_urb_wrap *wrap; | ||
356 | struct list_head *tmp; | ||
357 | 310 | ||
358 | command_port = serial->port[COMMAND_PORT]; | 311 | command_port = serial->port[COMMAND_PORT]; |
359 | 312 | ||
@@ -408,8 +361,8 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
408 | 361 | ||
409 | hw_info = (struct whiteheat_hw_info *)&result[1]; | 362 | hw_info = (struct whiteheat_hw_info *)&result[1]; |
410 | 363 | ||
411 | dev_info(&serial->dev->dev, "%s: Driver %s: Firmware v%d.%02d\n", | 364 | dev_info(&serial->dev->dev, "%s: Firmware v%d.%02d\n", |
412 | serial->type->description, DRIVER_VERSION, | 365 | serial->type->description, |
413 | hw_info->sw_major_rev, hw_info->sw_minor_rev); | 366 | hw_info->sw_major_rev, hw_info->sw_minor_rev); |
414 | 367 | ||
415 | for (i = 0; i < serial->num_ports; i++) { | 368 | for (i = 0; i < serial->num_ports; i++) { |
@@ -423,72 +376,7 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
423 | goto no_private; | 376 | goto no_private; |
424 | } | 377 | } |
425 | 378 | ||
426 | spin_lock_init(&info->lock); | ||
427 | mutex_init(&info->deathwarrant); | ||
428 | info->flags = 0; | ||
429 | info->mcr = 0; | 379 | info->mcr = 0; |
430 | INIT_WORK(&info->rx_work, rx_data_softint); | ||
431 | info->port = port; | ||
432 | |||
433 | INIT_LIST_HEAD(&info->rx_urbs_free); | ||
434 | INIT_LIST_HEAD(&info->rx_urbs_submitted); | ||
435 | INIT_LIST_HEAD(&info->rx_urb_q); | ||
436 | INIT_LIST_HEAD(&info->tx_urbs_free); | ||
437 | INIT_LIST_HEAD(&info->tx_urbs_submitted); | ||
438 | |||
439 | for (j = 0; j < urb_pool_size; j++) { | ||
440 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
441 | if (!urb) { | ||
442 | dev_err(&port->dev, "No free urbs available\n"); | ||
443 | goto no_rx_urb; | ||
444 | } | ||
445 | buf_size = port->read_urb->transfer_buffer_length; | ||
446 | urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL); | ||
447 | if (!urb->transfer_buffer) { | ||
448 | dev_err(&port->dev, | ||
449 | "Couldn't allocate urb buffer\n"); | ||
450 | goto no_rx_buf; | ||
451 | } | ||
452 | wrap = kmalloc(sizeof(*wrap), GFP_KERNEL); | ||
453 | if (!wrap) { | ||
454 | dev_err(&port->dev, | ||
455 | "Couldn't allocate urb wrapper\n"); | ||
456 | goto no_rx_wrap; | ||
457 | } | ||
458 | usb_fill_bulk_urb(urb, serial->dev, | ||
459 | usb_rcvbulkpipe(serial->dev, | ||
460 | port->bulk_in_endpointAddress), | ||
461 | urb->transfer_buffer, buf_size, | ||
462 | whiteheat_read_callback, port); | ||
463 | wrap->urb = urb; | ||
464 | list_add(&wrap->list, &info->rx_urbs_free); | ||
465 | |||
466 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
467 | if (!urb) { | ||
468 | dev_err(&port->dev, "No free urbs available\n"); | ||
469 | goto no_tx_urb; | ||
470 | } | ||
471 | buf_size = port->write_urb->transfer_buffer_length; | ||
472 | urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL); | ||
473 | if (!urb->transfer_buffer) { | ||
474 | dev_err(&port->dev, | ||
475 | "Couldn't allocate urb buffer\n"); | ||
476 | goto no_tx_buf; | ||
477 | } | ||
478 | wrap = kmalloc(sizeof(*wrap), GFP_KERNEL); | ||
479 | if (!wrap) { | ||
480 | dev_err(&port->dev, | ||
481 | "Couldn't allocate urb wrapper\n"); | ||
482 | goto no_tx_wrap; | ||
483 | } | ||
484 | usb_fill_bulk_urb(urb, serial->dev, | ||
485 | usb_sndbulkpipe(serial->dev, | ||
486 | port->bulk_out_endpointAddress), | ||
487 | urb->transfer_buffer, buf_size, | ||
488 | whiteheat_write_callback, port); | ||
489 | wrap->urb = urb; | ||
490 | list_add(&wrap->list, &info->tx_urbs_free); | ||
491 | } | ||
492 | 380 | ||
493 | usb_set_serial_port_data(port, info); | 381 | usb_set_serial_port_data(port, info); |
494 | } | 382 | } |
@@ -531,29 +419,6 @@ no_command_private: | |||
531 | for (i = serial->num_ports - 1; i >= 0; i--) { | 419 | for (i = serial->num_ports - 1; i >= 0; i--) { |
532 | port = serial->port[i]; | 420 | port = serial->port[i]; |
533 | info = usb_get_serial_port_data(port); | 421 | info = usb_get_serial_port_data(port); |
534 | for (j = urb_pool_size - 1; j >= 0; j--) { | ||
535 | tmp = list_first(&info->tx_urbs_free); | ||
536 | list_del(tmp); | ||
537 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
538 | urb = wrap->urb; | ||
539 | kfree(wrap); | ||
540 | no_tx_wrap: | ||
541 | kfree(urb->transfer_buffer); | ||
542 | no_tx_buf: | ||
543 | usb_free_urb(urb); | ||
544 | no_tx_urb: | ||
545 | tmp = list_first(&info->rx_urbs_free); | ||
546 | list_del(tmp); | ||
547 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
548 | urb = wrap->urb; | ||
549 | kfree(wrap); | ||
550 | no_rx_wrap: | ||
551 | kfree(urb->transfer_buffer); | ||
552 | no_rx_buf: | ||
553 | usb_free_urb(urb); | ||
554 | no_rx_urb: | ||
555 | ; | ||
556 | } | ||
557 | kfree(info); | 422 | kfree(info); |
558 | no_private: | 423 | no_private: |
559 | ; | 424 | ; |
@@ -569,12 +434,7 @@ no_command_buffer: | |||
569 | static void whiteheat_release(struct usb_serial *serial) | 434 | static void whiteheat_release(struct usb_serial *serial) |
570 | { | 435 | { |
571 | struct usb_serial_port *command_port; | 436 | struct usb_serial_port *command_port; |
572 | struct usb_serial_port *port; | ||
573 | struct whiteheat_private *info; | 437 | struct whiteheat_private *info; |
574 | struct whiteheat_urb_wrap *wrap; | ||
575 | struct urb *urb; | ||
576 | struct list_head *tmp; | ||
577 | struct list_head *tmp2; | ||
578 | int i; | 438 | int i; |
579 | 439 | ||
580 | dbg("%s", __func__); | 440 | dbg("%s", __func__); |
@@ -584,31 +444,14 @@ static void whiteheat_release(struct usb_serial *serial) | |||
584 | kfree(usb_get_serial_port_data(command_port)); | 444 | kfree(usb_get_serial_port_data(command_port)); |
585 | 445 | ||
586 | for (i = 0; i < serial->num_ports; i++) { | 446 | for (i = 0; i < serial->num_ports; i++) { |
587 | port = serial->port[i]; | 447 | info = usb_get_serial_port_data(serial->port[i]); |
588 | info = usb_get_serial_port_data(port); | ||
589 | list_for_each_safe(tmp, tmp2, &info->rx_urbs_free) { | ||
590 | list_del(tmp); | ||
591 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
592 | urb = wrap->urb; | ||
593 | kfree(wrap); | ||
594 | kfree(urb->transfer_buffer); | ||
595 | usb_free_urb(urb); | ||
596 | } | ||
597 | list_for_each_safe(tmp, tmp2, &info->tx_urbs_free) { | ||
598 | list_del(tmp); | ||
599 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
600 | urb = wrap->urb; | ||
601 | kfree(wrap); | ||
602 | kfree(urb->transfer_buffer); | ||
603 | usb_free_urb(urb); | ||
604 | } | ||
605 | kfree(info); | 448 | kfree(info); |
606 | } | 449 | } |
607 | } | 450 | } |
608 | 451 | ||
609 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | 452 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) |
610 | { | 453 | { |
611 | int retval = 0; | 454 | int retval; |
612 | 455 | ||
613 | dbg("%s - port %d", __func__, port->number); | 456 | dbg("%s - port %d", __func__, port->number); |
614 | 457 | ||
@@ -616,9 +459,6 @@ static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
616 | if (retval) | 459 | if (retval) |
617 | goto exit; | 460 | goto exit; |
618 | 461 | ||
619 | if (tty) | ||
620 | tty->low_latency = 1; | ||
621 | |||
622 | /* send an open port command */ | 462 | /* send an open port command */ |
623 | retval = firm_open(port); | 463 | retval = firm_open(port); |
624 | if (retval) { | 464 | if (retval) { |
@@ -640,17 +480,12 @@ static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
640 | usb_clear_halt(port->serial->dev, port->read_urb->pipe); | 480 | usb_clear_halt(port->serial->dev, port->read_urb->pipe); |
641 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); | 481 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); |
642 | 482 | ||
643 | /* Start reading from the device */ | 483 | retval = usb_serial_generic_open(tty, port); |
644 | retval = start_port_read(port); | ||
645 | if (retval) { | 484 | if (retval) { |
646 | dev_err(&port->dev, | ||
647 | "%s - failed submitting read urb, error %d\n", | ||
648 | __func__, retval); | ||
649 | firm_close(port); | 485 | firm_close(port); |
650 | stop_command_port(port->serial); | 486 | stop_command_port(port->serial); |
651 | goto exit; | 487 | goto exit; |
652 | } | 488 | } |
653 | |||
654 | exit: | 489 | exit: |
655 | dbg("%s - exit, retval = %d", __func__, retval); | 490 | dbg("%s - exit, retval = %d", __func__, retval); |
656 | return retval; | 491 | return retval; |
@@ -659,125 +494,14 @@ exit: | |||
659 | 494 | ||
660 | static void whiteheat_close(struct usb_serial_port *port) | 495 | static void whiteheat_close(struct usb_serial_port *port) |
661 | { | 496 | { |
662 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
663 | struct whiteheat_urb_wrap *wrap; | ||
664 | struct urb *urb; | ||
665 | struct list_head *tmp; | ||
666 | struct list_head *tmp2; | ||
667 | |||
668 | dbg("%s - port %d", __func__, port->number); | 497 | dbg("%s - port %d", __func__, port->number); |
669 | 498 | ||
670 | firm_report_tx_done(port); | 499 | firm_report_tx_done(port); |
671 | firm_close(port); | 500 | firm_close(port); |
672 | 501 | ||
673 | /* shutdown our bulk reads and writes */ | 502 | usb_serial_generic_close(port); |
674 | mutex_lock(&info->deathwarrant); | ||
675 | spin_lock_irq(&info->lock); | ||
676 | list_for_each_safe(tmp, tmp2, &info->rx_urbs_submitted) { | ||
677 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
678 | urb = wrap->urb; | ||
679 | list_del(tmp); | ||
680 | spin_unlock_irq(&info->lock); | ||
681 | usb_kill_urb(urb); | ||
682 | spin_lock_irq(&info->lock); | ||
683 | list_add(tmp, &info->rx_urbs_free); | ||
684 | } | ||
685 | list_for_each_safe(tmp, tmp2, &info->rx_urb_q) | ||
686 | list_move(tmp, &info->rx_urbs_free); | ||
687 | list_for_each_safe(tmp, tmp2, &info->tx_urbs_submitted) { | ||
688 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
689 | urb = wrap->urb; | ||
690 | list_del(tmp); | ||
691 | spin_unlock_irq(&info->lock); | ||
692 | usb_kill_urb(urb); | ||
693 | spin_lock_irq(&info->lock); | ||
694 | list_add(tmp, &info->tx_urbs_free); | ||
695 | } | ||
696 | spin_unlock_irq(&info->lock); | ||
697 | mutex_unlock(&info->deathwarrant); | ||
698 | stop_command_port(port->serial); | ||
699 | } | ||
700 | |||
701 | |||
702 | static int whiteheat_write(struct tty_struct *tty, | ||
703 | struct usb_serial_port *port, const unsigned char *buf, int count) | ||
704 | { | ||
705 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
706 | struct whiteheat_urb_wrap *wrap; | ||
707 | struct urb *urb; | ||
708 | int result; | ||
709 | int bytes; | ||
710 | int sent = 0; | ||
711 | unsigned long flags; | ||
712 | struct list_head *tmp; | ||
713 | |||
714 | dbg("%s - port %d", __func__, port->number); | ||
715 | |||
716 | if (count == 0) { | ||
717 | dbg("%s - write request of 0 bytes", __func__); | ||
718 | return (0); | ||
719 | } | ||
720 | |||
721 | while (count) { | ||
722 | spin_lock_irqsave(&info->lock, flags); | ||
723 | if (list_empty(&info->tx_urbs_free)) { | ||
724 | spin_unlock_irqrestore(&info->lock, flags); | ||
725 | break; | ||
726 | } | ||
727 | tmp = list_first(&info->tx_urbs_free); | ||
728 | list_del(tmp); | ||
729 | spin_unlock_irqrestore(&info->lock, flags); | ||
730 | |||
731 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
732 | urb = wrap->urb; | ||
733 | bytes = (count > port->bulk_out_size) ? | ||
734 | port->bulk_out_size : count; | ||
735 | memcpy(urb->transfer_buffer, buf + sent, bytes); | ||
736 | |||
737 | usb_serial_debug_data(debug, &port->dev, | ||
738 | __func__, bytes, urb->transfer_buffer); | ||
739 | |||
740 | urb->transfer_buffer_length = bytes; | ||
741 | result = usb_submit_urb(urb, GFP_ATOMIC); | ||
742 | if (result) { | ||
743 | dev_err_console(port, | ||
744 | "%s - failed submitting write urb, error %d\n", | ||
745 | __func__, result); | ||
746 | sent = result; | ||
747 | spin_lock_irqsave(&info->lock, flags); | ||
748 | list_add(tmp, &info->tx_urbs_free); | ||
749 | spin_unlock_irqrestore(&info->lock, flags); | ||
750 | break; | ||
751 | } else { | ||
752 | sent += bytes; | ||
753 | count -= bytes; | ||
754 | spin_lock_irqsave(&info->lock, flags); | ||
755 | list_add(tmp, &info->tx_urbs_submitted); | ||
756 | spin_unlock_irqrestore(&info->lock, flags); | ||
757 | } | ||
758 | } | ||
759 | 503 | ||
760 | return sent; | 504 | stop_command_port(port->serial); |
761 | } | ||
762 | |||
763 | static int whiteheat_write_room(struct tty_struct *tty) | ||
764 | { | ||
765 | struct usb_serial_port *port = tty->driver_data; | ||
766 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
767 | struct list_head *tmp; | ||
768 | int room = 0; | ||
769 | unsigned long flags; | ||
770 | |||
771 | dbg("%s - port %d", __func__, port->number); | ||
772 | |||
773 | spin_lock_irqsave(&info->lock, flags); | ||
774 | list_for_each(tmp, &info->tx_urbs_free) | ||
775 | room++; | ||
776 | spin_unlock_irqrestore(&info->lock, flags); | ||
777 | room *= port->bulk_out_size; | ||
778 | |||
779 | dbg("%s - returns %d", __func__, room); | ||
780 | return (room); | ||
781 | } | 505 | } |
782 | 506 | ||
783 | static int whiteheat_tiocmget(struct tty_struct *tty) | 507 | static int whiteheat_tiocmget(struct tty_struct *tty) |
@@ -837,7 +561,7 @@ static int whiteheat_ioctl(struct tty_struct *tty, | |||
837 | serstruct.line = port->serial->minor; | 561 | serstruct.line = port->serial->minor; |
838 | serstruct.port = port->number; | 562 | serstruct.port = port->number; |
839 | serstruct.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 563 | serstruct.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
840 | serstruct.xmit_fifo_size = port->bulk_out_size; | 564 | serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo); |
841 | serstruct.custom_divisor = 0; | 565 | serstruct.custom_divisor = 0; |
842 | serstruct.baud_base = 460800; | 566 | serstruct.baud_base = 460800; |
843 | serstruct.close_delay = CLOSING_DELAY; | 567 | serstruct.close_delay = CLOSING_DELAY; |
@@ -867,60 +591,6 @@ static void whiteheat_break_ctl(struct tty_struct *tty, int break_state) | |||
867 | } | 591 | } |
868 | 592 | ||
869 | 593 | ||
870 | static int whiteheat_chars_in_buffer(struct tty_struct *tty) | ||
871 | { | ||
872 | struct usb_serial_port *port = tty->driver_data; | ||
873 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
874 | struct list_head *tmp; | ||
875 | struct whiteheat_urb_wrap *wrap; | ||
876 | int chars = 0; | ||
877 | unsigned long flags; | ||
878 | |||
879 | dbg("%s - port %d", __func__, port->number); | ||
880 | |||
881 | spin_lock_irqsave(&info->lock, flags); | ||
882 | list_for_each(tmp, &info->tx_urbs_submitted) { | ||
883 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
884 | chars += wrap->urb->transfer_buffer_length; | ||
885 | } | ||
886 | spin_unlock_irqrestore(&info->lock, flags); | ||
887 | |||
888 | dbg("%s - returns %d", __func__, chars); | ||
889 | return chars; | ||
890 | } | ||
891 | |||
892 | |||
893 | static void whiteheat_throttle(struct tty_struct *tty) | ||
894 | { | ||
895 | struct usb_serial_port *port = tty->driver_data; | ||
896 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
897 | |||
898 | dbg("%s - port %d", __func__, port->number); | ||
899 | |||
900 | spin_lock_irq(&info->lock); | ||
901 | info->flags |= THROTTLED; | ||
902 | spin_unlock_irq(&info->lock); | ||
903 | } | ||
904 | |||
905 | |||
906 | static void whiteheat_unthrottle(struct tty_struct *tty) | ||
907 | { | ||
908 | struct usb_serial_port *port = tty->driver_data; | ||
909 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
910 | int actually_throttled; | ||
911 | |||
912 | dbg("%s - port %d", __func__, port->number); | ||
913 | |||
914 | spin_lock_irq(&info->lock); | ||
915 | actually_throttled = info->flags & ACTUALLY_THROTTLED; | ||
916 | info->flags &= ~(THROTTLED | ACTUALLY_THROTTLED); | ||
917 | spin_unlock_irq(&info->lock); | ||
918 | |||
919 | if (actually_throttled) | ||
920 | rx_data_softint(&info->rx_work); | ||
921 | } | ||
922 | |||
923 | |||
924 | /***************************************************************************** | 594 | /***************************************************************************** |
925 | * Connect Tech's White Heat callback routines | 595 | * Connect Tech's White Heat callback routines |
926 | *****************************************************************************/ | 596 | *****************************************************************************/ |
@@ -989,80 +659,6 @@ static void command_port_read_callback(struct urb *urb) | |||
989 | } | 659 | } |
990 | 660 | ||
991 | 661 | ||
992 | static void whiteheat_read_callback(struct urb *urb) | ||
993 | { | ||
994 | struct usb_serial_port *port = urb->context; | ||
995 | struct whiteheat_urb_wrap *wrap; | ||
996 | unsigned char *data = urb->transfer_buffer; | ||
997 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
998 | int status = urb->status; | ||
999 | |||
1000 | dbg("%s - port %d", __func__, port->number); | ||
1001 | |||
1002 | spin_lock(&info->lock); | ||
1003 | wrap = urb_to_wrap(urb, &info->rx_urbs_submitted); | ||
1004 | if (!wrap) { | ||
1005 | spin_unlock(&info->lock); | ||
1006 | dev_err(&port->dev, "%s - Not my urb!\n", __func__); | ||
1007 | return; | ||
1008 | } | ||
1009 | list_del(&wrap->list); | ||
1010 | spin_unlock(&info->lock); | ||
1011 | |||
1012 | if (status) { | ||
1013 | dbg("%s - nonzero read bulk status received: %d", | ||
1014 | __func__, status); | ||
1015 | spin_lock(&info->lock); | ||
1016 | list_add(&wrap->list, &info->rx_urbs_free); | ||
1017 | spin_unlock(&info->lock); | ||
1018 | return; | ||
1019 | } | ||
1020 | |||
1021 | usb_serial_debug_data(debug, &port->dev, | ||
1022 | __func__, urb->actual_length, data); | ||
1023 | |||
1024 | spin_lock(&info->lock); | ||
1025 | list_add_tail(&wrap->list, &info->rx_urb_q); | ||
1026 | if (info->flags & THROTTLED) { | ||
1027 | info->flags |= ACTUALLY_THROTTLED; | ||
1028 | spin_unlock(&info->lock); | ||
1029 | return; | ||
1030 | } | ||
1031 | spin_unlock(&info->lock); | ||
1032 | |||
1033 | schedule_work(&info->rx_work); | ||
1034 | } | ||
1035 | |||
1036 | |||
1037 | static void whiteheat_write_callback(struct urb *urb) | ||
1038 | { | ||
1039 | struct usb_serial_port *port = urb->context; | ||
1040 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
1041 | struct whiteheat_urb_wrap *wrap; | ||
1042 | int status = urb->status; | ||
1043 | |||
1044 | dbg("%s - port %d", __func__, port->number); | ||
1045 | |||
1046 | spin_lock(&info->lock); | ||
1047 | wrap = urb_to_wrap(urb, &info->tx_urbs_submitted); | ||
1048 | if (!wrap) { | ||
1049 | spin_unlock(&info->lock); | ||
1050 | dev_err(&port->dev, "%s - Not my urb!\n", __func__); | ||
1051 | return; | ||
1052 | } | ||
1053 | list_move(&wrap->list, &info->tx_urbs_free); | ||
1054 | spin_unlock(&info->lock); | ||
1055 | |||
1056 | if (status) { | ||
1057 | dbg("%s - nonzero write bulk status received: %d", | ||
1058 | __func__, status); | ||
1059 | return; | ||
1060 | } | ||
1061 | |||
1062 | usb_serial_port_softint(port); | ||
1063 | } | ||
1064 | |||
1065 | |||
1066 | /***************************************************************************** | 662 | /***************************************************************************** |
1067 | * Connect Tech's White Heat firmware interface | 663 | * Connect Tech's White Heat firmware interface |
1068 | *****************************************************************************/ | 664 | *****************************************************************************/ |
@@ -1337,123 +933,6 @@ static void stop_command_port(struct usb_serial *serial) | |||
1337 | mutex_unlock(&command_info->mutex); | 933 | mutex_unlock(&command_info->mutex); |
1338 | } | 934 | } |
1339 | 935 | ||
1340 | |||
1341 | static int start_port_read(struct usb_serial_port *port) | ||
1342 | { | ||
1343 | struct whiteheat_private *info = usb_get_serial_port_data(port); | ||
1344 | struct whiteheat_urb_wrap *wrap; | ||
1345 | struct urb *urb; | ||
1346 | int retval = 0; | ||
1347 | unsigned long flags; | ||
1348 | struct list_head *tmp; | ||
1349 | struct list_head *tmp2; | ||
1350 | |||
1351 | spin_lock_irqsave(&info->lock, flags); | ||
1352 | |||
1353 | list_for_each_safe(tmp, tmp2, &info->rx_urbs_free) { | ||
1354 | list_del(tmp); | ||
1355 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
1356 | urb = wrap->urb; | ||
1357 | spin_unlock_irqrestore(&info->lock, flags); | ||
1358 | retval = usb_submit_urb(urb, GFP_KERNEL); | ||
1359 | if (retval) { | ||
1360 | spin_lock_irqsave(&info->lock, flags); | ||
1361 | list_add(tmp, &info->rx_urbs_free); | ||
1362 | list_for_each_safe(tmp, tmp2, &info->rx_urbs_submitted) { | ||
1363 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
1364 | urb = wrap->urb; | ||
1365 | list_del(tmp); | ||
1366 | spin_unlock_irqrestore(&info->lock, flags); | ||
1367 | usb_kill_urb(urb); | ||
1368 | spin_lock_irqsave(&info->lock, flags); | ||
1369 | list_add(tmp, &info->rx_urbs_free); | ||
1370 | } | ||
1371 | break; | ||
1372 | } | ||
1373 | spin_lock_irqsave(&info->lock, flags); | ||
1374 | list_add(tmp, &info->rx_urbs_submitted); | ||
1375 | } | ||
1376 | |||
1377 | spin_unlock_irqrestore(&info->lock, flags); | ||
1378 | |||
1379 | return retval; | ||
1380 | } | ||
1381 | |||
1382 | |||
1383 | static struct whiteheat_urb_wrap *urb_to_wrap(struct urb *urb, | ||
1384 | struct list_head *head) | ||
1385 | { | ||
1386 | struct whiteheat_urb_wrap *wrap; | ||
1387 | struct list_head *tmp; | ||
1388 | |||
1389 | list_for_each(tmp, head) { | ||
1390 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
1391 | if (wrap->urb == urb) | ||
1392 | return wrap; | ||
1393 | } | ||
1394 | |||
1395 | return NULL; | ||
1396 | } | ||
1397 | |||
1398 | |||
1399 | static struct list_head *list_first(struct list_head *head) | ||
1400 | { | ||
1401 | return head->next; | ||
1402 | } | ||
1403 | |||
1404 | |||
1405 | static void rx_data_softint(struct work_struct *work) | ||
1406 | { | ||
1407 | struct whiteheat_private *info = | ||
1408 | container_of(work, struct whiteheat_private, rx_work); | ||
1409 | struct usb_serial_port *port = info->port; | ||
1410 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
1411 | struct whiteheat_urb_wrap *wrap; | ||
1412 | struct urb *urb; | ||
1413 | unsigned long flags; | ||
1414 | struct list_head *tmp; | ||
1415 | struct list_head *tmp2; | ||
1416 | int result; | ||
1417 | int sent = 0; | ||
1418 | |||
1419 | spin_lock_irqsave(&info->lock, flags); | ||
1420 | if (info->flags & THROTTLED) { | ||
1421 | spin_unlock_irqrestore(&info->lock, flags); | ||
1422 | goto out; | ||
1423 | } | ||
1424 | |||
1425 | list_for_each_safe(tmp, tmp2, &info->rx_urb_q) { | ||
1426 | list_del(tmp); | ||
1427 | spin_unlock_irqrestore(&info->lock, flags); | ||
1428 | |||
1429 | wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); | ||
1430 | urb = wrap->urb; | ||
1431 | |||
1432 | if (tty && urb->actual_length) | ||
1433 | sent += tty_insert_flip_string(tty, | ||
1434 | urb->transfer_buffer, urb->actual_length); | ||
1435 | |||
1436 | result = usb_submit_urb(urb, GFP_ATOMIC); | ||
1437 | if (result) { | ||
1438 | dev_err(&port->dev, | ||
1439 | "%s - failed resubmitting read urb, error %d\n", | ||
1440 | __func__, result); | ||
1441 | spin_lock_irqsave(&info->lock, flags); | ||
1442 | list_add(tmp, &info->rx_urbs_free); | ||
1443 | continue; | ||
1444 | } | ||
1445 | |||
1446 | spin_lock_irqsave(&info->lock, flags); | ||
1447 | list_add(tmp, &info->rx_urbs_submitted); | ||
1448 | } | ||
1449 | spin_unlock_irqrestore(&info->lock, flags); | ||
1450 | |||
1451 | if (sent) | ||
1452 | tty_flip_buffer_push(tty); | ||
1453 | out: | ||
1454 | tty_kref_put(tty); | ||
1455 | } | ||
1456 | |||
1457 | module_usb_serial_driver(whiteheat_driver, serial_drivers); | 936 | module_usb_serial_driver(whiteheat_driver, serial_drivers); |
1458 | 937 | ||
1459 | MODULE_AUTHOR(DRIVER_AUTHOR); | 938 | MODULE_AUTHOR(DRIVER_AUTHOR); |
@@ -1463,8 +942,5 @@ MODULE_LICENSE("GPL"); | |||
1463 | MODULE_FIRMWARE("whiteheat.fw"); | 942 | MODULE_FIRMWARE("whiteheat.fw"); |
1464 | MODULE_FIRMWARE("whiteheat_loader.fw"); | 943 | MODULE_FIRMWARE("whiteheat_loader.fw"); |
1465 | 944 | ||
1466 | module_param(urb_pool_size, int, 0); | ||
1467 | MODULE_PARM_DESC(urb_pool_size, "Number of urbs to use for buffering"); | ||
1468 | |||
1469 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 945 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
1470 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 946 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index e7e678109500..b28f2ad127d4 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c | |||
@@ -1933,11 +1933,7 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag) | |||
1933 | kfree(buf); | 1933 | kfree(buf); |
1934 | 1934 | ||
1935 | nofw: | 1935 | nofw: |
1936 | if (sd_fw != NULL) { | 1936 | release_firmware(sd_fw); |
1937 | release_firmware(sd_fw); | ||
1938 | sd_fw = NULL; | ||
1939 | } | ||
1940 | |||
1941 | return result; | 1937 | return result; |
1942 | } | 1938 | } |
1943 | 1939 | ||
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 5af9a075498f..98bb2901d7b7 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -139,6 +139,7 @@ struct bcma_device { | |||
139 | u8 core_unit; | 139 | u8 core_unit; |
140 | 140 | ||
141 | u32 addr; | 141 | u32 addr; |
142 | u32 addr1; | ||
142 | u32 wrap; | 143 | u32 wrap; |
143 | 144 | ||
144 | void __iomem *io_addr; | 145 | void __iomem *io_addr; |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index fffdf00f87b9..15be561e7397 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 7 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
8 | * | 8 | * |
9 | * Copyright 2004 Freescale Semiconductor, Inc | 9 | * Copyright 2004,2012 Freescale Semiconductor, Inc |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 11 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the | 12 | * under the terms of the GNU General Public License as published by the |
@@ -17,6 +17,12 @@ | |||
17 | #ifndef _FSL_DEVICE_H_ | 17 | #ifndef _FSL_DEVICE_H_ |
18 | #define _FSL_DEVICE_H_ | 18 | #define _FSL_DEVICE_H_ |
19 | 19 | ||
20 | #define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI | ||
21 | PHY CLK to become stable - 10ms*/ | ||
22 | #define FSL_USB_VER_OLD 0 | ||
23 | #define FSL_USB_VER_1_6 1 | ||
24 | #define FSL_USB_VER_2_2 2 | ||
25 | |||
20 | #include <linux/types.h> | 26 | #include <linux/types.h> |
21 | 27 | ||
22 | /* | 28 | /* |
@@ -63,6 +69,7 @@ struct platform_device; | |||
63 | 69 | ||
64 | struct fsl_usb2_platform_data { | 70 | struct fsl_usb2_platform_data { |
65 | /* board specific information */ | 71 | /* board specific information */ |
72 | int controller_ver; | ||
66 | enum fsl_usb2_operating_modes operating_mode; | 73 | enum fsl_usb2_operating_modes operating_mode; |
67 | enum fsl_usb2_phy_modes phy_mode; | 74 | enum fsl_usb2_phy_modes phy_mode; |
68 | unsigned int port_enables; | 75 | unsigned int port_enables; |
diff --git a/include/linux/platform_data/ehci-sh.h b/include/linux/platform_data/ehci-sh.h new file mode 100644 index 000000000000..5c15a738e116 --- /dev/null +++ b/include/linux/platform_data/ehci-sh.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * EHCI SuperH driver platform data | ||
3 | * | ||
4 | * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> | ||
5 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __USB_EHCI_SH_H | ||
22 | #define __USB_EHCI_SH_H | ||
23 | |||
24 | struct ehci_sh_platdata { | ||
25 | void (*phy_init)(void); /* Phy init function */ | ||
26 | }; | ||
27 | |||
28 | #endif /* __USB_EHCI_SH_H */ | ||
diff --git a/include/linux/usb.h b/include/linux/usb.h index 73b68d1f2cb0..22e9b328975b 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -1627,6 +1627,7 @@ static inline int usb_translate_errors(int error_code) | |||
1627 | case 0: | 1627 | case 0: |
1628 | case -ENOMEM: | 1628 | case -ENOMEM: |
1629 | case -ENODEV: | 1629 | case -ENODEV: |
1630 | case -EOPNOTSUPP: | ||
1630 | return error_code; | 1631 | return error_code; |
1631 | default: | 1632 | default: |
1632 | return -EIO; | 1633 | return -EIO; |