diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-16 23:48:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-16 23:48:14 -0400 |
commit | b62dabfb4b28a2d88deb4907ed0249da4d33d279 (patch) | |
tree | f3f00bcffd865218de8e53b9b08cb70dbb2bf432 | |
parent | 306a63bee192859ebd32c7328c7766636d882d8f (diff) | |
parent | e86103a75705c7c530768f4ffaba74cf382910f2 (diff) |
Merge tag 'usb-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB driver fixes from Greg KH:
"Here are some small USB fixes for 4.6-rc4.
Mostly xhci fixes for reported issues, a UAS bug that has hit a number
of people, including stable tree users, and a few other minor things.
All have been in linux-next for a while with no reported issues"
* tag 'usb-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: hcd: out of bounds access in for_each_companion
USB: uas: Add a new NO_REPORT_LUNS quirk
USB: uas: Limit qdepth at the scsi-host level
doc: usb: Fix typo in gadget_multi documentation
usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
xhci: fix 10 second timeout on removal of PCI hotpluggable xhci controllers
usb: xhci: fix wild pointers in xhci_mem_cleanup
usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys
usb: host: xhci: add a new quirk XHCI_NO_64BIT_SUPPORT
xhci: resume USB 3 roothub first
usb: xhci: applying XHCI_PME_STUCK_QUIRK to Intel BXT B0 host
cdc-acm: fix crash if flushed with nothing buffered
-rw-r--r-- | Documentation/kernel-parameters.txt | 2 | ||||
-rw-r--r-- | Documentation/usb/gadget_multi.txt | 2 | ||||
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 13 | ||||
-rw-r--r-- | drivers/usb/host/xhci-plat.h | 2 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 24 | ||||
-rw-r--r-- | drivers/usb/host/xhci.h | 2 | ||||
-rw-r--r-- | drivers/usb/storage/uas.c | 21 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_uas.h | 7 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 5 | ||||
-rw-r--r-- | include/linux/usb_usual.h | 2 |
15 files changed, 94 insertions, 13 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ecc74fa4bfde..0b3de80ec8f6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -4077,6 +4077,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
4077 | sector if the number is odd); | 4077 | sector if the number is odd); |
4078 | i = IGNORE_DEVICE (don't bind to this | 4078 | i = IGNORE_DEVICE (don't bind to this |
4079 | device); | 4079 | device); |
4080 | j = NO_REPORT_LUNS (don't use report luns | ||
4081 | command, uas only); | ||
4080 | l = NOT_LOCKABLE (don't try to lock and | 4082 | l = NOT_LOCKABLE (don't try to lock and |
4081 | unlock ejectable media); | 4083 | unlock ejectable media); |
4082 | m = MAX_SECTORS_64 (don't transfer more | 4084 | m = MAX_SECTORS_64 (don't transfer more |
diff --git a/Documentation/usb/gadget_multi.txt b/Documentation/usb/gadget_multi.txt index 7d66a8636cb5..5faf514047e9 100644 --- a/Documentation/usb/gadget_multi.txt +++ b/Documentation/usb/gadget_multi.txt | |||
@@ -43,7 +43,7 @@ For the gadget two work under Windows two conditions have to be met: | |||
43 | First of all, Windows need to detect the gadget as an USB composite | 43 | First of all, Windows need to detect the gadget as an USB composite |
44 | gadget which on its own have some conditions[4]. If they are met, | 44 | gadget which on its own have some conditions[4]. If they are met, |
45 | Windows lets USB Generic Parent Driver[5] handle the device which then | 45 | Windows lets USB Generic Parent Driver[5] handle the device which then |
46 | tries to much drivers for each individual interface (sort of, don't | 46 | tries to match drivers for each individual interface (sort of, don't |
47 | get into too many details). | 47 | get into too many details). |
48 | 48 | ||
49 | The good news is: you do not have to worry about most of the | 49 | The good news is: you do not have to worry about most of the |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 83fd30b0577c..a6c4a1b895bd 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -744,11 +744,15 @@ static void acm_tty_flush_chars(struct tty_struct *tty) | |||
744 | int err; | 744 | int err; |
745 | unsigned long flags; | 745 | unsigned long flags; |
746 | 746 | ||
747 | if (!cur) /* nothing to do */ | ||
748 | return; | ||
749 | |||
747 | acm->putbuffer = NULL; | 750 | acm->putbuffer = NULL; |
748 | err = usb_autopm_get_interface_async(acm->control); | 751 | err = usb_autopm_get_interface_async(acm->control); |
749 | spin_lock_irqsave(&acm->write_lock, flags); | 752 | spin_lock_irqsave(&acm->write_lock, flags); |
750 | if (err < 0) { | 753 | if (err < 0) { |
751 | cur->use = 0; | 754 | cur->use = 0; |
755 | acm->putbuffer = cur; | ||
752 | goto out; | 756 | goto out; |
753 | } | 757 | } |
754 | 758 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index f9d42cf23e55..7859d738df41 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -73,6 +73,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd, | |||
73 | if (companion->bus != pdev->bus || | 73 | if (companion->bus != pdev->bus || |
74 | PCI_SLOT(companion->devfn) != slot) | 74 | PCI_SLOT(companion->devfn) != slot) |
75 | continue; | 75 | continue; |
76 | |||
77 | /* | ||
78 | * Companion device should be either UHCI,OHCI or EHCI host | ||
79 | * controller, otherwise skip. | ||
80 | */ | ||
81 | if (companion->class != CL_UHCI && companion->class != CL_OHCI && | ||
82 | companion->class != CL_EHCI) | ||
83 | continue; | ||
84 | |||
76 | companion_hcd = pci_get_drvdata(companion); | 85 | companion_hcd = pci_get_drvdata(companion); |
77 | if (!companion_hcd || !companion_hcd->self.root_hub) | 86 | if (!companion_hcd || !companion_hcd->self.root_hub) |
78 | continue; | 87 | continue; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 80c1de239e9a..bad0d1f9a41d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1861,6 +1861,12 @@ no_bw: | |||
1861 | kfree(xhci->rh_bw); | 1861 | kfree(xhci->rh_bw); |
1862 | kfree(xhci->ext_caps); | 1862 | kfree(xhci->ext_caps); |
1863 | 1863 | ||
1864 | xhci->usb2_ports = NULL; | ||
1865 | xhci->usb3_ports = NULL; | ||
1866 | xhci->port_array = NULL; | ||
1867 | xhci->rh_bw = NULL; | ||
1868 | xhci->ext_caps = NULL; | ||
1869 | |||
1864 | xhci->page_size = 0; | 1870 | xhci->page_size = 0; |
1865 | xhci->page_shift = 0; | 1871 | xhci->page_shift = 0; |
1866 | xhci->bus_state[0].bus_suspended = 0; | 1872 | xhci->bus_state[0].bus_suspended = 0; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index f0640b7a1c42..48672fac7ff3 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f | 48 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f |
49 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f | 49 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f |
50 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 | 50 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 |
51 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 | ||
51 | 52 | ||
52 | static const char hcd_name[] = "xhci_hcd"; | 53 | static const char hcd_name[] = "xhci_hcd"; |
53 | 54 | ||
@@ -155,7 +156,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
155 | (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || | 156 | (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || |
156 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || | 157 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || |
157 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | 158 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || |
158 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI)) { | 159 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || |
160 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) { | ||
159 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; | 161 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; |
160 | } | 162 | } |
161 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 163 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
@@ -302,6 +304,7 @@ static void xhci_pci_remove(struct pci_dev *dev) | |||
302 | struct xhci_hcd *xhci; | 304 | struct xhci_hcd *xhci; |
303 | 305 | ||
304 | xhci = hcd_to_xhci(pci_get_drvdata(dev)); | 306 | xhci = hcd_to_xhci(pci_get_drvdata(dev)); |
307 | xhci->xhc_state |= XHCI_STATE_REMOVING; | ||
305 | if (xhci->shared_hcd) { | 308 | if (xhci->shared_hcd) { |
306 | usb_remove_hcd(xhci->shared_hcd); | 309 | usb_remove_hcd(xhci->shared_hcd); |
307 | usb_put_hcd(xhci->shared_hcd); | 310 | usb_put_hcd(xhci->shared_hcd); |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 5c15e9bc5f7a..474b5fa14900 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -39,12 +39,25 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = { | |||
39 | 39 | ||
40 | static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) | 40 | static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) |
41 | { | 41 | { |
42 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | ||
43 | |||
42 | /* | 44 | /* |
43 | * As of now platform drivers don't provide MSI support so we ensure | 45 | * As of now platform drivers don't provide MSI support so we ensure |
44 | * here that the generic code does not try to make a pci_dev from our | 46 | * here that the generic code does not try to make a pci_dev from our |
45 | * dev struct in order to setup MSI | 47 | * dev struct in order to setup MSI |
46 | */ | 48 | */ |
47 | xhci->quirks |= XHCI_PLAT; | 49 | xhci->quirks |= XHCI_PLAT; |
50 | |||
51 | /* | ||
52 | * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set | ||
53 | * to 1. However, these SoCs don't support 64-bit address memory | ||
54 | * pointers. So, this driver clears the AC64 bit of xhci->hcc_params | ||
55 | * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in | ||
56 | * xhci_gen_setup(). | ||
57 | */ | ||
58 | if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) || | ||
59 | xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) | ||
60 | xhci->quirks |= XHCI_NO_64BIT_SUPPORT; | ||
48 | } | 61 | } |
49 | 62 | ||
50 | /* called during probe() after chip reset completes */ | 63 | /* called during probe() after chip reset completes */ |
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h index 5a2e2e3936c4..529c3c40f901 100644 --- a/drivers/usb/host/xhci-plat.h +++ b/drivers/usb/host/xhci-plat.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include "xhci.h" /* for hcd_to_xhci() */ | 14 | #include "xhci.h" /* for hcd_to_xhci() */ |
15 | 15 | ||
16 | enum xhci_plat_type { | 16 | enum xhci_plat_type { |
17 | XHCI_PLAT_TYPE_MARVELL_ARMADA, | 17 | XHCI_PLAT_TYPE_MARVELL_ARMADA = 1, |
18 | XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, | 18 | XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, |
19 | XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3, | 19 | XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3, |
20 | }; | 20 | }; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 7cf66212ceae..99b4ff42f7a0 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -4004,7 +4004,8 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, | |||
4004 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; | 4004 | int reserved_trbs = xhci->cmd_ring_reserved_trbs; |
4005 | int ret; | 4005 | int ret; |
4006 | 4006 | ||
4007 | if (xhci->xhc_state) { | 4007 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
4008 | (xhci->xhc_state & XHCI_STATE_HALTED)) { | ||
4008 | xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); | 4009 | xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); |
4009 | return -ESHUTDOWN; | 4010 | return -ESHUTDOWN; |
4010 | } | 4011 | } |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d51ee0c3cf9f..9e71c96ad74a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -147,7 +147,8 @@ static int xhci_start(struct xhci_hcd *xhci) | |||
147 | "waited %u microseconds.\n", | 147 | "waited %u microseconds.\n", |
148 | XHCI_MAX_HALT_USEC); | 148 | XHCI_MAX_HALT_USEC); |
149 | if (!ret) | 149 | if (!ret) |
150 | xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING); | 150 | /* clear state flags. Including dying, halted or removing */ |
151 | xhci->xhc_state = 0; | ||
151 | 152 | ||
152 | return ret; | 153 | return ret; |
153 | } | 154 | } |
@@ -1108,8 +1109,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1108 | /* Resume root hubs only when have pending events. */ | 1109 | /* Resume root hubs only when have pending events. */ |
1109 | status = readl(&xhci->op_regs->status); | 1110 | status = readl(&xhci->op_regs->status); |
1110 | if (status & STS_EINT) { | 1111 | if (status & STS_EINT) { |
1111 | usb_hcd_resume_root_hub(hcd); | ||
1112 | usb_hcd_resume_root_hub(xhci->shared_hcd); | 1112 | usb_hcd_resume_root_hub(xhci->shared_hcd); |
1113 | usb_hcd_resume_root_hub(hcd); | ||
1113 | } | 1114 | } |
1114 | } | 1115 | } |
1115 | 1116 | ||
@@ -1124,10 +1125,10 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1124 | 1125 | ||
1125 | /* Re-enable port polling. */ | 1126 | /* Re-enable port polling. */ |
1126 | xhci_dbg(xhci, "%s: starting port polling.\n", __func__); | 1127 | xhci_dbg(xhci, "%s: starting port polling.\n", __func__); |
1127 | set_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
1128 | usb_hcd_poll_rh_status(hcd); | ||
1129 | set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); | 1128 | set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); |
1130 | usb_hcd_poll_rh_status(xhci->shared_hcd); | 1129 | usb_hcd_poll_rh_status(xhci->shared_hcd); |
1130 | set_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
1131 | usb_hcd_poll_rh_status(hcd); | ||
1131 | 1132 | ||
1132 | return retval; | 1133 | return retval; |
1133 | } | 1134 | } |
@@ -2773,7 +2774,8 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | |||
2773 | if (ret <= 0) | 2774 | if (ret <= 0) |
2774 | return ret; | 2775 | return ret; |
2775 | xhci = hcd_to_xhci(hcd); | 2776 | xhci = hcd_to_xhci(hcd); |
2776 | if (xhci->xhc_state & XHCI_STATE_DYING) | 2777 | if ((xhci->xhc_state & XHCI_STATE_DYING) || |
2778 | (xhci->xhc_state & XHCI_STATE_REMOVING)) | ||
2777 | return -ENODEV; | 2779 | return -ENODEV; |
2778 | 2780 | ||
2779 | xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); | 2781 | xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); |
@@ -3820,7 +3822,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3820 | 3822 | ||
3821 | mutex_lock(&xhci->mutex); | 3823 | mutex_lock(&xhci->mutex); |
3822 | 3824 | ||
3823 | if (xhci->xhc_state) /* dying or halted */ | 3825 | if (xhci->xhc_state) /* dying, removing or halted */ |
3824 | goto out; | 3826 | goto out; |
3825 | 3827 | ||
3826 | if (!udev->slot_id) { | 3828 | if (!udev->slot_id) { |
@@ -4948,6 +4950,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4948 | return retval; | 4950 | return retval; |
4949 | xhci_dbg(xhci, "Reset complete\n"); | 4951 | xhci_dbg(xhci, "Reset complete\n"); |
4950 | 4952 | ||
4953 | /* | ||
4954 | * On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) | ||
4955 | * of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit | ||
4956 | * address memory pointers actually. So, this driver clears the AC64 | ||
4957 | * bit of xhci->hcc_params to call dma_set_coherent_mask(dev, | ||
4958 | * DMA_BIT_MASK(32)) in this xhci_gen_setup(). | ||
4959 | */ | ||
4960 | if (xhci->quirks & XHCI_NO_64BIT_SUPPORT) | ||
4961 | xhci->hcc_params &= ~BIT(0); | ||
4962 | |||
4951 | /* Set dma_mask and coherent_dma_mask to 64-bits, | 4963 | /* Set dma_mask and coherent_dma_mask to 64-bits, |
4952 | * if xHC supports 64-bit addressing */ | 4964 | * if xHC supports 64-bit addressing */ |
4953 | if (HCC_64BIT_ADDR(xhci->hcc_params) && | 4965 | if (HCC_64BIT_ADDR(xhci->hcc_params) && |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index e293e0974f48..6c629c97f8ad 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1605,6 +1605,7 @@ struct xhci_hcd { | |||
1605 | */ | 1605 | */ |
1606 | #define XHCI_STATE_DYING (1 << 0) | 1606 | #define XHCI_STATE_DYING (1 << 0) |
1607 | #define XHCI_STATE_HALTED (1 << 1) | 1607 | #define XHCI_STATE_HALTED (1 << 1) |
1608 | #define XHCI_STATE_REMOVING (1 << 2) | ||
1608 | /* Statistics */ | 1609 | /* Statistics */ |
1609 | int error_bitmask; | 1610 | int error_bitmask; |
1610 | unsigned int quirks; | 1611 | unsigned int quirks; |
@@ -1641,6 +1642,7 @@ struct xhci_hcd { | |||
1641 | #define XHCI_PME_STUCK_QUIRK (1 << 20) | 1642 | #define XHCI_PME_STUCK_QUIRK (1 << 20) |
1642 | #define XHCI_MTK_HOST (1 << 21) | 1643 | #define XHCI_MTK_HOST (1 << 21) |
1643 | #define XHCI_SSIC_PORT_UNUSED (1 << 22) | 1644 | #define XHCI_SSIC_PORT_UNUSED (1 << 22) |
1645 | #define XHCI_NO_64BIT_SUPPORT (1 << 23) | ||
1644 | unsigned int num_active_eps; | 1646 | unsigned int num_active_eps; |
1645 | unsigned int limit_active_eps; | 1647 | unsigned int limit_active_eps; |
1646 | /* There are two roothubs to keep track of bus suspend info for */ | 1648 | /* There are two roothubs to keep track of bus suspend info for */ |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 13e4cc31bc79..16bc679dc2fc 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * USB Attached SCSI | 2 | * USB Attached SCSI |
3 | * Note that this is not the same as the USB Mass Storage driver | 3 | * Note that this is not the same as the USB Mass Storage driver |
4 | * | 4 | * |
5 | * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014 | 5 | * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016 |
6 | * Copyright Matthew Wilcox for Intel Corp, 2010 | 6 | * Copyright Matthew Wilcox for Intel Corp, 2010 |
7 | * Copyright Sarah Sharp for Intel Corp, 2010 | 7 | * Copyright Sarah Sharp for Intel Corp, 2010 |
8 | * | 8 | * |
@@ -781,6 +781,17 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
781 | return SUCCESS; | 781 | return SUCCESS; |
782 | } | 782 | } |
783 | 783 | ||
784 | static int uas_target_alloc(struct scsi_target *starget) | ||
785 | { | ||
786 | struct uas_dev_info *devinfo = (struct uas_dev_info *) | ||
787 | dev_to_shost(starget->dev.parent)->hostdata; | ||
788 | |||
789 | if (devinfo->flags & US_FL_NO_REPORT_LUNS) | ||
790 | starget->no_report_luns = 1; | ||
791 | |||
792 | return 0; | ||
793 | } | ||
794 | |||
784 | static int uas_slave_alloc(struct scsi_device *sdev) | 795 | static int uas_slave_alloc(struct scsi_device *sdev) |
785 | { | 796 | { |
786 | struct uas_dev_info *devinfo = | 797 | struct uas_dev_info *devinfo = |
@@ -824,7 +835,6 @@ static int uas_slave_configure(struct scsi_device *sdev) | |||
824 | if (devinfo->flags & US_FL_BROKEN_FUA) | 835 | if (devinfo->flags & US_FL_BROKEN_FUA) |
825 | sdev->broken_fua = 1; | 836 | sdev->broken_fua = 1; |
826 | 837 | ||
827 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); | ||
828 | return 0; | 838 | return 0; |
829 | } | 839 | } |
830 | 840 | ||
@@ -832,6 +842,7 @@ static struct scsi_host_template uas_host_template = { | |||
832 | .module = THIS_MODULE, | 842 | .module = THIS_MODULE, |
833 | .name = "uas", | 843 | .name = "uas", |
834 | .queuecommand = uas_queuecommand, | 844 | .queuecommand = uas_queuecommand, |
845 | .target_alloc = uas_target_alloc, | ||
835 | .slave_alloc = uas_slave_alloc, | 846 | .slave_alloc = uas_slave_alloc, |
836 | .slave_configure = uas_slave_configure, | 847 | .slave_configure = uas_slave_configure, |
837 | .eh_abort_handler = uas_eh_abort_handler, | 848 | .eh_abort_handler = uas_eh_abort_handler, |
@@ -956,6 +967,12 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
956 | if (result) | 967 | if (result) |
957 | goto set_alt0; | 968 | goto set_alt0; |
958 | 969 | ||
970 | /* | ||
971 | * 1 tag is reserved for untagged commands + | ||
972 | * 1 tag to avoid off by one errors in some bridge firmwares | ||
973 | */ | ||
974 | shost->can_queue = devinfo->qdepth - 2; | ||
975 | |||
959 | usb_set_intfdata(intf, shost); | 976 | usb_set_intfdata(intf, shost); |
960 | result = scsi_add_host(shost, &intf->dev); | 977 | result = scsi_add_host(shost, &intf->dev); |
961 | if (result) | 978 | if (result) |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index ccc113e83d88..53341a77d89f 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -64,6 +64,13 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, | |||
64 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 64 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
65 | US_FL_NO_ATA_1X), | 65 | US_FL_NO_ATA_1X), |
66 | 66 | ||
67 | /* Reported-by: David Webb <djw@noc.ac.uk> */ | ||
68 | UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, | ||
69 | "Seagate", | ||
70 | "Expansion Desk", | ||
71 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
72 | US_FL_NO_REPORT_LUNS), | ||
73 | |||
67 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 74 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
68 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, | 75 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, |
69 | "Seagate", | 76 | "Seagate", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 43576ed31ccd..9de988a0f856 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -482,7 +482,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
482 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | | 482 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
483 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | | 483 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | |
484 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | | 484 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | |
485 | US_FL_MAX_SECTORS_240); | 485 | US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS); |
486 | 486 | ||
487 | p = quirks; | 487 | p = quirks; |
488 | while (*p) { | 488 | while (*p) { |
@@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
532 | case 'i': | 532 | case 'i': |
533 | f |= US_FL_IGNORE_DEVICE; | 533 | f |= US_FL_IGNORE_DEVICE; |
534 | break; | 534 | break; |
535 | case 'j': | ||
536 | f |= US_FL_NO_REPORT_LUNS; | ||
537 | break; | ||
535 | case 'l': | 538 | case 'l': |
536 | f |= US_FL_NOT_LOCKABLE; | 539 | f |= US_FL_NOT_LOCKABLE; |
537 | break; | 540 | break; |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 7f5f78bd15ad..245f57dbbb61 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -79,6 +79,8 @@ | |||
79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ | 79 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ |
80 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ | 80 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ |
81 | /* Sets max_sectors to 240 */ \ | 81 | /* Sets max_sectors to 240 */ \ |
82 | US_FLAG(NO_REPORT_LUNS, 0x10000000) \ | ||
83 | /* Cannot handle REPORT_LUNS */ \ | ||
82 | 84 | ||
83 | #define US_FLAG(name, value) US_FL_##name = value , | 85 | #define US_FLAG(name, value) US_FL_##name = value , |
84 | enum { US_DO_ALL_FLAGS }; | 86 | enum { US_DO_ALL_FLAGS }; |