aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-02-01 14:36:23 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-02-01 14:36:23 -0800
commitdf953944fb5fa26a6371538ba70c9a265b2fe677 (patch)
treede9a5d9ac044ce06423be1f93f958effff51ad6d /usb
parent912ae66b952e249f66eef23a545e572263f989b8 (diff)
downloadpatches-df953944fb5fa26a6371538ba70c9a265b2fe677.tar.gz
driver core, usb, and tty patches
Diffstat (limited to 'usb')
-rw-r--r--usb/isp1760-flush-the-d-cache-for-the-pipe-in-transfer-buffers.patch58
-rw-r--r--usb/usb-gadgetfs-convert-semaphore-to-mutex.patch181
-rw-r--r--usb/usb-musb-disable-double-buffering-for-older-rtl-versions.patch35
-rw-r--r--usb/usb-musb-set-version-of-blackfin-version.patch62
4 files changed, 306 insertions, 30 deletions
diff --git a/usb/isp1760-flush-the-d-cache-for-the-pipe-in-transfer-buffers.patch b/usb/isp1760-flush-the-d-cache-for-the-pipe-in-transfer-buffers.patch
new file mode 100644
index 00000000000000..11a55ea15a41d8
--- /dev/null
+++ b/usb/isp1760-flush-the-d-cache-for-the-pipe-in-transfer-buffers.patch
@@ -0,0 +1,58 @@
+From catalin.marinas@arm.com Mon Feb 1 14:07:01 2010
+From: Catalin Marinas <catalin.marinas@arm.com>
+Date: Mon, 01 Feb 2010 17:29:14 +0000
+Subject: isp1760: Flush the D-cache for the pipe-in transfer buffers
+To: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
+Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>, Ming Lei <tom.leiming@gmail.com>, Sebastian Siewior <bigeasy@linutronix.de>, Greg KH <greg@kroah.com>
+Message-ID: <1265045354.25750.52.camel@pc1117.cambridge.arm.com>
+
+
+isp1760: Flush the D-cache for the pipe-in transfer buffers
+
+From: Catalin Marinas <catalin.marinas@arm.com>
+
+When the HDC driver writes the data to the transfer buffers it pollutes
+the D-cache (unlike DMA drivers where the device writes the data). If
+the corresponding pages get mapped into user space, there are no
+additional cache flushing operations performed and this causes random
+user space faults on architectures with separate I and D caches
+(Harvard) or those with aliasing D-cache.
+
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
+Cc: Sebastian Siewior <bigeasy@linutronix.de>
+Cc: Mike Frysinger <vapier@gentoo.org>
+Cc: Harvey Harrison <harvey.harrison@gmail.com>
+Cc: Ming Lei <tom.leiming@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/isp1760-hcd.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/usb/host/isp1760-hcd.c
++++ b/drivers/usb/host/isp1760-hcd.c
+@@ -18,6 +18,8 @@
+ #include <linux/uaccess.h>
+ #include <linux/io.h>
+ #include <asm/unaligned.h>
++#include <asm/cacheflush.h>
++#include <asm/memory.h>
+
+ #include "../core/hcd.h"
+ #include "isp1760-hcd.h"
+@@ -904,6 +906,14 @@ __acquires(priv->lock)
+ status = 0;
+ }
+
++ if (usb_pipein(urb->pipe) && usb_pipetype(urb->pipe) == PIPE_BULK) {
++ void *ptr;
++ for (ptr = urb->transfer_buffer;
++ ptr < urb->transfer_buffer + urb->transfer_buffer_length;
++ ptr += PAGE_SIZE)
++ flush_dcache_page(virt_to_page(ptr));
++ }
++
+ /* complete() can reenter this HCD */
+ usb_hcd_unlink_urb_from_ep(priv_to_hcd(priv), urb);
+ spin_unlock(&priv->lock);
diff --git a/usb/usb-gadgetfs-convert-semaphore-to-mutex.patch b/usb/usb-gadgetfs-convert-semaphore-to-mutex.patch
new file mode 100644
index 00000000000000..ef35b5a1c57747
--- /dev/null
+++ b/usb/usb-gadgetfs-convert-semaphore-to-mutex.patch
@@ -0,0 +1,181 @@
+From tglx@linutronix.de Mon Feb 1 14:34:47 2010
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Fri, 29 Jan 2010 20:38:59 -0000
+Subject: usb: gadgetfs: Convert semaphore to mutex
+Cc: Christoph Hellwig <hch@infradead.org>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@elte.hu>, Greg Kroah-Hartman <gregkh@suse.de>
+Message-ID: <20100129203613.628793121@linutronix.de>
+
+
+The semaphore data->lock is semantically a mutex. Convert it to a real
+mutex.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/inode.c | 39 +++++++++++++++++++++------------------
+ 1 file changed, 21 insertions(+), 18 deletions(-)
+
+--- a/drivers/usb/gadget/inode.c
++++ b/drivers/usb/gadget/inode.c
+@@ -194,7 +194,7 @@ enum ep_state {
+ };
+
+ struct ep_data {
+- struct semaphore lock;
++ struct mutex lock;
+ enum ep_state state;
+ atomic_t count;
+ struct dev_data *dev;
+@@ -298,10 +298,10 @@ get_ready_ep (unsigned f_flags, struct e
+ int val;
+
+ if (f_flags & O_NONBLOCK) {
+- if (down_trylock (&epdata->lock) != 0)
++ if (!mutex_trylock(&epdata->lock))
+ goto nonblock;
+ if (epdata->state != STATE_EP_ENABLED) {
+- up (&epdata->lock);
++ mutex_unlock(&epdata->lock);
+ nonblock:
+ val = -EAGAIN;
+ } else
+@@ -309,7 +309,8 @@ nonblock:
+ return val;
+ }
+
+- if ((val = down_interruptible (&epdata->lock)) < 0)
++ val = mutex_lock_interruptible(&epdata->lock);
++ if (val < 0)
+ return val;
+
+ switch (epdata->state) {
+@@ -323,7 +324,7 @@ nonblock:
+ // FALLTHROUGH
+ case STATE_EP_UNBOUND: /* clean disconnect */
+ val = -ENODEV;
+- up (&epdata->lock);
++ mutex_unlock(&epdata->lock);
+ }
+ return val;
+ }
+@@ -393,7 +394,7 @@ ep_read (struct file *fd, char __user *b
+ if (likely (data->ep != NULL))
+ usb_ep_set_halt (data->ep);
+ spin_unlock_irq (&data->dev->lock);
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ return -EBADMSG;
+ }
+
+@@ -411,7 +412,7 @@ ep_read (struct file *fd, char __user *b
+ value = -EFAULT;
+
+ free1:
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ kfree (kbuf);
+ return value;
+ }
+@@ -436,7 +437,7 @@ ep_write (struct file *fd, const char __
+ if (likely (data->ep != NULL))
+ usb_ep_set_halt (data->ep);
+ spin_unlock_irq (&data->dev->lock);
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ return -EBADMSG;
+ }
+
+@@ -455,7 +456,7 @@ ep_write (struct file *fd, const char __
+ VDEBUG (data->dev, "%s write %zu IN, status %d\n",
+ data->name, len, (int) value);
+ free1:
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ kfree (kbuf);
+ return value;
+ }
+@@ -466,7 +467,8 @@ ep_release (struct inode *inode, struct
+ struct ep_data *data = fd->private_data;
+ int value;
+
+- if ((value = down_interruptible(&data->lock)) < 0)
++ value = mutex_lock_interruptible(&data->lock);
++ if (value < 0)
+ return value;
+
+ /* clean up if this can be reopened */
+@@ -476,7 +478,7 @@ ep_release (struct inode *inode, struct
+ data->hs_desc.bDescriptorType = 0;
+ usb_ep_disable(data->ep);
+ }
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ put_ep (data);
+ return 0;
+ }
+@@ -507,7 +509,7 @@ static long ep_ioctl(struct file *fd, un
+ } else
+ status = -ENODEV;
+ spin_unlock_irq (&data->dev->lock);
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ return status;
+ }
+
+@@ -673,7 +675,7 @@ fail:
+ value = -ENODEV;
+ spin_unlock_irq(&epdata->dev->lock);
+
+- up(&epdata->lock);
++ mutex_unlock(&epdata->lock);
+
+ if (unlikely(value)) {
+ kfree(priv);
+@@ -765,7 +767,8 @@ ep_config (struct file *fd, const char _
+ u32 tag;
+ int value, length = len;
+
+- if ((value = down_interruptible (&data->lock)) < 0)
++ value = mutex_lock_interruptible(&data->lock);
++ if (value < 0)
+ return value;
+
+ if (data->state != STATE_EP_READY) {
+@@ -854,7 +857,7 @@ fail:
+ data->desc.bDescriptorType = 0;
+ data->hs_desc.bDescriptorType = 0;
+ }
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ return value;
+ fail0:
+ value = -EINVAL;
+@@ -870,7 +873,7 @@ ep_open (struct inode *inode, struct fil
+ struct ep_data *data = inode->i_private;
+ int value = -EBUSY;
+
+- if (down_interruptible (&data->lock) != 0)
++ if (mutex_lock_interruptible(&data->lock) != 0)
+ return -EINTR;
+ spin_lock_irq (&data->dev->lock);
+ if (data->dev->state == STATE_DEV_UNBOUND)
+@@ -885,7 +888,7 @@ ep_open (struct inode *inode, struct fil
+ DBG (data->dev, "%s state %d\n",
+ data->name, data->state);
+ spin_unlock_irq (&data->dev->lock);
+- up (&data->lock);
++ mutex_unlock(&data->lock);
+ return value;
+ }
+
+@@ -1631,7 +1634,7 @@ static int activate_ep_files (struct dev
+ if (!data)
+ goto enomem0;
+ data->state = STATE_EP_DISABLED;
+- init_MUTEX (&data->lock);
++ mutex_init(&data->lock);
+ init_waitqueue_head (&data->wait);
+
+ strncpy (data->name, ep->name, sizeof (data->name) - 1);
diff --git a/usb/usb-musb-disable-double-buffering-for-older-rtl-versions.patch b/usb/usb-musb-disable-double-buffering-for-older-rtl-versions.patch
index 065ae5e65e78ad..edd5ef3f170408 100644
--- a/usb/usb-musb-disable-double-buffering-for-older-rtl-versions.patch
+++ b/usb/usb-musb-disable-double-buffering-for-older-rtl-versions.patch
@@ -1,10 +1,10 @@
-From vapier@gentoo.org Thu Jan 28 09:54:08 2010
-From: Cliff Cai <cliff.cai@analog.com>
-Date: Wed, 27 Jan 2010 20:40:04 -0500
+From vapier@gentoo.org Mon Feb 1 14:33:09 2010
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 28 Jan 2010 20:44:18 -0500
Subject: USB: musb: disable double buffering for older RTL versions
To: linux-usb@vger.kernel.org, Felipe Balbi <felipe.balbi@nokia.com>
-Cc: uclinux-dist-devel@blackfin.uclinux.org, Cliff Cai <cliff.cai@analog.com>
-Message-ID: <1264642804-2093-2-git-send-email-vapier@gentoo.org>
+Cc: uclinux-dist-devel@blackfin.uclinux.org, Greg Kroah-Hartman <gregkh@suse.de>, Cliff Cai <cliff.cai@analog.com>
+Message-ID: <1264729458-22105-1-git-send-email-vapier@gentoo.org>
From: Cliff Cai <cliff.cai@analog.com>
@@ -14,13 +14,13 @@ infinite hangs or data corruption. So avoid them with older versions.
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-Cc: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/usb/musb/musb_gadget.c | 17 +++++++++++++++--
- drivers/usb/musb/musb_host.c | 7 +++++++
- 2 files changed, 22 insertions(+), 2 deletions(-)
+ drivers/usb/musb/musb_host.c | 10 ++++++++--
+ 2 files changed, 23 insertions(+), 4 deletions(-)
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -29,8 +29,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* likewise high bandwidth periodic tx
*/
- musb_writew(regs, MUSB_TXMAXP, tmp);
-+ /* Set TXMAXP with the FIFO size of the endpoint to disable
-+ * double buffering mode. Currently, It seems that double
++ /* Set TXMAXP with the FIFO size of the endpoint
++ * to disable double buffering mode. Currently, It seems that double
+ * buffering has problem if musb RTL revision number < 2.0.
+ */
+ if (musb->hwvers < MUSB_HWVERS_2000)
@@ -57,19 +57,20 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
if (hw_ep->is_shared_fifo) {
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
-@@ -605,8 +605,15 @@ musb_rx_reinit(struct musb *musb, struct
+@@ -605,8 +605,14 @@ musb_rx_reinit(struct musb *musb, struct
musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg);
musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg);
/* NOTE: bulk combining rewrites high bits of maxpacket */
-+#if defined(CONFIG_BLACKFIN) && ANOMALY_05000465
+- musb_writew(ep->regs, MUSB_RXMAXP,
+- qh->maxpacket | ((qh->hb_mult - 1) << 11));
+ /* Set RXMAXP with the FIFO size of the endpoint
+ * to disable double buffer mode.
+ */
-+ musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
-+#else
- musb_writew(ep->regs, MUSB_RXMAXP,
- qh->maxpacket | ((qh->hb_mult - 1) << 11));
-+#endif
++ if (musb->hwvers < MUSB_HWVERS_2000)
++ musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
++ else
++ musb_writew(ep->regs, MUSB_RXMAXP,
++ qh->maxpacket | ((qh->hb_mult - 1) << 11));
ep->rx_reinit = 0;
}
diff --git a/usb/usb-musb-set-version-of-blackfin-version.patch b/usb/usb-musb-set-version-of-blackfin-version.patch
index 9469975ea62b5a..78799b04d1a7f7 100644
--- a/usb/usb-musb-set-version-of-blackfin-version.patch
+++ b/usb/usb-musb-set-version-of-blackfin-version.patch
@@ -1,11 +1,10 @@
-From vapier@gentoo.org Thu Jan 28 09:54:35 2010
-From: Cliff Cai <cliff.cai@analog.com>
-Date: Wed, 27 Jan 2010 20:40:03 -0500
+From vapier@gentoo.org Mon Feb 1 14:32:47 2010
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 28 Jan 2010 20:43:44 -0500
Subject: USB: musb: set version of Blackfin version
To: linux-usb@vger.kernel.org, Felipe Balbi <felipe.balbi@nokia.com>
-Cc: uclinux-dist-devel@blackfin.uclinux.org, Cliff Cai <cliff.cai@analog.com>
-Message-ID: <1264642804-2093-1-git-send-email-vapier@gentoo.org>
-
+Cc: uclinux-dist-devel@blackfin.uclinux.org, Greg Kroah-Hartman <gregkh@suse.de>, Cliff Cai <cliff.cai@analog.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1264729424-22025-1-git-send-email-vapier@gentoo.org>
From: Cliff Cai <cliff.cai@analog.com>
@@ -13,26 +12,63 @@ All current Blackfin parts are using RTL v1.9, but they don't expose the
hardware registers to probe this dynamically. So hardcode the version to
v1.9 for now.
+Need to move the local hwvers related defines higher up in the header so
+that sub-musb headers may utilize them.
+
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-Cc: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
- drivers/usb/musb/musb_regs.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
+ drivers/usb/musb/musb_core.h | 16 +++++++++-------
+ drivers/usb/musb/musb_regs.h | 6 +++++-
+ 2 files changed, 14 insertions(+), 8 deletions(-)
+--- a/drivers/usb/musb/musb_core.h
++++ b/drivers/usb/musb/musb_core.h
+@@ -52,6 +52,15 @@ struct musb;
+ struct musb_hw_ep;
+ struct musb_ep;
+
++/* Helper defines for struct musb->hwvers */
++#define MUSB_HWVERS_MAJOR(x) ((x >> 10) & 0x1f)
++#define MUSB_HWVERS_MINOR(x) (x & 0x3ff)
++#define MUSB_HWVERS_RC 0x8000
++#define MUSB_HWVERS_1300 0x52C
++#define MUSB_HWVERS_1400 0x590
++#define MUSB_HWVERS_1800 0x720
++#define MUSB_HWVERS_1900 0x784
++#define MUSB_HWVERS_2000 0x800
+
+ #include "musb_debug.h"
+ #include "musb_dma.h"
+@@ -322,13 +331,6 @@ struct musb {
+ struct clk *clock;
+ irqreturn_t (*isr)(int, void *);
+ struct work_struct irq_work;
+-#define MUSB_HWVERS_MAJOR(x) ((x >> 10) & 0x1f)
+-#define MUSB_HWVERS_MINOR(x) (x & 0x3ff)
+-#define MUSB_HWVERS_RC 0x8000
+-#define MUSB_HWVERS_1300 0x52C
+-#define MUSB_HWVERS_1400 0x590
+-#define MUSB_HWVERS_1800 0x720
+-#define MUSB_HWVERS_2000 0x800
+ u16 hwvers;
+
+ /* this hub status bit is reserved by USB 2.0 and not seen by usbcore */
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
-@@ -533,7 +533,10 @@ static inline u8 musb_read_configdata(vo
+@@ -533,7 +533,11 @@ static inline u8 musb_read_configdata(vo
static inline u16 musb_read_hwvers(void __iomem *mbase)
{
- return 0;
-+ /* This register is invisible on Blackfin, actually the MUSB
-+ * RTL version of Blackfin is 1.9, So just set it's value to 1.9.
++ /*
++ * This register is invisible on Blackfin, actually the MUSB
++ * RTL version of Blackfin is 1.9, so just harcode its value.
+ */
-+ return 1 << 10 | 9;
++ return MUSB_HWVERS_1900;
}
static inline void __iomem *musb_read_target_reg_base(u8 i, void __iomem *mbase)