aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
Diffstat (limited to 'usb')
-rw-r--r--usb/scsi-sd-add-a-no_read_capacity_16-scsi_device-flag.patch85
-rw-r--r--usb/scsi-sr-add-no_read_disc_info-scsi_device-flag.patch72
-rw-r--r--usb/usb-add-uas-driver.patch2
-rw-r--r--usb/usb-do-not-print-eshutdown-message-if-usb-at-otg-device-mode.patch36
-rw-r--r--usb/usb-gadget-goku_udc-fix-error-path.patch117
-rw-r--r--usb/usb-musb-gadget-fix-zlp-sending-in-musb_g_tx-v1.patch2
-rw-r--r--usb/usb-musb-gadget-kill-duplicate-code-in-musb_gadget_queue.patch34
-rw-r--r--usb/usb-musb-gadget-kill-unreachable-code-in-musb_g_rx.patch4
-rw-r--r--usb/usb-musb-gadget-only-enable-autoclear-in-double-buffered-case.patch2
-rw-r--r--usb/usb-musb-gadget-unmapping-the-dma-buffer-when-switching-to-pio-mode.patch190
-rw-r--r--usb/usb-storage-add-new-no_read_capacity_16-quirk.patch67
-rw-r--r--usb/usb-storage-add-new-no_read_disc_info-quirk.patch71
-rw-r--r--usb/usb-usbtest-support-gadget-zero-isochronous-configurations.patch31
13 files changed, 484 insertions, 229 deletions
diff --git a/usb/scsi-sd-add-a-no_read_capacity_16-scsi_device-flag.patch b/usb/scsi-sd-add-a-no_read_capacity_16-scsi_device-flag.patch
new file mode 100644
index 00000000000000..b614be5cb3a298
--- /dev/null
+++ b/usb/scsi-sd-add-a-no_read_capacity_16-scsi_device-flag.patch
@@ -0,0 +1,85 @@
+From akpm@linux-foundation.org Wed Oct 6 13:35:58 2010
+Message-Id: <201010012120.o91LKAdl021407@imap1.linux-foundation.org>
+From: Hans de Goede <hdegoede@redhat.com>
+Subject: scsi/sd: add a no_read_capacity_16 scsi_device flag
+To: greg@kroah.com
+Cc: linux-usb@vger.kernel.org, akpm@linux-foundation.org, hdegoede@redhat.com,
+ James.Bottomley@HansenPartnership.com, mdharm-usb@one-eyed-alien.net,
+ stern@rowland.harvard.edu
+Date: Fri, 01 Oct 2010 14:20:10 -0700
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+I seem to have a knack for digging up buggy usb devices which don't work
+with Linux, and I'm crazy enough to try to make them work. So this time a
+friend of mine asked me to get an mp4 player (an mp3 player which can play
+videos on a small screen) to work with Linux.
+
+It is based on the well known rockbox chipset for which we already have an
+unusual devs entries to work around some of its bugs. But this model
+comes with an additional twist.
+
+This model chokes on read_capacity_16 calls. Now normally we don't make
+those calls, but this model comes with an sdcard slot and when there is no
+card in there (and shipped from the factory there is none), it reports a
+size of 0. However this time the programmers actually got the
+read_capacity_10 response right! So they substract one from the size as
+stored internally in the mp3 player before reporting it back, resulting in
+an answer of ... 0xffffffff sectors, causing sd.c to try a
+read_capacity_16, on which the device crashes.
+
+This patch adds a flag to scsi_device to indicate that a a device cannot
+handle read_capacity_16, and when this flag is set if a device reports an
+lba of 0xffffffff as answer to a read_capacity_10, assumes it tries to
+report a size of 0.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>
+Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/sd.c | 12 ++++++++++++
+ include/scsi/scsi_device.h | 1 +
+ 2 files changed, 13 insertions(+)
+
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -1498,6 +1498,9 @@ static int read_capacity_16(struct scsi_
+ unsigned long long lba;
+ unsigned sector_size;
+
++ if (sdp->no_read_capacity_16)
++ return -EINVAL;
++
+ do {
+ memset(cmd, 0, 16);
+ cmd[0] = SERVICE_ACTION_IN;
+@@ -1626,6 +1629,15 @@ static int read_capacity_10(struct scsi_
+ sector_size = get_unaligned_be32(&buffer[4]);
+ lba = get_unaligned_be32(&buffer[0]);
+
++ if (sdp->no_read_capacity_16 && (lba == 0xffffffff)) {
++ /* Some buggy (usb cardreader) devices return an lba of
++ 0xffffffff when the want to report a size of 0 (with
++ which they really mean no media is present) */
++ sdkp->capacity = 0;
++ sdkp->hw_sector_size = sector_size;
++ return sector_size;
++ }
++
+ if ((sizeof(sdkp->capacity) == 4) && (lba == 0xffffffff)) {
+ sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
+ "kernel compiled with support for large block "
+--- a/include/scsi/scsi_device.h
++++ b/include/scsi/scsi_device.h
+@@ -149,6 +149,7 @@ struct scsi_device {
+ unsigned last_sector_bug:1; /* do not use multisector accesses on
+ SD_LAST_BUGGY_SECTORS */
+ unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
++ unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
+ unsigned is_visible:1; /* is the device visible in sysfs */
+
+ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
diff --git a/usb/scsi-sr-add-no_read_disc_info-scsi_device-flag.patch b/usb/scsi-sr-add-no_read_disc_info-scsi_device-flag.patch
new file mode 100644
index 00000000000000..eaeea14f38480e
--- /dev/null
+++ b/usb/scsi-sr-add-no_read_disc_info-scsi_device-flag.patch
@@ -0,0 +1,72 @@
+From linux-usb-owner@vger.kernel.org Wed Oct 6 13:35:11 2010
+Message-Id: <201010012120.o91LK84M021399@imap1.linux-foundation.org>
+From: Hans de Goede <hdegoede@redhat.com>
+Subject: scsi/sr: add no_read_disc_info scsi_device flag
+To: greg@kroah.com
+Cc: linux-usb@vger.kernel.org, akpm@linux-foundation.org,
+ hdegoede@redhat.com, James.Bottomley@HansenPartnership.com,
+ mdharm-usb@one-eyed-alien.net, stern@rowland.harvard.edu
+Date: Fri, 01 Oct 2010 14:20:08 -0700
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+Some USB devices emulate a usb-mass-storage attached (scsi) cdrom device,
+usually this fake cdrom contains the windows software for the device.
+While working on supporting Appotech ax3003 based photoframes, which do
+this I discovered that they will go of into lala land when ever they see a
+READ_DISC_INFO scsi command.
+
+Thus this patch adds a scsi_device flag (which can then be set by the
+usb-storage driver through an unsual-devs entry), to indicate this, and
+makes the sr driver honor this flag.
+
+I know this sucks, but as discussed on linux-scsi list there is no other
+way to make this device work properly.
+
+Looking at usb traces made under windows, windows never sends a
+READ_DISC_INFO during normal interactions with a usb cdrom device. So as
+this cdrom emulation thingie becomes more common we might see more of this
+problem.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>
+Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/sr.c | 8 +++++++-
+ include/scsi/scsi_device.h | 1 +
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/scsi/sr.c
++++ b/drivers/scsi/sr.c
+@@ -862,10 +862,16 @@ static void get_capabilities(struct scsi
+ static int sr_packet(struct cdrom_device_info *cdi,
+ struct packet_command *cgc)
+ {
++ struct scsi_cd *cd = cdi->handle;
++ struct scsi_device *sdev = cd->device;
++
++ if (cgc->cmd[0] == GPCMD_READ_DISC_INFO && sdev->no_read_disc_info)
++ return -EDRIVE_CANT_DO_THIS;
++
+ if (cgc->timeout <= 0)
+ cgc->timeout = IOCTL_TIMEOUT;
+
+- sr_do_ioctl(cdi->handle, cgc);
++ sr_do_ioctl(cd, cgc);
+
+ return cgc->stat;
+ }
+--- a/include/scsi/scsi_device.h
++++ b/include/scsi/scsi_device.h
+@@ -148,6 +148,7 @@ struct scsi_device {
+ unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
+ unsigned last_sector_bug:1; /* do not use multisector accesses on
+ SD_LAST_BUGGY_SECTORS */
++ unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
+ unsigned is_visible:1; /* is the device visible in sysfs */
+
+ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
diff --git a/usb/usb-add-uas-driver.patch b/usb/usb-add-uas-driver.patch
index 77c6313c870283..5980c54ce0a9ef 100644
--- a/usb/usb-add-uas-driver.patch
+++ b/usb/usb-add-uas-driver.patch
@@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -5908,6 +5908,14 @@ S: Maintained
+@@ -5916,6 +5916,14 @@ S: Maintained
F: Documentation/usb/acm.txt
F: drivers/usb/class/cdc-acm.*
diff --git a/usb/usb-do-not-print-eshutdown-message-if-usb-at-otg-device-mode.patch b/usb/usb-do-not-print-eshutdown-message-if-usb-at-otg-device-mode.patch
new file mode 100644
index 00000000000000..c317a6f5fb7a40
--- /dev/null
+++ b/usb/usb-do-not-print-eshutdown-message-if-usb-at-otg-device-mode.patch
@@ -0,0 +1,36 @@
+From linux-usb-owner@vger.kernel.org Wed Oct 6 13:37:13 2010
+From: Peter Chen <peter.chen@freescale.com>
+To: linux-usb@vger.kernel.org
+CC: Peter Chen <peter.chen@freescale.com>
+Subject: USB: do not print -ESHUTDOWN message if usb at otg device mode
+Date: Mon, 27 Sep 2010 16:43:25 +0800
+Message-ID: <1285577005-24081-1-git-send-email-peter.chen@freescale.com>
+
+From: Peter Chen <peter.chen@freescale.com>
+
+At otg device mode, the otg host resume should do no-op during
+system resume, otherwise, the otg device will be treated as a
+host for enumeration.
+
+So, the otg host driver returns -ESHUTDOWN if it detects the
+current usb mode is device mode. The host driver has to return
+-ESHUTDOWN, otherwise, the usb_hc_died will be called.
+
+Signed-off-by: Peter Chen <peter.chen@freescale.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/driver.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/core/driver.c
++++ b/drivers/usb/core/driver.c
+@@ -1337,7 +1337,7 @@ int usb_resume(struct device *dev, pm_me
+ /* Avoid PM error messages for devices disconnected while suspended
+ * as we'll display regular disconnect messages just a bit later.
+ */
+- if (status == -ENODEV)
++ if (status == -ENODEV || status == -ESHUTDOWN)
+ status = 0;
+ return status;
+ }
diff --git a/usb/usb-gadget-goku_udc-fix-error-path.patch b/usb/usb-gadget-goku_udc-fix-error-path.patch
new file mode 100644
index 00000000000000..9572c8a99d53e8
--- /dev/null
+++ b/usb/usb-gadget-goku_udc-fix-error-path.patch
@@ -0,0 +1,117 @@
+From linux-usb-owner@vger.kernel.org Wed Oct 6 13:25:09 2010
+Date: Tue, 5 Oct 2010 18:55:34 +0200
+From: Dan Carpenter <error27@gmail.com>
+To: Greg KH <gregkh@suse.de>
+Cc: Rahul Ruikar <rahul.ruikar@gmail.com>,
+ David Brownell <dbrownell@users.sourceforge.net>,
+ nm127@freemail.hu, linux-usb@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: usb: gadget: goku_udc: Fix error path
+Message-ID: <20101005165534.GJ5692@bicker>
+Content-Disposition: inline
+
+This is based on an initial patch by Rahul Ruikar.
+
+The goku_remove() function can be called before device_register() so it
+can call device_unregister() improperly. Also if the call to
+device_register() fails we need to call put_device().
+
+As I was changing the error handling in goku_probe(), I noticed that
+the label was "done" but actually if the function succeeds we return
+earlier. I renamed the error path to "err" instead of "done."
+
+Reported-by: Rahul Ruikar <rahul.ruikar@gmail.com>
+Signed-off-by: Dan Carpenter <error27@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/goku_udc.c | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+--- a/drivers/usb/gadget/goku_udc.c
++++ b/drivers/usb/gadget/goku_udc.c
+@@ -1745,7 +1745,8 @@ static void goku_remove(struct pci_dev *
+ pci_resource_len (pdev, 0));
+ if (dev->enabled)
+ pci_disable_device(pdev);
+- device_unregister(&dev->gadget.dev);
++ if (dev->registered)
++ device_unregister(&dev->gadget.dev);
+
+ pci_set_drvdata(pdev, NULL);
+ dev->regs = NULL;
+@@ -1775,7 +1776,7 @@ static int goku_probe(struct pci_dev *pd
+ if (!pdev->irq) {
+ printk(KERN_ERR "Check PCI %s IRQ setup!\n", pci_name(pdev));
+ retval = -ENODEV;
+- goto done;
++ goto err;
+ }
+
+ /* alloc, and start init */
+@@ -1783,7 +1784,7 @@ static int goku_probe(struct pci_dev *pd
+ if (dev == NULL){
+ pr_debug("enomem %s\n", pci_name(pdev));
+ retval = -ENOMEM;
+- goto done;
++ goto err;
+ }
+
+ spin_lock_init(&dev->lock);
+@@ -1801,7 +1802,7 @@ static int goku_probe(struct pci_dev *pd
+ retval = pci_enable_device(pdev);
+ if (retval < 0) {
+ DBG(dev, "can't enable, %d\n", retval);
+- goto done;
++ goto err;
+ }
+ dev->enabled = 1;
+
+@@ -1810,7 +1811,7 @@ static int goku_probe(struct pci_dev *pd
+ if (!request_mem_region(resource, len, driver_name)) {
+ DBG(dev, "controller already in use\n");
+ retval = -EBUSY;
+- goto done;
++ goto err;
+ }
+ dev->got_region = 1;
+
+@@ -1818,7 +1819,7 @@ static int goku_probe(struct pci_dev *pd
+ if (base == NULL) {
+ DBG(dev, "can't map memory\n");
+ retval = -EFAULT;
+- goto done;
++ goto err;
+ }
+ dev->regs = (struct goku_udc_regs __iomem *) base;
+
+@@ -1834,7 +1835,7 @@ static int goku_probe(struct pci_dev *pd
+ driver_name, dev) != 0) {
+ DBG(dev, "request interrupt %d failed\n", pdev->irq);
+ retval = -EBUSY;
+- goto done;
++ goto err;
+ }
+ dev->got_irq = 1;
+ if (use_dma)
+@@ -1845,13 +1846,16 @@ static int goku_probe(struct pci_dev *pd
+ create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev);
+ #endif
+
+- /* done */
+ the_controller = dev;
+ retval = device_register(&dev->gadget.dev);
+- if (retval == 0)
+- return 0;
++ if (retval) {
++ put_device(&dev->gadget.dev);
++ goto err;
++ }
++ dev->registered = 1;
++ return 0;
+
+-done:
++err:
+ if (dev)
+ goku_remove (pdev);
+ return retval;
diff --git a/usb/usb-musb-gadget-fix-zlp-sending-in-musb_g_tx-v1.patch b/usb/usb-musb-gadget-fix-zlp-sending-in-musb_g_tx-v1.patch
index 712e90c8a2c824..8a825f1dc953ed 100644
--- a/usb/usb-musb-gadget-fix-zlp-sending-in-musb_g_tx-v1.patch
+++ b/usb/usb-musb-gadget-fix-zlp-sending-in-musb_g_tx-v1.patch
@@ -37,7 +37,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
-@@ -522,40 +522,39 @@ void musb_g_tx(struct musb *musb, u8 epn
+@@ -477,40 +477,39 @@ void musb_g_tx(struct musb *musb, u8 epn
epnum, csr, musb_ep->dma->actual_len, request);
}
diff --git a/usb/usb-musb-gadget-kill-duplicate-code-in-musb_gadget_queue.patch b/usb/usb-musb-gadget-kill-duplicate-code-in-musb_gadget_queue.patch
deleted file mode 100644
index 58719014989f62..00000000000000
--- a/usb/usb-musb-gadget-kill-duplicate-code-in-musb_gadget_queue.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From linux-usb-owner@vger.kernel.org Tue Oct 5 13:30:26 2010
-From: Felipe Balbi <balbi@ti.com>
-To: Greg KH <greg@kroah.com>
-Cc: Linux USB Mailing List <linux-usb@vger.kernel.org>,
- Sergei Shtylyov <sshtylyov@ru.mvista.com>,
- Felipe Balbi <balbi@ti.com>
-Subject: usb: musb: gadget: kill duplicate code in musb_gadget_queue()
-Date: Fri, 24 Sep 2010 13:44:11 +0300
-Message-Id: <1285325055-1247-11-git-send-email-balbi@ti.com>
-
-From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
-
-I've noticed that musb_gadget_queue() checks for '!req->buf' condition twice:
-in the second case the code is both duplicate and unreachable as the first
-check returns early.
-
-Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/usb/musb/musb_gadget.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- a/drivers/usb/musb/musb_gadget.c
-+++ b/drivers/usb/musb/musb_gadget.c
-@@ -1214,8 +1214,6 @@ static int musb_gadget_queue(struct usb_
-
- if (is_dma_capable() && musb_ep->dma)
- map_dma_buffer(request, musb);
-- else if (!req->buf)
-- return -ENODATA;
- else
- request->mapped = 0;
-
diff --git a/usb/usb-musb-gadget-kill-unreachable-code-in-musb_g_rx.patch b/usb/usb-musb-gadget-kill-unreachable-code-in-musb_g_rx.patch
index 685cd9b5d7ca55..b08eeb8763f2f3 100644
--- a/usb/usb-musb-gadget-kill-unreachable-code-in-musb_g_rx.patch
+++ b/usb/usb-musb-gadget-kill-unreachable-code-in-musb_g_rx.patch
@@ -24,7 +24,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
-@@ -834,7 +834,7 @@ void musb_g_rx(struct musb *musb, u8 epn
+@@ -775,7 +775,7 @@ void musb_g_rx(struct musb *musb, u8 epn
musb_writew(epio, MUSB_RXCSR, csr);
DBG(3, "%s iso overrun on %p\n", musb_ep->name, request);
@@ -33,7 +33,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
request->status = -EOVERFLOW;
}
if (csr & MUSB_RXCSR_INCOMPRX) {
-@@ -887,14 +887,8 @@ void musb_g_rx(struct musb *musb, u8 epn
+@@ -828,14 +828,8 @@ void musb_g_rx(struct musb *musb, u8 epn
return;
}
diff --git a/usb/usb-musb-gadget-only-enable-autoclear-in-double-buffered-case.patch b/usb/usb-musb-gadget-only-enable-autoclear-in-double-buffered-case.patch
index 4376a184cdc118..913896651078a3 100644
--- a/usb/usb-musb-gadget-only-enable-autoclear-in-double-buffered-case.patch
+++ b/usb/usb-musb-gadget-only-enable-autoclear-in-double-buffered-case.patch
@@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
-@@ -689,7 +689,8 @@ static void rxstate(struct musb *musb, s
+@@ -644,7 +644,8 @@ static void rxstate(struct musb *musb, s
*/
csr |= MUSB_RXCSR_DMAENAB;
diff --git a/usb/usb-musb-gadget-unmapping-the-dma-buffer-when-switching-to-pio-mode.patch b/usb/usb-musb-gadget-unmapping-the-dma-buffer-when-switching-to-pio-mode.patch
deleted file mode 100644
index 2b44fc1afdcb62..00000000000000
--- a/usb/usb-musb-gadget-unmapping-the-dma-buffer-when-switching-to-pio-mode.patch
+++ /dev/null
@@ -1,190 +0,0 @@
-From balbi@ti.com Tue Oct 5 13:29:53 2010
-From: Felipe Balbi <balbi@ti.com>
-To: Greg KH <greg@kroah.com>
-Cc: Linux USB Mailing List <linux-usb@vger.kernel.org>,
- Hema HK <hemahk@ti.com>, Felipe Balbi <balbi@ti.com>
-Subject: usb: musb: gadget: Unmapping the dma buffer when switching to PIO mode
-Date: Fri, 24 Sep 2010 13:44:08 +0300
-Message-Id: <1285325055-1247-8-git-send-email-balbi@ti.com>
-
-From: Hema HK <hemahk@ti.com>
-
-Buffer is mapped to dma when dma channel is allocated. buffer needs
-to be unmapped when fallback to PIO mode if dma channel_program
-fails.
-
-Signed-off-by: Hema HK <hemahk@ti.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-Reviewed-by: Ming Lei <tom.leiming@gmail.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/usb/musb/musb_gadget.c | 122 +++++++++++++++++++++++++++--------------
- 1 file changed, 82 insertions(+), 40 deletions(-)
-
---- a/drivers/usb/musb/musb_gadget.c
-+++ b/drivers/usb/musb/musb_gadget.c
-@@ -92,6 +92,60 @@
-
- /* ----------------------------------------------------------------------- */
-
-+/* Maps the buffer to dma */
-+
-+static inline void map_dma_buffer(struct musb_request *request,
-+ struct musb *musb)
-+{
-+ if (request->request.dma == DMA_ADDR_INVALID) {
-+ request->request.dma = dma_map_single(
-+ musb->controller,
-+ request->request.buf,
-+ request->request.length,
-+ request->tx
-+ ? DMA_TO_DEVICE
-+ : DMA_FROM_DEVICE);
-+ request->mapped = 1;
-+ } else {
-+ dma_sync_single_for_device(musb->controller,
-+ request->request.dma,
-+ request->request.length,
-+ request->tx
-+ ? DMA_TO_DEVICE
-+ : DMA_FROM_DEVICE);
-+ request->mapped = 0;
-+ }
-+}
-+
-+/* Unmap the buffer from dma and maps it back to cpu */
-+static inline void unmap_dma_buffer(struct musb_request *request,
-+ struct musb *musb)
-+{
-+ if (request->request.dma == DMA_ADDR_INVALID) {
-+ DBG(20, "not unmapping a never mapped buffer\n");
-+ return;
-+ }
-+
-+ if (request->mapped) {
-+ dma_unmap_single(musb->controller,
-+ request->request.dma,
-+ request->request.length,
-+ request->tx
-+ ? DMA_TO_DEVICE
-+ : DMA_FROM_DEVICE);
-+ request->request.dma = DMA_ADDR_INVALID;
-+ request->mapped = 0;
-+ } else {
-+ dma_sync_single_for_cpu(musb->controller,
-+ request->request.dma,
-+ request->request.length,
-+ request->tx
-+ ? DMA_TO_DEVICE
-+ : DMA_FROM_DEVICE);
-+
-+ }
-+}
-+
- /*
- * Immediately complete a request.
- *
-@@ -119,24 +173,8 @@ __acquires(ep->musb->lock)
-
- ep->busy = 1;
- spin_unlock(&musb->lock);
-- if (is_dma_capable()) {
-- if (req->mapped) {
-- dma_unmap_single(musb->controller,
-- req->request.dma,
-- req->request.length,
-- req->tx
-- ? DMA_TO_DEVICE
-- : DMA_FROM_DEVICE);
-- req->request.dma = DMA_ADDR_INVALID;
-- req->mapped = 0;
-- } else if (req->request.dma != DMA_ADDR_INVALID)
-- dma_sync_single_for_cpu(musb->controller,
-- req->request.dma,
-- req->request.length,
-- req->tx
-- ? DMA_TO_DEVICE
-- : DMA_FROM_DEVICE);
-- }
-+ if (is_dma_capable() && ep->dma)
-+ unmap_dma_buffer(req, musb);
- if (request->status == 0)
- DBG(5, "%s done request %p, %d/%d\n",
- ep->end_point.name, request,
-@@ -298,7 +336,7 @@ static void txstate(struct musb *musb, s
- csr);
-
- #ifndef CONFIG_MUSB_PIO_ONLY
-- if (is_dma_capable() && musb_ep->dma) {
-+ if (is_dma_capable() && !musb_ep->dma && musb->dma_controller) {
- struct dma_controller *c = musb->dma_controller;
- size_t request_size;
-
-@@ -395,6 +433,13 @@ static void txstate(struct musb *musb, s
- #endif
-
- if (!use_dma) {
-+ /*
-+ * Unmap the dma buffer back to cpu if dma channel
-+ * programming fails
-+ */
-+ if (is_dma_capable() && musb_ep->dma)
-+ unmap_dma_buffer(req, musb);
-+
- musb_write_fifo(musb_ep->hw_ep, fifo_count,
- (u8 *) (request->buf + request->actual));
- request->actual += fifo_count;
-@@ -711,6 +756,20 @@ static void rxstate(struct musb *musb, s
- return;
- }
- #endif
-+ /*
-+ * Unmap the dma buffer back to cpu if dma channel
-+ * programming fails. This buffer is mapped if the
-+ * channel allocation is successful
-+ */
-+ if (is_dma_capable() && musb_ep->dma) {
-+ unmap_dma_buffer(req, musb);
-+
-+ /* Clear DMAENAB for the
-+ * PIO mode transfer
-+ */
-+ csr &= ~MUSB_RXCSR_DMAENAB;
-+ musb_writew(epio, MUSB_RXCSR, csr);
-+ }
-
- musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *)
- (request->buf + request->actual));
-@@ -1153,28 +1212,11 @@ static int musb_gadget_queue(struct usb_
- request->epnum = musb_ep->current_epnum;
- request->tx = musb_ep->is_in;
-
-- if (is_dma_capable() && musb_ep->dma) {
-- if (request->request.dma == DMA_ADDR_INVALID) {
-- request->request.dma = dma_map_single(
-- musb->controller,
-- request->request.buf,
-- request->request.length,
-- request->tx
-- ? DMA_TO_DEVICE
-- : DMA_FROM_DEVICE);
-- request->mapped = 1;
-- } else {
-- dma_sync_single_for_device(musb->controller,
-- request->request.dma,
-- request->request.length,
-- request->tx
-- ? DMA_TO_DEVICE
-- : DMA_FROM_DEVICE);
-- request->mapped = 0;
-- }
-- } else if (!req->buf) {
-+ if (is_dma_capable() && musb_ep->dma)
-+ map_dma_buffer(request, musb);
-+ else if (!req->buf)
- return -ENODATA;
-- } else
-+ else
- request->mapped = 0;
-
- spin_lock_irqsave(&musb->lock, lockflags);
diff --git a/usb/usb-storage-add-new-no_read_capacity_16-quirk.patch b/usb/usb-storage-add-new-no_read_capacity_16-quirk.patch
new file mode 100644
index 00000000000000..4d9a25da2c766e
--- /dev/null
+++ b/usb/usb-storage-add-new-no_read_capacity_16-quirk.patch
@@ -0,0 +1,67 @@
+From akpm@linux-foundation.org Wed Oct 6 13:36:21 2010
+Message-Id: <201010012120.o91LKBQp021410@imap1.linux-foundation.org>
+From: Hans de Goede <hdegoede@redhat.com>
+Subject: usb-storage: add new no_read_capacity_16 quirk
+To: greg@kroah.com
+Cc: linux-usb@vger.kernel.org, akpm@linux-foundation.org, hdegoede@redhat.com,
+ James.Bottomley@HansenPartnership.com, mdharm-usb@one-eyed-alien.net,
+ stern@rowland.harvard.edu
+Date: Fri, 01 Oct 2010 14:20:11 -0700
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+Some Rockbox based mp4 players will crash when ever they see a
+read_capacity_16 scsi command. So add a new US_FL which tells the scsi sd
+driver to not issue any read_capacity_16 scsi commands.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>
+Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/scsiglue.c | 4 ++++
+ drivers/usb/storage/unusual_devs.h | 3 ++-
+ include/linux/usb_usual.h | 4 +++-
+ 3 files changed, 9 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/storage/scsiglue.c
++++ b/drivers/usb/storage/scsiglue.c
+@@ -209,6 +209,10 @@ static int slave_configure(struct scsi_d
+ if (us->fflags & US_FL_CAPACITY_HEURISTICS)
+ sdev->guess_capacity = 1;
+
++ /* Some devices cannot handle READ_CAPACITY_16 */
++ if (us->fflags & US_FL_NO_READ_CAPACITY_16)
++ sdev->no_read_capacity_16 = 1;
++
+ /* assume SPC3 or latter devices support sense size > 18 */
+ if (sdev->scsi_level > SCSI_SPC_2)
+ us->fflags |= US_FL_SANE_SENSE;
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -877,7 +877,8 @@ UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x
+ "RockChip",
+ "MP3",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+- US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64),
++ US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64 |
++ US_FL_NO_READ_CAPACITY_16),
+
+ /* Reported by Jean-Baptiste Onofre <jb@nanthrax.net>
+ * Support the following product :
+--- a/include/linux/usb_usual.h
++++ b/include/linux/usb_usual.h
+@@ -60,7 +60,9 @@
+ US_FLAG(BAD_SENSE, 0x00020000) \
+ /* Bad Sense (never more than 18 bytes) */ \
+ US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
+- /* cannot handle READ_DISC_INFO */
++ /* cannot handle READ_DISC_INFO */ \
++ US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
++ /* cannot handle READ_CAPACITY_16 */
+
+ #define US_FLAG(name, value) US_FL_##name = value ,
+ enum { US_DO_ALL_FLAGS };
diff --git a/usb/usb-storage-add-new-no_read_disc_info-quirk.patch b/usb/usb-storage-add-new-no_read_disc_info-quirk.patch
new file mode 100644
index 00000000000000..77dbd5499dde74
--- /dev/null
+++ b/usb/usb-storage-add-new-no_read_disc_info-quirk.patch
@@ -0,0 +1,71 @@
+From linux-usb-owner@vger.kernel.org Wed Oct 6 13:35:39 2010
+Message-Id: <201010012120.o91LKASf021404@imap1.linux-foundation.org>
+From: Hans de Goede <hdegoede@redhat.com>
+Subject: usb-storage: add new no_read_disc_info quirk
+To: greg@kroah.com
+Cc: linux-usb@vger.kernel.org, akpm@linux-foundation.org,
+ hdegoede@redhat.com, James.Bottomley@HansenPartnership.com,
+ mdharm-usb@one-eyed-alien.net, stern@rowland.harvard.edu
+Date: Fri, 01 Oct 2010 14:20:10 -0700
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+Appotech ax3003 (the larger brother of the ax203) based devices are even
+more buggy then the ax203. They will go of into lala land when ever they
+see a READ_DISC_INFO scsi command. So add a new US_FL which tells the
+scsi sr driver to not issue any READ_DISC_INFO scsi commands.
+
+[akpm@linux-foundation.org: fix build]
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>
+Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/scsiglue.c | 4 ++++
+ drivers/usb/storage/unusual_devs.h | 5 +++++
+ include/linux/usb_usual.h | 4 +++-
+ 3 files changed, 12 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/storage/scsiglue.c
++++ b/drivers/usb/storage/scsiglue.c
+@@ -253,6 +253,10 @@ static int slave_configure(struct scsi_d
+ * or to force 192-byte transfer lengths for MODE SENSE.
+ * But they do need to use MODE SENSE(10). */
+ sdev->use_10_for_ms = 1;
++
++ /* Some (fake) usb cdrom devices don't like READ_DISC_INFO */
++ if (us->fflags & US_FL_NO_READ_DISC_INFO)
++ sdev->no_read_disc_info = 1;
+ }
+
+ /* The CB and CBI transports have no way to pass LUN values
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1858,6 +1858,11 @@ UNUSUAL_DEV( 0x1908, 0x1320, 0x0000, 0x0
+ "Photo Frame",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_BAD_SENSE ),
++UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
++ "BUILDWIN",
++ "Photo Frame",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ US_FL_NO_READ_DISC_INFO ),
+
+ UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
+ "ST",
+--- a/include/linux/usb_usual.h
++++ b/include/linux/usb_usual.h
+@@ -58,7 +58,9 @@
+ US_FLAG(CAPACITY_OK, 0x00010000) \
+ /* READ CAPACITY response is correct */ \
+ US_FLAG(BAD_SENSE, 0x00020000) \
+- /* Bad Sense (never more than 18 bytes) */
++ /* Bad Sense (never more than 18 bytes) */ \
++ US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
++ /* cannot handle READ_DISC_INFO */
+
+ #define US_FLAG(name, value) US_FL_##name = value ,
+ enum { US_DO_ALL_FLAGS };
diff --git a/usb/usb-usbtest-support-gadget-zero-isochronous-configurations.patch b/usb/usb-usbtest-support-gadget-zero-isochronous-configurations.patch
new file mode 100644
index 00000000000000..99e41f3748016d
--- /dev/null
+++ b/usb/usb-usbtest-support-gadget-zero-isochronous-configurations.patch
@@ -0,0 +1,31 @@
+From mfuzzey@gmail.com Wed Oct 6 13:39:37 2010
+From: Martin Fuzzey <mfuzzey@gmail.com>
+Subject: USB: usbtest: Support gadget zero isochronous configurations
+To: Greg KH <greg@kroah.com>
+Cc: linux-usb@vger.kernel.org
+Date: Wed, 06 Oct 2010 17:43:46 +0200
+Message-ID: <20101006154346.26831.55484.stgit@srv002.fuzzey.net>
+
+Gadget zero now provides isochronous endpoints via f_iso;
+add support for this to usbtest.
+
+Signed-off-by: Martin Fuzzey <mfuzzey@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/misc/usbtest.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/misc/usbtest.c
++++ b/drivers/usb/misc/usbtest.c
+@@ -2083,7 +2083,8 @@ static struct usbtest_info gz_info = {
+ .name = "Linux gadget zero",
+ .autoconf = 1,
+ .ctrl_out = 1,
+- .alt = 0,
++ .alt = -1,
++ .iso = 1,
+ };
+
+ static struct usbtest_info um_info = {