aboutsummaryrefslogtreecommitdiffstats
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-01-15 12:15:23 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-01-15 12:15:23 -0800
commitd8090ba7e175e4c220bd0027e9631d0116891ce0 (patch)
treeb8cc5b4a4a4a760e85710e74c3010dedf9367813
parent2b0ec05ccfa354c1ecf71a59d1fe887abe78d97e (diff)
downloadpatches-d8090ba7e175e4c220bd0027e9631d0116891ce0.tar.gz
lots of usb patches
-rw-r--r--driver-core/driver-core-devtmpfs-remove-experimental-and-enable-it-by-default.patch4
-rw-r--r--driver-core/kobject-constify-struct-kset_uevent_ops.patch176
-rw-r--r--series53
-rw-r--r--staging.current/staging-asus_oled-fix-oops-in-2.6.32.2.patch2
-rw-r--r--staging/staging-comedi-adq12b-checkpatch-cleanups.patch115
-rw-r--r--staging/staging-comedi-c6xdigio-checkpatch-cleanups.patch141
-rw-r--r--staging/staging-comedi-rti800-checkpatch-cleanups.patch99
-rw-r--r--staging/staging-rtl8192u-ieee80211-currentmpdudensity-assigned-to-itself-in-htusedefaultsetting.patch28
-rw-r--r--staging/staging-sm7xx-remove-the-buggy-2d-acceleration-support.patch1768
-rw-r--r--tty.current/nozomi-quick-fix-for-the-close-close-bug.patch48
-rw-r--r--tty.current/serial-8250_pnp-add-a-new-fujitsu-wacom-tablet-pc-device.patch31
-rw-r--r--tty.current/serial-fix-crash-if-the-minimum-rate-of-the-device-is-9600-baud.patch49
-rw-r--r--usb.current/usb-fix-usbstorage-for-2770-915d-delivers-no-fat.patch53
-rw-r--r--usb/arm-defconfig-rx51-enable-phonet-and-g_nokia.patch65
-rw-r--r--usb/musb-add-extvbus-in-musb_hdrc_platform_data.patch84
-rw-r--r--usb/usb-c67x00-use-resource_size.patch52
-rw-r--r--usb/usb-ch341-fix-dma-buffer-on-stack.patch54
-rw-r--r--usb/usb-ch341-replace-printk-warnings-with-dev_err.patch41
-rw-r--r--usb/usb-ch341-use-get_unaligned_le16-in-break_ctl.patch36
-rw-r--r--usb/usb-ch341-use-le16_to_cpup-to-be-explicit-about-endianess.patch28
-rw-r--r--usb/usb-correct-config-variable-typo.patch28
-rw-r--r--usb/usb-cypress_m8-fix-dma-buffer-on-stack.patch114
-rw-r--r--usb/usb-cypress_m8-fix-endianess-bug.patch37
-rw-r--r--usb/usb-cypress_m8-use-put_unaligned_le32-where-necessary.patch45
-rw-r--r--usb/usb-document-abi-for-usb_quirk_reset_morphs.patch37
-rw-r--r--usb/usb-fhci-correct-the-size-argument-to-kzalloc.patch49
-rw-r--r--usb/usb-ftdi_sio-clean-up-modem-status-handling.patch85
-rw-r--r--usb/usb-ftdi_sio-fix-dma-buffers-on-stack.patch289
-rw-r--r--usb/usb-ftdi_sio-fix-latency-timeout-endianess-bug.patch52
-rw-r--r--usb/usb-ftdi_sio-remove-unnecessary-initialisations.patch105
-rw-r--r--usb/usb-ftdi_sio-use-error-code-from-usb-stack-in-read_latency_timer.patch33
-rw-r--r--usb/usb-gadget-introduce-g_nokia-gadget-driver.patch319
-rw-r--r--usb/usb-host-ehci-adding-regulator-framework-in-ehci-omap.c-driver.patch112
-rw-r--r--usb/usb-host-ehci-fix-missing-kfree-in-remove-path-also.patch31
-rw-r--r--usb/usb-io_ti-fix-dma-buffers-on-stack.patch173
-rw-r--r--usb/usb-keyspan_pda-fix-dma-buffers-on-stack.patch130
-rw-r--r--usb/usb-kl5kusb105-fix-dma-buffers-on-stack.patch157
-rw-r--r--usb/usb-kobil_sct-clean-up-kobil_set_termios.patch71
-rw-r--r--usb/usb-mos7720-fix-dma-buffers-on-stack-and-clean-up-send_mos_cmd.patch74
-rw-r--r--usb/usb-mos7840-fix-dma-buffers-on-stack-and-endianess-bugs.patch67
-rw-r--r--usb/usb-musb-add-new-fifo-table-for-a-omap3-errata.patch80
-rw-r--r--usb/usb-musb-clean-up-commit-workaround-blackfin-fifo-anomalies.patch98
-rw-r--r--usb/usb-musb-fix-cppi_channel_abort-function-to-handle-tx-abort-correctly.patch99
-rw-r--r--usb/usb-musb-handle-irqs-in-the-order-dictated-by-programming-guide.patch326
-rw-r--r--usb/usb-musb-hsdma-add-wrapper-for-reading-dma-count.patch56
-rw-r--r--usb/usb-musb-save-dynfifo-in-musb-struct.patch47
-rw-r--r--usb/usb-musb-workaround-musb-dma_intr-sometimes-reads-zero.patch77
-rw-r--r--usb/usb-musb-workaround-toggle-bug-when-doing-bulk-transfer-after-isoc.patch71
-rw-r--r--usb/usb-otg-twl4030-move-to-request_threaded_irq.patch44
-rw-r--r--usb/usb-oti6858-fix-dma-buffer-on-stack.patch51
-rw-r--r--usb/usb-serial-fix-dma-buffers-on-stack-for-io_edgeport.c.patch79
-rw-r--r--usb/usb-unusual_devs-add-support-for-multiple-option-3g-sticks.patch129
-rw-r--r--usb/usb-usblp-remove-checks-no-longer-needed-with-the-new-runtime-pm-system.patch107
-rw-r--r--usb/usb-use-binterfacenumber-in-bandwidth-allocations.patch43
-rw-r--r--usb/usb-visor-fix-dma-buffers-on-stack.patch85
-rw-r--r--usb/usb-xhci-fix-compile-issues-with-xhci_get_slot_state.patch52
56 files changed, 6376 insertions, 3 deletions
diff --git a/driver-core/driver-core-devtmpfs-remove-experimental-and-enable-it-by-default.patch b/driver-core/driver-core-devtmpfs-remove-experimental-and-enable-it-by-default.patch
index ce76e1fdb2c9e8..8bd76020ec03a1 100644
--- a/driver-core/driver-core-devtmpfs-remove-experimental-and-enable-it-by-default.patch
+++ b/driver-core/driver-core-devtmpfs-remove-experimental-and-enable-it-by-default.patch
@@ -56,7 +56,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config DEVTMPFS_MOUNT
- bool "Automount devtmpfs at /dev"
-+ bool "Automount devtmpfs at /dev, after the kernel mouted the rootfs"
++ bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs"
depends on DEVTMPFS
+ default y
help
@@ -68,7 +68,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+ mounted the root filesystem. The behavior can be overridden
+ with the commandline parameter: devtmpfs.mount=0|1.
+ This option does not affect initramfs based booting, here
-+ the devtmpfs filesystem always needs to be mouted manually
++ the devtmpfs filesystem always needs to be mounted manually
+ after the roots is mounted.
+ With this option enabled, it allows to bring up a system in
+ rescue mode with init=/bin/sh, even when the /dev directory
diff --git a/driver-core/kobject-constify-struct-kset_uevent_ops.patch b/driver-core/kobject-constify-struct-kset_uevent_ops.patch
new file mode 100644
index 00000000000000..d81b33d7faadc3
--- /dev/null
+++ b/driver-core/kobject-constify-struct-kset_uevent_ops.patch
@@ -0,0 +1,176 @@
+From re.emese@gmail.com Fri Jan 15 11:18:41 2010
+From: Emese Revfy <re.emese@gmail.com>
+Date: Thu, 31 Dec 2009 14:52:51 +0100
+Subject: kobject: Constify struct kset_uevent_ops
+To: Greg KH <gregkh@suse.de>
+Cc: Pekka Enberg <penberg@cs.helsinki.fi>, linux-kernel@vger.kernel.org, rientjes@google.com, cl@linux-foundation.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, rjw@sisk.pl, rusty@rustcorp.com.au, Arjan van de Ven <arjan@infradead.org>
+Message-ID: <4B3CACB3.8020901@gmail.com>
+
+
+From: Emese Revfy <re.emese@gmail.com>
+
+Constify struct kset_uevent_ops.
+
+This is part of the ops structure constification
+effort started by Arjan van de Ven et al.
+
+Benefits of this constification:
+
+ * prevents modification of data that is shared
+ (referenced) by many other structure instances
+ at runtime
+
+ * detects/prevents accidental (but not intentional)
+ modification attempts on archs that enforce
+ read-only kernel data at runtime
+
+ * potentially better optimized code as the compiler
+ can assume that the const data cannot be changed
+
+ * the compiler/linker move const data into .rodata
+ and therefore exclude them from false sharing
+
+Signed-off-by: Emese Revfy <re.emese@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/base/bus.c | 2 +-
+ drivers/base/core.c | 2 +-
+ drivers/base/memory.c | 2 +-
+ fs/gfs2/sys.c | 2 +-
+ include/linux/kobject.h | 10 +++++-----
+ kernel/params.c | 2 +-
+ lib/kobject.c | 4 ++--
+ lib/kobject_uevent.c | 2 +-
+ mm/slub.c | 2 +-
+ 9 files changed, 14 insertions(+), 14 deletions(-)
+
+--- a/drivers/base/bus.c
++++ b/drivers/base/bus.c
+@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset
+ return 0;
+ }
+
+-static struct kset_uevent_ops bus_uevent_ops = {
++static const struct kset_uevent_ops bus_uevent_ops = {
+ .filter = bus_uevent_filter,
+ };
+
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset,
+ return retval;
+ }
+
+-static struct kset_uevent_ops device_uevent_ops = {
++static const struct kset_uevent_ops device_uevent_ops = {
+ .filter = dev_uevent_filter,
+ .name = dev_uevent_name,
+ .uevent = dev_uevent,
+--- a/drivers/base/memory.c
++++ b/drivers/base/memory.c
+@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *ks
+ return retval;
+ }
+
+-static struct kset_uevent_ops memory_uevent_ops = {
++static const struct kset_uevent_ops memory_uevent_ops = {
+ .name = memory_uevent_name,
+ .uevent = memory_uevent,
+ };
+--- a/fs/gfs2/sys.c
++++ b/fs/gfs2/sys.c
+@@ -576,7 +576,7 @@ static int gfs2_uevent(struct kset *kset
+ return 0;
+ }
+
+-static struct kset_uevent_ops gfs2_uevent_ops = {
++static const struct kset_uevent_ops gfs2_uevent_ops = {
+ .uevent = gfs2_uevent,
+ };
+
+--- a/include/linux/kobject.h
++++ b/include/linux/kobject.h
+@@ -118,9 +118,9 @@ struct kobj_uevent_env {
+ };
+
+ struct kset_uevent_ops {
+- int (*filter)(struct kset *kset, struct kobject *kobj);
+- const char *(*name)(struct kset *kset, struct kobject *kobj);
+- int (*uevent)(struct kset *kset, struct kobject *kobj,
++ int (* const filter)(struct kset *kset, struct kobject *kobj);
++ const char *(* const name)(struct kset *kset, struct kobject *kobj);
++ int (* const uevent)(struct kset *kset, struct kobject *kobj,
+ struct kobj_uevent_env *env);
+ };
+
+@@ -155,14 +155,14 @@ struct kset {
+ struct list_head list;
+ spinlock_t list_lock;
+ struct kobject kobj;
+- struct kset_uevent_ops *uevent_ops;
++ const struct kset_uevent_ops *uevent_ops;
+ };
+
+ extern void kset_init(struct kset *kset);
+ extern int __must_check kset_register(struct kset *kset);
+ extern void kset_unregister(struct kset *kset);
+ extern struct kset * __must_check kset_create_and_add(const char *name,
+- struct kset_uevent_ops *u,
++ const struct kset_uevent_ops *u,
+ struct kobject *parent_kobj);
+
+ static inline struct kset *to_kset(struct kobject *kobj)
+--- a/kernel/params.c
++++ b/kernel/params.c
+@@ -737,7 +737,7 @@ static int uevent_filter(struct kset *ks
+ return 0;
+ }
+
+-static struct kset_uevent_ops module_uevent_ops = {
++static const struct kset_uevent_ops module_uevent_ops = {
+ .filter = uevent_filter,
+ };
+
+--- a/lib/kobject.c
++++ b/lib/kobject.c
+@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {
+ * If the kset was not able to be created, NULL will be returned.
+ */
+ static struct kset *kset_create(const char *name,
+- struct kset_uevent_ops *uevent_ops,
++ const struct kset_uevent_ops *uevent_ops,
+ struct kobject *parent_kobj)
+ {
+ struct kset *kset;
+@@ -832,7 +832,7 @@ static struct kset *kset_create(const ch
+ * If the kset was not able to be created, NULL will be returned.
+ */
+ struct kset *kset_create_and_add(const char *name,
+- struct kset_uevent_ops *uevent_ops,
++ const struct kset_uevent_ops *uevent_ops,
+ struct kobject *parent_kobj)
+ {
+ struct kset *kset;
+--- a/lib/kobject_uevent.c
++++ b/lib/kobject_uevent.c
+@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *k
+ const char *subsystem;
+ struct kobject *top_kobj;
+ struct kset *kset;
+- struct kset_uevent_ops *uevent_ops;
++ const struct kset_uevent_ops *uevent_ops;
+ u64 seq;
+ int i = 0;
+ int retval = 0;
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -4538,7 +4538,7 @@ static int uevent_filter(struct kset *ks
+ return 0;
+ }
+
+-static struct kset_uevent_ops slab_uevent_ops = {
++static const struct kset_uevent_ops slab_uevent_ops = {
+ .filter = uevent_filter,
+ };
+
diff --git a/series b/series
index ce9efe0965b183..b09aca7e8911e4 100644
--- a/series
+++ b/series
@@ -16,6 +16,9 @@ gregkh/gkh-version.patch
tty.current/serial-imx-bit-confusion.patch
tty.current/serial-core-resume-serial-hardware-with-no_console_suspend.patch
tty.current/tty-fix-race-in-tty_fasync.patch
+tty.current/serial-8250_pnp-add-a-new-fujitsu-wacom-tablet-pc-device.patch
+tty.current/serial-fix-crash-if-the-minimum-rate-of-the-device-is-9600-baud.patch
+tty.current/nozomi-quick-fix-for-the-close-close-bug.patch
#################################
# USB patches for 2.6.33
@@ -31,6 +34,7 @@ usb.current/usb-add-speed-values-for-usb-3.0-and-wireless-controllers.patch
usb.current/usb-fix-duplicate-sysfs-problem-after-device-reset.patch
usb.current/usb-fhci-avoid-null-pointer-dereference.patch
usb.current/usb-fix-level-of-isp1760-reloading-ptd-error-message.patch
+usb.current/usb-fix-usbstorage-for-2770-915d-delivers-no-fat.patch
#################################
# Staging patches for 2.6.33
@@ -69,6 +73,7 @@ driver-core/driver-core-disable-sbin-hotplug-by-default.patch
driver-core/driver-core-require-valid-action-string-in-uevent-trigger.patch
driver-core/sysfs-cache-the-last-sysfs_dirent-to-improve-readdir-scalability-v2.patch
driver-core/driver-core-firmware_class-remove-base.h-header-inclusion.patch
+driver-core/kobject-constify-struct-kset_uevent_ops.patch
#####################################
# TTY patches for after 2.6.33 is out
@@ -161,6 +166,49 @@ usb/usb-cdc_acm-add-support-for-pblua-console-port.patch
usb/usb-cdc_acm-silence-it-is-not-a-modem.-error-for-pblua-devices.patch
usb/usb-retain-usb-device-power-wakeup-setting-across-reconfiguration.patch
usb/usb-rename-usb_speed_variable-to-usb_speed_wireless.patch
+usb/usb-document-abi-for-usb_quirk_reset_morphs.patch
+usb/usb-ftdi_sio-use-error-code-from-usb-stack-in-read_latency_timer.patch
+usb/usb-ftdi_sio-fix-latency-timeout-endianess-bug.patch
+usb/usb-ftdi_sio-fix-dma-buffers-on-stack.patch
+usb/usb-ftdi_sio-clean-up-modem-status-handling.patch
+usb/usb-ftdi_sio-remove-unnecessary-initialisations.patch
+usb/usb-usblp-remove-checks-no-longer-needed-with-the-new-runtime-pm-system.patch
+usb/usb-correct-config-variable-typo.patch
+usb/usb-otg-twl4030-move-to-request_threaded_irq.patch
+usb/usb-musb-add-new-fifo-table-for-a-omap3-errata.patch
+usb/usb-musb-hsdma-add-wrapper-for-reading-dma-count.patch
+usb/usb-musb-workaround-musb-dma_intr-sometimes-reads-zero.patch
+usb/usb-musb-workaround-toggle-bug-when-doing-bulk-transfer-after-isoc.patch
+usb/usb-musb-fix-cppi_channel_abort-function-to-handle-tx-abort-correctly.patch
+usb/usb-musb-clean-up-commit-workaround-blackfin-fifo-anomalies.patch
+usb/usb-musb-handle-irqs-in-the-order-dictated-by-programming-guide.patch
+usb/usb-musb-save-dynfifo-in-musb-struct.patch
+usb/musb-add-extvbus-in-musb_hdrc_platform_data.patch
+usb/usb-host-ehci-fix-missing-kfree-in-remove-path-also.patch
+usb/usb-host-ehci-adding-regulator-framework-in-ehci-omap.c-driver.patch
+usb/usb-ch341-replace-printk-warnings-with-dev_err.patch
+usb/usb-ch341-fix-dma-buffer-on-stack.patch
+usb/usb-ch341-use-le16_to_cpup-to-be-explicit-about-endianess.patch
+usb/usb-cypress_m8-fix-dma-buffer-on-stack.patch
+usb/usb-cypress_m8-fix-endianess-bug.patch
+usb/usb-io_ti-fix-dma-buffers-on-stack.patch
+usb/usb-keyspan_pda-fix-dma-buffers-on-stack.patch
+usb/usb-kl5kusb105-fix-dma-buffers-on-stack.patch
+usb/usb-mos7720-fix-dma-buffers-on-stack-and-clean-up-send_mos_cmd.patch
+usb/usb-mos7840-fix-dma-buffers-on-stack-and-endianess-bugs.patch
+usb/usb-oti6858-fix-dma-buffer-on-stack.patch
+usb/usb-visor-fix-dma-buffers-on-stack.patch
+usb/usb-kobil_sct-clean-up-kobil_set_termios.patch
+usb/usb-serial-fix-dma-buffers-on-stack-for-io_edgeport.c.patch
+usb/usb-ch341-use-get_unaligned_le16-in-break_ctl.patch
+usb/usb-cypress_m8-use-put_unaligned_le32-where-necessary.patch
+usb/usb-fhci-correct-the-size-argument-to-kzalloc.patch
+usb/usb-c67x00-use-resource_size.patch
+usb/usb-xhci-fix-compile-issues-with-xhci_get_slot_state.patch
+usb/usb-gadget-introduce-g_nokia-gadget-driver.patch
+usb/arm-defconfig-rx51-enable-phonet-and-g_nokia.patch
+usb/usb-unusual_devs-add-support-for-multiple-option-3g-sticks.patch
+usb/usb-use-binterfacenumber-in-bandwidth-allocations.patch
#######################################
@@ -331,5 +379,10 @@ staging/staging-fix-typos-enalbe-enable.patch
staging/staging-fix-typos-selct-select.patch
staging/staging-fix-typos-aquire-acquire.patch
staging/staging-fix-typos-couter-counter.patch
+staging/staging-sm7xx-remove-the-buggy-2d-acceleration-support.patch
+staging/staging-rtl8192u-ieee80211-currentmpdudensity-assigned-to-itself-in-htusedefaultsetting.patch
+staging/staging-comedi-adq12b-checkpatch-cleanups.patch
+staging/staging-comedi-c6xdigio-checkpatch-cleanups.patch
+staging/staging-comedi-rti800-checkpatch-cleanups.patch
diff --git a/staging.current/staging-asus_oled-fix-oops-in-2.6.32.2.patch b/staging.current/staging-asus_oled-fix-oops-in-2.6.32.2.patch
index fd36846fda58c4..a8ef4e4435baf0 100644
--- a/staging.current/staging-asus_oled-fix-oops-in-2.6.32.2.patch
+++ b/staging.current/staging-asus_oled-fix-oops-in-2.6.32.2.patch
@@ -14,7 +14,7 @@ set_enabled and set_disabled functions. This can be triggered by simple
running the userspace client for asus_old (e.g., 'asusoled -e' or
'asusoled -d').
-From: Eugeni Dodonov <eugeni@mandriva.com>
+Signed-off-by: Eugeni Dodonov <eugeni@mandriva.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/staging/staging-comedi-adq12b-checkpatch-cleanups.patch b/staging/staging-comedi-adq12b-checkpatch-cleanups.patch
new file mode 100644
index 00000000000000..99ecda3d48526c
--- /dev/null
+++ b/staging/staging-comedi-adq12b-checkpatch-cleanups.patch
@@ -0,0 +1,115 @@
+From b.adolphi@googlemail.com Fri Jan 15 09:59:54 2010
+From: Benjamin Adolphi <b.adolphi@googlemail.com>
+Date: Fri, 15 Jan 2010 12:08:01 +0100
+Subject: Staging: comedi: adq12b: Checkpatch cleanups
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Benjamin Adolphi <b.adolphi@gmail.com>
+Message-ID: <1263553681-8058-1-git-send-email-b.adolphi@gmail.com>
+
+
+This fixes some checkpatch issues in the adq12b comedi driver.
+
+Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/staging/comedi/drivers/adq12b.c | 48 ++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 24 deletions(-)
+
+--- a/drivers/staging/comedi/drivers/adq12b.c
++++ b/drivers/staging/comedi/drivers/adq12b.c
+@@ -42,23 +42,23 @@ If you do not specify any options, they
+ option 1: I/O base address. The following table is provided as a help
+ of the hardware jumpers.
+
+- address jumper JADR
+- 0x300 1 (factory default)
+- 0x320 2
+- 0x340 3
+- 0x360 4
+- 0x380 5
+- 0x3A0 6
++ address jumper JADR
++ 0x300 1 (factory default)
++ 0x320 2
++ 0x340 3
++ 0x360 4
++ 0x380 5
++ 0x3A0 6
+
+ option 2: unipolar/bipolar ADC selection: 0 -> bipolar, 1 -> unipolar
+
+- selection comedi_config option JUB
+- bipolar 0 2-3 (factory default)
+- unipolar 1 1-2
++ selection comedi_config option JUB
++ bipolar 0 2-3 (factory default)
++ unipolar 1 1-2
+
+ option 3: single-ended/differential AI selection: 0 -> SE, 1 -> differential
+
+- selection comedi_config option JCHA JCHB
++ selection comedi_config option JCHA JCHB
+ single-ended 0 1-2 1-2 (factory default)
+ differential 1 2-3 2-3
+
+@@ -140,7 +140,7 @@ static const struct adq12b_board adq12b_
+ .ai_bits = 12,
+ .di_chans = 8,
+ .do_chans = 5
+- }*/
++ }*/
+ };
+
+ #define thisboard ((const struct adq12b_board *)dev->board_ptr)
+@@ -164,14 +164,15 @@ struct adq12b_private {
+ static int adq12b_attach(struct comedi_device *dev,
+ struct comedi_devconfig *it);
+ static int adq12b_detach(struct comedi_device *dev);
++
+ static struct comedi_driver driver_adq12b = {
+-driver_name:"adq12b",
+-module:THIS_MODULE,
+-attach:adq12b_attach,
+-detach:adq12b_detach,
+-board_name:&adq12b_boards[0].name,
+-offset:sizeof(struct adq12b_board),
+-num_names:ARRAY_SIZE(adq12b_boards),
++ .driver_name = "adq12b",
++ .module = THIS_MODULE,
++ .attach = adq12b_attach,
++ .detach = adq12b_detach,
++ .board_name = &adq12b_boards[0].name,
++ .offset = sizeof(struct adq12b_board),
++ .num_names = ARRAY_SIZE(adq12b_boards),
+ };
+
+ static int adq12b_ai_rinsn(struct comedi_device *dev,
+@@ -259,11 +260,10 @@ static int adq12b_attach(struct comedi_d
+ s->n_chan = thisboard->ai_se_chans;
+ }
+
+- if (unipolar) {
++ if (unipolar)
+ s->range_table = &range_adq12b_ai_unipolar;
+- } else {
++ else
+ s->range_table = &range_adq12b_ai_bipolar;
+- }
+
+ s->maxdata = (1 << thisboard->ai_bits) - 1;
+
+@@ -344,11 +344,11 @@ static int adq12b_ai_rinsn(struct comedi
+ /* wait for end of convertion */
+ i = 0;
+ do {
+-/* udelay(1); */
++ /* udelay(1); */
+ status = inb(dev->iobase + ADQ12B_STINR);
+ status = status & ADQ12B_EOC;
+ } while (status == 0 && ++i < TIMEOUT);
+-/* } while (++i < 10); */
++ /* } while (++i < 10); */
+
+ /* read data */
+ hi = inb(dev->iobase + ADQ12B_ADHIG);
diff --git a/staging/staging-comedi-c6xdigio-checkpatch-cleanups.patch b/staging/staging-comedi-c6xdigio-checkpatch-cleanups.patch
new file mode 100644
index 00000000000000..3b2fff96fcf96a
--- /dev/null
+++ b/staging/staging-comedi-c6xdigio-checkpatch-cleanups.patch
@@ -0,0 +1,141 @@
+From b.adolphi@googlemail.com Fri Jan 15 10:00:08 2010
+From: Benjamin Adolphi <b.adolphi@googlemail.com>
+Date: Fri, 15 Jan 2010 17:37:47 +0100
+Subject: Staging: comedi: c6xdigio: Checkpatch cleanups
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Benjamin Adolphi <b.adolphi@gmail.com>
+Message-ID: <1263573467-18780-1-git-send-email-b.adolphi@gmail.com>
+
+
+This fixes some checkpatch issues and some
+spelling mistakes in the c6xdigio comedi driver.
+
+Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/staging/comedi/drivers/c6xdigio.c | 55 ++++++++++++++----------------
+ 1 file changed, 27 insertions(+), 28 deletions(-)
+
+--- a/drivers/staging/comedi/drivers/c6xdigio.c
++++ b/drivers/staging/comedi/drivers/c6xdigio.c
+@@ -45,7 +45,7 @@ http://robot0.ge.uiuc.edu/~spong/mecha/
+ #include <linux/interrupt.h>
+ #include <linux/timex.h>
+ #include <linux/timer.h>
+-#include <asm/io.h>
++#include <linux/io.h>
+ #include <linux/pnp.h>
+
+ #include "../comedidev.h"
+@@ -220,11 +220,11 @@ static int C6X_encInput(unsigned long ba
+ /* printk("Inside C6X_encInput\n"); */
+
+ enc.value = 0;
+- if (channel == 0) {
++ if (channel == 0)
+ ppcmd = 0x48;
+- } else {
++ else
+ ppcmd = 0x50;
+- }
++
+ WriteByteToHwPort(baseAddr, ppcmd);
+ tmp = ReadByteFromHwPort(baseAddr + 1);
+ while (((tmp & 0x80) == 0) && (timeout < C6XDIGIO_TIME_OUT)) {
+@@ -391,9 +391,8 @@ static int c6xdigio_ei_insn_read(struct
+ int n;
+ int chan = CR_CHAN(insn->chanspec);
+
+- for (n = 0; n < insn->n; n++) {
++ for (n = 0; n < insn->n; n++)
+ data[n] = (C6X_encInput(dev->iobase, chan) & 0xffffff);
+- }
+
+ return n;
+ }
+@@ -420,9 +419,9 @@ static void board_init(struct comedi_dev
+
+ static const struct pnp_device_id c6xdigio_pnp_tbl[] = {
+ /* Standard LPT Printer Port */
+- {.id = "PNP0400",.driver_data = 0},
++ {.id = "PNP0400", .driver_data = 0},
+ /* ECP Printer Port */
+- {.id = "PNP0401",.driver_data = 0},
++ {.id = "PNP0401", .driver_data = 0},
+ {}
+ };
+
+@@ -452,15 +451,14 @@ static int c6xdigio_attach(struct comedi
+ if (result < 0)
+ return result;
+
+- /* Make sure that PnP ports gets activated */
++ /* Make sure that PnP ports get activated */
+ pnp_register_driver(&c6xdigio_pnp_driver);
+
+ irq = it->options[1];
+- if (irq > 0) {
++ if (irq > 0)
+ printk("comedi%d: irq = %u ignored\n", dev->minor, irq);
+- } else if (irq == 0) {
++ else if (irq == 0)
+ printk("comedi%d: no irq\n", dev->minor);
+- }
+
+ s = dev->subdevices + 0;
+ /* pwm output subdevice */
+@@ -483,19 +481,19 @@ static int c6xdigio_attach(struct comedi
+ s->maxdata = 0xffffff;
+ s->range_table = &range_unknown;
+
+- /* s = dev->subdevices + 2; */
++ /* s = dev->subdevices + 2; */
+ /* pwm output subdevice */
+- /* s->type = COMEDI_SUBD_COUNTER; // Not sure what to put here */
+- /* s->subdev_flags = SDF_WRITEABLE; */
+- /* s->n_chan = 1; */
+- /* s->trig[0] = c6xdigio_ei_init; */
+- /* s->insn_read = c6xdigio_ei_init_insn_read; */
+- /* s->insn_write = c6xdigio_ei_init_insn_write; */
+- /* s->maxdata = 0xFFFF; // Really just a don't care */
+- /* s->range_table = &range_unknown; // Not sure what to put here */
++ /* s->type = COMEDI_SUBD_COUNTER; // Not sure what to put here */
++ /* s->subdev_flags = SDF_WRITEABLE; */
++ /* s->n_chan = 1; */
++ /* s->trig[0] = c6xdigio_ei_init; */
++ /* s->insn_read = c6xdigio_ei_init_insn_read; */
++ /* s->insn_write = c6xdigio_ei_init_insn_write; */
++ /* s->maxdata = 0xFFFF; // Really just a don't care */
++ /* s->range_table = &range_unknown; // Not sure what to put here */
+
+- /* I will call this init anyway but more than likely the DSP board will not be connect */
+- /* when device driver is loaded. */
++ /* I will call this init anyway but more than likely the DSP board */
++ /* will not be connected when device driver is loaded. */
+ board_init(dev);
+
+ return 0;
+@@ -503,16 +501,17 @@ static int c6xdigio_attach(struct comedi
+
+ static int c6xdigio_detach(struct comedi_device *dev)
+ {
+-/* board_halt(dev); may not need this */
++ /* board_halt(dev); may not need this */
+
+ printk("comedi%d: c6xdigio: remove\n", dev->minor);
+
+- if (dev->iobase) {
++ if (dev->iobase)
+ release_region(dev->iobase, C6XDIGIO_SIZE);
+- }
+- if (dev->irq) {
++
++ /* Not using IRQ so I am not sure if I need this */
++ if (dev->irq)
+ free_irq(dev->irq, dev);
+- } /* Not using IRQ so I am not sure if I need this */
++
+ pnp_unregister_driver(&c6xdigio_pnp_driver);
+
+ return 0;
diff --git a/staging/staging-comedi-rti800-checkpatch-cleanups.patch b/staging/staging-comedi-rti800-checkpatch-cleanups.patch
new file mode 100644
index 00000000000000..4d62be9193093c
--- /dev/null
+++ b/staging/staging-comedi-rti800-checkpatch-cleanups.patch
@@ -0,0 +1,99 @@
+From b.adolphi@googlemail.com Fri Jan 15 10:00:24 2010
+From: Benjamin Adolphi <b.adolphi@googlemail.com>
+Date: Fri, 15 Jan 2010 18:03:35 +0100
+Subject: Staging: comedi: rti800: Checkpatch cleanups
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Benjamin Adolphi <b.adolphi@gmail.com>
+Message-ID: <1263575015-4455-1-git-send-email-b.adolphi@gmail.com>
+
+
+This fixes some checkpatch issues in the rti800 comedi driver.
+
+Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/staging/comedi/drivers/rti800.c | 41 +++++++++++++++-----------------
+ 1 file changed, 20 insertions(+), 21 deletions(-)
+
+--- a/drivers/staging/comedi/drivers/rti800.c
++++ b/drivers/staging/comedi/drivers/rti800.c
+@@ -32,22 +32,22 @@ Configuration options:
+ [0] - I/O port base address
+ [1] - IRQ
+ [2] - A/D reference
+- 0 = differential
+- 1 = pseudodifferential (common)
+- 2 = single-ended
++ 0 = differential
++ 1 = pseudodifferential (common)
++ 2 = single-ended
+ [3] - A/D range
+- 0 = [-10,10]
+- 1 = [-5,5]
+- 2 = [0,10]
++ 0 = [-10,10]
++ 1 = [-5,5]
++ 2 = [0,10]
+ [4] - A/D encoding
+- 0 = two's complement
+- 1 = straight binary
++ 0 = two's complement
++ 1 = straight binary
+ [5] - DAC 0 range
+- 0 = [-10,10]
+- 1 = [0,10]
++ 0 = [-10,10]
++ 1 = [0,10]
+ [6] - DAC 0 encoding
+- 0 = two's complement
+- 1 = straight binary
++ 0 = two's complement
++ 1 = straight binary
+ [7] - DAC 1 range (same as DAC 0)
+ [8] - DAC 1 encoding (same as DAC 0)
+ */
+@@ -240,9 +240,8 @@ static int rti800_ai_insn_read(struct co
+ data[i] = inb(dev->iobase + RTI800_ADCLO);
+ data[i] |= (0xf & inb(dev->iobase + RTI800_ADCHI)) << 8;
+
+- if (devpriv->adc_coding == adc_2comp) {
++ if (devpriv->adc_coding == adc_2comp)
+ data[i] ^= 0x800;
+- }
+ }
+
+ return i;
+@@ -271,9 +270,9 @@ static int rti800_ao_insn_write(struct c
+
+ for (i = 0; i < insn->n; i++) {
+ devpriv->ao_readback[chan] = d = data[i];
+- if (devpriv->dac0_coding == dac_2comp) {
++ if (devpriv->dac0_coding == dac_2comp)
+ d ^= 0x800;
+- }
++
+ outb(d & 0xff,
+ dev->iobase + (chan ? RTI800_DAC1LO : RTI800_DAC0LO));
+ outb(d >> 8,
+@@ -315,15 +314,15 @@ static int rti800_do_insn_bits(struct co
+ options[0] - I/O port
+ options[1] - irq
+ options[2] - a/d mux
+- 0=differential, 1=pseudodiff, 2=single
++ 0=differential, 1=pseudodiff, 2=single
+ options[3] - a/d range
+- 0=bipolar10, 1=bipolar5, 2=unipolar10
++ 0=bipolar10, 1=bipolar5, 2=unipolar10
+ options[4] - a/d coding
+- 0=2's comp, 1=straight binary
++ 0=2's comp, 1=straight binary
+ options[5] - dac0 range
+- 0=bipolar10, 1=unipolar10
++ 0=bipolar10, 1=unipolar10
+ options[6] - dac0 coding
+- 0=2's comp, 1=straight binary
++ 0=2's comp, 1=straight binary
+ options[7] - dac1 range
+ options[8] - dac1 coding
+ */
diff --git a/staging/staging-rtl8192u-ieee80211-currentmpdudensity-assigned-to-itself-in-htusedefaultsetting.patch b/staging/staging-rtl8192u-ieee80211-currentmpdudensity-assigned-to-itself-in-htusedefaultsetting.patch
new file mode 100644
index 00000000000000..925d160e47630d
--- /dev/null
+++ b/staging/staging-rtl8192u-ieee80211-currentmpdudensity-assigned-to-itself-in-htusedefaultsetting.patch
@@ -0,0 +1,28 @@
+From roel.kluin@gmail.com Fri Jan 15 09:58:36 2010
+From: Roel Kluin <roel.kluin@gmail.com>
+Date: Thu, 14 Jan 2010 21:25:56 +0100
+Subject: Staging: rtl8192u: ieee80211: CurrentMPDUDensity assigned to itself in HTUseDefaultSetting()
+To: Greg Kroah-Hartman <gregkh@suse.de>, devel@driverdev.osuosl.org, Andrew Morton <akpm@linux-foundation.org>, <mchehab@redhat.com>
+Message-ID: <4B4F7DD4.6050102@gmail.com>
+
+
+CurrentMPDUDensity was designed to itself.
+
+Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
++++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+@@ -1342,7 +1342,7 @@ void HTUseDefaultSetting(struct ieee8021
+
+ pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
+
+- pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity;
++ pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
+
+ // Set BWOpMode register
+
diff --git a/staging/staging-sm7xx-remove-the-buggy-2d-acceleration-support.patch b/staging/staging-sm7xx-remove-the-buggy-2d-acceleration-support.patch
new file mode 100644
index 00000000000000..16a075bbbc8f3d
--- /dev/null
+++ b/staging/staging-sm7xx-remove-the-buggy-2d-acceleration-support.patch
@@ -0,0 +1,1768 @@
+From wuzhangjin@gmail.com Fri Jan 15 09:55:42 2010
+From: Wu Zhangjin <wuzhangjin@gmail.com>
+Date: Wed, 6 Jan 2010 16:33:10 +0800
+Subject: staging: sm7xx: remove the buggy 2D acceleration support
+To: Greg Kroah-Hartman <greg@kroah.com>, Teddy Wang <teddy.wang@siliconmotion.com.cn>
+Cc: devel@driverdev.osuosl.org, Wu Zhangjin <wuzhangjin@gmail.com>
+Message-ID: <1262766790-24838-1-git-send-email-wuzhangjin@gmail.com>
+
+
+From: Wu Zhangjin <wuzhangjin@gmail.com>
+
+When scrolling the screen on the console with the 2D acceleration
+support, the whole system may hang. for example, when copying some files
+from another machine to YeeLoong netbook with the sm7xx video driver via
+scp and when the screen output is enabled, the system may hang.
+
+Before the bug is fixed, remove the 2D acceleration!
+
+Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
+Cc: Teddy Wang <teddy.wang@siliconmotion.com.cn>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/staging/sm7xx/Kconfig | 7
+ drivers/staging/sm7xx/TODO | 1
+ drivers/staging/sm7xx/smtc2d.c | 979 -----------------------------------------
+ drivers/staging/sm7xx/smtc2d.h | 530 ----------------------
+ drivers/staging/sm7xx/smtcfb.c | 129 -----
+ 5 files changed, 11 insertions(+), 1635 deletions(-)
+
+--- a/drivers/staging/sm7xx/Kconfig
++++ b/drivers/staging/sm7xx/Kconfig
+@@ -6,10 +6,3 @@ config FB_SM7XX
+ select FB_CFB_IMAGEBLIT
+ help
+ Frame Buffer driver for the Silicon Motion SM7XX serial graphic card.
+-
+-config FB_SM7XX_ACCEL
+- bool "Siliconmotion Acceleration functions (EXPERIMENTAL)"
+- depends on FB_SM7XX && EXPERIMENTAL
+- help
+- This will compile the Trident frame buffer device with
+- acceleration functions.
+--- a/drivers/staging/sm7xx/smtc2d.c
++++ /dev/null
+@@ -1,979 +0,0 @@
+-/*
+- * Silicon Motion SM7XX 2D drawing engine functions.
+- *
+- * Copyright (C) 2006 Silicon Motion Technology Corp.
+- * Author: Boyod boyod.yang@siliconmotion.com.cn
+- *
+- * Copyright (C) 2009 Lemote, Inc.
+- * Author: Wu Zhangjin, wuzj@lemote.com
+- *
+- * This file is subject to the terms and conditions of the GNU General Public
+- * License. See the file COPYING in the main directory of this archive for
+- * more details.
+- *
+- * Version 0.10.26192.21.01
+- * - Add PowerPC support
+- * - Add 2D support for Lynx -
+- * Verified on 2.6.19.2
+- * Boyod.yang <boyod.yang@siliconmotion.com.cn>
+- */
+-
+-unsigned char smtc_de_busy;
+-
+-void SMTC_write2Dreg(unsigned long nOffset, unsigned long nData)
+-{
+- writel(nData, smtc_2DBaseAddress + nOffset);
+-}
+-
+-unsigned long SMTC_read2Dreg(unsigned long nOffset)
+-{
+- return readl(smtc_2DBaseAddress + nOffset);
+-}
+-
+-void SMTC_write2Ddataport(unsigned long nOffset, unsigned long nData)
+-{
+- writel(nData, smtc_2Ddataport + nOffset);
+-}
+-
+-/**********************************************************************
+- *
+- * deInit
+- *
+- * Purpose
+- * Drawing engine initialization.
+- *
+- **********************************************************************/
+-
+-void deInit(unsigned int nModeWidth, unsigned int nModeHeight,
+- unsigned int bpp)
+-{
+- /* Get current power configuration. */
+- unsigned char clock;
+- clock = smtc_seqr(0x21);
+-
+- /* initialize global 'mutex lock' variable */
+- smtc_de_busy = 0;
+-
+- /* Enable 2D Drawing Engine */
+- smtc_seqw(0x21, clock & 0xF8);
+-
+- SMTC_write2Dreg(DE_CLIP_TL,
+- FIELD_VALUE(0, DE_CLIP_TL, TOP, 0) |
+- FIELD_SET(0, DE_CLIP_TL, STATUS, DISABLE) |
+- FIELD_SET(0, DE_CLIP_TL, INHIBIT, OUTSIDE) |
+- FIELD_VALUE(0, DE_CLIP_TL, LEFT, 0));
+-
+- if (bpp >= 24) {
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- nModeWidth * 3) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- nModeWidth
+- * 3));
+- } else {
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- nModeWidth) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- nModeWidth));
+- }
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- nModeWidth) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- nModeWidth));
+-
+- switch (bpp) {
+- case 8:
+- SMTC_write2Dreg(DE_STRETCH_FORMAT,
+- FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
+- NORMAL) | FIELD_VALUE(0,
+- DE_STRETCH_FORMAT,
+- PATTERN_Y,
+- 0) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
+- 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
+- PIXEL_FORMAT,
+- 8) | FIELD_SET(0,
+- DE_STRETCH_FORMAT,
+- ADDRESSING,
+- XY) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT,
+- SOURCE_HEIGHT, 3));
+- break;
+- case 24:
+- SMTC_write2Dreg(DE_STRETCH_FORMAT,
+- FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
+- NORMAL) | FIELD_VALUE(0,
+- DE_STRETCH_FORMAT,
+- PATTERN_Y,
+- 0) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
+- 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
+- PIXEL_FORMAT,
+- 24) | FIELD_SET(0,
+- DE_STRETCH_FORMAT,
+- ADDRESSING,
+- XY) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT,
+- SOURCE_HEIGHT, 3));
+- break;
+- case 16:
+- default:
+- SMTC_write2Dreg(DE_STRETCH_FORMAT,
+- FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
+- NORMAL) | FIELD_VALUE(0,
+- DE_STRETCH_FORMAT,
+- PATTERN_Y,
+- 0) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
+- 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
+- PIXEL_FORMAT,
+- 16) | FIELD_SET(0,
+- DE_STRETCH_FORMAT,
+- ADDRESSING,
+- XY) |
+- FIELD_VALUE(0, DE_STRETCH_FORMAT,
+- SOURCE_HEIGHT, 3));
+- break;
+- }
+-
+- SMTC_write2Dreg(DE_MASKS,
+- FIELD_VALUE(0, DE_MASKS, BYTE_MASK, 0xFFFF) |
+- FIELD_VALUE(0, DE_MASKS, BIT_MASK, 0xFFFF));
+- SMTC_write2Dreg(DE_COLOR_COMPARE_MASK,
+- FIELD_VALUE(0, DE_COLOR_COMPARE_MASK, MASKS, \
+- 0xFFFFFF));
+- SMTC_write2Dreg(DE_COLOR_COMPARE,
+- FIELD_VALUE(0, DE_COLOR_COMPARE, COLOR, 0xFFFFFF));
+-}
+-
+-void deVerticalLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX,
+- unsigned long nY,
+- unsigned long dst_height, unsigned long nColor)
+-{
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
+- dst_base));
+-
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION, dst_pitch) |
+- FIELD_VALUE(0, DE_PITCH, SOURCE, dst_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0, DE_WINDOW_WIDTH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_FOREGROUND,
+- FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, nX) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, nY));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, 1) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
+-
+- SMTC_write2Dreg(DE_CONTROL,
+- FIELD_SET(0, DE_CONTROL, STATUS, START) |
+- FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
+- FIELD_SET(0, DE_CONTROL, MAJOR, Y) |
+- FIELD_SET(0, DE_CONTROL, STEP_X, NEGATIVE) |
+- FIELD_SET(0, DE_CONTROL, STEP_Y, POSITIVE) |
+- FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
+- FIELD_SET(0, DE_CONTROL, COMMAND, SHORT_STROKE) |
+- FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
+- FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C));
+-
+- smtc_de_busy = 1;
+-}
+-
+-void deHorizontalLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX,
+- unsigned long nY,
+- unsigned long dst_width, unsigned long nColor)
+-{
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
+- dst_base));
+-
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION, dst_pitch) |
+- FIELD_VALUE(0, DE_PITCH, SOURCE, dst_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0, DE_WINDOW_WIDTH,
+- SOURCE,
+- dst_pitch));
+- SMTC_write2Dreg(DE_FOREGROUND,
+- FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP,
+- DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X,
+- nX) | FIELD_VALUE(0,
+- DE_DESTINATION,
+- Y,
+- nY));
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X,
+- dst_width) | FIELD_VALUE(0, DE_DIMENSION,
+- Y_ET, 1));
+- SMTC_write2Dreg(DE_CONTROL,
+- FIELD_SET(0, DE_CONTROL, STATUS, START) | FIELD_SET(0,
+- DE_CONTROL,
+- DIRECTION,
+- RIGHT_TO_LEFT)
+- | FIELD_SET(0, DE_CONTROL, MAJOR, X) | FIELD_SET(0,
+- DE_CONTROL,
+- STEP_X,
+- POSITIVE)
+- | FIELD_SET(0, DE_CONTROL, STEP_Y,
+- NEGATIVE) | FIELD_SET(0, DE_CONTROL,
+- LAST_PIXEL,
+- OFF) | FIELD_SET(0,
+- DE_CONTROL,
+- COMMAND,
+- SHORT_STROKE)
+- | FIELD_SET(0, DE_CONTROL, ROP_SELECT,
+- ROP2) | FIELD_VALUE(0, DE_CONTROL, ROP,
+- 0x0C));
+-
+- smtc_de_busy = 1;
+-}
+-
+-void deLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX1,
+- unsigned long nY1,
+- unsigned long nX2, unsigned long nY2, unsigned long nColor)
+-{
+- unsigned long nCommand =
+- FIELD_SET(0, DE_CONTROL, STATUS, START) |
+- FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
+- FIELD_SET(0, DE_CONTROL, MAJOR, X) |
+- FIELD_SET(0, DE_CONTROL, STEP_X, POSITIVE) |
+- FIELD_SET(0, DE_CONTROL, STEP_Y, POSITIVE) |
+- FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
+- FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
+- FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C);
+- unsigned long DeltaX;
+- unsigned long DeltaY;
+-
+- /* Calculate delta X */
+- if (nX1 <= nX2)
+- DeltaX = nX2 - nX1;
+- else {
+- DeltaX = nX1 - nX2;
+- nCommand = FIELD_SET(nCommand, DE_CONTROL, STEP_X, NEGATIVE);
+- }
+-
+- /* Calculate delta Y */
+- if (nY1 <= nY2)
+- DeltaY = nY2 - nY1;
+- else {
+- DeltaY = nY1 - nY2;
+- nCommand = FIELD_SET(nCommand, DE_CONTROL, STEP_Y, NEGATIVE);
+- }
+-
+- /* Determine the major axis */
+- if (DeltaX < DeltaY)
+- nCommand = FIELD_SET(nCommand, DE_CONTROL, MAJOR, Y);
+-
+- /* Vertical line? */
+- if (nX1 == nX2)
+- deVerticalLine(dst_base, dst_pitch, nX1, nY1, DeltaY, nColor);
+-
+- /* Horizontal line? */
+- else if (nY1 == nY2)
+- deHorizontalLine(dst_base, dst_pitch, nX1, nY1, \
+- DeltaX, nColor);
+-
+- /* Diagonal line? */
+- else if (DeltaX == DeltaY) {
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE,
+- ADDRESS, dst_base));
+-
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_FOREGROUND,
+- FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, 1) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, nY1));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, 1) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, DeltaX));
+-
+- SMTC_write2Dreg(DE_CONTROL,
+- FIELD_SET(nCommand, DE_CONTROL, COMMAND,
+- SHORT_STROKE));
+- }
+-
+- /* Generic line */
+- else {
+- unsigned int k1, k2, et, w;
+- if (DeltaX < DeltaY) {
+- k1 = 2 * DeltaX;
+- et = k1 - DeltaY;
+- k2 = et - DeltaY;
+- w = DeltaY + 1;
+- } else {
+- k1 = 2 * DeltaY;
+- et = k1 - DeltaX;
+- k2 = et - DeltaX;
+- w = DeltaX + 1;
+- }
+-
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE,
+- ADDRESS, dst_base));
+-
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_FOREGROUND,
+- FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
+-
+- SMTC_write2Dreg(DE_SOURCE,
+- FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_SOURCE, X_K1, k1) |
+- FIELD_VALUE(0, DE_SOURCE, Y_K2, k2));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, nX1) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, nY1));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, w) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, et));
+-
+- SMTC_write2Dreg(DE_CONTROL,
+- FIELD_SET(nCommand, DE_CONTROL, COMMAND,
+- LINE_DRAW));
+- }
+-
+- smtc_de_busy = 1;
+-}
+-
+-void deFillRect(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long dst_X,
+- unsigned long dst_Y,
+- unsigned long dst_width,
+- unsigned long dst_height, unsigned long nColor)
+-{
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
+- dst_base));
+-
+- if (dst_pitch) {
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- dst_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- dst_pitch));
+- }
+-
+- SMTC_write2Dreg(DE_FOREGROUND,
+- FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, dst_X) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, dst_Y));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, dst_width) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
+-
+- SMTC_write2Dreg(DE_CONTROL,
+- FIELD_SET(0, DE_CONTROL, STATUS, START) |
+- FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
+- FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
+- FIELD_SET(0, DE_CONTROL, COMMAND, RECTANGLE_FILL) |
+- FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
+- FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C));
+-
+- smtc_de_busy = 1;
+-}
+-
+-/**********************************************************************
+- *
+- * deRotatePattern
+- *
+- * Purpose
+- * Rotate the given pattern if necessary
+- *
+- * Parameters
+- * [in]
+- * pPattern - Pointer to DE_SURFACE structure containing
+- * pattern attributes
+- * patternX - X position (0-7) of pattern origin
+- * patternY - Y position (0-7) of pattern origin
+- *
+- * [out]
+- * pattern_dstaddr - Pointer to pre-allocated buffer containing
+- * rotated pattern
+- *
+- **********************************************************************/
+-void deRotatePattern(unsigned char *pattern_dstaddr,
+- unsigned long pattern_src_addr,
+- unsigned long pattern_BPP,
+- unsigned long pattern_stride, int patternX, int patternY)
+-{
+- unsigned int i;
+- unsigned long pattern[PATTERN_WIDTH * PATTERN_HEIGHT];
+- unsigned int x, y;
+- unsigned char *pjPatByte;
+-
+- if (pattern_dstaddr != NULL) {
+- deWaitForNotBusy();
+-
+- if (patternX || patternY) {
+- /* Rotate pattern */
+- pjPatByte = (unsigned char *)pattern;
+-
+- switch (pattern_BPP) {
+- case 8:
+- {
+- for (y = 0; y < 8; y++) {
+- unsigned char *pjBuffer =
+- pattern_dstaddr +
+- ((patternY + y) & 7) * 8;
+- for (x = 0; x < 8; x++) {
+- pjBuffer[(patternX +
+- x) & 7] =
+- pjPatByte[x];
+- }
+- pjPatByte += pattern_stride;
+- }
+- break;
+- }
+-
+- case 16:
+- {
+- for (y = 0; y < 8; y++) {
+- unsigned short *pjBuffer =
+- (unsigned short *)
+- pattern_dstaddr +
+- ((patternY + y) & 7) * 8;
+- for (x = 0; x < 8; x++) {
+- pjBuffer[(patternX +
+- x) & 7] =
+- ((unsigned short *)
+- pjPatByte)[x];
+- }
+- pjPatByte += pattern_stride;
+- }
+- break;
+- }
+-
+- case 32:
+- {
+- for (y = 0; y < 8; y++) {
+- unsigned long *pjBuffer =
+- (unsigned long *)
+- pattern_dstaddr +
+- ((patternY + y) & 7) * 8;
+- for (x = 0; x < 8; x++) {
+- pjBuffer[(patternX +
+- x) & 7] =
+- ((unsigned long *)
+- pjPatByte)[x];
+- }
+- pjPatByte += pattern_stride;
+- }
+- break;
+- }
+- }
+- } else {
+- /*Don't rotate,just copy pattern into pattern_dstaddr*/
+- for (i = 0; i < (pattern_BPP * 2); i++) {
+- ((unsigned long *)pattern_dstaddr)[i] =
+- pattern[i];
+- }
+- }
+-
+- }
+-}
+-
+-/**********************************************************************
+- *
+- * deCopy
+- *
+- * Purpose
+- * Copy a rectangular area of the source surface to a destination surface
+- *
+- * Remarks
+- * Source bitmap must have the same color depth (BPP) as the destination
+- * bitmap.
+- *
+-**********************************************************************/
+-void deCopy(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long dst_BPP,
+- unsigned long dst_X,
+- unsigned long dst_Y,
+- unsigned long dst_width,
+- unsigned long dst_height,
+- unsigned long src_base,
+- unsigned long src_pitch,
+- unsigned long src_X,
+- unsigned long src_Y, pTransparent pTransp, unsigned char nROP2)
+-{
+- unsigned long nDirection = 0;
+- unsigned long nTransparent = 0;
+- /* Direction of ROP2 operation:
+- * 1 = Left to Right,
+- * (-1) = Right to Left
+- */
+- unsigned long opSign = 1;
+- /* xWidth is in pixels */
+- unsigned long xWidth = 192 / (dst_BPP / 8);
+- unsigned long de_ctrl = 0;
+-
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
+- FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
+- dst_base));
+-
+- SMTC_write2Dreg(DE_WINDOW_SOURCE_BASE,
+- FIELD_VALUE(0, DE_WINDOW_SOURCE_BASE, ADDRESS,
+- src_base));
+-
+- if (dst_pitch && src_pitch) {
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- src_pitch));
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- dst_pitch) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- src_pitch));
+- }
+-
+- /* Set transparent bits if necessary */
+- if (pTransp != NULL) {
+- nTransparent =
+- pTransp->match | pTransp->select | pTransp->control;
+-
+- /* Set color compare register */
+- SMTC_write2Dreg(DE_COLOR_COMPARE,
+- FIELD_VALUE(0, DE_COLOR_COMPARE, COLOR,
+- pTransp->color));
+- }
+-
+- /* Determine direction of operation */
+- if (src_Y < dst_Y) {
+- /* +----------+
+- |S |
+- | +----------+
+- | | | |
+- | | | |
+- +---|------+ |
+- | D |
+- +----------+ */
+-
+- nDirection = BOTTOM_TO_TOP;
+- } else if (src_Y > dst_Y) {
+- /* +----------+
+- |D |
+- | +----------+
+- | | | |
+- | | | |
+- +---|------+ |
+- | S |
+- +----------+ */
+-
+- nDirection = TOP_TO_BOTTOM;
+- } else {
+- /* src_Y == dst_Y */
+-
+- if (src_X <= dst_X) {
+- /* +------+---+------+
+- |S | | D|
+- | | | |
+- | | | |
+- | | | |
+- +------+---+------+ */
+-
+- nDirection = RIGHT_TO_LEFT;
+- } else {
+- /* src_X > dst_X */
+-
+- /* +------+---+------+
+- |D | | S|
+- | | | |
+- | | | |
+- | | | |
+- +------+---+------+ */
+-
+- nDirection = LEFT_TO_RIGHT;
+- }
+- }
+-
+- if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) {
+- src_X += dst_width - 1;
+- src_Y += dst_height - 1;
+- dst_X += dst_width - 1;
+- dst_Y += dst_height - 1;
+- opSign = (-1);
+- }
+-
+- if (dst_BPP >= 24) {
+- src_X *= 3;
+- src_Y *= 3;
+- dst_X *= 3;
+- dst_Y *= 3;
+- dst_width *= 3;
+- if ((nDirection == BOTTOM_TO_TOP)
+- || (nDirection == RIGHT_TO_LEFT)) {
+- src_X += 2;
+- dst_X += 2;
+- }
+- }
+-
+- /* Workaround for 192 byte hw bug */
+- if ((nROP2 != 0x0C) && ((dst_width * (dst_BPP / 8)) >= 192)) {
+- /*
+- * Perform the ROP2 operation in chunks of (xWidth *
+- * dst_height)
+- */
+- while (1) {
+- deWaitForNotBusy();
+-
+- SMTC_write2Dreg(DE_SOURCE,
+- FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_SOURCE, X_K1, src_X) |
+- FIELD_VALUE(0, DE_SOURCE, Y_K2, src_Y));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP,
+- DISABLE) | FIELD_VALUE(0,
+- DE_DESTINATION,
+- X,
+- dst_X)
+- | FIELD_VALUE(0, DE_DESTINATION, Y,
+- dst_Y));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X,
+- xWidth) | FIELD_VALUE(0,
+- DE_DIMENSION,
+- Y_ET,
+- dst_height));
+-
+- de_ctrl =
+- FIELD_VALUE(0, DE_CONTROL, ROP,
+- nROP2) | nTransparent | FIELD_SET(0,
+- DE_CONTROL,
+- ROP_SELECT,
+- ROP2)
+- | FIELD_SET(0, DE_CONTROL, COMMAND,
+- BITBLT) | ((nDirection ==
+- 1) ? FIELD_SET(0,
+- DE_CONTROL,
+- DIRECTION,
+- RIGHT_TO_LEFT)
+- : FIELD_SET(0, DE_CONTROL,
+- DIRECTION,
+- LEFT_TO_RIGHT)) |
+- FIELD_SET(0, DE_CONTROL, STATUS, START);
+-
+- SMTC_write2Dreg(DE_CONTROL, de_ctrl);
+-
+- src_X += (opSign * xWidth);
+- dst_X += (opSign * xWidth);
+- dst_width -= xWidth;
+-
+- if (dst_width <= 0) {
+- /* ROP2 operation is complete */
+- break;
+- }
+-
+- if (xWidth > dst_width)
+- xWidth = dst_width;
+- }
+- } else {
+- deWaitForNotBusy();
+- SMTC_write2Dreg(DE_SOURCE,
+- FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_SOURCE, X_K1, src_X) |
+- FIELD_VALUE(0, DE_SOURCE, Y_K2, src_Y));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, dst_X) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, dst_Y));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, dst_width) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
+-
+- de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, nROP2) |
+- nTransparent |
+- FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
+- FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) |
+- ((nDirection == 1) ? FIELD_SET(0, DE_CONTROL, DIRECTION,
+- RIGHT_TO_LEFT)
+- : FIELD_SET(0, DE_CONTROL, DIRECTION,
+- LEFT_TO_RIGHT)) | FIELD_SET(0, DE_CONTROL,
+- STATUS, START);
+- SMTC_write2Dreg(DE_CONTROL, de_ctrl);
+- }
+-
+- smtc_de_busy = 1;
+-}
+-
+-/*
+- * This function sets the pixel format that will apply to the 2D Engine.
+- */
+-void deSetPixelFormat(unsigned long bpp)
+-{
+- unsigned long de_format;
+-
+- de_format = SMTC_read2Dreg(DE_STRETCH_FORMAT);
+-
+- switch (bpp) {
+- case 8:
+- de_format =
+- FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 8);
+- break;
+- default:
+- case 16:
+- de_format =
+- FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 16);
+- break;
+- case 32:
+- de_format =
+- FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 32);
+- break;
+- }
+-
+- SMTC_write2Dreg(DE_STRETCH_FORMAT, de_format);
+-}
+-
+-/*
+- * System memory to Video memory monochrome expansion.
+- *
+- * Source is monochrome image in system memory. This function expands the
+- * monochrome data to color image in video memory.
+- */
+-
+-long deSystemMem2VideoMemMonoBlt(const char *pSrcbuf,
+- long srcDelta,
+- unsigned long startBit,
+- unsigned long dBase,
+- unsigned long dPitch,
+- unsigned long bpp,
+- unsigned long dx, unsigned long dy,
+- unsigned long width, unsigned long height,
+- unsigned long fColor,
+- unsigned long bColor,
+- unsigned long rop2) {
+- unsigned long bytePerPixel;
+- unsigned long ulBytesPerScan;
+- unsigned long ul4BytesPerScan;
+- unsigned long ulBytesRemain;
+- unsigned long de_ctrl = 0;
+- unsigned char ajRemain[4];
+- long i, j;
+-
+- bytePerPixel = bpp / 8;
+-
+- /* Just make sure the start bit is within legal range */
+- startBit &= 7;
+-
+- ulBytesPerScan = (width + startBit + 7) / 8;
+- ul4BytesPerScan = ulBytesPerScan & ~3;
+- ulBytesRemain = ulBytesPerScan & 3;
+-
+- if (smtc_de_busy)
+- deWaitForNotBusy();
+-
+- /*
+- * 2D Source Base. Use 0 for HOST Blt.
+- */
+-
+- SMTC_write2Dreg(DE_WINDOW_SOURCE_BASE, 0);
+-
+- /*
+- * 2D Destination Base.
+- *
+- * It is an address offset (128 bit aligned) from the beginning of
+- * frame buffer.
+- */
+-
+- SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE, dBase);
+-
+- if (dPitch) {
+-
+- /*
+- * Program pitch (distance between the 1st points of two
+- * adjacent lines).
+- *
+- * Note that input pitch is BYTE value, but the 2D Pitch
+- * register uses pixel values. Need Byte to pixel convertion.
+- */
+-
+- SMTC_write2Dreg(DE_PITCH,
+- FIELD_VALUE(0, DE_PITCH, DESTINATION,
+- dPitch /
+- bytePerPixel) | FIELD_VALUE(0,
+- DE_PITCH,
+- SOURCE,
+- dPitch /
+- bytePerPixel));
+-
+- /* Screen Window width in Pixels.
+- *
+- * 2D engine uses this value to calculate the linear address in
+- * frame buffer for a given point.
+- */
+-
+- SMTC_write2Dreg(DE_WINDOW_WIDTH,
+- FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
+- (dPitch /
+- bytePerPixel)) | FIELD_VALUE(0,
+- DE_WINDOW_WIDTH,
+- SOURCE,
+- (dPitch
+- /
+- bytePerPixel)));
+- }
+- /* Note: For 2D Source in Host Write, only X_K1 field is needed, and
+- * Y_K2 field is not used. For mono bitmap, use startBit for X_K1.
+- */
+-
+- SMTC_write2Dreg(DE_SOURCE,
+- FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_SOURCE, X_K1, startBit) |
+- FIELD_VALUE(0, DE_SOURCE, Y_K2, 0));
+-
+- SMTC_write2Dreg(DE_DESTINATION,
+- FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
+- FIELD_VALUE(0, DE_DESTINATION, X, dx) |
+- FIELD_VALUE(0, DE_DESTINATION, Y, dy));
+-
+- SMTC_write2Dreg(DE_DIMENSION,
+- FIELD_VALUE(0, DE_DIMENSION, X, width) |
+- FIELD_VALUE(0, DE_DIMENSION, Y_ET, height));
+-
+- SMTC_write2Dreg(DE_FOREGROUND, fColor);
+- SMTC_write2Dreg(DE_BACKGROUND, bColor);
+-
+- if (bpp)
+- deSetPixelFormat(bpp);
+- /* Set the pixel format of the destination */
+-
+- de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) |
+- FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
+- FIELD_SET(0, DE_CONTROL, COMMAND, HOST_WRITE) |
+- FIELD_SET(0, DE_CONTROL, HOST, MONO) |
+- FIELD_SET(0, DE_CONTROL, STATUS, START);
+-
+- SMTC_write2Dreg(DE_CONTROL, de_ctrl | deGetTransparency());
+-
+- /* Write MONO data (line by line) to 2D Engine data port */
+- for (i = 0; i < height; i++) {
+- /* For each line, send the data in chunks of 4 bytes */
+- for (j = 0; j < (ul4BytesPerScan / 4); j++)
+- SMTC_write2Ddataport(0,
+- *(unsigned long *)(pSrcbuf +
+- (j * 4)));
+-
+- if (ulBytesRemain) {
+- memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
+- ulBytesRemain);
+- SMTC_write2Ddataport(0, *(unsigned long *)ajRemain);
+- }
+-
+- pSrcbuf += srcDelta;
+- }
+- smtc_de_busy = 1;
+-
+- return 0;
+-}
+-
+-/*
+- * This function gets the transparency status from DE_CONTROL register.
+- * It returns a double word with the transparent fields properly set,
+- * while other fields are 0.
+- */
+-unsigned long deGetTransparency(void)
+-{
+- unsigned long de_ctrl;
+-
+- de_ctrl = SMTC_read2Dreg(DE_CONTROL);
+-
+- de_ctrl &=
+- FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) |
+- FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT) |
+- FIELD_MASK(DE_CONTROL_TRANSPARENCY);
+-
+- return de_ctrl;
+-}
+--- a/drivers/staging/sm7xx/smtc2d.h
++++ /dev/null
+@@ -1,530 +0,0 @@
+-/*
+- * Silicon Motion SM712 2D drawing engine functions.
+- *
+- * Copyright (C) 2006 Silicon Motion Technology Corp.
+- * Author: Ge Wang, gewang@siliconmotion.com
+- *
+- * Copyright (C) 2009 Lemote, Inc.
+- * Author: Wu Zhangjin, wuzj@lemote.com
+- *
+- * This file is subject to the terms and conditions of the GNU General Public
+- * License. See the file COPYING in the main directory of this archive for
+- * more details.
+- */
+-
+-#ifndef NULL
+-#define NULL 0
+-#endif
+-
+-/* Internal macros */
+-
+-#define _F_START(f) (0 ? f)
+-#define _F_END(f) (1 ? f)
+-#define _F_SIZE(f) (1 + _F_END(f) - _F_START(f))
+-#define _F_MASK(f) (((1ULL << _F_SIZE(f)) - 1) << _F_START(f))
+-#define _F_NORMALIZE(v, f) (((v) & _F_MASK(f)) >> _F_START(f))
+-#define _F_DENORMALIZE(v, f) (((v) << _F_START(f)) & _F_MASK(f))
+-
+-/* Global macros */
+-
+-#define FIELD_GET(x, reg, field) \
+-( \
+- _F_NORMALIZE((x), reg ## _ ## field) \
+-)
+-
+-#define FIELD_SET(x, reg, field, value) \
+-( \
+- (x & ~_F_MASK(reg ## _ ## field)) \
+- | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \
+-)
+-
+-#define FIELD_VALUE(x, reg, field, value) \
+-( \
+- (x & ~_F_MASK(reg ## _ ## field)) \
+- | _F_DENORMALIZE(value, reg ## _ ## field) \
+-)
+-
+-#define FIELD_CLEAR(reg, field) \
+-( \
+- ~_F_MASK(reg ## _ ## field) \
+-)
+-
+-/* Field Macros */
+-
+-#define FIELD_START(field) (0 ? field)
+-#define FIELD_END(field) (1 ? field)
+-#define FIELD_SIZE(field) \
+- (1 + FIELD_END(field) - FIELD_START(field))
+-
+-#define FIELD_MASK(field) \
+- (((1 << (FIELD_SIZE(field)-1)) \
+- | ((1 << (FIELD_SIZE(field)-1)) - 1)) \
+- << FIELD_START(field))
+-
+-#define FIELD_NORMALIZE(reg, field) \
+- (((reg) & FIELD_MASK(field)) >> FIELD_START(field))
+-
+-#define FIELD_DENORMALIZE(field, value) \
+- (((value) << FIELD_START(field)) & FIELD_MASK(field))
+-
+-#define FIELD_INIT(reg, field, value) \
+- FIELD_DENORMALIZE(reg ## _ ## field, \
+- reg ## _ ## field ## _ ## value)
+-
+-#define FIELD_INIT_VAL(reg, field, value) \
+- (FIELD_DENORMALIZE(reg ## _ ## field, value))
+-
+-#define FIELD_VAL_SET(x, r, f, v) ({ \
+- x = (x & ~FIELD_MASK(r ## _ ## f)) \
+- | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) \
+-})
+-
+-#define RGB(r, g, b) ((unsigned long)(((r) << 16) | ((g) << 8) | (b)))
+-
+-/* Transparent info definition */
+-typedef struct {
+- unsigned long match; /* Matching pixel is OPAQUE/TRANSPARENT */
+- unsigned long select; /* Transparency controlled by SRC/DST */
+- unsigned long control; /* ENABLE/DISABLE transparency */
+- unsigned long color; /* Transparent color */
+-} Transparent, *pTransparent;
+-
+-#define PIXEL_DEPTH_1_BP 0 /* 1 bit per pixel */
+-#define PIXEL_DEPTH_8_BPP 1 /* 8 bits per pixel */
+-#define PIXEL_DEPTH_16_BPP 2 /* 16 bits per pixel */
+-#define PIXEL_DEPTH_32_BPP 3 /* 32 bits per pixel */
+-#define PIXEL_DEPTH_YUV422 8 /* 16 bits per pixel YUV422 */
+-#define PIXEL_DEPTH_YUV420 9 /* 16 bits per pixel YUV420 */
+-
+-#define PATTERN_WIDTH 8
+-#define PATTERN_HEIGHT 8
+-
+-#define TOP_TO_BOTTOM 0
+-#define BOTTOM_TO_TOP 1
+-#define RIGHT_TO_LEFT BOTTOM_TO_TOP
+-#define LEFT_TO_RIGHT TOP_TO_BOTTOM
+-
+-/* Constants used in Transparent structure */
+-#define MATCH_OPAQUE 0x00000000
+-#define MATCH_TRANSPARENT 0x00000400
+-#define SOURCE 0x00000000
+-#define DESTINATION 0x00000200
+-
+-/* 2D registers. */
+-
+-#define DE_SOURCE 0x000000
+-#define DE_SOURCE_WRAP 31 : 31
+-#define DE_SOURCE_WRAP_DISABLE 0
+-#define DE_SOURCE_WRAP_ENABLE 1
+-#define DE_SOURCE_X_K1 29 : 16
+-#define DE_SOURCE_Y_K2 15 : 0
+-
+-#define DE_DESTINATION 0x000004
+-#define DE_DESTINATION_WRAP 31 : 31
+-#define DE_DESTINATION_WRAP_DISABLE 0
+-#define DE_DESTINATION_WRAP_ENABLE 1
+-#define DE_DESTINATION_X 28 : 16
+-#define DE_DESTINATION_Y 15 : 0
+-
+-#define DE_DIMENSION 0x000008
+-#define DE_DIMENSION_X 28 : 16
+-#define DE_DIMENSION_Y_ET 15 : 0
+-
+-#define DE_CONTROL 0x00000C
+-#define DE_CONTROL_STATUS 31 : 31
+-#define DE_CONTROL_STATUS_STOP 0
+-#define DE_CONTROL_STATUS_START 1
+-#define DE_CONTROL_PATTERN 30 : 30
+-#define DE_CONTROL_PATTERN_MONO 0
+-#define DE_CONTROL_PATTERN_COLOR 1
+-#define DE_CONTROL_UPDATE_DESTINATION_X 29 : 29
+-#define DE_CONTROL_UPDATE_DESTINATION_X_DISABLE 0
+-#define DE_CONTROL_UPDATE_DESTINATION_X_ENABLE 1
+-#define DE_CONTROL_QUICK_START 28 : 28
+-#define DE_CONTROL_QUICK_START_DISABLE 0
+-#define DE_CONTROL_QUICK_START_ENABLE 1
+-#define DE_CONTROL_DIRECTION 27 : 27
+-#define DE_CONTROL_DIRECTION_LEFT_TO_RIGHT 0
+-#define DE_CONTROL_DIRECTION_RIGHT_TO_LEFT 1
+-#define DE_CONTROL_MAJOR 26 : 26
+-#define DE_CONTROL_MAJOR_X 0
+-#define DE_CONTROL_MAJOR_Y 1
+-#define DE_CONTROL_STEP_X 25 : 25
+-#define DE_CONTROL_STEP_X_POSITIVE 1
+-#define DE_CONTROL_STEP_X_NEGATIVE 0
+-#define DE_CONTROL_STEP_Y 24 : 24
+-#define DE_CONTROL_STEP_Y_POSITIVE 1
+-#define DE_CONTROL_STEP_Y_NEGATIVE 0
+-#define DE_CONTROL_STRETCH 23 : 23
+-#define DE_CONTROL_STRETCH_DISABLE 0
+-#define DE_CONTROL_STRETCH_ENABLE 1
+-#define DE_CONTROL_HOST 22 : 22
+-#define DE_CONTROL_HOST_COLOR 0
+-#define DE_CONTROL_HOST_MONO 1
+-#define DE_CONTROL_LAST_PIXEL 21 : 21
+-#define DE_CONTROL_LAST_PIXEL_OFF 0
+-#define DE_CONTROL_LAST_PIXEL_ON 1
+-#define DE_CONTROL_COMMAND 20 : 16
+-#define DE_CONTROL_COMMAND_BITBLT 0
+-#define DE_CONTROL_COMMAND_RECTANGLE_FILL 1
+-#define DE_CONTROL_COMMAND_DE_TILE 2
+-#define DE_CONTROL_COMMAND_TRAPEZOID_FILL 3
+-#define DE_CONTROL_COMMAND_ALPHA_BLEND 4
+-#define DE_CONTROL_COMMAND_RLE_STRIP 5
+-#define DE_CONTROL_COMMAND_SHORT_STROKE 6
+-#define DE_CONTROL_COMMAND_LINE_DRAW 7
+-#define DE_CONTROL_COMMAND_HOST_WRITE 8
+-#define DE_CONTROL_COMMAND_HOST_READ 9
+-#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP 10
+-#define DE_CONTROL_COMMAND_ROTATE 11
+-#define DE_CONTROL_COMMAND_FONT 12
+-#define DE_CONTROL_COMMAND_TEXTURE_LOAD 15
+-#define DE_CONTROL_ROP_SELECT 15 : 15
+-#define DE_CONTROL_ROP_SELECT_ROP3 0
+-#define DE_CONTROL_ROP_SELECT_ROP2 1
+-#define DE_CONTROL_ROP2_SOURCE 14 : 14
+-#define DE_CONTROL_ROP2_SOURCE_BITMAP 0
+-#define DE_CONTROL_ROP2_SOURCE_PATTERN 1
+-#define DE_CONTROL_MONO_DATA 13 : 12
+-#define DE_CONTROL_MONO_DATA_NOT_PACKED 0
+-#define DE_CONTROL_MONO_DATA_8_PACKED 1
+-#define DE_CONTROL_MONO_DATA_16_PACKED 2
+-#define DE_CONTROL_MONO_DATA_32_PACKED 3
+-#define DE_CONTROL_REPEAT_ROTATE 11 : 11
+-#define DE_CONTROL_REPEAT_ROTATE_DISABLE 0
+-#define DE_CONTROL_REPEAT_ROTATE_ENABLE 1
+-#define DE_CONTROL_TRANSPARENCY_MATCH 10 : 10
+-#define DE_CONTROL_TRANSPARENCY_MATCH_OPAQUE 0
+-#define DE_CONTROL_TRANSPARENCY_MATCH_TRANSPARENT 1
+-#define DE_CONTROL_TRANSPARENCY_SELECT 9 : 9
+-#define DE_CONTROL_TRANSPARENCY_SELECT_SOURCE 0
+-#define DE_CONTROL_TRANSPARENCY_SELECT_DESTINATION 1
+-#define DE_CONTROL_TRANSPARENCY 8 : 8
+-#define DE_CONTROL_TRANSPARENCY_DISABLE 0
+-#define DE_CONTROL_TRANSPARENCY_ENABLE 1
+-#define DE_CONTROL_ROP 7 : 0
+-
+-/* Pseudo fields. */
+-
+-#define DE_CONTROL_SHORT_STROKE_DIR 27 : 24
+-#define DE_CONTROL_SHORT_STROKE_DIR_225 0
+-#define DE_CONTROL_SHORT_STROKE_DIR_135 1
+-#define DE_CONTROL_SHORT_STROKE_DIR_315 2
+-#define DE_CONTROL_SHORT_STROKE_DIR_45 3
+-#define DE_CONTROL_SHORT_STROKE_DIR_270 4
+-#define DE_CONTROL_SHORT_STROKE_DIR_90 5
+-#define DE_CONTROL_SHORT_STROKE_DIR_180 8
+-#define DE_CONTROL_SHORT_STROKE_DIR_0 10
+-#define DE_CONTROL_ROTATION 25 : 24
+-#define DE_CONTROL_ROTATION_0 0
+-#define DE_CONTROL_ROTATION_270 1
+-#define DE_CONTROL_ROTATION_90 2
+-#define DE_CONTROL_ROTATION_180 3
+-
+-#define DE_PITCH 0x000010
+-#define DE_PITCH_DESTINATION 28 : 16
+-#define DE_PITCH_SOURCE 12 : 0
+-
+-#define DE_FOREGROUND 0x000014
+-#define DE_FOREGROUND_COLOR 31 : 0
+-
+-#define DE_BACKGROUND 0x000018
+-#define DE_BACKGROUND_COLOR 31 : 0
+-
+-#define DE_STRETCH_FORMAT 0x00001C
+-#define DE_STRETCH_FORMAT_PATTERN_XY 30 : 30
+-#define DE_STRETCH_FORMAT_PATTERN_XY_NORMAL 0
+-#define DE_STRETCH_FORMAT_PATTERN_XY_OVERWRITE 1
+-#define DE_STRETCH_FORMAT_PATTERN_Y 29 : 27
+-#define DE_STRETCH_FORMAT_PATTERN_X 25 : 23
+-#define DE_STRETCH_FORMAT_PIXEL_FORMAT 21 : 20
+-#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8 0
+-#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16 1
+-#define DE_STRETCH_FORMAT_PIXEL_FORMAT_24 3
+-#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32 2
+-#define DE_STRETCH_FORMAT_ADDRESSING 19 : 16
+-#define DE_STRETCH_FORMAT_ADDRESSING_XY 0
+-#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR 15
+-#define DE_STRETCH_FORMAT_SOURCE_HEIGHT 11 : 0
+-
+-#define DE_COLOR_COMPARE 0x000020
+-#define DE_COLOR_COMPARE_COLOR 23 : 0
+-
+-#define DE_COLOR_COMPARE_MASK 0x000024
+-#define DE_COLOR_COMPARE_MASK_MASKS 23 : 0
+-
+-#define DE_MASKS 0x000028
+-#define DE_MASKS_BYTE_MASK 31 : 16
+-#define DE_MASKS_BIT_MASK 15 : 0
+-
+-#define DE_CLIP_TL 0x00002C
+-#define DE_CLIP_TL_TOP 31 : 16
+-#define DE_CLIP_TL_STATUS 13 : 13
+-#define DE_CLIP_TL_STATUS_DISABLE 0
+-#define DE_CLIP_TL_STATUS_ENABLE 1
+-#define DE_CLIP_TL_INHIBIT 12 : 12
+-#define DE_CLIP_TL_INHIBIT_OUTSIDE 0
+-#define DE_CLIP_TL_INHIBIT_INSIDE 1
+-#define DE_CLIP_TL_LEFT 11 : 0
+-
+-#define DE_CLIP_BR 0x000030
+-#define DE_CLIP_BR_BOTTOM 31 : 16
+-#define DE_CLIP_BR_RIGHT 12 : 0
+-
+-#define DE_MONO_PATTERN_LOW 0x000034
+-#define DE_MONO_PATTERN_LOW_PATTERN 31 : 0
+-
+-#define DE_MONO_PATTERN_HIGH 0x000038
+-#define DE_MONO_PATTERN_HIGH_PATTERN 31 : 0
+-
+-#define DE_WINDOW_WIDTH 0x00003C
+-#define DE_WINDOW_WIDTH_DESTINATION 28 : 16
+-#define DE_WINDOW_WIDTH_SOURCE 12 : 0
+-
+-#define DE_WINDOW_SOURCE_BASE 0x000040
+-#define DE_WINDOW_SOURCE_BASE_EXT 27 : 27
+-#define DE_WINDOW_SOURCE_BASE_EXT_LOCAL 0
+-#define DE_WINDOW_SOURCE_BASE_EXT_EXTERNAL 1
+-#define DE_WINDOW_SOURCE_BASE_CS 26 : 26
+-#define DE_WINDOW_SOURCE_BASE_CS_0 0
+-#define DE_WINDOW_SOURCE_BASE_CS_1 1
+-#define DE_WINDOW_SOURCE_BASE_ADDRESS 25 : 0
+-
+-#define DE_WINDOW_DESTINATION_BASE 0x000044
+-#define DE_WINDOW_DESTINATION_BASE_EXT 27 : 27
+-#define DE_WINDOW_DESTINATION_BASE_EXT_LOCAL 0
+-#define DE_WINDOW_DESTINATION_BASE_EXT_EXTERNAL 1
+-#define DE_WINDOW_DESTINATION_BASE_CS 26 : 26
+-#define DE_WINDOW_DESTINATION_BASE_CS_0 0
+-#define DE_WINDOW_DESTINATION_BASE_CS_1 1
+-#define DE_WINDOW_DESTINATION_BASE_ADDRESS 25 : 0
+-
+-#define DE_ALPHA 0x000048
+-#define DE_ALPHA_VALUE 7 : 0
+-
+-#define DE_WRAP 0x00004C
+-#define DE_WRAP_X 31 : 16
+-#define DE_WRAP_Y 15 : 0
+-
+-#define DE_STATUS 0x000050
+-#define DE_STATUS_CSC 1 : 1
+-#define DE_STATUS_CSC_CLEAR 0
+-#define DE_STATUS_CSC_NOT_ACTIVE 0
+-#define DE_STATUS_CSC_ACTIVE 1
+-#define DE_STATUS_2D 0 : 0
+-#define DE_STATUS_2D_CLEAR 0
+-#define DE_STATUS_2D_NOT_ACTIVE 0
+-#define DE_STATUS_2D_ACTIVE 1
+-
+-/* Color Space Conversion registers. */
+-
+-#define CSC_Y_SOURCE_BASE 0x0000C8
+-#define CSC_Y_SOURCE_BASE_EXT 27 : 27
+-#define CSC_Y_SOURCE_BASE_EXT_LOCAL 0
+-#define CSC_Y_SOURCE_BASE_EXT_EXTERNAL 1
+-#define CSC_Y_SOURCE_BASE_CS 26 : 26
+-#define CSC_Y_SOURCE_BASE_CS_0 0
+-#define CSC_Y_SOURCE_BASE_CS_1 1
+-#define CSC_Y_SOURCE_BASE_ADDRESS 25 : 0
+-
+-#define CSC_CONSTANTS 0x0000CC
+-#define CSC_CONSTANTS_Y 31 : 24
+-#define CSC_CONSTANTS_R 23 : 16
+-#define CSC_CONSTANTS_G 15 : 8
+-#define CSC_CONSTANTS_B 7 : 0
+-
+-#define CSC_Y_SOURCE_X 0x0000D0
+-#define CSC_Y_SOURCE_X_INTEGER 26 : 16
+-#define CSC_Y_SOURCE_X_FRACTION 15 : 3
+-
+-#define CSC_Y_SOURCE_Y 0x0000D4
+-#define CSC_Y_SOURCE_Y_INTEGER 27 : 16
+-#define CSC_Y_SOURCE_Y_FRACTION 15 : 3
+-
+-#define CSC_U_SOURCE_BASE 0x0000D8
+-#define CSC_U_SOURCE_BASE_EXT 27 : 27
+-#define CSC_U_SOURCE_BASE_EXT_LOCAL 0
+-#define CSC_U_SOURCE_BASE_EXT_EXTERNAL 1
+-#define CSC_U_SOURCE_BASE_CS 26 : 26
+-#define CSC_U_SOURCE_BASE_CS_0 0
+-#define CSC_U_SOURCE_BASE_CS_1 1
+-#define CSC_U_SOURCE_BASE_ADDRESS 25 : 0
+-
+-#define CSC_V_SOURCE_BASE 0x0000DC
+-#define CSC_V_SOURCE_BASE_EXT 27 : 27
+-#define CSC_V_SOURCE_BASE_EXT_LOCAL 0
+-#define CSC_V_SOURCE_BASE_EXT_EXTERNAL 1
+-#define CSC_V_SOURCE_BASE_CS 26 : 26
+-#define CSC_V_SOURCE_BASE_CS_0 0
+-#define CSC_V_SOURCE_BASE_CS_1 1
+-#define CSC_V_SOURCE_BASE_ADDRESS 25 : 0
+-
+-#define CSC_SOURCE_DIMENSION 0x0000E0
+-#define CSC_SOURCE_DIMENSION_X 31 : 16
+-#define CSC_SOURCE_DIMENSION_Y 15 : 0
+-
+-#define CSC_SOURCE_PITCH 0x0000E4
+-#define CSC_SOURCE_PITCH_Y 31 : 16
+-#define CSC_SOURCE_PITCH_UV 15 : 0
+-
+-#define CSC_DESTINATION 0x0000E8
+-#define CSC_DESTINATION_WRAP 31 : 31
+-#define CSC_DESTINATION_WRAP_DISABLE 0
+-#define CSC_DESTINATION_WRAP_ENABLE 1
+-#define CSC_DESTINATION_X 27 : 16
+-#define CSC_DESTINATION_Y 11 : 0
+-
+-#define CSC_DESTINATION_DIMENSION 0x0000EC
+-#define CSC_DESTINATION_DIMENSION_X 31 : 16
+-#define CSC_DESTINATION_DIMENSION_Y 15 : 0
+-
+-#define CSC_DESTINATION_PITCH 0x0000F0
+-#define CSC_DESTINATION_PITCH_X 31 : 16
+-#define CSC_DESTINATION_PITCH_Y 15 : 0
+-
+-#define CSC_SCALE_FACTOR 0x0000F4
+-#define CSC_SCALE_FACTOR_HORIZONTAL 31 : 16
+-#define CSC_SCALE_FACTOR_VERTICAL 15 : 0
+-
+-#define CSC_DESTINATION_BASE 0x0000F8
+-#define CSC_DESTINATION_BASE_EXT 27 : 27
+-#define CSC_DESTINATION_BASE_EXT_LOCAL 0
+-#define CSC_DESTINATION_BASE_EXT_EXTERNAL 1
+-#define CSC_DESTINATION_BASE_CS 26 : 26
+-#define CSC_DESTINATION_BASE_CS_0 0
+-#define CSC_DESTINATION_BASE_CS_1 1
+-#define CSC_DESTINATION_BASE_ADDRESS 25 : 0
+-
+-#define CSC_CONTROL 0x0000FC
+-#define CSC_CONTROL_STATUS 31 : 31
+-#define CSC_CONTROL_STATUS_STOP 0
+-#define CSC_CONTROL_STATUS_START 1
+-#define CSC_CONTROL_SOURCE_FORMAT 30 : 28
+-#define CSC_CONTROL_SOURCE_FORMAT_YUV422 0
+-#define CSC_CONTROL_SOURCE_FORMAT_YUV420I 1
+-#define CSC_CONTROL_SOURCE_FORMAT_YUV420 2
+-#define CSC_CONTROL_SOURCE_FORMAT_YVU9 3
+-#define CSC_CONTROL_SOURCE_FORMAT_IYU1 4
+-#define CSC_CONTROL_SOURCE_FORMAT_IYU2 5
+-#define CSC_CONTROL_SOURCE_FORMAT_RGB565 6
+-#define CSC_CONTROL_SOURCE_FORMAT_RGB8888 7
+-#define CSC_CONTROL_DESTINATION_FORMAT 27 : 26
+-#define CSC_CONTROL_DESTINATION_FORMAT_RGB565 0
+-#define CSC_CONTROL_DESTINATION_FORMAT_RGB8888 1
+-#define CSC_CONTROL_HORIZONTAL_FILTER 25 : 25
+-#define CSC_CONTROL_HORIZONTAL_FILTER_DISABLE 0
+-#define CSC_CONTROL_HORIZONTAL_FILTER_ENABLE 1
+-#define CSC_CONTROL_VERTICAL_FILTER 24 : 24
+-#define CSC_CONTROL_VERTICAL_FILTER_DISABLE 0
+-#define CSC_CONTROL_VERTICAL_FILTER_ENABLE 1
+-#define CSC_CONTROL_BYTE_ORDER 23 : 23
+-#define CSC_CONTROL_BYTE_ORDER_YUYV 0
+-#define CSC_CONTROL_BYTE_ORDER_UYVY 1
+-
+-#define DE_DATA_PORT_501 0x110000
+-#define DE_DATA_PORT_712 0x400000
+-#define DE_DATA_PORT_722 0x6000
+-
+-/* point to virtual Memory Map IO starting address */
+-extern char *smtc_RegBaseAddress;
+-/* point to virtual video memory starting address */
+-extern char *smtc_VRAMBaseAddress;
+-extern unsigned char smtc_de_busy;
+-
+-extern unsigned long memRead32(unsigned long nOffset);
+-extern void memWrite32(unsigned long nOffset, unsigned long nData);
+-extern unsigned long SMTC_read2Dreg(unsigned long nOffset);
+-
+-/* 2D functions */
+-extern void deInit(unsigned int nModeWidth, unsigned int nModeHeight,
+- unsigned int bpp);
+-
+-extern void deWaitForNotBusy(void);
+-
+-extern void deVerticalLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX,
+- unsigned long nY,
+- unsigned long dst_height,
+- unsigned long nColor);
+-
+-extern void deHorizontalLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX,
+- unsigned long nY,
+- unsigned long dst_width,
+- unsigned long nColor);
+-
+-extern void deLine(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long nX1,
+- unsigned long nY1,
+- unsigned long nX2,
+- unsigned long nY2,
+- unsigned long nColor);
+-
+-extern void deFillRect(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long dst_X,
+- unsigned long dst_Y,
+- unsigned long dst_width,
+- unsigned long dst_height,
+- unsigned long nColor);
+-
+-extern void deRotatePattern(unsigned char *pattern_dstaddr,
+- unsigned long pattern_src_addr,
+- unsigned long pattern_BPP,
+- unsigned long pattern_stride,
+- int patternX,
+- int patternY);
+-
+-extern void deCopy(unsigned long dst_base,
+- unsigned long dst_pitch,
+- unsigned long dst_BPP,
+- unsigned long dst_X,
+- unsigned long dst_Y,
+- unsigned long dst_width,
+- unsigned long dst_height,
+- unsigned long src_base,
+- unsigned long src_pitch,
+- unsigned long src_X,
+- unsigned long src_Y,
+- pTransparent pTransp,
+- unsigned char nROP2);
+-
+-/*
+- * System memory to Video memory monochrome expansion.
+- *
+- * Source is monochrome image in system memory. This function expands the
+- * monochrome data to color image in video memory.
+- *
+- * @pSrcbuf: pointer to start of source buffer in system memory
+- * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top
+- * down and -ive mean button up
+- * @startBit: Mono data can start at any bit in a byte, this value should
+- * be 0 to 7
+- * @dBase: Address of destination : offset in frame buffer
+- * @dPitch: Pitch value of destination surface in BYTE
+- * @bpp: Color depth of destination surface
+- * @dx, dy: Starting coordinate of destination surface
+- * @width, height: width and height of rectange in pixel value
+- * @fColor,bColor: Foreground, Background color (corresponding to a 1, 0 in
+- * the monochrome data)
+- * @rop2: ROP value
+- */
+-
+-extern long deSystemMem2VideoMemMonoBlt(
+- const char *pSrcbuf,
+- long srcDelta,
+- unsigned long startBit,
+- unsigned long dBase,
+- unsigned long dPitch,
+- unsigned long bpp,
+- unsigned long dx, unsigned long dy,
+- unsigned long width, unsigned long height,
+- unsigned long fColor,
+- unsigned long bColor,
+- unsigned long rop2);
+-
+-extern unsigned long deGetTransparency(void);
+-extern void deSetPixelFormat(unsigned long bpp);
+--- a/drivers/staging/sm7xx/smtcfb.c
++++ b/drivers/staging/sm7xx/smtcfb.c
+@@ -45,7 +45,6 @@
+ struct screen_info smtc_screen_info;
+
+ #include "smtcfb.h"
+-#include "smtc2d.h"
+
+ #ifdef DEBUG
+ #define smdbg(format, arg...) printk(KERN_DEBUG format , ## arg)
+@@ -120,10 +119,6 @@ static struct vesa_mode_table vesa_mode[
+ char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */
+ char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */
+
+-char *smtc_2DBaseAddress; /* 2D engine starting address */
+-char *smtc_2Ddataport; /* 2D data port offset */
+-short smtc_2Dacceleration;
+-
+ static u32 colreg[17];
+ static struct par_info hw; /* hardware information */
+
+@@ -135,16 +130,6 @@ u16 smtc_ChipIDs[] = {
+
+ #define numSMTCchipIDs (sizeof(smtc_ChipIDs) / sizeof(u16))
+
+-void deWaitForNotBusy(void)
+-{
+- unsigned long i = 0x1000000;
+- while (i--) {
+- if ((smtc_seqr(0x16) & 0x18) == 0x10)
+- break;
+- }
+- smtc_de_busy = 0;
+-}
+-
+ static void sm712_set_timing(struct smtcfb_info *sfb,
+ struct par_info *ppar_info)
+ {
+@@ -324,7 +309,7 @@ static inline unsigned int chan_to_field
+ return chan << bf->offset;
+ }
+
+-static int smtcfb_blank(int blank_mode, struct fb_info *info)
++static int cfb_blank(int blank_mode, struct fb_info *info)
+ {
+ /* clear DPMS setting */
+ switch (blank_mode) {
+@@ -622,93 +607,13 @@ smtcfb_write(struct fb_info *info, const
+ }
+ #endif /* ! __BIG_ENDIAN */
+
+-#include "smtc2d.c"
+-
+-void smtcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
+-{
+- struct par_info *p = (struct par_info *)info->par;
+-
+- if (smtc_2Dacceleration) {
+- if (!area->width || !area->height)
+- return;
+-
+- deCopy(p->BaseAddressInVRAM, 0, info->var.bits_per_pixel,
+- area->dx, area->dy, area->width, area->height,
+- p->BaseAddressInVRAM, 0, area->sx, area->sy, 0, 0xC);
+-
+- } else
+- cfb_copyarea(info, area);
+-}
+-
+-void smtcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
+-{
+- struct par_info *p = (struct par_info *)info->par;
+-
+- if (smtc_2Dacceleration) {
+- if (!rect->width || !rect->height)
+- return;
+- if (info->var.bits_per_pixel >= 24)
+- deFillRect(p->BaseAddressInVRAM, 0, rect->dx * 3,
+- rect->dy * 3, rect->width * 3, rect->height,
+- rect->color);
+- else
+- deFillRect(p->BaseAddressInVRAM, 0, rect->dx, rect->dy,
+- rect->width, rect->height, rect->color);
+- } else
+- cfb_fillrect(info, rect);
+-}
+-
+-void smtcfb_imageblit(struct fb_info *info, const struct fb_image *image)
+-{
+- struct par_info *p = (struct par_info *)info->par;
+- u32 bg_col = 0, fg_col = 0;
+-
+- if ((smtc_2Dacceleration) && (image->depth == 1)) {
+- if (smtc_de_busy)
+- deWaitForNotBusy();
+-
+- switch (info->var.bits_per_pixel) {
+- case 8:
+- bg_col = image->bg_color;
+- fg_col = image->fg_color;
+- break;
+- case 16:
+- bg_col =
+- ((u32 *) (info->pseudo_palette))[image->bg_color];
+- fg_col =
+- ((u32 *) (info->pseudo_palette))[image->fg_color];
+- break;
+- case 32:
+- bg_col =
+- ((u32 *) (info->pseudo_palette))[image->bg_color];
+- fg_col =
+- ((u32 *) (info->pseudo_palette))[image->fg_color];
+- break;
+- }
+-
+- deSystemMem2VideoMemMonoBlt(
+- image->data,
+- image->width / 8,
+- 0,
+- p->BaseAddressInVRAM,
+- 0,
+- 0,
+- image->dx, image->dy,
+- image->width, image->height,
+- fg_col, bg_col,
+- 0x0C);
+-
+- } else
+- cfb_imageblit(info, image);
+-}
+-
+ static struct fb_ops smtcfb_ops = {
+ .owner = THIS_MODULE,
+ .fb_setcolreg = smtc_setcolreg,
+- .fb_blank = smtcfb_blank,
+- .fb_fillrect = smtcfb_fillrect,
+- .fb_imageblit = smtcfb_imageblit,
+- .fb_copyarea = smtcfb_copyarea,
++ .fb_blank = cfb_blank,
++ .fb_fillrect = cfb_fillrect,
++ .fb_imageblit = cfb_imageblit,
++ .fb_copyarea = cfb_copyarea,
+ #ifdef __BIG_ENDIAN
+ .fb_read = smtcfb_read,
+ .fb_write = smtcfb_write,
+@@ -772,12 +677,6 @@ void smtcfb_setmode(struct smtcfb_info *
+ hw.height = sfb->fb.var.yres;
+ hw.hz = 60;
+ smtc_set_timing(sfb, &hw);
+- if (smtc_2Dacceleration) {
+- printk("2D acceleration enabled!\n");
+- /* Init smtc drawing engine */
+- deInit(sfb->fb.var.xres, sfb->fb.var.yres,
+- sfb->fb.var.bits_per_pixel);
+- }
+ }
+
+ /*
+@@ -1004,9 +903,7 @@ static int __init smtcfb_pci_probe(struc
+ #endif
+ hw.m_pMMIO = (smtc_RegBaseAddress =
+ smtc_VRAMBaseAddress + 0x00700000);
+- smtc_2DBaseAddress = (hw.m_pDPR =
+- smtc_VRAMBaseAddress + 0x00408000);
+- smtc_2Ddataport = smtc_VRAMBaseAddress + DE_DATA_PORT_712;
++ hw.m_pDPR = smtc_VRAMBaseAddress + 0x00408000;
+ hw.m_pVPR = hw.m_pLFB + 0x0040c000;
+ #ifdef __BIG_ENDIAN
+ if (sfb->fb.var.bits_per_pixel == 32) {
+@@ -1035,27 +932,21 @@ static int __init smtcfb_pci_probe(struc
+ if (sfb->fb.var.bits_per_pixel == 32)
+ smtc_seqw(0x17, 0x30);
+ #endif
+-#ifdef CONFIG_FB_SM7XX_ACCEL
+- smtc_2Dacceleration = 1;
+-#endif
+ break;
+ case 0x720:
+ sfb->fb.fix.mmio_start = pFramebufferPhysical;
+ sfb->fb.fix.mmio_len = 0x00200000;
+ smem_size = SM722_VIDEOMEMORYSIZE;
+- smtc_2DBaseAddress = (hw.m_pDPR =
+- ioremap(pFramebufferPhysical, 0x00a00000));
++ hw.m_pDPR = ioremap(pFramebufferPhysical, 0x00a00000);
+ hw.m_pLFB = (smtc_VRAMBaseAddress =
+- smtc_2DBaseAddress + 0x00200000);
++ hw.m_pDPR + 0x00200000);
+ hw.m_pMMIO = (smtc_RegBaseAddress =
+- smtc_2DBaseAddress + 0x000c0000);
+- smtc_2Ddataport = smtc_2DBaseAddress + DE_DATA_PORT_722;
+- hw.m_pVPR = smtc_2DBaseAddress + 0x800;
++ hw.m_pDPR + 0x000c0000);
++ hw.m_pVPR = hw.m_pDPR + 0x800;
+
+ smtc_seqw(0x62, 0xff);
+ smtc_seqw(0x6a, 0x0d);
+ smtc_seqw(0x6b, 0x02);
+- smtc_2Dacceleration = 0;
+ break;
+ default:
+ printk(KERN_INFO
+--- a/drivers/staging/sm7xx/TODO
++++ b/drivers/staging/sm7xx/TODO
+@@ -1,5 +1,6 @@
+ TODO:
+ - Dual head support
++- 2D acceleration support
+ - use kernel coding style
+ - checkpatch.pl clean
+ - refine the code and remove unused code
diff --git a/tty.current/nozomi-quick-fix-for-the-close-close-bug.patch b/tty.current/nozomi-quick-fix-for-the-close-close-bug.patch
new file mode 100644
index 00000000000000..c74d3dbe8fd484
--- /dev/null
+++ b/tty.current/nozomi-quick-fix-for-the-close-close-bug.patch
@@ -0,0 +1,48 @@
+From alan@linux.intel.com Fri Jan 15 10:58:59 2010
+From: Alan Cox <alan@linux.intel.com>
+Date: Mon, 04 Jan 2010 16:26:50 +0000
+Subject: nozomi: quick fix for the close/close bug
+To: greg@kroah.com, linux-serial@vger.kernel.org
+Message-ID: <20100104162650.17194.17161.stgit@localhost.localdomain>
+
+
+Nozomi goes wrong if you get the sequence
+
+ open
+ open
+ close
+
+ [stuff]
+ close
+
+which turns out to occur on some ppp type setups.
+
+This is a quick patch up for the problem. It's not really fixing Nozomi
+which completely fails to implement tty open/close semantics and all the
+other needed stuff. Doing it right is a rather more invasive patch set and
+not one that will backport.
+
+
+
+Signed-off-by: Alan Cox <alan@linux.intel.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/char/nozomi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/char/nozomi.c
++++ b/drivers/char/nozomi.c
+@@ -1651,10 +1651,10 @@ static void ntty_close(struct tty_struct
+
+ dc->open_ttys--;
+ port->count--;
+- tty_port_tty_set(port, NULL);
+
+ if (port->count == 0) {
+ DBG1("close: %d", nport->token_dl);
++ tty_port_tty_set(port, NULL);
+ spin_lock_irqsave(&dc->spin_mutex, flags);
+ dc->last_ier &= ~(nport->token_dl);
+ writew(dc->last_ier, dc->reg_ier);
diff --git a/tty.current/serial-8250_pnp-add-a-new-fujitsu-wacom-tablet-pc-device.patch b/tty.current/serial-8250_pnp-add-a-new-fujitsu-wacom-tablet-pc-device.patch
new file mode 100644
index 00000000000000..c343d6f0bcf8da
--- /dev/null
+++ b/tty.current/serial-8250_pnp-add-a-new-fujitsu-wacom-tablet-pc-device.patch
@@ -0,0 +1,31 @@
+From pinglinux@gmail.com Fri Jan 15 11:03:03 2010
+From: Ping <pinglinux@gmail.com>
+Date: Thu, 7 Jan 2010 16:49:59 -0800
+Subject: serial/8250_pnp: Add a new Fujitsu Wacom Tablet PC device
+To: Andrew Morton <akpm@linux-foundation.org>
+Cc: alan@lxorguk.ukuu.org.uk, greg@kroah.com, jkosina@suse.cz, mjg59@srcf.ucam.org, mjg@redhat.com
+Message-ID: <167e8a331001071649l3d8df335w2b2422984bb245e8@mail.gmail.com>
+
+From: Ping Cheng <pingc@wacom.com>
+
+This is a new two finger touch Fujitsu Wacom Tablet PC
+
+Signed-off-by: Ping Cheng <pingc@wacom.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/8250_pnp.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/serial/8250_pnp.c
++++ b/drivers/serial/8250_pnp.c
+@@ -354,6 +354,8 @@ static const struct pnp_device_id pnp_de
+ { "FUJ02E5", 0 },
+ /* Fujitsu P-series tablet PC device */
+ { "FUJ02E6", 0 },
++ /* Fujitsu Wacom 2FGT Tablet PC device */
++ { "FUJ02E7", 0 },
+ /*
+ * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
+ * disguise)
diff --git a/tty.current/serial-fix-crash-if-the-minimum-rate-of-the-device-is-9600-baud.patch b/tty.current/serial-fix-crash-if-the-minimum-rate-of-the-device-is-9600-baud.patch
new file mode 100644
index 00000000000000..d9bb6be0a7ad95
--- /dev/null
+++ b/tty.current/serial-fix-crash-if-the-minimum-rate-of-the-device-is-9600-baud.patch
@@ -0,0 +1,49 @@
+From alan@linux.intel.com Fri Jan 15 10:58:40 2010
+From: Alan Cox <alan@linux.intel.com>
+Date: Mon, 04 Jan 2010 16:26:21 +0000
+Subject: serial: Fix crash if the minimum rate of the device is > 9600 baud
+To: greg@kroah.com, linux-serial@vger.kernel.org
+Message-ID: <20100104162557.17151.23761.stgit@localhost.localdomain>
+
+
+In that situation if the old rate is invalid and the new rate is invalid
+and the chip cannot do 9600 baud we report zero, which makes all the
+drivers explode.
+
+Instead force the rate based on min/max
+
+Signed-off-by: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/serial_core.c | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+--- a/drivers/serial/serial_core.c
++++ b/drivers/serial/serial_core.c
+@@ -385,13 +385,20 @@ uart_get_baud_rate(struct uart_port *por
+ }
+
+ /*
+- * As a last resort, if the quotient is zero,
+- * default to 9600 bps
++ * As a last resort, if the range cannot be met then clip to
++ * the nearest chip supported rate.
+ */
+- if (!hung_up)
+- tty_termios_encode_baud_rate(termios, 9600, 9600);
++ if (!hung_up) {
++ if (baud <= min)
++ tty_termios_encode_baud_rate(termios,
++ min + 1, min + 1);
++ else
++ tty_termios_encode_baud_rate(termios,
++ max - 1, max - 1);
++ }
+ }
+-
++ /* Should never happen */
++ WARN_ON(1);
+ return 0;
+ }
+
diff --git a/usb.current/usb-fix-usbstorage-for-2770-915d-delivers-no-fat.patch b/usb.current/usb-fix-usbstorage-for-2770-915d-delivers-no-fat.patch
new file mode 100644
index 00000000000000..4ae9e38c6c151b
--- /dev/null
+++ b/usb.current/usb-fix-usbstorage-for-2770-915d-delivers-no-fat.patch
@@ -0,0 +1,53 @@
+From rmay31@gmail.com Fri Jan 15 11:01:41 2010
+From: Ryan May <rmay31@gmail.com>
+Date: Wed, 6 Jan 2010 10:09:25 -0600
+Subject: USB: fix usbstorage for 2770:915d delivers no FAT
+To: Andrew Morton <akpm@linux-foundation.org>
+Cc: arne_woerner <arne_woerner@yahoo.com>, bugzilla-daemon <bugzilla-daemon@bugzilla.kernel.org>, bugme-daemon <bugme-daemon@bugzilla.kernel.org>, linux-usb <linux-usb@vger.kernel.org>, "rohan.hart17" <rohan.hart17@gmail.com>
+Message-ID: <c7b95a021001060809m5ef61e2eh7387001b32a31cd4@mail.gmail.com>
+
+
+From: Ryan May <rmay31@gmail.com>
+
+Resolves kernel.org bug 14914.
+
+Remove entry for 2770:915d (usb digital camera with mass storage
+support) from unusual_devs.h. The fix triggered by the entry causes
+the file system on the camera to be completely inaccessible (no
+partition table, the device is not mountable).
+
+The patch works, but let me clarify a few things about it. All the
+patch does is remove the entry for this device from the
+drivers/usb/storage/unusual_devs.h, which is supposed to help with a
+problem with the device's reported size (I think). I'm pretty sure it
+was originally added for a reason, so I'm not sure removing it won't
+cause other problems to reappear. Also, I should note that this
+unusual_devs.h entry was present (and activating workarounds) in
+2.6.29, but in that version everything works fine. Starting with
+2.6.30, things no longer work.
+
+Signed-off-by: Ryan May <rmay31@gmail.com>
+Cc: Rohan Hart <rohan.hart17@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/storage/unusual_devs.h | 7 -------
+ 1 file changed, 7 deletions(-)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1807,13 +1807,6 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_GO_SLOW ),
+
+-/* Reported by Rohan Hart <rohan.hart17@gmail.com> */
+-UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010,
+- "INTOVA",
+- "Pixtreme",
+- US_SC_DEVICE, US_PR_DEVICE, NULL,
+- US_FL_FIX_CAPACITY ),
+-
+ /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
+ * Mio Moov 330
+ */
diff --git a/usb/arm-defconfig-rx51-enable-phonet-and-g_nokia.patch b/usb/arm-defconfig-rx51-enable-phonet-and-g_nokia.patch
new file mode 100644
index 00000000000000..3abd84216522ab
--- /dev/null
+++ b/usb/arm-defconfig-rx51-enable-phonet-and-g_nokia.patch
@@ -0,0 +1,65 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:59:45 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Tue, 5 Jan 2010 16:10:14 +0200
+Subject: arm: defconfig: rx51: enable phonet and g_nokia
+To: linux-usb@vger.kernel.org
+Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>, Tony Lindgren <tony@atomide.com>, Greg KH <greg@kroah.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262700614-16438-2-git-send-email-felipe.balbi@nokia.com>
+
+
+trivial patch enabling g_nokia on rx51_defconfig.
+
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/arm/configs/rx51_defconfig | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/configs/rx51_defconfig
++++ b/arch/arm/configs/rx51_defconfig
+@@ -445,6 +445,8 @@ CONFIG_IP_NF_FILTER=m
+ # CONFIG_LAPB is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
++CONFIG_PHONET=y
++# CONFIG_IEEE802154 is not set
+ # CONFIG_NET_SCHED is not set
+ # CONFIG_DCB is not set
+
+@@ -1325,27 +1327,34 @@ CONFIG_USB_GADGET_SELECTED=y
+ # CONFIG_USB_GADGET_LH7A40X is not set
+ # CONFIG_USB_GADGET_OMAP is not set
+ # CONFIG_USB_GADGET_PXA25X is not set
++# CONFIG_USB_GADGET_R8A66597 is not set
+ # CONFIG_USB_GADGET_PXA27X is not set
+-# CONFIG_USB_GADGET_S3C2410 is not set
++# CONFIG_USB_GADGET_S3C_HSOTG is not set
+ # CONFIG_USB_GADGET_IMX is not set
++# CONFIG_USB_GADGET_S3C2410 is not set
+ # CONFIG_USB_GADGET_M66592 is not set
+ # CONFIG_USB_GADGET_AMD5536UDC is not set
+ # CONFIG_USB_GADGET_FSL_QE is not set
+ # CONFIG_USB_GADGET_CI13XXX is not set
+ # CONFIG_USB_GADGET_NET2280 is not set
+ # CONFIG_USB_GADGET_GOKU is not set
++# CONFIG_USB_GADGET_LANGWELL is not set
+ # CONFIG_USB_GADGET_DUMMY_HCD is not set
+ CONFIG_USB_GADGET_DUALSPEED=y
+ CONFIG_USB_ZERO=m
+ # CONFIG_USB_ZERO_HNPTEST is not set
++# CONFIG_USB_AUDIO is not set
+ # CONFIG_USB_ETH is not set
+ # CONFIG_USB_GADGETFS is not set
+ CONFIG_USB_FILE_STORAGE=m
+ # CONFIG_USB_FILE_STORAGE_TEST is not set
++# CONFIG_USB_MASS_STORAGE is not set
+ # CONFIG_USB_G_SERIAL is not set
+ # CONFIG_USB_MIDI_GADGET is not set
+ # CONFIG_USB_G_PRINTER is not set
+ # CONFIG_USB_CDC_COMPOSITE is not set
++CONFIG_USB_G_NOKIA=m
++# CONFIG_USB_G_MULTI is not set
+
+ #
+ # OTG and related infrastructure
diff --git a/usb/musb-add-extvbus-in-musb_hdrc_platform_data.patch b/usb/musb-add-extvbus-in-musb_hdrc_platform_data.patch
new file mode 100644
index 00000000000000..89751a9a87e2b9
--- /dev/null
+++ b/usb/musb-add-extvbus-in-musb_hdrc_platform_data.patch
@@ -0,0 +1,84 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:40:21 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:42 +0200
+Subject: usb: musb: Add 'extvbus' in musb_hdrc_platform_data
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Ajay Kumar Gupta <ajay.gupta@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-10-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Ajay Kumar Gupta <ajay.gupta@ti.com>
+
+Some of the board might use external Vbus power supply on musb
+interface which would require to program ULPI_BUSCONTROL register.
+
+Adding 'extvbus' flag which can be set from such boards which will
+be checked at musb driver files before programming ULPI_BUSCONTROL.
+
+Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musb_core.c | 8 ++++++++
+ drivers/usb/musb/musb_regs.h | 5 +++++
+ include/linux/usb/musb.h | 3 +++
+ 3 files changed, 16 insertions(+)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -2031,6 +2031,7 @@ bad_config:
+ /* host side needs more setup */
+ if (is_host_enabled(musb)) {
+ struct usb_hcd *hcd = musb_to_hcd(musb);
++ u8 busctl;
+
+ otg_set_host(musb->xceiv, &hcd->self);
+
+@@ -2038,6 +2039,13 @@ bad_config:
+ hcd->self.otg_port = 1;
+ musb->xceiv->host = &hcd->self;
+ hcd->power_budget = 2 * (plat->power ? : 250);
++
++ /* program PHY to use external vBus if required */
++ if (plat->extvbus) {
++ busctl = musb_readb(musb->mregs, MUSB_ULPI_BUSCONTROL);
++ busctl |= MUSB_ULPI_USE_EXTVBUS;
++ musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, busctl);
++ }
+ }
+
+ /* For the host-only role, we can activate right away.
+--- a/drivers/usb/musb/musb_regs.h
++++ b/drivers/usb/musb/musb_regs.h
+@@ -72,6 +72,10 @@
+ #define MUSB_DEVCTL_HR 0x02
+ #define MUSB_DEVCTL_SESSION 0x01
+
++/* MUSB ULPI VBUSCONTROL */
++#define MUSB_ULPI_USE_EXTVBUS 0x01
++#define MUSB_ULPI_USE_EXTVBUSIND 0x02
++
+ /* TESTMODE */
+ #define MUSB_TEST_FORCE_HOST 0x80
+ #define MUSB_TEST_FIFO_ACCESS 0x40
+@@ -246,6 +250,7 @@
+
+ /* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */
+ #define MUSB_HWVERS 0x6C /* 8 bit */
++#define MUSB_ULPI_BUSCONTROL 0x70 /* 8 bit */
+
+ #define MUSB_EPINFO 0x78 /* 8 bit */
+ #define MUSB_RAMINFO 0x79 /* 8 bit */
+--- a/include/linux/usb/musb.h
++++ b/include/linux/usb/musb.h
+@@ -76,6 +76,9 @@ struct musb_hdrc_platform_data {
+ /* (HOST or OTG) msec/2 after VBUS on till power good */
+ u8 potpgt;
+
++ /* (HOST or OTG) program PHY for external Vbus */
++ unsigned extvbus:1;
++
+ /* Power the device on or off */
+ int (*set_power)(int state);
+
diff --git a/usb/usb-c67x00-use-resource_size.patch b/usb/usb-c67x00-use-resource_size.patch
new file mode 100644
index 00000000000000..f38c5ae6851dd1
--- /dev/null
+++ b/usb/usb-c67x00-use-resource_size.patch
@@ -0,0 +1,52 @@
+From tfransosi@gmail.com Fri Jan 15 10:52:55 2010
+From: Thiago Farina <tfransosi@gmail.com>
+Date: Fri, 1 Jan 2010 16:42:34 -0500
+Subject: USB: c67x00: use resource_size().
+To: linux@vger.kernel.org
+Cc: Peter Korsgaard <jacmet@sunsite.dk>, Greg Kroah-Hartman <gregkh@suse.de>, Thiago Farina <tfransosi@gmail.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
+Message-ID: <1262382155-10534-1-git-send-email-tfransosi@gmail.com>
+
+
+Signed-off-by: Thiago Farina <tfransosi@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/c67x00/c67x00-drv.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/c67x00/c67x00-drv.c
++++ b/drivers/usb/c67x00/c67x00-drv.c
+@@ -137,13 +137,13 @@ static int __devinit c67x00_drv_probe(st
+ if (!c67x00)
+ return -ENOMEM;
+
+- if (!request_mem_region(res->start, res->end - res->start + 1,
++ if (!request_mem_region(res->start, resource_size(res),
+ pdev->name)) {
+ dev_err(&pdev->dev, "Memory region busy\n");
+ ret = -EBUSY;
+ goto request_mem_failed;
+ }
+- c67x00->hpi.base = ioremap(res->start, res->end - res->start + 1);
++ c67x00->hpi.base = ioremap(res->start, resource_size(res));
+ if (!c67x00->hpi.base) {
+ dev_err(&pdev->dev, "Unable to map HPI registers\n");
+ ret = -EIO;
+@@ -182,7 +182,7 @@ static int __devinit c67x00_drv_probe(st
+ request_irq_failed:
+ iounmap(c67x00->hpi.base);
+ map_failed:
+- release_mem_region(res->start, res->end - res->start + 1);
++ release_mem_region(res->start, resource_size(res));
+ request_mem_failed:
+ kfree(c67x00);
+
+@@ -208,7 +208,7 @@ static int __devexit c67x00_drv_remove(s
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (res)
+- release_mem_region(res->start, res->end - res->start + 1);
++ release_mem_region(res->start, resource_size(res));
+
+ kfree(c67x00);
+
diff --git a/usb/usb-ch341-fix-dma-buffer-on-stack.patch b/usb/usb-ch341-fix-dma-buffer-on-stack.patch
new file mode 100644
index 00000000000000..80c3f09a5d3794
--- /dev/null
+++ b/usb/usb-ch341-fix-dma-buffer-on-stack.patch
@@ -0,0 +1,54 @@
+From jhovold@gmail.com Fri Jan 15 10:43:42 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:46 +0100
+Subject: USB: ch341: fix DMA buffer on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-3-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ch341.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/serial/ch341.c
++++ b/drivers/usb/serial/ch341.c
+@@ -392,16 +392,22 @@ static void ch341_break_ctl(struct tty_s
+ struct usb_serial_port *port = tty->driver_data;
+ int r;
+ uint16_t reg_contents;
+- uint8_t break_reg[2];
++ uint8_t *break_reg;
+
+ dbg("%s()", __func__);
+
++ break_reg = kmalloc(2, GFP_KERNEL);
++ if (!break_reg) {
++ dev_err(&port->dev, "%s - kmalloc failed\n", __func__);
++ return;
++ }
++
+ r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
+- ch341_break_reg, 0, break_reg, sizeof(break_reg));
++ ch341_break_reg, 0, break_reg, 2);
+ if (r < 0) {
+ dev_err(&port->dev, "%s - USB control read error (%d)\n",
+ __func__, r);
+- return;
++ goto out;
+ }
+ dbg("%s - initial ch341 break register contents - reg1: %x, reg2: %x",
+ __func__, break_reg[0], break_reg[1]);
+@@ -422,6 +428,8 @@ static void ch341_break_ctl(struct tty_s
+ if (r < 0)
+ dev_err(&port->dev, "%s - USB control write error (%d)\n",
+ __func__, r);
++out:
++ kfree(break_reg);
+ }
+
+ static int ch341_tiocmset(struct tty_struct *tty, struct file *file,
diff --git a/usb/usb-ch341-replace-printk-warnings-with-dev_err.patch b/usb/usb-ch341-replace-printk-warnings-with-dev_err.patch
new file mode 100644
index 00000000000000..42e5509b953bb1
--- /dev/null
+++ b/usb/usb-ch341-replace-printk-warnings-with-dev_err.patch
@@ -0,0 +1,41 @@
+From jhovold@gmail.com Fri Jan 15 10:43:32 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:45 +0100
+Subject: USB: ch341: replace printk warnings with dev_err
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-2-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ch341.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/serial/ch341.c
++++ b/drivers/usb/serial/ch341.c
+@@ -399,8 +399,8 @@ static void ch341_break_ctl(struct tty_s
+ r = ch341_control_in(port->serial->dev, CH341_REQ_READ_REG,
+ ch341_break_reg, 0, break_reg, sizeof(break_reg));
+ if (r < 0) {
+- printk(KERN_WARNING "%s: USB control read error whilst getting"
+- " break register contents.\n", __FILE__);
++ dev_err(&port->dev, "%s - USB control read error (%d)\n",
++ __func__, r);
+ return;
+ }
+ dbg("%s - initial ch341 break register contents - reg1: %x, reg2: %x",
+@@ -420,8 +420,8 @@ static void ch341_break_ctl(struct tty_s
+ r = ch341_control_out(port->serial->dev, CH341_REQ_WRITE_REG,
+ ch341_break_reg, reg_contents);
+ if (r < 0)
+- printk(KERN_WARNING "%s: USB control write error whilst setting"
+- " break register contents.\n", __FILE__);
++ dev_err(&port->dev, "%s - USB control write error (%d)\n",
++ __func__, r);
+ }
+
+ static int ch341_tiocmset(struct tty_struct *tty, struct file *file,
diff --git a/usb/usb-ch341-use-get_unaligned_le16-in-break_ctl.patch b/usb/usb-ch341-use-get_unaligned_le16-in-break_ctl.patch
new file mode 100644
index 00000000000000..91616a91f762d3
--- /dev/null
+++ b/usb/usb-ch341-use-get_unaligned_le16-in-break_ctl.patch
@@ -0,0 +1,36 @@
+From jhovold@gmail.com Fri Jan 15 10:47:28 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 31 Dec 2009 16:47:59 +0100
+Subject: USB: ch341: use get_unaligned_le16 in break_ctl
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262274489-12447-4-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ch341.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/ch341.c
++++ b/drivers/usb/serial/ch341.c
+@@ -22,6 +22,7 @@
+ #include <linux/usb.h>
+ #include <linux/usb/serial.h>
+ #include <linux/serial.h>
++#include <asm/unaligned.h>
+
+ #define DEFAULT_BAUD_RATE 9600
+ #define DEFAULT_TIMEOUT 1000
+@@ -422,7 +423,7 @@ static void ch341_break_ctl(struct tty_s
+ }
+ dbg("%s - New ch341 break register contents - reg1: %x, reg2: %x",
+ __func__, break_reg[0], break_reg[1]);
+- reg_contents = le16_to_cpup((uint16_t *)break_reg);
++ reg_contents = get_unaligned_le16(break_reg);
+ r = ch341_control_out(port->serial->dev, CH341_REQ_WRITE_REG,
+ ch341_break_reg, reg_contents);
+ if (r < 0)
diff --git a/usb/usb-ch341-use-le16_to_cpup-to-be-explicit-about-endianess.patch b/usb/usb-ch341-use-le16_to_cpup-to-be-explicit-about-endianess.patch
new file mode 100644
index 00000000000000..acd43ad5429a2d
--- /dev/null
+++ b/usb/usb-ch341-use-le16_to_cpup-to-be-explicit-about-endianess.patch
@@ -0,0 +1,28 @@
+From jhovold@gmail.com Fri Jan 15 10:43:52 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:47 +0100
+Subject: USB: ch341: use le16_to_cpup to be explicit about endianess
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-4-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ch341.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/serial/ch341.c
++++ b/drivers/usb/serial/ch341.c
+@@ -422,7 +422,7 @@ static void ch341_break_ctl(struct tty_s
+ }
+ dbg("%s - New ch341 break register contents - reg1: %x, reg2: %x",
+ __func__, break_reg[0], break_reg[1]);
+- reg_contents = (uint16_t)break_reg[0] | ((uint16_t)break_reg[1] << 8);
++ reg_contents = le16_to_cpup((uint16_t *)break_reg);
+ r = ch341_control_out(port->serial->dev, CH341_REQ_WRITE_REG,
+ ch341_break_reg, reg_contents);
+ if (r < 0)
diff --git a/usb/usb-correct-config-variable-typo.patch b/usb/usb-correct-config-variable-typo.patch
new file mode 100644
index 00000000000000..887a8976287bad
--- /dev/null
+++ b/usb/usb-correct-config-variable-typo.patch
@@ -0,0 +1,28 @@
+From rpjday@crashcourse.ca Fri Jan 15 10:33:01 2010
+From: "Robert P. J. Day" <rpjday@crashcourse.ca>
+Date: Mon, 28 Dec 2009 06:31:08 -0500 (EST)
+Subject: USB: Correct CONFIG variable typo.
+Cc: David Brownell <dbrownell@users.sourceforge.net>
+Message-ID: <alpine.LFD.2.00.0912280630070.16302@localhost>
+
+
+
+Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
+Cc: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/ether.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/ether.c
++++ b/drivers/usb/gadget/ether.c
+@@ -259,7 +259,7 @@ static struct usb_configuration rndis_co
+
+ /*-------------------------------------------------------------------------*/
+
+-#ifdef USB_ETH_EEM
++#ifdef CONFIG_USB_ETH_EEM
+ static int use_eem = 1;
+ #else
+ static int use_eem;
diff --git a/usb/usb-cypress_m8-fix-dma-buffer-on-stack.patch b/usb/usb-cypress_m8-fix-dma-buffer-on-stack.patch
new file mode 100644
index 00000000000000..8ee9d8b914c36b
--- /dev/null
+++ b/usb/usb-cypress_m8-fix-dma-buffer-on-stack.patch
@@ -0,0 +1,114 @@
+From jhovold@gmail.com Fri Jan 15 10:44:03 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:48 +0100
+Subject: USB: cypress_m8: fix DMA buffer on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, Lonnie Mendez <dignome@gmail.com>
+Message-ID: <1262037718-31424-5-git-send-email-jhovold@gmail.com>
+
+
+Cc: Lonnie Mendez <dignome@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/cypress_m8.c | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+--- a/drivers/usb/serial/cypress_m8.c
++++ b/drivers/usb/serial/cypress_m8.c
+@@ -344,7 +344,8 @@ static int cypress_serial_control(struct
+ {
+ int new_baudrate = 0, retval = 0, tries = 0;
+ struct cypress_private *priv;
+- __u8 feature_buffer[5];
++ u8 *feature_buffer;
++ const unsigned int feature_len = 5;
+ unsigned long flags;
+
+ dbg("%s", __func__);
+@@ -354,6 +355,10 @@ static int cypress_serial_control(struct
+ if (!priv->comm_is_ok)
+ return -ENODEV;
+
++ feature_buffer = kcalloc(feature_len, sizeof(u8), GFP_KERNEL);
++ if (!feature_buffer)
++ return -ENOMEM;
++
+ switch (cypress_request_type) {
+ case CYPRESS_SET_CONFIG:
+ /* 0 means 'Hang up' so doesn't change the true bit rate */
+@@ -370,7 +375,6 @@ static int cypress_serial_control(struct
+ dbg("%s - baud rate is being sent as %d",
+ __func__, new_baudrate);
+
+- memset(feature_buffer, 0, sizeof(feature_buffer));
+ /* fill the feature_buffer with new configuration */
+ *((u_int32_t *)feature_buffer) = new_baudrate;
+ feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */
+@@ -394,15 +398,15 @@ static int cypress_serial_control(struct
+ HID_REQ_SET_REPORT,
+ USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS,
+ 0x0300, 0, feature_buffer,
+- sizeof(feature_buffer), 500);
++ feature_len, 500);
+
+ if (tries++ >= 3)
+ break;
+
+- } while (retval != sizeof(feature_buffer) &&
++ } while (retval != feature_len &&
+ retval != -ENODEV);
+
+- if (retval != sizeof(feature_buffer)) {
++ if (retval != feature_len) {
+ dev_err(&port->dev, "%s - failed sending serial "
+ "line settings - %d\n", __func__, retval);
+ cypress_set_dead(port);
+@@ -422,30 +426,28 @@ static int cypress_serial_control(struct
+ /* Not implemented for this device,
+ and if we try to do it we're likely
+ to crash the hardware. */
+- return -ENOTTY;
++ retval = -ENOTTY;
++ goto out;
+ }
+ dbg("%s - retreiving serial line settings", __func__);
+- /* set initial values in feature buffer */
+- memset(feature_buffer, 0, sizeof(feature_buffer));
+-
+ do {
+ retval = usb_control_msg(port->serial->dev,
+ usb_rcvctrlpipe(port->serial->dev, 0),
+ HID_REQ_GET_REPORT,
+ USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS,
+ 0x0300, 0, feature_buffer,
+- sizeof(feature_buffer), 500);
++ feature_len, 500);
+
+ if (tries++ >= 3)
+ break;
+- } while (retval != sizeof(feature_buffer)
++ } while (retval != feature_len
+ && retval != -ENODEV);
+
+- if (retval != sizeof(feature_buffer)) {
++ if (retval != feature_len) {
+ dev_err(&port->dev, "%s - failed to retrieve serial "
+ "line settings - %d\n", __func__, retval);
+ cypress_set_dead(port);
+- return retval;
++ goto out;
+ } else {
+ spin_lock_irqsave(&priv->lock, flags);
+ /* store the config in one byte, and later
+@@ -458,7 +460,8 @@ static int cypress_serial_control(struct
+ spin_lock_irqsave(&priv->lock, flags);
+ ++priv->cmd_count;
+ spin_unlock_irqrestore(&priv->lock, flags);
+-
++out:
++ kfree(feature_buffer);
+ return retval;
+ } /* cypress_serial_control */
+
diff --git a/usb/usb-cypress_m8-fix-endianess-bug.patch b/usb/usb-cypress_m8-fix-endianess-bug.patch
new file mode 100644
index 00000000000000..9fdf9fbbf73a7e
--- /dev/null
+++ b/usb/usb-cypress_m8-fix-endianess-bug.patch
@@ -0,0 +1,37 @@
+From jhovold@gmail.com Fri Jan 15 10:44:14 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:49 +0100
+Subject: USB: cypress_m8: fix endianess bug
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, Lonnie Mendez <dignome@gmail.com>
+Message-ID: <1262037718-31424-6-git-send-email-jhovold@gmail.com>
+
+
+Cc: Lonnie Mendez <dignome@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/cypress_m8.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/serial/cypress_m8.c
++++ b/drivers/usb/serial/cypress_m8.c
+@@ -376,7 +376,7 @@ static int cypress_serial_control(struct
+ __func__, new_baudrate);
+
+ /* fill the feature_buffer with new configuration */
+- *((u_int32_t *)feature_buffer) = new_baudrate;
++ *((u32 *)feature_buffer) = cpu_to_le32(new_baudrate);
+ feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */
+ /* 1 bit gap */
+ feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */
+@@ -453,7 +453,7 @@ static int cypress_serial_control(struct
+ /* store the config in one byte, and later
+ use bit masks to check values */
+ priv->current_config = feature_buffer[4];
+- priv->baud_rate = *((u_int32_t *)feature_buffer);
++ priv->baud_rate = le32_to_cpup((u32 *)feature_buffer);
+ spin_unlock_irqrestore(&priv->lock, flags);
+ }
+ }
diff --git a/usb/usb-cypress_m8-use-put_unaligned_le32-where-necessary.patch b/usb/usb-cypress_m8-use-put_unaligned_le32-where-necessary.patch
new file mode 100644
index 00000000000000..f77b204f733513
--- /dev/null
+++ b/usb/usb-cypress_m8-use-put_unaligned_le32-where-necessary.patch
@@ -0,0 +1,45 @@
+From jhovold@gmail.com Fri Jan 15 10:48:40 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 31 Dec 2009 16:48:01 +0100
+Subject: USB: cypress_m8: use put_unaligned_le32() where necessary
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, Lonnie Mendez <dignome@gmail.com>
+Message-ID: <1262274489-12447-6-git-send-email-jhovold@gmail.com>
+
+
+Cc: Lonnie Mendez <dignome@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/cypress_m8.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/serial/cypress_m8.c
++++ b/drivers/usb/serial/cypress_m8.c
+@@ -66,6 +66,7 @@
+ #include <linux/serial.h>
+ #include <linux/delay.h>
+ #include <linux/uaccess.h>
++#include <asm/unaligned.h>
+
+ #include "cypress_m8.h"
+
+@@ -376,7 +377,7 @@ static int cypress_serial_control(struct
+ __func__, new_baudrate);
+
+ /* fill the feature_buffer with new configuration */
+- *((u32 *)feature_buffer) = cpu_to_le32(new_baudrate);
++ put_unaligned_le32(new_baudrate, feature_buffer);
+ feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */
+ /* 1 bit gap */
+ feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */
+@@ -453,7 +454,7 @@ static int cypress_serial_control(struct
+ /* store the config in one byte, and later
+ use bit masks to check values */
+ priv->current_config = feature_buffer[4];
+- priv->baud_rate = le32_to_cpup((u32 *)feature_buffer);
++ priv->baud_rate = get_unaligned_le32(feature_buffer);
+ spin_unlock_irqrestore(&priv->lock, flags);
+ }
+ }
diff --git a/usb/usb-document-abi-for-usb_quirk_reset_morphs.patch b/usb/usb-document-abi-for-usb_quirk_reset_morphs.patch
new file mode 100644
index 00000000000000..f58d4719c16950
--- /dev/null
+++ b/usb/usb-document-abi-for-usb_quirk_reset_morphs.patch
@@ -0,0 +1,37 @@
+From oliver@neukum.org Fri Jan 15 10:05:34 2010
+From: Oliver Neukum <oliver@neukum.org>
+Date: Wed, 23 Dec 2009 19:22:19 +0100
+Subject: USB: Document ABI for USB_QUIRK_RESET_MORPHS
+To: Greg KH <greg@kroah.com>, Linux USB list <linux-usb@vger.kernel.org>
+Message-ID: <200912231922.19894.oliver@neukum.org>
+
+
+From: Oliver Neukum <oliver@neukum.org>
+
+Adds documentation about the attribute that tells
+the kernel a device cannot be successfully reset.
+
+Signed-off-by: Oliver Neukum <oliver@neukum.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ Documentation/ABI/testing/sysfs-bus-usb | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/Documentation/ABI/testing/sysfs-bus-usb
++++ b/Documentation/ABI/testing/sysfs-bus-usb
+@@ -159,3 +159,14 @@ Description:
+ device. This is useful to ensure auto probing won't
+ match the driver to the device. For example:
+ # echo "046d c315" > /sys/bus/usb/drivers/foo/remove_id
++
++What: /sys/bus/usb/drivers/.../reset
++Date: December 2009
++Contact: Oliver Neukum <oliver@neukum.org>
++Description:
++ Writing 1 to this file tells the kernel that this
++ device will morph into another mode when it is reset.
++ Drivers will not use reset for error handling for
++ such devices.
++Users:
++ usb_modeswitch
diff --git a/usb/usb-fhci-correct-the-size-argument-to-kzalloc.patch b/usb/usb-fhci-correct-the-size-argument-to-kzalloc.patch
new file mode 100644
index 00000000000000..def1fb967ca580
--- /dev/null
+++ b/usb/usb-fhci-correct-the-size-argument-to-kzalloc.patch
@@ -0,0 +1,49 @@
+From julia@diku.dk Fri Jan 15 10:50:56 2010
+From: Julia Lawall <julia@diku.dk>
+Date: Wed, 30 Dec 2009 15:34:37 +0100 (CET)
+Subject: USB: FHCI: Correct the size argument to kzalloc
+To: gregkh@suse.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
+Message-ID: <Pine.LNX.4.64.0912301534070.23134@ask.diku.dk>
+
+
+From: Julia Lawall <julia@diku.dk>
+
+urb_priv->tds has type struct td **, not struct td *, so the
+elements of the array should have pointer type, not structure type.
+
+Convert kzalloc to kcalloc as well.
+
+The semantic patch that makes this change is as follows:
+(http://coccinelle.lip6.fr/)
+
+// <smpl>
+@disable sizeof_type_expr@
+type T;
+T **x;
+@@
+
+ x =
+ <+...sizeof(
+- T
++ *x
+ )...+>
+// </smpl>
+
+Signed-off-by: Julia Lawall <julia@diku.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/fhci-hcd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/fhci-hcd.c
++++ b/drivers/usb/host/fhci-hcd.c
+@@ -433,7 +433,7 @@ static int fhci_urb_enqueue(struct usb_h
+ return -ENOMEM;
+
+ /* allocate the private part of the URB */
+- urb_priv->tds = kzalloc(size * sizeof(struct td), mem_flags);
++ urb_priv->tds = kcalloc(size, sizeof(*urb_priv->tds), mem_flags);
+ if (!urb_priv->tds) {
+ kfree(urb_priv);
+ return -ENOMEM;
diff --git a/usb/usb-ftdi_sio-clean-up-modem-status-handling.patch b/usb/usb-ftdi_sio-clean-up-modem-status-handling.patch
new file mode 100644
index 00000000000000..4937c344149e07
--- /dev/null
+++ b/usb/usb-ftdi_sio-clean-up-modem-status-handling.patch
@@ -0,0 +1,85 @@
+From jhovold@gmail.com Fri Jan 15 10:07:41 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 24 Dec 2009 12:42:10 +0100
+Subject: USB: ftdi_sio: clean up modem status handling
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Aarnio <matti.aarnio@zmailer.org>, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1261654931-31543-5-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 37 ++++++++++++++++---------------------
+ 1 file changed, 16 insertions(+), 21 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -2322,6 +2322,7 @@ static int ftdi_tiocmget(struct tty_stru
+ struct usb_serial_port *port = tty->driver_data;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ unsigned char *buf;
++ int len;
+ int ret;
+
+ dbg("%s TIOCMGET", __func__);
+@@ -2329,18 +2330,13 @@ static int ftdi_tiocmget(struct tty_stru
+ buf = kmalloc(2, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+-
++ /*
++ * The 8U232AM returns a two byte value (the SIO a 1 byte value) in
++ * the same format as the data returned from the in point.
++ */
+ switch (priv->chip_type) {
+ case SIO:
+- /* Request the status from the device */
+- ret = usb_control_msg(port->serial->dev,
+- usb_rcvctrlpipe(port->serial->dev, 0),
+- FTDI_SIO_GET_MODEM_STATUS_REQUEST,
+- FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
+- 0, 0,
+- buf, 1, WDR_TIMEOUT);
+- if (ret < 0)
+- goto out;
++ len = 1;
+ break;
+ case FT8U232AM:
+ case FT232BM:
+@@ -2348,23 +2344,22 @@ static int ftdi_tiocmget(struct tty_stru
+ case FT232RL:
+ case FT2232H:
+ case FT4232H:
+- /* the 8U232AM returns a two byte value (the sio is a 1 byte
+- value) - in the same format as the data returned from the in
+- point */
+- ret = usb_control_msg(port->serial->dev,
+- usb_rcvctrlpipe(port->serial->dev, 0),
+- FTDI_SIO_GET_MODEM_STATUS_REQUEST,
+- FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
+- 0, priv->interface,
+- buf, 2, WDR_TIMEOUT);
+- if (ret < 0)
+- goto out;
++ len = 2;
+ break;
+ default:
+ ret = -EFAULT;
+ goto out;
+ }
+
++ ret = usb_control_msg(port->serial->dev,
++ usb_rcvctrlpipe(port->serial->dev, 0),
++ FTDI_SIO_GET_MODEM_STATUS_REQUEST,
++ FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
++ 0, priv->interface,
++ buf, len, WDR_TIMEOUT);
++ if (ret < 0)
++ goto out;
++
+ ret = (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |
+ (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) |
+ (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) |
diff --git a/usb/usb-ftdi_sio-fix-dma-buffers-on-stack.patch b/usb/usb-ftdi_sio-fix-dma-buffers-on-stack.patch
new file mode 100644
index 00000000000000..42f2a1ff5fcc35
--- /dev/null
+++ b/usb/usb-ftdi_sio-fix-dma-buffers-on-stack.patch
@@ -0,0 +1,289 @@
+From jhovold@gmail.com Fri Jan 15 10:07:30 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 24 Dec 2009 12:42:09 +0100
+Subject: USB: ftdi_sio: fix DMA buffers on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Aarnio <matti.aarnio@zmailer.org>, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1261654931-31543-4-git-send-email-jhovold@gmail.com>
+
+
+Also remove unnecessary buffer allocations for zero-length transfers.
+
+Reported-by: Matti Aarnio <matti.aarnio@zmailer.org>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 69 ++++++++++++++++--------------------------
+ 1 file changed, 27 insertions(+), 42 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -916,7 +916,6 @@ static int update_mctrl(struct usb_seria
+ unsigned int clear)
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+- char *buf;
+ unsigned urb_value;
+ int rv;
+
+@@ -925,10 +924,6 @@ static int update_mctrl(struct usb_seria
+ return 0; /* no change */
+ }
+
+- buf = kmalloc(1, GFP_NOIO);
+- if (!buf)
+- return -ENOMEM;
+-
+ clear &= ~set; /* 'set' takes precedence over 'clear' */
+ urb_value = 0;
+ if (clear & TIOCM_DTR)
+@@ -944,9 +939,7 @@ static int update_mctrl(struct usb_seria
+ FTDI_SIO_SET_MODEM_CTRL_REQUEST,
+ FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
+ urb_value, priv->interface,
+- buf, 0, WDR_TIMEOUT);
+-
+- kfree(buf);
++ NULL, 0, WDR_TIMEOUT);
+ if (rv < 0) {
+ dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
+ __func__,
+@@ -1105,16 +1098,11 @@ static __u32 get_ftdi_divisor(struct tty
+ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port)
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+- char *buf;
+ __u16 urb_value;
+ __u16 urb_index;
+ __u32 urb_index_value;
+ int rv;
+
+- buf = kmalloc(1, GFP_NOIO);
+- if (!buf)
+- return -ENOMEM;
+-
+ urb_index_value = get_ftdi_divisor(tty, port);
+ urb_value = (__u16)urb_index_value;
+ urb_index = (__u16)(urb_index_value >> 16);
+@@ -1127,9 +1115,7 @@ static int change_speed(struct tty_struc
+ FTDI_SIO_SET_BAUDRATE_REQUEST,
+ FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE,
+ urb_value, urb_index,
+- buf, 0, WDR_SHORT_TIMEOUT);
+-
+- kfree(buf);
++ NULL, 0, WDR_SHORT_TIMEOUT);
+ return rv;
+ }
+
+@@ -1137,7 +1123,6 @@ static int write_latency_timer(struct us
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+- char buf[1];
+ int rv = 0;
+ int l = priv->latency;
+
+@@ -1151,8 +1136,7 @@ static int write_latency_timer(struct us
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
+ l, priv->interface,
+- buf, 0, WDR_TIMEOUT);
+-
++ NULL, 0, WDR_TIMEOUT);
+ if (rv < 0)
+ dev_err(&port->dev, "Unable to write latency timer: %i\n", rv);
+ return rv;
+@@ -1426,7 +1410,6 @@ static ssize_t store_event_char(struct d
+ struct usb_serial_port *port = to_usb_serial_port(dev);
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+- char buf[1];
+ int v = simple_strtoul(valbuf, NULL, 10);
+ int rv = 0;
+
+@@ -1437,8 +1420,7 @@ static ssize_t store_event_char(struct d
+ FTDI_SIO_SET_EVENT_CHAR_REQUEST,
+ FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE,
+ v, priv->interface,
+- buf, 0, WDR_TIMEOUT);
+-
++ NULL, 0, WDR_TIMEOUT);
+ if (rv < 0) {
+ dbg("Unable to write event character: %i", rv);
+ return -EIO;
+@@ -1617,7 +1599,6 @@ static int ftdi_NDI_device_setup(struct
+ struct usb_device *udev = serial->dev;
+ int latency = ndi_latency_timer;
+ int rv = 0;
+- char buf[1];
+
+ if (latency == 0)
+ latency = 1;
+@@ -1630,7 +1611,7 @@ static int ftdi_NDI_device_setup(struct
+ rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
+- latency, 0, buf, 0, WDR_TIMEOUT);
++ latency, 0, NULL, 0, WDR_TIMEOUT);
+ return 0;
+ }
+
+@@ -1718,9 +1699,7 @@ static int ftdi_open(struct tty_struct *
+ struct usb_device *dev = port->serial->dev;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ unsigned long flags;
+-
+ int result = 0;
+- char buf[1]; /* Needed for the usb_control_msg I think */
+
+ dbg("%s", __func__);
+
+@@ -1735,7 +1714,7 @@ static int ftdi_open(struct tty_struct *
+ usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+ FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE,
+ FTDI_SIO_RESET_SIO,
+- priv->interface, buf, 0, WDR_TIMEOUT);
++ priv->interface, NULL, 0, WDR_TIMEOUT);
+
+ /* Termios defaults are set by usb_serial_init. We don't change
+ port->tty->termios - this would lose speed settings, etc.
+@@ -1763,7 +1742,6 @@ static int ftdi_open(struct tty_struct *
+ static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+- char buf[1];
+
+ mutex_lock(&port->serial->disc_mutex);
+ if (!port->serial->disconnected) {
+@@ -1772,7 +1750,7 @@ static void ftdi_dtr_rts(struct usb_seri
+ usb_sndctrlpipe(port->serial->dev, 0),
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+- 0, priv->interface, buf, 0,
++ 0, priv->interface, NULL, 0,
+ WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev, "error from flowcontrol urb\n");
+ }
+@@ -2141,7 +2119,6 @@ static void ftdi_break_ctl(struct tty_st
+ struct usb_serial_port *port = tty->driver_data;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ __u16 urb_value = 0;
+- char buf[1];
+
+ /* break_state = -1 to turn on break, and 0 to turn off break */
+ /* see drivers/char/tty_io.c to see it used */
+@@ -2157,7 +2134,7 @@ static void ftdi_break_ctl(struct tty_st
+ FTDI_SIO_SET_DATA_REQUEST,
+ FTDI_SIO_SET_DATA_REQUEST_TYPE,
+ urb_value , priv->interface,
+- buf, 0, WDR_TIMEOUT) < 0) {
++ NULL, 0, WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev, "%s FAILED to enable/disable break state "
+ "(state was %d)\n", __func__, break_state);
+ }
+@@ -2181,7 +2158,6 @@ static void ftdi_set_termios(struct tty_
+ struct ktermios *termios = tty->termios;
+ unsigned int cflag = termios->c_cflag;
+ __u16 urb_value; /* will hold the new flags */
+- char buf[1]; /* Perhaps I should dynamically alloc this? */
+
+ /* Added for xon/xoff support */
+ unsigned int iflag = termios->c_iflag;
+@@ -2247,7 +2223,7 @@ static void ftdi_set_termios(struct tty_
+ FTDI_SIO_SET_DATA_REQUEST,
+ FTDI_SIO_SET_DATA_REQUEST_TYPE,
+ urb_value , priv->interface,
+- buf, 0, WDR_SHORT_TIMEOUT) < 0) {
++ NULL, 0, WDR_SHORT_TIMEOUT) < 0) {
+ dev_err(&port->dev, "%s FAILED to set "
+ "databits/stopbits/parity\n", __func__);
+ }
+@@ -2259,7 +2235,7 @@ static void ftdi_set_termios(struct tty_
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+ 0, priv->interface,
+- buf, 0, WDR_TIMEOUT) < 0) {
++ NULL, 0, WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev,
+ "%s error from disable flowcontrol urb\n",
+ __func__);
+@@ -2285,7 +2261,7 @@ static void ftdi_set_termios(struct tty_
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+ 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
+- buf, 0, WDR_TIMEOUT) < 0) {
++ NULL, 0, WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev,
+ "urb failed to set to rts/cts flow control\n");
+ }
+@@ -2317,7 +2293,7 @@ static void ftdi_set_termios(struct tty_
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+ urb_value , (FTDI_SIO_XON_XOFF_HS
+ | priv->interface),
+- buf, 0, WDR_TIMEOUT) < 0) {
++ NULL, 0, WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev, "urb failed to set to "
+ "xon/xoff flow control\n");
+ }
+@@ -2331,7 +2307,7 @@ static void ftdi_set_termios(struct tty_
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+ FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+ 0, priv->interface,
+- buf, 0, WDR_TIMEOUT) < 0) {
++ NULL, 0, WDR_TIMEOUT) < 0) {
+ dev_err(&port->dev,
+ "urb failed to clear flow control\n");
+ }
+@@ -2345,10 +2321,15 @@ static int ftdi_tiocmget(struct tty_stru
+ {
+ struct usb_serial_port *port = tty->driver_data;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+- unsigned char buf[2];
++ unsigned char *buf;
+ int ret;
+
+ dbg("%s TIOCMGET", __func__);
++
++ buf = kmalloc(2, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
++
+ switch (priv->chip_type) {
+ case SIO:
+ /* Request the status from the device */
+@@ -2359,7 +2340,7 @@ static int ftdi_tiocmget(struct tty_stru
+ 0, 0,
+ buf, 1, WDR_TIMEOUT);
+ if (ret < 0)
+- return ret;
++ goto out;
+ break;
+ case FT8U232AM:
+ case FT232BM:
+@@ -2377,17 +2358,21 @@ static int ftdi_tiocmget(struct tty_stru
+ 0, priv->interface,
+ buf, 2, WDR_TIMEOUT);
+ if (ret < 0)
+- return ret;
++ goto out;
+ break;
+ default:
+- return -EFAULT;
++ ret = -EFAULT;
++ goto out;
+ }
+
+- return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |
++ ret = (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |
+ (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) |
+ (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) |
+ (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) |
+ priv->last_dtr_rts;
++out:
++ kfree(buf);
++ return ret;
+ }
+
+ static int ftdi_tiocmset(struct tty_struct *tty, struct file *file,
diff --git a/usb/usb-ftdi_sio-fix-latency-timeout-endianess-bug.patch b/usb/usb-ftdi_sio-fix-latency-timeout-endianess-bug.patch
new file mode 100644
index 00000000000000..2c385d5789ea04
--- /dev/null
+++ b/usb/usb-ftdi_sio-fix-latency-timeout-endianess-bug.patch
@@ -0,0 +1,52 @@
+From jhovold@gmail.com Fri Jan 15 10:07:16 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 24 Dec 2009 12:42:08 +0100
+Subject: USB: ftdi_sio: fix latency-timeout endianess bug
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Aarnio <matti.aarnio@zmailer.org>, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1261654931-31543-3-git-send-email-jhovold@gmail.com>
+
+Also fixes DMA transfer to stack for latency buffer.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1162,22 +1162,28 @@ static int read_latency_timer(struct usb
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+- unsigned short latency = 0;
++ unsigned char *buf;
+ int rv = 0;
+
+ dbg("%s", __func__);
+
++ buf = kmalloc(1, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
++
+ rv = usb_control_msg(udev,
+ usb_rcvctrlpipe(udev, 0),
+ FTDI_SIO_GET_LATENCY_TIMER_REQUEST,
+ FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
+ 0, priv->interface,
+- (char *) &latency, 1, WDR_TIMEOUT);
+-
++ buf, 1, WDR_TIMEOUT);
+ if (rv < 0)
+ dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
+ else
+- priv->latency = latency;
++ priv->latency = buf[0];
++
++ kfree(buf);
++
+ return rv;
+ }
+
diff --git a/usb/usb-ftdi_sio-remove-unnecessary-initialisations.patch b/usb/usb-ftdi_sio-remove-unnecessary-initialisations.patch
new file mode 100644
index 00000000000000..58c0c4efee6217
--- /dev/null
+++ b/usb/usb-ftdi_sio-remove-unnecessary-initialisations.patch
@@ -0,0 +1,105 @@
+From jhovold@gmail.com Fri Jan 15 10:31:17 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 24 Dec 2009 12:42:11 +0100
+Subject: USB: ftdi_sio: remove unnecessary initialisations
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Aarnio <matti.aarnio@zmailer.org>, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1261654931-31543-6-git-send-email-jhovold@gmail.com>
+
+
+Return values are being initialised to zero only to be unconditionally
+assigned to a few instructions later. This may give the impression that
+zero is returned on success, which is not the case.
+
+Note also that ftdi_NDI_device_setup never reports errors.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1123,7 +1123,7 @@ static int write_latency_timer(struct us
+ {
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+- int rv = 0;
++ int rv;
+ int l = priv->latency;
+
+ if (priv->flags & ASYNC_LOW_LATENCY)
+@@ -1147,7 +1147,7 @@ static int read_latency_timer(struct usb
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+ unsigned char *buf;
+- int rv = 0;
++ int rv;
+
+ dbg("%s", __func__);
+
+@@ -1341,7 +1341,7 @@ static void ftdi_set_max_packet_size(str
+ struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc;
+
+ unsigned num_endpoints;
+- int i = 0;
++ int i;
+
+ num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
+ dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
+@@ -1393,7 +1393,7 @@ static ssize_t store_latency_timer(struc
+ struct usb_serial_port *port = to_usb_serial_port(dev);
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ int v = simple_strtoul(valbuf, NULL, 10);
+- int rv = 0;
++ int rv;
+
+ priv->latency = v;
+ rv = write_latency_timer(port);
+@@ -1411,7 +1411,7 @@ static ssize_t store_event_char(struct d
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ struct usb_device *udev = port->serial->dev;
+ int v = simple_strtoul(valbuf, NULL, 10);
+- int rv = 0;
++ int rv;
+
+ dbg("%s: setting event char = %i", __func__, v);
+
+@@ -1598,7 +1598,6 @@ static int ftdi_NDI_device_setup(struct
+ {
+ struct usb_device *udev = serial->dev;
+ int latency = ndi_latency_timer;
+- int rv = 0;
+
+ if (latency == 0)
+ latency = 1;
+@@ -1608,7 +1607,8 @@ static int ftdi_NDI_device_setup(struct
+ dbg("%s setting NDI device latency to %d", __func__, latency);
+ dev_info(&udev->dev, "NDI device with a latency value of %d", latency);
+
+- rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
++ /* FIXME: errors are not returned */
++ usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
+ FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
+ latency, 0, NULL, 0, WDR_TIMEOUT);
+@@ -1699,7 +1699,7 @@ static int ftdi_open(struct tty_struct *
+ struct usb_device *dev = port->serial->dev;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+ unsigned long flags;
+- int result = 0;
++ int result;
+
+ dbg("%s", __func__);
+
+@@ -2118,7 +2118,7 @@ static void ftdi_break_ctl(struct tty_st
+ {
+ struct usb_serial_port *port = tty->driver_data;
+ struct ftdi_private *priv = usb_get_serial_port_data(port);
+- __u16 urb_value = 0;
++ __u16 urb_value;
+
+ /* break_state = -1 to turn on break, and 0 to turn off break */
+ /* see drivers/char/tty_io.c to see it used */
diff --git a/usb/usb-ftdi_sio-use-error-code-from-usb-stack-in-read_latency_timer.patch b/usb/usb-ftdi_sio-use-error-code-from-usb-stack-in-read_latency_timer.patch
new file mode 100644
index 00000000000000..099144a439eea7
--- /dev/null
+++ b/usb/usb-ftdi_sio-use-error-code-from-usb-stack-in-read_latency_timer.patch
@@ -0,0 +1,33 @@
+From jhovold@gmail.com Fri Jan 15 10:06:56 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Thu, 24 Dec 2009 12:42:07 +0100
+Subject: USB: ftdi_sio: use error code from usb stack in read_latency_timer
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Aarnio <matti.aarnio@zmailer.org>, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1261654931-31543-2-git-send-email-jhovold@gmail.com>
+
+
+Use same semantics as for write_latency_timer.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -1174,10 +1174,9 @@ static int read_latency_timer(struct usb
+ 0, priv->interface,
+ (char *) &latency, 1, WDR_TIMEOUT);
+
+- if (rv < 0) {
++ if (rv < 0)
+ dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
+- return -EIO;
+- } else
++ else
+ priv->latency = latency;
+ return rv;
+ }
diff --git a/usb/usb-gadget-introduce-g_nokia-gadget-driver.patch b/usb/usb-gadget-introduce-g_nokia-gadget-driver.patch
new file mode 100644
index 00000000000000..d479403b90c498
--- /dev/null
+++ b/usb/usb-gadget-introduce-g_nokia-gadget-driver.patch
@@ -0,0 +1,319 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:59:19 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Tue, 5 Jan 2010 16:10:13 +0200
+Subject: USB: gadget: introduce g_nokia gadget driver
+To: linux-usb@vger.kernel.org
+Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>, Tony Lindgren <tony@atomide.com>, Greg KH <greg@kroah.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262700614-16438-1-git-send-email-felipe.balbi@nokia.com>
+
+
+g_nokia is the gadget driver implementing
+WMCDC Wireless Handset Control Model for the N900
+device.
+
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/Kconfig | 10 +
+ drivers/usb/gadget/Makefile | 2
+ drivers/usb/gadget/nokia.c | 259 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 271 insertions(+)
+
+--- a/drivers/usb/gadget/Kconfig
++++ b/drivers/usb/gadget/Kconfig
+@@ -812,6 +812,16 @@ config USB_CDC_COMPOSITE
+ Say "y" to link the driver statically, or "m" to build a
+ dynamically linked module.
+
++config USB_G_NOKIA
++ tristate "Nokia composite gadget"
++ depends on PHONET
++ help
++ The Nokia composite gadget provides support for acm, obex
++ and phonet in only one composite gadget driver.
++
++ It's only really useful for N900 hardware. If you're building
++ a kernel for N900, say Y or M here. If unsure, say N.
++
+ config USB_G_MULTI
+ tristate "Multifunction Composite Gadget (EXPERIMENTAL)"
+ depends on BLOCK && NET
+--- a/drivers/usb/gadget/Makefile
++++ b/drivers/usb/gadget/Makefile
+@@ -43,6 +43,7 @@ g_mass_storage-objs := mass_storage.o
+ g_printer-objs := printer.o
+ g_cdc-objs := cdc2.o
+ g_multi-objs := multi.o
++g_nokia-objs := nokia.o
+
+ obj-$(CONFIG_USB_ZERO) += g_zero.o
+ obj-$(CONFIG_USB_AUDIO) += g_audio.o
+@@ -55,4 +56,5 @@ obj-$(CONFIG_USB_G_PRINTER) += g_printer
+ obj-$(CONFIG_USB_MIDI_GADGET) += g_midi.o
+ obj-$(CONFIG_USB_CDC_COMPOSITE) += g_cdc.o
+ obj-$(CONFIG_USB_G_MULTI) += g_multi.o
++obj-$(CONFIG_USB_G_NOKIA) += g_nokia.o
+
+--- /dev/null
++++ b/drivers/usb/gadget/nokia.c
+@@ -0,0 +1,259 @@
++/*
++ * nokia.c -- Nokia Composite Gadget Driver
++ *
++ * Copyright (C) 2008-2010 Nokia Corporation
++ * Contact: Felipe Balbi <felipe.balbi@nokia.com>
++ *
++ * This gadget driver borrows from serial.c which is:
++ *
++ * Copyright (C) 2003 Al Borchers (alborchers@steinerpoint.com)
++ * Copyright (C) 2008 by David Brownell
++ * Copyright (C) 2008 by Nokia Corporation
++ *
++ * This software is distributed under the terms of the GNU General
++ * Public License ("GPL") as published by the Free Software Foundation,
++ * version 2 of that License.
++ */
++
++#include <linux/kernel.h>
++#include <linux/utsname.h>
++#include <linux/device.h>
++
++#include "u_serial.h"
++#include "u_ether.h"
++#include "u_phonet.h"
++#include "gadget_chips.h"
++
++/* Defines */
++
++#define NOKIA_VERSION_NUM 0x0211
++#define NOKIA_LONG_NAME "N900 (PC-Suite Mode)"
++
++/*-------------------------------------------------------------------------*/
++
++/*
++ * Kbuild is not very cooperative with respect to linking separately
++ * compiled library objects into one module. So for now we won't use
++ * separate compilation ... ensuring init/exit sections work to shrink
++ * the runtime footprint, and giving us at least some parts of what
++ * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
++ */
++#include "composite.c"
++#include "usbstring.c"
++#include "config.c"
++#include "epautoconf.c"
++
++#include "u_serial.c"
++#include "f_acm.c"
++#include "f_ecm.c"
++#include "f_obex.c"
++#include "f_serial.c"
++#include "f_phonet.c"
++#include "u_ether.c"
++
++/*-------------------------------------------------------------------------*/
++
++#define NOKIA_VENDOR_ID 0x0421 /* Nokia */
++#define NOKIA_PRODUCT_ID 0x01c8 /* Nokia Gadget */
++
++/* string IDs are assigned dynamically */
++
++#define STRING_MANUFACTURER_IDX 0
++#define STRING_PRODUCT_IDX 1
++#define STRING_DESCRIPTION_IDX 2
++
++static char manufacturer_nokia[] = "Nokia";
++static const char product_nokia[] = NOKIA_LONG_NAME;
++static const char description_nokia[] = "PC-Suite Configuration";
++
++static struct usb_string strings_dev[] = {
++ [STRING_MANUFACTURER_IDX].s = manufacturer_nokia,
++ [STRING_PRODUCT_IDX].s = NOKIA_LONG_NAME,
++ [STRING_DESCRIPTION_IDX].s = description_nokia,
++ { } /* end of list */
++};
++
++static struct usb_gadget_strings stringtab_dev = {
++ .language = 0x0409, /* en-us */
++ .strings = strings_dev,
++};
++
++static struct usb_gadget_strings *dev_strings[] = {
++ &stringtab_dev,
++ NULL,
++};
++
++static struct usb_device_descriptor device_desc = {
++ .bLength = USB_DT_DEVICE_SIZE,
++ .bDescriptorType = USB_DT_DEVICE,
++ .bcdUSB = __constant_cpu_to_le16(0x0200),
++ .bDeviceClass = USB_CLASS_COMM,
++ .idVendor = __constant_cpu_to_le16(NOKIA_VENDOR_ID),
++ .idProduct = __constant_cpu_to_le16(NOKIA_PRODUCT_ID),
++ /* .iManufacturer = DYNAMIC */
++ /* .iProduct = DYNAMIC */
++ .bNumConfigurations = 1,
++};
++
++/*-------------------------------------------------------------------------*/
++
++/* Module */
++MODULE_DESCRIPTION("Nokia composite gadget driver for N900");
++MODULE_AUTHOR("Felipe Balbi");
++MODULE_LICENSE("GPL");
++
++/*-------------------------------------------------------------------------*/
++
++static u8 hostaddr[ETH_ALEN];
++
++static int __init nokia_bind_config(struct usb_configuration *c)
++{
++ int status = 0;
++
++ status = phonet_bind_config(c);
++ if (status)
++ printk(KERN_DEBUG "could not bind phonet config\n");
++
++ status = obex_bind_config(c, 0);
++ if (status)
++ printk(KERN_DEBUG "could not bind obex config %d\n", 0);
++
++ status = obex_bind_config(c, 1);
++ if (status)
++ printk(KERN_DEBUG "could not bind obex config %d\n", 0);
++
++ status = acm_bind_config(c, 2);
++ if (status)
++ printk(KERN_DEBUG "could not bind acm config\n");
++
++ status = ecm_bind_config(c, hostaddr);
++ if (status)
++ printk(KERN_DEBUG "could not bind ecm config\n");
++
++ return status;
++}
++
++static struct usb_configuration nokia_config_500ma_driver = {
++ .label = "Bus Powered",
++ .bind = nokia_bind_config,
++ .bConfigurationValue = 1,
++ /* .iConfiguration = DYNAMIC */
++ .bmAttributes = USB_CONFIG_ATT_ONE,
++ .bMaxPower = 250, /* 500mA */
++};
++
++static struct usb_configuration nokia_config_100ma_driver = {
++ .label = "Self Powered",
++ .bind = nokia_bind_config,
++ .bConfigurationValue = 2,
++ /* .iConfiguration = DYNAMIC */
++ .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
++ .bMaxPower = 50, /* 100 mA */
++};
++
++static int __init nokia_bind(struct usb_composite_dev *cdev)
++{
++ int gcnum;
++ struct usb_gadget *gadget = cdev->gadget;
++ int status;
++
++ status = gphonet_setup(cdev->gadget);
++ if (status < 0)
++ goto err_phonet;
++
++ status = gserial_setup(cdev->gadget, 3);
++ if (status < 0)
++ goto err_serial;
++
++ status = gether_setup(cdev->gadget, hostaddr);
++ if (status < 0)
++ goto err_ether;
++
++ status = usb_string_id(cdev);
++ if (status < 0)
++ goto err_usb;
++ strings_dev[STRING_MANUFACTURER_IDX].id = status;
++
++ device_desc.iManufacturer = status;
++
++ status = usb_string_id(cdev);
++ if (status < 0)
++ goto err_usb;
++ strings_dev[STRING_PRODUCT_IDX].id = status;
++
++ device_desc.iProduct = status;
++
++ /* config description */
++ status = usb_string_id(cdev);
++ if (status < 0)
++ goto err_usb;
++ strings_dev[STRING_DESCRIPTION_IDX].id = status;
++
++ nokia_config_500ma_driver.iConfiguration = status;
++ nokia_config_100ma_driver.iConfiguration = status;
++
++ /* set up other descriptors */
++ gcnum = usb_gadget_controller_number(gadget);
++ if (gcnum >= 0)
++ device_desc.bcdDevice = cpu_to_le16(NOKIA_VERSION_NUM);
++ else {
++ /* this should only work with hw that supports altsettings
++ * and several endpoints, anything else, panic.
++ */
++ pr_err("nokia_bind: controller '%s' not recognized\n",
++ gadget->name);
++ goto err_usb;
++ }
++
++ /* finaly register the configuration */
++ status = usb_add_config(cdev, &nokia_config_500ma_driver);
++ if (status < 0)
++ goto err_usb;
++
++ status = usb_add_config(cdev, &nokia_config_100ma_driver);
++ if (status < 0)
++ goto err_usb;
++
++ dev_info(&gadget->dev, "%s\n", NOKIA_LONG_NAME);
++
++ return 0;
++
++err_usb:
++ gether_cleanup();
++err_ether:
++ gserial_cleanup();
++err_serial:
++ gphonet_cleanup();
++err_phonet:
++ return status;
++}
++
++static int __exit nokia_unbind(struct usb_composite_dev *cdev)
++{
++ gphonet_cleanup();
++ gserial_cleanup();
++ gether_cleanup();
++
++ return 0;
++}
++
++static struct usb_composite_driver nokia_driver = {
++ .name = "g_nokia",
++ .dev = &device_desc,
++ .strings = dev_strings,
++ .bind = nokia_bind,
++ .unbind = __exit_p(nokia_unbind),
++};
++
++static int __init nokia_init(void)
++{
++ return usb_composite_register(&nokia_driver);
++}
++module_init(nokia_init);
++
++static void __exit nokia_cleanup(void)
++{
++ usb_composite_unregister(&nokia_driver);
++}
++module_exit(nokia_cleanup);
++
diff --git a/usb/usb-host-ehci-adding-regulator-framework-in-ehci-omap.c-driver.patch b/usb/usb-host-ehci-adding-regulator-framework-in-ehci-omap.c-driver.patch
new file mode 100644
index 00000000000000..cb5215de0b75cd
--- /dev/null
+++ b/usb/usb-host-ehci-adding-regulator-framework-in-ehci-omap.c-driver.patch
@@ -0,0 +1,112 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:42:53 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:46 +0200
+Subject: usb: host: ehci: adding regulator framework in ehci-omap.c driver.
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Ajay Kumar Gupta <ajay.gupta@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-14-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Ajay Kumar Gupta <ajay.gupta@ti.com>
+
+OMAP3 has three HS USB ports so it can have three different regulator
+for each PHY connected to each port.
+
+Currently these regulators are assumed to be optional and driver doesn't
+fail but continue with the initialization if it doesn't get any regulators.
+
+Regulator supply names has to be mapped in board files as 'hsusbN' where
+'N' is port number and can be {0, 1 ,2}.
+
+Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ehci-omap.c | 36 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+--- a/drivers/usb/host/ehci-omap.c
++++ b/drivers/usb/host/ehci-omap.c
+@@ -37,6 +37,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/clk.h>
+ #include <linux/gpio.h>
++#include <linux/regulator/consumer.h>
+ #include <plat/usb.h>
+
+ /*
+@@ -178,6 +179,11 @@ struct ehci_hcd_omap {
+ void __iomem *uhh_base;
+ void __iomem *tll_base;
+ void __iomem *ehci_base;
++
++ /* Regulators for USB PHYs.
++ * Each PHY can have a seperate regulator.
++ */
++ struct regulator *regulator[OMAP3_HS_USB_PORTS];
+ };
+
+ /*-------------------------------------------------------------------------*/
+@@ -546,6 +552,8 @@ static int ehci_hcd_omap_probe(struct pl
+
+ int irq = platform_get_irq(pdev, 0);
+ int ret = -ENODEV;
++ int i;
++ char supply[7];
+
+ if (!pdata) {
+ dev_dbg(&pdev->dev, "missing platform_data\n");
+@@ -613,6 +621,21 @@ static int ehci_hcd_omap_probe(struct pl
+ goto err_tll_ioremap;
+ }
+
++ /* get ehci regulator and enable */
++ for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
++ if (omap->port_mode[i] != EHCI_HCD_OMAP_MODE_PHY) {
++ omap->regulator[i] = NULL;
++ continue;
++ }
++ snprintf(supply, sizeof(supply), "hsusb%d", i);
++ omap->regulator[i] = regulator_get(omap->dev, supply);
++ if (IS_ERR(omap->regulator[i]))
++ dev_dbg(&pdev->dev,
++ "failed to get ehci port%d regulator\n", i);
++ else
++ regulator_enable(omap->regulator[i]);
++ }
++
+ ret = omap_start_ehc(omap, hcd);
+ if (ret) {
+ dev_dbg(&pdev->dev, "failed to start ehci\n");
+@@ -641,6 +664,12 @@ err_add_hcd:
+ omap_stop_ehc(omap, hcd);
+
+ err_start:
++ for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
++ if (omap->regulator[i]) {
++ regulator_disable(omap->regulator[i]);
++ regulator_put(omap->regulator[i]);
++ }
++ }
+ iounmap(omap->tll_base);
+
+ err_tll_ioremap:
+@@ -674,10 +703,17 @@ static int ehci_hcd_omap_remove(struct p
+ {
+ struct ehci_hcd_omap *omap = platform_get_drvdata(pdev);
+ struct usb_hcd *hcd = ehci_to_hcd(omap->ehci);
++ int i;
+
+ usb_remove_hcd(hcd);
+ omap_stop_ehc(omap, hcd);
+ iounmap(hcd->regs);
++ for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
++ if (omap->regulator[i]) {
++ regulator_disable(omap->regulator[i]);
++ regulator_put(omap->regulator[i]);
++ }
++ }
+ iounmap(omap->tll_base);
+ iounmap(omap->uhh_base);
+ usb_put_hcd(hcd);
diff --git a/usb/usb-host-ehci-fix-missing-kfree-in-remove-path-also.patch b/usb/usb-host-ehci-fix-missing-kfree-in-remove-path-also.patch
new file mode 100644
index 00000000000000..7ec2b2c627dc2e
--- /dev/null
+++ b/usb/usb-host-ehci-fix-missing-kfree-in-remove-path-also.patch
@@ -0,0 +1,31 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:42:42 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:45 +0200
+Subject: usb: host: ehci: fix missing kfree in remove path also
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Ajay Kumar Gupta <ajay.gupta@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-13-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Ajay Kumar Gupta <ajay.gupta@ti.com>
+
+Added missing kfree() in ehci_hcd_omap_remove().
+
+Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ehci-omap.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/host/ehci-omap.c
++++ b/drivers/usb/host/ehci-omap.c
+@@ -681,6 +681,7 @@ static int ehci_hcd_omap_remove(struct p
+ iounmap(omap->tll_base);
+ iounmap(omap->uhh_base);
+ usb_put_hcd(hcd);
++ kfree(omap);
+
+ return 0;
+ }
diff --git a/usb/usb-io_ti-fix-dma-buffers-on-stack.patch b/usb/usb-io_ti-fix-dma-buffers-on-stack.patch
new file mode 100644
index 00000000000000..f9bb5a47ff903a
--- /dev/null
+++ b/usb/usb-io_ti-fix-dma-buffers-on-stack.patch
@@ -0,0 +1,173 @@
+From jhovold@gmail.com Fri Jan 15 10:44:24 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:50 +0100
+Subject: USB: io_ti: fix DMA buffers on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-7-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/io_ti.c | 66 ++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 48 insertions(+), 18 deletions(-)
+
+--- a/drivers/usb/serial/io_ti.c
++++ b/drivers/usb/serial/io_ti.c
+@@ -413,11 +413,18 @@ static int write_boot_mem(struct edgepor
+ {
+ int status = 0;
+ int i;
+- __u8 temp;
++ u8 *temp;
+
+ /* Must do a read before write */
+ if (!serial->TiReadI2C) {
+- status = read_boot_mem(serial, 0, 1, &temp);
++ temp = kmalloc(1, GFP_KERNEL);
++ if (!temp) {
++ dev_err(&serial->serial->dev->dev,
++ "%s - out of memory\n", __func__);
++ return -ENOMEM;
++ }
++ status = read_boot_mem(serial, 0, 1, temp);
++ kfree(temp);
+ if (status)
+ return status;
+ }
+@@ -935,37 +942,47 @@ static int build_i2c_fw_hdr(__u8 *header
+ static int i2c_type_bootmode(struct edgeport_serial *serial)
+ {
+ int status;
+- __u8 data;
++ u8 *data;
++
++ data = kmalloc(1, GFP_KERNEL);
++ if (!data) {
++ dev_err(&serial->serial->dev->dev,
++ "%s - out of memory\n", __func__);
++ return -ENOMEM;
++ }
+
+ /* Try to read type 2 */
+ status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
+- DTK_ADDR_SPACE_I2C_TYPE_II, 0, &data, 0x01);
++ DTK_ADDR_SPACE_I2C_TYPE_II, 0, data, 0x01);
+ if (status)
+ dbg("%s - read 2 status error = %d", __func__, status);
+ else
+- dbg("%s - read 2 data = 0x%x", __func__, data);
+- if ((!status) && (data == UMP5152 || data == UMP3410)) {
++ dbg("%s - read 2 data = 0x%x", __func__, *data);
++ if ((!status) && (*data == UMP5152 || *data == UMP3410)) {
+ dbg("%s - ROM_TYPE_II", __func__);
+ serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
+- return 0;
++ goto out;
+ }
+
+ /* Try to read type 3 */
+ status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
+- DTK_ADDR_SPACE_I2C_TYPE_III, 0, &data, 0x01);
++ DTK_ADDR_SPACE_I2C_TYPE_III, 0, data, 0x01);
+ if (status)
+ dbg("%s - read 3 status error = %d", __func__, status);
+ else
+- dbg("%s - read 2 data = 0x%x", __func__, data);
+- if ((!status) && (data == UMP5152 || data == UMP3410)) {
++ dbg("%s - read 2 data = 0x%x", __func__, *data);
++ if ((!status) && (*data == UMP5152 || *data == UMP3410)) {
+ dbg("%s - ROM_TYPE_III", __func__);
+ serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III;
+- return 0;
++ goto out;
+ }
+
+ dbg("%s - Unknown", __func__);
+ serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
+- return -ENODEV;
++ status = -ENODEV;
++out:
++ kfree(data);
++ return status;
+ }
+
+ static int bulk_xfer(struct usb_serial *serial, void *buffer,
+@@ -1113,7 +1130,7 @@ static int download_fw(struct edgeport_s
+ I2C_DESC_TYPE_FIRMWARE_BASIC, rom_desc);
+ if (start_address != 0) {
+ struct ti_i2c_firmware_rec *firmware_version;
+- __u8 record;
++ u8 *record;
+
+ dbg("%s - Found Type FIRMWARE (Type 2) record",
+ __func__);
+@@ -1165,6 +1182,15 @@ static int download_fw(struct edgeport_s
+ OperationalMajorVersion,
+ OperationalMinorVersion);
+
++ record = kmalloc(1, GFP_KERNEL);
++ if (!record) {
++ dev_err(dev, "%s - out of memory.\n",
++ __func__);
++ kfree(firmware_version);
++ kfree(rom_desc);
++ kfree(ti_manuf_desc);
++ return -ENOMEM;
++ }
+ /* In order to update the I2C firmware we must
+ * change the type 2 record to type 0xF2. This
+ * will force the UMP to come up in Boot Mode.
+@@ -1177,13 +1203,14 @@ static int download_fw(struct edgeport_s
+ * firmware will update the record type from
+ * 0xf2 to 0x02.
+ */
+- record = I2C_DESC_TYPE_FIRMWARE_BLANK;
++ *record = I2C_DESC_TYPE_FIRMWARE_BLANK;
+
+ /* Change the I2C Firmware record type to
+ 0xf2 to trigger an update */
+ status = write_rom(serial, start_address,
+- sizeof(record), &record);
++ sizeof(*record), record);
+ if (status) {
++ kfree(record);
+ kfree(firmware_version);
+ kfree(rom_desc);
+ kfree(ti_manuf_desc);
+@@ -1196,19 +1223,21 @@ static int download_fw(struct edgeport_s
+ */
+ status = read_rom(serial,
+ start_address,
+- sizeof(record),
+- &record);
++ sizeof(*record),
++ record);
+ if (status) {
++ kfree(record);
+ kfree(firmware_version);
+ kfree(rom_desc);
+ kfree(ti_manuf_desc);
+ return status;
+ }
+
+- if (record != I2C_DESC_TYPE_FIRMWARE_BLANK) {
++ if (*record != I2C_DESC_TYPE_FIRMWARE_BLANK) {
+ dev_err(dev,
+ "%s - error resetting device\n",
+ __func__);
++ kfree(record);
+ kfree(firmware_version);
+ kfree(rom_desc);
+ kfree(ti_manuf_desc);
+@@ -1226,6 +1255,7 @@ static int download_fw(struct edgeport_s
+ __func__, status);
+
+ /* return an error on purpose. */
++ kfree(record);
+ kfree(firmware_version);
+ kfree(rom_desc);
+ kfree(ti_manuf_desc);
diff --git a/usb/usb-keyspan_pda-fix-dma-buffers-on-stack.patch b/usb/usb-keyspan_pda-fix-dma-buffers-on-stack.patch
new file mode 100644
index 00000000000000..d3e52b0bab0854
--- /dev/null
+++ b/usb/usb-keyspan_pda-fix-dma-buffers-on-stack.patch
@@ -0,0 +1,130 @@
+From jhovold@gmail.com Fri Jan 15 10:44:34 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:51 +0100
+Subject: USB: keyspan_pda: fix DMA buffers on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-8-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/keyspan_pda.c | 45 ++++++++++++++++++++++++++++-----------
+ 1 file changed, 33 insertions(+), 12 deletions(-)
+
+--- a/drivers/usb/serial/keyspan_pda.c
++++ b/drivers/usb/serial/keyspan_pda.c
+@@ -429,13 +429,20 @@ static int keyspan_pda_get_modem_info(st
+ unsigned char *value)
+ {
+ int rc;
+- unsigned char data;
++ u8 *data;
++
++ data = kmalloc(1, GFP_KERNEL);
++ if (!data)
++ return -ENOMEM;
++
+ rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ 3, /* get pins */
+ USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
+- 0, 0, &data, 1, 2000);
++ 0, 0, data, 1, 2000);
+ if (rc >= 0)
+- *value = data;
++ *value = *data;
++
++ kfree(data);
+ return rc;
+ }
+
+@@ -543,7 +550,14 @@ static int keyspan_pda_write(struct tty_
+ device how much room it really has. This is done only on
+ scheduler time, since usb_control_msg() sleeps. */
+ if (count > priv->tx_room && !in_interrupt()) {
+- unsigned char room;
++ u8 *room;
++
++ room = kmalloc(1, GFP_KERNEL);
++ if (!room) {
++ rc = -ENOMEM;
++ goto exit;
++ }
++
+ rc = usb_control_msg(serial->dev,
+ usb_rcvctrlpipe(serial->dev, 0),
+ 6, /* write_room */
+@@ -551,9 +565,14 @@ static int keyspan_pda_write(struct tty_
+ | USB_DIR_IN,
+ 0, /* value: 0 means "remaining room" */
+ 0, /* index */
+- &room,
++ room,
+ 1,
+ 2000);
++ if (rc > 0) {
++ dbg(" roomquery says %d", *room);
++ priv->tx_room = *room;
++ }
++ kfree(room);
+ if (rc < 0) {
+ dbg(" roomquery failed");
+ goto exit;
+@@ -563,8 +582,6 @@ static int keyspan_pda_write(struct tty_
+ rc = -EIO; /* device didn't return any data */
+ goto exit;
+ }
+- dbg(" roomquery says %d", room);
+- priv->tx_room = room;
+ }
+ if (count > priv->tx_room) {
+ /* we're about to completely fill the Tx buffer, so
+@@ -684,18 +701,22 @@ static int keyspan_pda_open(struct tty_s
+ struct usb_serial_port *port)
+ {
+ struct usb_serial *serial = port->serial;
+- unsigned char room;
++ u8 *room;
+ int rc = 0;
+ struct keyspan_pda_private *priv;
+
+ /* find out how much room is in the Tx ring */
++ room = kmalloc(1, GFP_KERNEL);
++ if (!room)
++ return -ENOMEM;
++
+ rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ 6, /* write_room */
+ USB_TYPE_VENDOR | USB_RECIP_INTERFACE
+ | USB_DIR_IN,
+ 0, /* value */
+ 0, /* index */
+- &room,
++ room,
+ 1,
+ 2000);
+ if (rc < 0) {
+@@ -708,8 +729,8 @@ static int keyspan_pda_open(struct tty_s
+ goto error;
+ }
+ priv = usb_get_serial_port_data(port);
+- priv->tx_room = room;
+- priv->tx_throttled = room ? 0 : 1;
++ priv->tx_room = *room;
++ priv->tx_throttled = *room ? 0 : 1;
+
+ /*Start reading from the device*/
+ port->interrupt_in_urb->dev = serial->dev;
+@@ -718,8 +739,8 @@ static int keyspan_pda_open(struct tty_s
+ dbg("%s - usb_submit_urb(read int) failed", __func__);
+ goto error;
+ }
+-
+ error:
++ kfree(room);
+ return rc;
+ }
+ static void keyspan_pda_close(struct usb_serial_port *port)
diff --git a/usb/usb-kl5kusb105-fix-dma-buffers-on-stack.patch b/usb/usb-kl5kusb105-fix-dma-buffers-on-stack.patch
new file mode 100644
index 00000000000000..96da1267f5e293
--- /dev/null
+++ b/usb/usb-kl5kusb105-fix-dma-buffers-on-stack.patch
@@ -0,0 +1,157 @@
+From jhovold@gmail.com Fri Jan 15 10:44:46 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:52 +0100
+Subject: USB: kl5kusb105: fix DMA buffers on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, Oliver Neukum <oliver@neukum.name>
+Message-ID: <1262037718-31424-9-git-send-email-jhovold@gmail.com>
+
+
+Cc: Oliver Neukum <oliver@neukum.name>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/kl5kusb105.c | 63 ++++++++++++++++++++++++++++------------
+ 1 file changed, 45 insertions(+), 18 deletions(-)
+
+--- a/drivers/usb/serial/kl5kusb105.c
++++ b/drivers/usb/serial/kl5kusb105.c
+@@ -212,10 +212,19 @@ static int klsi_105_get_line_state(struc
+ unsigned long *line_state_p)
+ {
+ int rc;
+- __u8 status_buf[KLSI_STATUSBUF_LEN] = { -1, -1};
++ u8 *status_buf;
+ __u16 status;
+
+ dev_info(&port->serial->dev->dev, "sending SIO Poll request\n");
++
++ status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL);
++ if (!status_buf) {
++ dev_err(&port->dev, "%s - out of memory for status buffer.\n",
++ __func__);
++ return -ENOMEM;
++ }
++ status_buf[0] = 0xff;
++ status_buf[1] = 0xff;
+ rc = usb_control_msg(port->serial->dev,
+ usb_rcvctrlpipe(port->serial->dev, 0),
+ KL5KUSB105A_SIO_POLL,
+@@ -236,6 +245,8 @@ static int klsi_105_get_line_state(struc
+
+ *line_state_p = klsi_105_status2linestate(status);
+ }
++
++ kfree(status_buf);
+ return rc;
+ }
+
+@@ -364,7 +375,7 @@ static int klsi_105_open(struct tty_str
+ int rc;
+ int i;
+ unsigned long line_state;
+- struct klsi_105_port_settings cfg;
++ struct klsi_105_port_settings *cfg;
+ unsigned long flags;
+
+ dbg("%s port %d", __func__, port->number);
+@@ -376,12 +387,18 @@ static int klsi_105_open(struct tty_str
+ * Then read the modem line control and store values in
+ * priv->line_state.
+ */
+- cfg.pktlen = 5;
+- cfg.baudrate = kl5kusb105a_sio_b9600;
+- cfg.databits = kl5kusb105a_dtb_8;
+- cfg.unknown1 = 0;
+- cfg.unknown2 = 1;
+- klsi_105_chg_port_settings(port, &cfg);
++ cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
++ if (!cfg) {
++ dev_err(&port->dev, "%s - out of memory for config buffer.\n",
++ __func__);
++ return -ENOMEM;
++ }
++ cfg->pktlen = 5;
++ cfg->baudrate = kl5kusb105a_sio_b9600;
++ cfg->databits = kl5kusb105a_dtb_8;
++ cfg->unknown1 = 0;
++ cfg->unknown2 = 1;
++ klsi_105_chg_port_settings(port, cfg);
+
+ /* set up termios structure */
+ spin_lock_irqsave(&priv->lock, flags);
+@@ -391,11 +408,11 @@ static int klsi_105_open(struct tty_str
+ priv->termios.c_lflag = tty->termios->c_lflag;
+ for (i = 0; i < NCCS; i++)
+ priv->termios.c_cc[i] = tty->termios->c_cc[i];
+- priv->cfg.pktlen = cfg.pktlen;
+- priv->cfg.baudrate = cfg.baudrate;
+- priv->cfg.databits = cfg.databits;
+- priv->cfg.unknown1 = cfg.unknown1;
+- priv->cfg.unknown2 = cfg.unknown2;
++ priv->cfg.pktlen = cfg->pktlen;
++ priv->cfg.baudrate = cfg->baudrate;
++ priv->cfg.databits = cfg->databits;
++ priv->cfg.unknown1 = cfg->unknown1;
++ priv->cfg.unknown2 = cfg->unknown2;
+ spin_unlock_irqrestore(&priv->lock, flags);
+
+ /* READ_ON and urb submission */
+@@ -441,6 +458,7 @@ static int klsi_105_open(struct tty_str
+ retval = rc;
+
+ exit:
++ kfree(cfg);
+ return retval;
+ } /* klsi_105_open */
+
+@@ -714,10 +732,17 @@ static void klsi_105_set_termios(struct
+ unsigned int old_iflag = old_termios->c_iflag;
+ unsigned int cflag = tty->termios->c_cflag;
+ unsigned int old_cflag = old_termios->c_cflag;
+- struct klsi_105_port_settings cfg;
++ struct klsi_105_port_settings *cfg;
+ unsigned long flags;
+ speed_t baud;
+
++ cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
++ if (!cfg) {
++ dev_err(&port->dev, "%s - out of memory for config buffer.\n",
++ __func__);
++ return;
++ }
++
+ /* lock while we are modifying the settings */
+ spin_lock_irqsave(&priv->lock, flags);
+
+@@ -793,11 +818,11 @@ static void klsi_105_set_termios(struct
+ case CS5:
+ dbg("%s - 5 bits/byte not supported", __func__);
+ spin_unlock_irqrestore(&priv->lock, flags);
+- return ;
++ goto err;
+ case CS6:
+ dbg("%s - 6 bits/byte not supported", __func__);
+ spin_unlock_irqrestore(&priv->lock, flags);
+- return ;
++ goto err;
+ case CS7:
+ priv->cfg.databits = kl5kusb105a_dtb_7;
+ break;
+@@ -856,11 +881,13 @@ static void klsi_105_set_termios(struct
+ #endif
+ ;
+ }
+- memcpy(&cfg, &priv->cfg, sizeof(cfg));
++ memcpy(cfg, &priv->cfg, sizeof(*cfg));
+ spin_unlock_irqrestore(&priv->lock, flags);
+
+ /* now commit changes to device */
+- klsi_105_chg_port_settings(port, &cfg);
++ klsi_105_chg_port_settings(port, cfg);
++err:
++ kfree(cfg);
+ } /* klsi_105_set_termios */
+
+
diff --git a/usb/usb-kobil_sct-clean-up-kobil_set_termios.patch b/usb/usb-kobil_sct-clean-up-kobil_set_termios.patch
new file mode 100644
index 00000000000000..3df641fc8ee28a
--- /dev/null
+++ b/usb/usb-kobil_sct-clean-up-kobil_set_termios.patch
@@ -0,0 +1,71 @@
+From jhovold@gmail.com Fri Jan 15 10:46:17 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:58 +0100
+Subject: USB: kobil_sct: clean up kobil_set_termios
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-15-git-send-email-jhovold@gmail.com>
+
+
+Kill string that is allocated and generated using speed and parity
+settings but is never used (and never has been).
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/kobil_sct.c | 22 ++++------------------
+ 1 file changed, 4 insertions(+), 18 deletions(-)
+
+--- a/drivers/usb/serial/kobil_sct.c
++++ b/drivers/usb/serial/kobil_sct.c
+@@ -624,7 +624,6 @@ static void kobil_set_termios(struct tty
+ unsigned short urb_val = 0;
+ int c_cflag = tty->termios->c_cflag;
+ speed_t speed;
+- void *settings;
+
+ priv = usb_get_serial_port_data(port);
+ if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
+@@ -647,25 +646,13 @@ static void kobil_set_termios(struct tty
+ }
+ urb_val |= (c_cflag & CSTOPB) ? SUSBCR_SPASB_2StopBits :
+ SUSBCR_SPASB_1StopBit;
+-
+- settings = kzalloc(50, GFP_KERNEL);
+- if (!settings)
+- return;
+-
+- sprintf(settings, "%d ", speed);
+-
+ if (c_cflag & PARENB) {
+- if (c_cflag & PARODD) {
++ if (c_cflag & PARODD)
+ urb_val |= SUSBCR_SPASB_OddParity;
+- strcat(settings, "Odd Parity");
+- } else {
++ else
+ urb_val |= SUSBCR_SPASB_EvenParity;
+- strcat(settings, "Even Parity");
+- }
+- } else {
++ } else
+ urb_val |= SUSBCR_SPASB_NoParity;
+- strcat(settings, "No Parity");
+- }
+ tty->termios->c_cflag &= ~CMSPAR;
+ tty_encode_baud_rate(tty, speed, speed);
+
+@@ -675,11 +662,10 @@ static void kobil_set_termios(struct tty
+ USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
+ urb_val,
+ 0,
+- settings,
++ NULL,
+ 0,
+ KOBIL_TIMEOUT
+ );
+- kfree(settings);
+ }
+
+ static int kobil_ioctl(struct tty_struct *tty, struct file *file,
diff --git a/usb/usb-mos7720-fix-dma-buffers-on-stack-and-clean-up-send_mos_cmd.patch b/usb/usb-mos7720-fix-dma-buffers-on-stack-and-clean-up-send_mos_cmd.patch
new file mode 100644
index 00000000000000..82a4bc6d3e311b
--- /dev/null
+++ b/usb/usb-mos7720-fix-dma-buffers-on-stack-and-clean-up-send_mos_cmd.patch
@@ -0,0 +1,74 @@
+From jhovold@gmail.com Fri Jan 15 10:44:57 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:54 +0100
+Subject: USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-11-git-send-email-jhovold@gmail.com>
+
+
+Change data-argument type from (void *) to (u8 *) to prevent endianess
+problems.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/mos7720.c | 34 +++++++++++++++++-----------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+--- a/drivers/usb/serial/mos7720.c
++++ b/drivers/usb/serial/mos7720.c
+@@ -275,13 +275,11 @@ static void mos7720_bulk_out_data_callba
+ * this function will be used for sending command to device
+ */
+ static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value,
+- __u16 index, void *data)
++ __u16 index, u8 *data)
+ {
+ int status;
+- unsigned int pipe;
++ u8 *buf;
+ u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
+- __u8 requesttype;
+- __u16 size = 0x0000;
+
+ if (value < MOS_MAX_PORT) {
+ if (product == MOSCHIP_DEVICE_ID_7715)
+@@ -298,21 +296,23 @@ static int send_mos_cmd(struct usb_seria
+ }
+
+ if (request == MOS_WRITE) {
+- request = (__u8)MOS_WRITE;
+- requesttype = (__u8)0x40;
+- value = value + (__u16)*((unsigned char *)data);
+- data = NULL;
+- pipe = usb_sndctrlpipe(serial->dev, 0);
++ value = value + *data;
++ status = usb_control_msg(serial->dev,
++ usb_sndctrlpipe(serial->dev, 0), MOS_WRITE,
++ 0x40, value, index, NULL, 0, MOS_WDR_TIMEOUT);
+ } else {
+- request = (__u8)MOS_READ;
+- requesttype = (__u8)0xC0;
+- size = 0x01;
+- pipe = usb_rcvctrlpipe(serial->dev, 0);
++ buf = kmalloc(1, GFP_KERNEL);
++ if (!buf) {
++ status = -ENOMEM;
++ goto out;
++ }
++ status = usb_control_msg(serial->dev,
++ usb_rcvctrlpipe(serial->dev, 0), MOS_READ,
++ 0xc0, value, index, buf, 1, MOS_WDR_TIMEOUT);
++ *data = *buf;
++ kfree(buf);
+ }
+-
+- status = usb_control_msg(serial->dev, pipe, request, requesttype,
+- value, index, data, size, MOS_WDR_TIMEOUT);
+-
++out:
+ if (status < 0)
+ dbg("Command Write failed Value %x index %x\n", value, index);
+
diff --git a/usb/usb-mos7840-fix-dma-buffers-on-stack-and-endianess-bugs.patch b/usb/usb-mos7840-fix-dma-buffers-on-stack-and-endianess-bugs.patch
new file mode 100644
index 00000000000000..1b4dcffd6786b2
--- /dev/null
+++ b/usb/usb-mos7840-fix-dma-buffers-on-stack-and-endianess-bugs.patch
@@ -0,0 +1,67 @@
+From jhovold@gmail.com Fri Jan 15 10:45:14 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:55 +0100
+Subject: USB: mos7840: fix DMA buffers on stack and endianess bugs
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-12-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/mos7840.c | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/serial/mos7840.c
++++ b/drivers/usb/serial/mos7840.c
+@@ -283,12 +283,19 @@ static int mos7840_get_reg_sync(struct u
+ {
+ struct usb_device *dev = port->serial->dev;
+ int ret = 0;
++ u8 *buf;
++
++ buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
+
+ ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
+- MCS_RD_RTYPE, 0, reg, val, VENDOR_READ_LENGTH,
++ MCS_RD_RTYPE, 0, reg, buf, VENDOR_READ_LENGTH,
+ MOS_WDR_TIMEOUT);
++ *val = buf[0];
+ dbg("mos7840_get_reg_sync offset is %x, return val %x", reg, *val);
+- *val = (*val) & 0x00ff;
++
++ kfree(buf);
+ return ret;
+ }
+
+@@ -341,6 +348,11 @@ static int mos7840_get_uart_reg(struct u
+ struct usb_device *dev = port->serial->dev;
+ int ret = 0;
+ __u16 Wval;
++ u8 *buf;
++
++ buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
+
+ /* dbg("application number is %4x",
+ (((__u16)port->number - (__u16)(port->serial->minor))+1)<<8); */
+@@ -364,9 +376,11 @@ static int mos7840_get_uart_reg(struct u
+ }
+ }
+ ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
+- MCS_RD_RTYPE, Wval, reg, val, VENDOR_READ_LENGTH,
++ MCS_RD_RTYPE, Wval, reg, buf, VENDOR_READ_LENGTH,
+ MOS_WDR_TIMEOUT);
+- *val = (*val) & 0x00ff;
++ *val = buf[0];
++
++ kfree(buf);
+ return ret;
+ }
+
diff --git a/usb/usb-musb-add-new-fifo-table-for-a-omap3-errata.patch b/usb/usb-musb-add-new-fifo-table-for-a-omap3-errata.patch
new file mode 100644
index 00000000000000..82021323a90f06
--- /dev/null
+++ b/usb/usb-musb-add-new-fifo-table-for-a-omap3-errata.patch
@@ -0,0 +1,80 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:34:10 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:34 +0200
+Subject: USB: musb: Add new fifo table for a OMAP3 errata
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Ajay Kumar Gupta <ajay.gupta@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-2-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Ajay Kumar Gupta <ajay.gupta@ti.com>
+
+We have observed MSC data read corruption when USB LAN device is
+also connected and it's interface is up.
+
+Silicon team has confirmed an errata where in all the active
+transfers should use FIFO space either in first 8K or next 8K.
+So far we have observed the issue in above use case scenario.
+
+As a workaround to it, adding a new FIFO config (5) fitting well
+within first 8K which can be used for such use cases.
+
+Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Acked-by: Anand Gadiyar <gadiyar@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musb_core.c | 34 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 34 insertions(+)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -1095,6 +1095,36 @@ static struct fifo_cfg __initdata mode_4
+ { .hw_ep_num = 15, .style = FIFO_RXTX, .maxpacket = 1024, },
+ };
+
++/* mode 5 - fits in 8KB */
++static struct fifo_cfg __initdata mode_5_cfg[] = {
++{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
++{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
++{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, },
++{ .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, },
++{ .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, },
++{ .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, },
++{ .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, },
++{ .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, },
++{ .hw_ep_num = 5, .style = FIFO_TX, .maxpacket = 512, },
++{ .hw_ep_num = 5, .style = FIFO_RX, .maxpacket = 512, },
++{ .hw_ep_num = 6, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 6, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 7, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 7, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 8, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 8, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 9, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 9, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 10, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 10, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 11, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 11, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 12, .style = FIFO_TX, .maxpacket = 32, },
++{ .hw_ep_num = 12, .style = FIFO_RX, .maxpacket = 32, },
++{ .hw_ep_num = 13, .style = FIFO_RXTX, .maxpacket = 512, },
++{ .hw_ep_num = 14, .style = FIFO_RXTX, .maxpacket = 1024, },
++{ .hw_ep_num = 15, .style = FIFO_RXTX, .maxpacket = 1024, },
++};
+
+ /*
+ * configure a fifo; for non-shared endpoints, this may be called
+@@ -1210,6 +1240,10 @@ static int __init ep_config_from_table(s
+ cfg = mode_4_cfg;
+ n = ARRAY_SIZE(mode_4_cfg);
+ break;
++ case 5:
++ cfg = mode_5_cfg;
++ n = ARRAY_SIZE(mode_5_cfg);
++ break;
+ }
+
+ printk(KERN_DEBUG "%s: setup fifo_mode %d\n",
diff --git a/usb/usb-musb-clean-up-commit-workaround-blackfin-fifo-anomalies.patch b/usb/usb-musb-clean-up-commit-workaround-blackfin-fifo-anomalies.patch
new file mode 100644
index 00000000000000..605adf3288bb16
--- /dev/null
+++ b/usb/usb-musb-clean-up-commit-workaround-blackfin-fifo-anomalies.patch
@@ -0,0 +1,98 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:39:38 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:39 +0200
+Subject: usb: musb: clean up commit 'workaround Blackfin FIFO anomalies'
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Bryan Wu <cooloney@kernel.org>, Cliff Cai <cliff.cai@analog.com>, Mike Frysinger <vapier@gentoo.org>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-7-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Bryan Wu <cooloney@kernel.org>
+
+The version applied had a few comments which are now
+done.
+
+Thanks to Sergei for pointing out.
+
+Signed-off-by: Bryan Wu <cooloney@kernel.org>
+Signed-off-by: Cliff Cai <cliff.cai@analog.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/blackfin.c | 28 +++++++++++++---------------
+ 1 file changed, 13 insertions(+), 15 deletions(-)
+
+--- a/drivers/usb/musb/blackfin.c
++++ b/drivers/usb/musb/blackfin.c
+@@ -30,7 +30,6 @@ void musb_write_fifo(struct musb_hw_ep *
+ void __iomem *fifo = hw_ep->fifo;
+ void __iomem *epio = hw_ep->regs;
+ u8 epnum = hw_ep->epnum;
+- u16 dma_reg = 0;
+
+ prefetch((u8 *)src);
+
+@@ -42,15 +41,17 @@ void musb_write_fifo(struct musb_hw_ep *
+ dump_fifo_data(src, len);
+
+ if (!ANOMALY_05000380 && epnum != 0) {
+- flush_dcache_range((unsigned int)src,
+- (unsigned int)(src + len));
++ u16 dma_reg;
++
++ flush_dcache_range((unsigned long)src,
++ (unsigned long)(src + len));
+
+ /* Setup DMA address register */
+- dma_reg = (u16) ((u32) src & 0xFFFF);
++ dma_reg = (u32)src;
+ bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
+ SSYNC();
+
+- dma_reg = (u16) (((u32) src >> 16) & 0xFFFF);
++ dma_reg = (u32)src >> 16;
+ bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
+ SSYNC();
+
+@@ -79,12 +80,9 @@ void musb_write_fifo(struct musb_hw_ep *
+ SSYNC();
+
+ if (unlikely((unsigned long)src & 0x01))
+- outsw_8((unsigned long)fifo, src,
+- len & 0x01 ? (len >> 1) + 1 : len >> 1);
++ outsw_8((unsigned long)fifo, src, (len + 1) >> 1);
+ else
+- outsw((unsigned long)fifo, src,
+- len & 0x01 ? (len >> 1) + 1 : len >> 1);
+-
++ outsw((unsigned long)fifo, src, (len + 1) >> 1);
+ }
+ }
+ /*
+@@ -94,19 +92,19 @@ void musb_read_fifo(struct musb_hw_ep *h
+ {
+ void __iomem *fifo = hw_ep->fifo;
+ u8 epnum = hw_ep->epnum;
+- u16 dma_reg = 0;
+
+ if (ANOMALY_05000467 && epnum != 0) {
++ u16 dma_reg;
+
+- invalidate_dcache_range((unsigned int)dst,
+- (unsigned int)(dst + len));
++ invalidate_dcache_range((unsigned long)dst,
++ (unsigned long)(dst + len));
+
+ /* Setup DMA address register */
+- dma_reg = (u16) ((u32) dst & 0xFFFF);
++ dma_reg = (u32)dst;
+ bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
+ SSYNC();
+
+- dma_reg = (u16) (((u32) dst >> 16) & 0xFFFF);
++ dma_reg = (u32)dst >> 16;
+ bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
+ SSYNC();
+
diff --git a/usb/usb-musb-fix-cppi_channel_abort-function-to-handle-tx-abort-correctly.patch b/usb/usb-musb-fix-cppi_channel_abort-function-to-handle-tx-abort-correctly.patch
new file mode 100644
index 00000000000000..402042426e56ef
--- /dev/null
+++ b/usb/usb-musb-fix-cppi_channel_abort-function-to-handle-tx-abort-correctly.patch
@@ -0,0 +1,99 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:39:23 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:38 +0200
+Subject: usb: musb: Fix cppi_channel_abort() function to handle Tx abort correctly
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Swaminathan S <swami.iyer@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-6-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Swaminathan S <swami.iyer@ti.com>
+
+This patch fixes the Tx abort/teardown logic. We now wait for the teardown
+completion interrupt and acknowledge the same by setting the tx_complete
+register to 0.
+
+This change is needed to ensure that abort processing works on DM365 platform.
+Without this change after completion of abort processing the system is
+overwhelmed with continuous stream of abort interrupts.
+
+This change has been tested on all CPPI3.x platforms (DM644x, DM646x, DM35x,
+DM36x).
+
+Signed-off-by: Swaminathan S <swami.iyer@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/cppi_dma.c | 33 ++++++++++-----------------------
+ 1 file changed, 10 insertions(+), 23 deletions(-)
+
+--- a/drivers/usb/musb/cppi_dma.c
++++ b/drivers/usb/musb/cppi_dma.c
+@@ -1191,8 +1191,13 @@ irqreturn_t cppi_interrupt(int irq, void
+
+ bd = tx_ch->head;
+
++ /*
++ * If Head is null then this could mean that a abort interrupt
++ * that needs to be acknowledged.
++ */
+ if (NULL == bd) {
+ DBG(1, "null BD\n");
++ tx_ram->tx_complete = 0;
+ continue;
+ }
+
+@@ -1412,15 +1417,6 @@ static int cppi_channel_abort(struct dma
+
+ if (cppi_ch->transmit) {
+ struct cppi_tx_stateram __iomem *tx_ram;
+- int enabled;
+-
+- /* mask interrupts raised to signal teardown complete. */
+- enabled = musb_readl(tibase, DAVINCI_TXCPPI_INTENAB_REG)
+- & (1 << cppi_ch->index);
+- if (enabled)
+- musb_writel(tibase, DAVINCI_TXCPPI_INTCLR_REG,
+- (1 << cppi_ch->index));
+-
+ /* REVISIT put timeouts on these controller handshakes */
+
+ cppi_dump_tx(6, cppi_ch, " (teardown)");
+@@ -1435,7 +1431,6 @@ static int cppi_channel_abort(struct dma
+ do {
+ value = musb_readl(&tx_ram->tx_complete, 0);
+ } while (0xFFFFFFFC != value);
+- musb_writel(&tx_ram->tx_complete, 0, 0xFFFFFFFC);
+
+ /* FIXME clean up the transfer state ... here?
+ * the completion routine should get called with
+@@ -1448,23 +1443,15 @@ static int cppi_channel_abort(struct dma
+ musb_writew(regs, MUSB_TXCSR, value);
+ musb_writew(regs, MUSB_TXCSR, value);
+
+- /* While we scrub the TX state RAM, ensure that we clean
+- * up any interrupt that's currently asserted:
++ /*
+ * 1. Write to completion Ptr value 0x1(bit 0 set)
+ * (write back mode)
+- * 2. Write to completion Ptr value 0x0(bit 0 cleared)
+- * (compare mode)
+- * Value written is compared(for bits 31:2) and when
+- * equal, interrupt is deasserted.
++ * 2. Wait for abort interrupt and then put the channel in
++ * compare mode by writing 1 to the tx_complete register.
+ */
+ cppi_reset_tx(tx_ram, 1);
+- musb_writel(&tx_ram->tx_complete, 0, 0);
+-
+- /* re-enable interrupt */
+- if (enabled)
+- musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG,
+- (1 << cppi_ch->index));
+-
++ cppi_ch->head = 0;
++ musb_writel(&tx_ram->tx_complete, 0, 1);
+ cppi_dump_tx(5, cppi_ch, " (done teardown)");
+
+ /* REVISIT tx side _should_ clean up the same way
diff --git a/usb/usb-musb-handle-irqs-in-the-order-dictated-by-programming-guide.patch b/usb/usb-musb-handle-irqs-in-the-order-dictated-by-programming-guide.patch
new file mode 100644
index 00000000000000..6e16aae4444288
--- /dev/null
+++ b/usb/usb-musb-handle-irqs-in-the-order-dictated-by-programming-guide.patch
@@ -0,0 +1,326 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:39:55 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:40 +0200
+Subject: usb: musb: handle irqs in the order dictated by programming guide
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Arnaud Mandy <ext-arnaud.2.mandy@nokia.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-8-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Arnaud Mandy <ext-arnaud.2.mandy@nokia.com>
+
+MUSB's programming guide dictates how we should handle its
+irqs and in which order. Follow that.
+
+Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@nokia.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musb_core.c | 255 +++++++++++++++++++------------------------
+ 1 file changed, 116 insertions(+), 139 deletions(-)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -557,6 +557,69 @@ static irqreturn_t musb_stage0_irq(struc
+ handled = IRQ_HANDLED;
+ }
+
++
++ if (int_usb & MUSB_INTR_SUSPEND) {
++ DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
++ otg_state_string(musb), devctl, power);
++ handled = IRQ_HANDLED;
++
++ switch (musb->xceiv->state) {
++#ifdef CONFIG_USB_MUSB_OTG
++ case OTG_STATE_A_PERIPHERAL:
++ /* We also come here if the cable is removed, since
++ * this silicon doesn't report ID-no-longer-grounded.
++ *
++ * We depend on T(a_wait_bcon) to shut us down, and
++ * hope users don't do anything dicey during this
++ * undesired detour through A_WAIT_BCON.
++ */
++ musb_hnp_stop(musb);
++ usb_hcd_resume_root_hub(musb_to_hcd(musb));
++ musb_root_disconnect(musb);
++ musb_platform_try_idle(musb, jiffies
++ + msecs_to_jiffies(musb->a_wait_bcon
++ ? : OTG_TIME_A_WAIT_BCON));
++
++ break;
++#endif
++ case OTG_STATE_B_IDLE:
++ if (!musb->is_active)
++ break;
++ case OTG_STATE_B_PERIPHERAL:
++ musb_g_suspend(musb);
++ musb->is_active = is_otg_enabled(musb)
++ && musb->xceiv->gadget->b_hnp_enable;
++ if (musb->is_active) {
++#ifdef CONFIG_USB_MUSB_OTG
++ musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
++ DBG(1, "HNP: Setting timer for b_ase0_brst\n");
++ mod_timer(&musb->otg_timer, jiffies
++ + msecs_to_jiffies(
++ OTG_TIME_B_ASE0_BRST));
++#endif
++ }
++ break;
++ case OTG_STATE_A_WAIT_BCON:
++ if (musb->a_wait_bcon != 0)
++ musb_platform_try_idle(musb, jiffies
++ + msecs_to_jiffies(musb->a_wait_bcon));
++ break;
++ case OTG_STATE_A_HOST:
++ musb->xceiv->state = OTG_STATE_A_SUSPEND;
++ musb->is_active = is_otg_enabled(musb)
++ && musb->xceiv->host->b_hnp_enable;
++ break;
++ case OTG_STATE_B_HOST:
++ /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
++ DBG(1, "REVISIT: SUSPEND as B_HOST\n");
++ break;
++ default:
++ /* "should not happen" */
++ musb->is_active = 0;
++ break;
++ }
++ }
++
+ if (int_usb & MUSB_INTR_CONNECT) {
+ struct usb_hcd *hcd = musb_to_hcd(musb);
+
+@@ -625,10 +688,61 @@ b_host:
+ }
+ #endif /* CONFIG_USB_MUSB_HDRC_HCD */
+
++ if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
++ DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n",
++ otg_state_string(musb),
++ MUSB_MODE(musb), devctl);
++ handled = IRQ_HANDLED;
++
++ switch (musb->xceiv->state) {
++#ifdef CONFIG_USB_MUSB_HDRC_HCD
++ case OTG_STATE_A_HOST:
++ case OTG_STATE_A_SUSPEND:
++ usb_hcd_resume_root_hub(musb_to_hcd(musb));
++ musb_root_disconnect(musb);
++ if (musb->a_wait_bcon != 0 && is_otg_enabled(musb))
++ musb_platform_try_idle(musb, jiffies
++ + msecs_to_jiffies(musb->a_wait_bcon));
++ break;
++#endif /* HOST */
++#ifdef CONFIG_USB_MUSB_OTG
++ case OTG_STATE_B_HOST:
++ /* REVISIT this behaves for "real disconnect"
++ * cases; make sure the other transitions from
++ * from B_HOST act right too. The B_HOST code
++ * in hnp_stop() is currently not used...
++ */
++ musb_root_disconnect(musb);
++ musb_to_hcd(musb)->self.is_b_host = 0;
++ musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
++ MUSB_DEV_MODE(musb);
++ musb_g_disconnect(musb);
++ break;
++ case OTG_STATE_A_PERIPHERAL:
++ musb_hnp_stop(musb);
++ musb_root_disconnect(musb);
++ /* FALLTHROUGH */
++ case OTG_STATE_B_WAIT_ACON:
++ /* FALLTHROUGH */
++#endif /* OTG */
++#ifdef CONFIG_USB_GADGET_MUSB_HDRC
++ case OTG_STATE_B_PERIPHERAL:
++ case OTG_STATE_B_IDLE:
++ musb_g_disconnect(musb);
++ break;
++#endif /* GADGET */
++ default:
++ WARNING("unhandled DISCONNECT transition (%s)\n",
++ otg_state_string(musb));
++ break;
++ }
++ }
++
+ /* mentor saves a bit: bus reset and babble share the same irq.
+ * only host sees babble; only peripheral sees bus reset.
+ */
+ if (int_usb & MUSB_INTR_RESET) {
++ handled = IRQ_HANDLED;
+ if (is_host_capable() && (devctl & MUSB_DEVCTL_HM) != 0) {
+ /*
+ * Looks like non-HS BABBLE can be ignored, but
+@@ -641,7 +755,7 @@ b_host:
+ DBG(1, "BABBLE devctl: %02x\n", devctl);
+ else {
+ ERR("Stopping host session -- babble\n");
+- musb_writeb(mbase, MUSB_DEVCTL, 0);
++ musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+ }
+ } else if (is_peripheral_capable()) {
+ DBG(1, "BUS RESET as %s\n", otg_state_string(musb));
+@@ -686,29 +800,7 @@ b_host:
+ otg_state_string(musb));
+ }
+ }
+-
+- handled = IRQ_HANDLED;
+ }
+- schedule_work(&musb->irq_work);
+-
+- return handled;
+-}
+-
+-/*
+- * Interrupt Service Routine to record USB "global" interrupts.
+- * Since these do not happen often and signify things of
+- * paramount importance, it seems OK to check them individually;
+- * the order of the tests is specified in the manual
+- *
+- * @param musb instance pointer
+- * @param int_usb register contents
+- * @param devctl
+- * @param power
+- */
+-static irqreturn_t musb_stage2_irq(struct musb *musb, u8 int_usb,
+- u8 devctl, u8 power)
+-{
+- irqreturn_t handled = IRQ_NONE;
+
+ #if 0
+ /* REVISIT ... this would be for multiplexing periodic endpoints, or
+@@ -755,117 +847,7 @@ static irqreturn_t musb_stage2_irq(struc
+ }
+ #endif
+
+- if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
+- DBG(1, "DISCONNECT (%s) as %s, devctl %02x\n",
+- otg_state_string(musb),
+- MUSB_MODE(musb), devctl);
+- handled = IRQ_HANDLED;
+-
+- switch (musb->xceiv->state) {
+-#ifdef CONFIG_USB_MUSB_HDRC_HCD
+- case OTG_STATE_A_HOST:
+- case OTG_STATE_A_SUSPEND:
+- usb_hcd_resume_root_hub(musb_to_hcd(musb));
+- musb_root_disconnect(musb);
+- if (musb->a_wait_bcon != 0 && is_otg_enabled(musb))
+- musb_platform_try_idle(musb, jiffies
+- + msecs_to_jiffies(musb->a_wait_bcon));
+- break;
+-#endif /* HOST */
+-#ifdef CONFIG_USB_MUSB_OTG
+- case OTG_STATE_B_HOST:
+- /* REVISIT this behaves for "real disconnect"
+- * cases; make sure the other transitions from
+- * from B_HOST act right too. The B_HOST code
+- * in hnp_stop() is currently not used...
+- */
+- musb_root_disconnect(musb);
+- musb_to_hcd(musb)->self.is_b_host = 0;
+- musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+- MUSB_DEV_MODE(musb);
+- musb_g_disconnect(musb);
+- break;
+- case OTG_STATE_A_PERIPHERAL:
+- musb_hnp_stop(musb);
+- musb_root_disconnect(musb);
+- /* FALLTHROUGH */
+- case OTG_STATE_B_WAIT_ACON:
+- /* FALLTHROUGH */
+-#endif /* OTG */
+-#ifdef CONFIG_USB_GADGET_MUSB_HDRC
+- case OTG_STATE_B_PERIPHERAL:
+- case OTG_STATE_B_IDLE:
+- musb_g_disconnect(musb);
+- break;
+-#endif /* GADGET */
+- default:
+- WARNING("unhandled DISCONNECT transition (%s)\n",
+- otg_state_string(musb));
+- break;
+- }
+-
+- schedule_work(&musb->irq_work);
+- }
+-
+- if (int_usb & MUSB_INTR_SUSPEND) {
+- DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
+- otg_state_string(musb), devctl, power);
+- handled = IRQ_HANDLED;
+-
+- switch (musb->xceiv->state) {
+-#ifdef CONFIG_USB_MUSB_OTG
+- case OTG_STATE_A_PERIPHERAL:
+- /* We also come here if the cable is removed, since
+- * this silicon doesn't report ID-no-longer-grounded.
+- *
+- * We depend on T(a_wait_bcon) to shut us down, and
+- * hope users don't do anything dicey during this
+- * undesired detour through A_WAIT_BCON.
+- */
+- musb_hnp_stop(musb);
+- usb_hcd_resume_root_hub(musb_to_hcd(musb));
+- musb_root_disconnect(musb);
+- musb_platform_try_idle(musb, jiffies
+- + msecs_to_jiffies(musb->a_wait_bcon
+- ? : OTG_TIME_A_WAIT_BCON));
+- break;
+-#endif
+- case OTG_STATE_B_PERIPHERAL:
+- musb_g_suspend(musb);
+- musb->is_active = is_otg_enabled(musb)
+- && musb->xceiv->gadget->b_hnp_enable;
+- if (musb->is_active) {
+-#ifdef CONFIG_USB_MUSB_OTG
+- musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
+- DBG(1, "HNP: Setting timer for b_ase0_brst\n");
+- mod_timer(&musb->otg_timer, jiffies
+- + msecs_to_jiffies(
+- OTG_TIME_B_ASE0_BRST));
+-#endif
+- }
+- break;
+- case OTG_STATE_A_WAIT_BCON:
+- if (musb->a_wait_bcon != 0)
+- musb_platform_try_idle(musb, jiffies
+- + msecs_to_jiffies(musb->a_wait_bcon));
+- break;
+- case OTG_STATE_A_HOST:
+- musb->xceiv->state = OTG_STATE_A_SUSPEND;
+- musb->is_active = is_otg_enabled(musb)
+- && musb->xceiv->host->b_hnp_enable;
+- break;
+- case OTG_STATE_B_HOST:
+- /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
+- DBG(1, "REVISIT: SUSPEND as B_HOST\n");
+- break;
+- default:
+- /* "should not happen" */
+- musb->is_active = 0;
+- break;
+- }
+- schedule_work(&musb->irq_work);
+- }
+-
++ schedule_work(&musb->irq_work);
+
+ return handled;
+ }
+@@ -1597,11 +1579,6 @@ irqreturn_t musb_interrupt(struct musb *
+ ep_num++;
+ }
+
+- /* finish handling "global" interrupts after handling fifos */
+- if (musb->int_usb)
+- retval |= musb_stage2_irq(musb,
+- musb->int_usb, devctl, power);
+-
+ return retval;
+ }
+
diff --git a/usb/usb-musb-hsdma-add-wrapper-for-reading-dma-count.patch b/usb/usb-musb-hsdma-add-wrapper-for-reading-dma-count.patch
new file mode 100644
index 00000000000000..605e045560c9c7
--- /dev/null
+++ b/usb/usb-musb-hsdma-add-wrapper-for-reading-dma-count.patch
@@ -0,0 +1,56 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:38:20 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:35 +0200
+Subject: usb: musb: hsdma: add wrapper for reading DMA count
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Anand Gadiyar <gadiyar@ti.com>, Vikram Pandita <vikram.pandita@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-3-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Anand Gadiyar <gadiyar@ti.com>
+
+Add a wrapper for reading the DMA count register, analogous
+to the one for writing to this register.
+
+Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
+Cc: Vikram Pandita <vikram.pandita@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musbhsdma.h | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/drivers/usb/musb/musbhsdma.h
++++ b/drivers/usb/musb/musbhsdma.h
+@@ -55,6 +55,10 @@
+ MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDRESS), \
+ addr)
+
++#define musb_read_hsdma_count(mbase, bchannel) \
++ musb_readl(mbase, \
++ MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT))
++
+ #define musb_write_hsdma_count(mbase, bchannel, len) \
+ musb_writel(mbase, \
+ MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT), \
+@@ -96,6 +100,19 @@ static inline void musb_write_hsdma_addr
+ ((u16)(((u32) dma_addr >> 16) & 0xFFFF)));
+ }
+
++static inline u32 musb_read_hsdma_count(void __iomem *mbase, u8 bchannel)
++{
++ u32 count = musb_readw(mbase,
++ MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH));
++
++ count = count << 16;
++
++ count |= musb_readw(mbase,
++ MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW));
++
++ return count;
++}
++
+ static inline void musb_write_hsdma_count(void __iomem *mbase,
+ u8 bchannel, u32 len)
+ {
diff --git a/usb/usb-musb-save-dynfifo-in-musb-struct.patch b/usb/usb-musb-save-dynfifo-in-musb-struct.patch
new file mode 100644
index 00000000000000..fad1a76bb81737
--- /dev/null
+++ b/usb/usb-musb-save-dynfifo-in-musb-struct.patch
@@ -0,0 +1,47 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:40:08 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:41 +0200
+Subject: usb: musb: save dynfifo in musb struct
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Ajay Kumar Gupta <ajay.gupta@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-9-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Ajay Kumar Gupta <ajay.gupta@ti.com>
+
+Save dynamic FIFO read only information for later uses during
+musb_save/restore_context functions.
+
+Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musb_core.c | 4 +++-
+ drivers/usb/musb/musb_core.h | 1 +
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -1341,8 +1341,10 @@ static int __init musb_core_init(u16 mus
+ reg = musb_read_configdata(mbase);
+
+ strcpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-8");
+- if (reg & MUSB_CONFIGDATA_DYNFIFO)
++ if (reg & MUSB_CONFIGDATA_DYNFIFO) {
+ strcat(aInfo, ", dyn FIFOs");
++ musb->dyn_fifo = true;
++ }
+ if (reg & MUSB_CONFIGDATA_MPRXE) {
+ strcat(aInfo, ", bulk combine");
+ musb->bulk_combine = true;
+--- a/drivers/usb/musb/musb_core.h
++++ b/drivers/usb/musb/musb_core.h
+@@ -411,6 +411,7 @@ struct musb {
+
+ unsigned hb_iso_rx:1; /* high bandwidth iso rx? */
+ unsigned hb_iso_tx:1; /* high bandwidth iso tx? */
++ unsigned dyn_fifo:1; /* dynamic FIFO supported? */
+
+ unsigned bulk_split:1;
+ #define can_bulk_split(musb,type) \
diff --git a/usb/usb-musb-workaround-musb-dma_intr-sometimes-reads-zero.patch b/usb/usb-musb-workaround-musb-dma_intr-sometimes-reads-zero.patch
new file mode 100644
index 00000000000000..4a907c421d0d97
--- /dev/null
+++ b/usb/usb-musb-workaround-musb-dma_intr-sometimes-reads-zero.patch
@@ -0,0 +1,77 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:38:45 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:36 +0200
+Subject: usb: musb: workaround MUSB DMA_INTR sometimes reads zero
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Anand Gadiyar <gadiyar@ti.com>, Ajay Kumar Gupta <ajay.gupta@ti.com>, David Brownell <dbrownell@users.sourceforge.net>, Sergei Shtylyov <sshtylyov@ru.mvista.com>, Vikram Pandita <vikram.pandita@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-4-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Anand Gadiyar <gadiyar@ti.com>
+
+MUSB DMA_INTR register may sometimes read zero when infact there
+was a pending interrupt. Workaround this by reading the DMA_COUNT
+values for all enabled channels when this condition occurs.
+Flag these channels as the ones needing to be serviced.
+
+Additionally, the absence of a debug print meant we would never
+catch a spurious DMA interrupt in MUSB. So this patch adds a
+debug print in the IRQ handler.
+
+Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
+Cc: Ajay Kumar Gupta <ajay.gupta@ti.com>
+Cc: David Brownell <dbrownell@users.sourceforge.net>
+Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
+Cc: Vikram Pandita <vikram.pandita@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musbhsdma.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/musb/musbhsdma.c
++++ b/drivers/usb/musb/musbhsdma.c
+@@ -250,20 +250,39 @@ static irqreturn_t dma_controller_irq(in
+ u8 bchannel;
+ u8 int_hsdma;
+
+- u32 addr;
++ u32 addr, count;
+ u16 csr;
+
+ spin_lock_irqsave(&musb->lock, flags);
+
+ int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR);
+- if (!int_hsdma)
+- goto done;
+
+ #ifdef CONFIG_BLACKFIN
+ /* Clear DMA interrupt flags */
+ musb_writeb(mbase, MUSB_HSDMA_INTR, int_hsdma);
+ #endif
+
++ if (!int_hsdma) {
++ DBG(2, "spurious DMA irq\n");
++
++ for (bchannel = 0; bchannel < MUSB_HSDMA_CHANNELS; bchannel++) {
++ musb_channel = (struct musb_dma_channel *)
++ &(controller->channel[bchannel]);
++ channel = &musb_channel->channel;
++ if (channel->status == MUSB_DMA_STATUS_BUSY) {
++ count = musb_read_hsdma_count(mbase, bchannel);
++
++ if (count == 0)
++ int_hsdma |= (1 << bchannel);
++ }
++ }
++
++ DBG(2, "int_hsdma = 0x%x\n", int_hsdma);
++
++ if (!int_hsdma)
++ goto done;
++ }
++
+ for (bchannel = 0; bchannel < MUSB_HSDMA_CHANNELS; bchannel++) {
+ if (int_hsdma & (1 << bchannel)) {
+ musb_channel = (struct musb_dma_channel *)
diff --git a/usb/usb-musb-workaround-toggle-bug-when-doing-bulk-transfer-after-isoc.patch b/usb/usb-musb-workaround-toggle-bug-when-doing-bulk-transfer-after-isoc.patch
new file mode 100644
index 00000000000000..a126db4618cbd6
--- /dev/null
+++ b/usb/usb-musb-workaround-toggle-bug-when-doing-bulk-transfer-after-isoc.patch
@@ -0,0 +1,71 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:39:07 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:40:37 +0200
+Subject: usb: musb: workaround toggle bug when doing bulk transfer after isoc
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Swaminathan S <swami.iyer@ti.com>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1262000446-19672-5-git-send-email-felipe.balbi@nokia.com>
+
+
+From: Swaminathan S <swami.iyer@ti.com>
+
+This patch implements the work around for a Mentor controller related
+bug where it's observed a BULK Tx toggle error on the bus when a
+BULK IO gets scheduled on an endpoint that was earlier used for
+handling ISOC transaction and needed to start on 1 toggle. When such
+a situation arises even if the TXCSR toggle bits are programmed
+correctly by the musb driver the data gets transmitted with 0 toggle
+which leads to toggle error on the bus and the BULK transaction fails.
+In case of MSC write, the device gets reset by the Host.
+
+This Mentor bug is observed on almost all Mentor versions (1.3, 1.5,
+1.8). Confirmed on DM644x, DM355, DM365, OMAPL13x platforms.
+
+Signed-off-by: Swaminathan S <swami.iyer@ti.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/musb_host.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/drivers/usb/musb/musb_host.c
++++ b/drivers/usb/musb/musb_host.c
+@@ -1771,6 +1771,9 @@ static int musb_schedule(
+ int best_end, epnum;
+ struct musb_hw_ep *hw_ep = NULL;
+ struct list_head *head = NULL;
++ u8 toggle;
++ u8 txtype;
++ struct urb *urb = next_urb(qh);
+
+ /* use fixed hardware for control and bulk */
+ if (qh->type == USB_ENDPOINT_XFER_CONTROL) {
+@@ -1809,6 +1812,27 @@ static int musb_schedule(
+ diff -= (qh->maxpacket * qh->hb_mult);
+
+ if (diff >= 0 && best_diff > diff) {
++
++ /*
++ * Mentor controller has a bug in that if we schedule
++ * a BULK Tx transfer on an endpoint that had earlier
++ * handled ISOC then the BULK transfer has to start on
++ * a zero toggle. If the BULK transfer starts on a 1
++ * toggle then this transfer will fail as the mentor
++ * controller starts the Bulk transfer on a 0 toggle
++ * irrespective of the programming of the toggle bits
++ * in the TXCSR register. Check for this condition
++ * while allocating the EP for a Tx Bulk transfer. If
++ * so skip this EP.
++ */
++ hw_ep = musb->endpoints + epnum;
++ toggle = usb_gettoggle(urb->dev, qh->epnum, !is_in);
++ txtype = (musb_readb(hw_ep->regs, MUSB_TXTYPE)
++ >> 4) & 0x3;
++ if (!is_in && (qh->type == USB_ENDPOINT_XFER_BULK) &&
++ toggle && (txtype == USB_ENDPOINT_XFER_ISOC))
++ continue;
++
+ best_diff = diff;
+ best_end = epnum;
+ }
diff --git a/usb/usb-otg-twl4030-move-to-request_threaded_irq.patch b/usb/usb-otg-twl4030-move-to-request_threaded_irq.patch
new file mode 100644
index 00000000000000..21a90c9ae4161e
--- /dev/null
+++ b/usb/usb-otg-twl4030-move-to-request_threaded_irq.patch
@@ -0,0 +1,44 @@
+From felipe.balbi@nokia.com Fri Jan 15 10:33:53 2010
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Mon, 28 Dec 2009 13:02:48 +0200
+Subject: usb: otg: twl4030: move to request_threaded_irq
+Cc: Andrew Morton <akpm@linux-foundation.org>, Felipe Balbi <felipe.balbi@nokia.com>, Greg Kroah-Hartman <gregkh@suse.de>, linux-usb@vger.kernel.org
+Message-ID: <1261998172-29760-1-git-send-email-felipe.balbi@nokia.com>
+
+
+move to request_threaded_irq() on twl4030 children.
+
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/usb/otg/twl4030-usb.c | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+--- a/drivers/usb/otg/twl4030-usb.c
++++ b/drivers/usb/otg/twl4030-usb.c
+@@ -567,14 +567,6 @@ static irqreturn_t twl4030_usb_irq(int i
+ struct twl4030_usb *twl = _twl;
+ int status;
+
+-#ifdef CONFIG_LOCKDEP
+- /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
+- * we don't want and can't tolerate. Although it might be
+- * friendlier not to borrow this thread context...
+- */
+- local_irq_enable();
+-#endif
+-
+ status = twl4030_usb_linkstat(twl);
+ if (status >= 0) {
+ /* FIXME add a set_power() method so that B-devices can
+@@ -695,7 +687,7 @@ static int __devinit twl4030_usb_probe(s
+ * need both handles, otherwise just one suffices.
+ */
+ twl->irq_enabled = true;
+- status = request_irq(twl->irq, twl4030_usb_irq,
++ status = request_threaded_irq(twl->irq, NULL, twl4030_usb_irq,
+ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+ "twl4030_usb", twl);
+ if (status < 0) {
diff --git a/usb/usb-oti6858-fix-dma-buffer-on-stack.patch b/usb/usb-oti6858-fix-dma-buffer-on-stack.patch
new file mode 100644
index 00000000000000..188c794a56990f
--- /dev/null
+++ b/usb/usb-oti6858-fix-dma-buffer-on-stack.patch
@@ -0,0 +1,51 @@
+From jhovold@gmail.com Fri Jan 15 10:45:35 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:56 +0100
+Subject: USB: oti6858: fix DMA buffer on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-13-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/oti6858.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/serial/oti6858.c
++++ b/drivers/usb/serial/oti6858.c
+@@ -302,7 +302,7 @@ void send_data(struct work_struct *work)
+ struct usb_serial_port *port = priv->port;
+ int count = 0, result;
+ unsigned long flags;
+- unsigned char allow;
++ u8 *allow;
+
+ dbg("%s(port = %d)", __func__, port->number);
+
+@@ -321,13 +321,20 @@ void send_data(struct work_struct *work)
+ count = port->bulk_out_size;
+
+ if (count != 0) {
++ allow = kmalloc(1, GFP_KERNEL);
++ if (!allow) {
++ dev_err(&port->dev, "%s(): kmalloc failed\n",
++ __func__);
++ return;
++ }
+ result = usb_control_msg(port->serial->dev,
+ usb_rcvctrlpipe(port->serial->dev, 0),
+ OTI6858_REQ_T_CHECK_TXBUFF,
+ OTI6858_REQ_CHECK_TXBUFF,
+- count, 0, &allow, 1, 100);
+- if (result != 1 || allow != 0)
++ count, 0, allow, 1, 100);
++ if (result != 1 || *allow != 0)
+ count = 0;
++ kfree(allow);
+ }
+
+ if (count == 0) {
diff --git a/usb/usb-serial-fix-dma-buffers-on-stack-for-io_edgeport.c.patch b/usb/usb-serial-fix-dma-buffers-on-stack-for-io_edgeport.c.patch
new file mode 100644
index 00000000000000..9305c092a73a2a
--- /dev/null
+++ b/usb/usb-serial-fix-dma-buffers-on-stack-for-io_edgeport.c.patch
@@ -0,0 +1,79 @@
+From error27@gmail.com Fri Jan 15 10:46:46 2010
+From: Dan Carpenter <error27@gmail.com>
+Date: Thu, 31 Dec 2009 17:42:55 +0200
+Subject: USB: serial: fix DMA buffers on stack for io_edgeport.c
+To: Johan Hovold <jhovold@gmail.com>
+Cc: Greg Kroah-Hartman <gregkh@suse.de>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
+Message-ID: <20091231154255.GC21362@bicker>
+
+
+The original code was passing a stack variable as a dma buffer, so I
+made it an allocated variable. Instead of adding a bunch of kfree()
+calls, I changed all the error return paths to gotos.
+
+Also I noticed that the error checking wasn't correct because
+usb_get_descriptor() can return negative values.
+
+While I was at it, I made an unrelated white space change by moving
+the unicode_to_ascii() on to one line.
+
+Signed-off-by: Dan Carpenter <error27@gmail.com>
+Cc: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/io_edgeport.c | 35 ++++++++++++++++++-----------------
+ 1 file changed, 18 insertions(+), 17 deletions(-)
+
+--- a/drivers/usb/serial/io_edgeport.c
++++ b/drivers/usb/serial/io_edgeport.c
+@@ -372,31 +372,32 @@ static void update_edgeport_E2PROM(struc
+ ************************************************************************/
+ static int get_string(struct usb_device *dev, int Id, char *string, int buflen)
+ {
+- struct usb_string_descriptor StringDesc;
+- struct usb_string_descriptor *pStringDesc;
++ struct usb_string_descriptor *StringDesc = NULL;
++ struct usb_string_descriptor *pStringDesc = NULL;
++ int ret = 0;
+
+ dbg("%s - USB String ID = %d", __func__, Id);
+
+- if (!usb_get_descriptor(dev, USB_DT_STRING, Id,
+- &StringDesc, sizeof(StringDesc)))
+- return 0;
++ StringDesc = kmalloc(sizeof(*StringDesc), GFP_KERNEL);
++ if (!StringDesc)
++ goto free;
++ if (usb_get_descriptor(dev, USB_DT_STRING, Id, StringDesc, sizeof(*StringDesc)) <= 0)
++ goto free;
+
+- pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL);
++ pStringDesc = kmalloc(StringDesc->bLength, GFP_KERNEL);
+ if (!pStringDesc)
+- return 0;
++ goto free;
+
+- if (!usb_get_descriptor(dev, USB_DT_STRING, Id,
+- pStringDesc, StringDesc.bLength)) {
+- kfree(pStringDesc);
+- return 0;
+- }
+-
+- unicode_to_ascii(string, buflen,
+- pStringDesc->wData, pStringDesc->bLength/2);
++ if (usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc, StringDesc->bLength) <= 0)
++ goto free;
+
+- kfree(pStringDesc);
++ unicode_to_ascii(string, buflen, pStringDesc->wData, pStringDesc->bLength/2);
++ ret = strlen(string);
+ dbg("%s - USB String %s", __func__, string);
+- return strlen(string);
++free:
++ kfree(StringDesc);
++ kfree(pStringDesc);
++ return ret;
+ }
+
+
diff --git a/usb/usb-unusual_devs-add-support-for-multiple-option-3g-sticks.patch b/usb/usb-unusual_devs-add-support-for-multiple-option-3g-sticks.patch
new file mode 100644
index 00000000000000..c0eb5a12c7530b
--- /dev/null
+++ b/usb/usb-unusual_devs-add-support-for-multiple-option-3g-sticks.patch
@@ -0,0 +1,129 @@
+From j.dumon@option.com Fri Jan 15 11:00:18 2010
+From: Jan Dumon <j.dumon@option.com>
+Date: Tue, 5 Jan 2010 15:53:26 +0100
+Subject: USB: unusual_devs: Add support for multiple Option 3G sticks
+To: Phil Dibowitz <phil@ipom.com>
+Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net
+Message-ID: <20100105145326.GG19825@raptor>
+
+
+From: Jan Dumon <j.dumon@option.com>
+
+Enable the SD-Card interface on multiple Option 3G sticks.
+The unusual_devs.h entry is necessary because the device descriptor is
+vendor-specific. That prevents usb-storage from binding to it as an interface
+driver.
+
+Signed-off-by: Jan Dumon <j.dumon@option.com>
+Signed-off-by: Phil Dibowitz <phil@ipom.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/unusual_devs.h | 88 ++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 86 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1147,8 +1147,8 @@ UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0
+ 0 ),
+
+ /* Reported by Jan Dumon <j.dumon@option.com>
+- * This device (wrongly) has a vendor-specific device descriptor.
+- * The entry is needed so usb-storage can bind to it's mass-storage
++ * These devices (wrongly) have a vendor-specific device descriptor.
++ * These entries are needed so usb-storage can bind to their mass-storage
+ * interface as an interface driver */
+ UNUSUAL_DEV( 0x0af0, 0x7501, 0x0000, 0x0000,
+ "Option",
+@@ -1156,6 +1156,90 @@ UNUSUAL_DEV( 0x0af0, 0x7501, 0x0000, 0x0
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ 0 ),
+
++UNUSUAL_DEV( 0x0af0, 0x7701, 0x0000, 0x0000,
++ "Option",
++ "GI 0451 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x7706, 0x0000, 0x0000,
++ "Option",
++ "GI 0451 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x7901, 0x0000, 0x0000,
++ "Option",
++ "GI 0452 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x7A01, 0x0000, 0x0000,
++ "Option",
++ "GI 0461 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x7A05, 0x0000, 0x0000,
++ "Option",
++ "GI 0461 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x8300, 0x0000, 0x0000,
++ "Option",
++ "GI 033x SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x8302, 0x0000, 0x0000,
++ "Option",
++ "GI 033x SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0000,
++ "Option",
++ "GI 033x SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000,
++ "Option",
++ "GI 070x SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xd057, 0x0000, 0x0000,
++ "Option",
++ "GI 1505 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xd058, 0x0000, 0x0000,
++ "Option",
++ "GI 1509 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xd157, 0x0000, 0x0000,
++ "Option",
++ "GI 1515 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xd257, 0x0000, 0x0000,
++ "Option",
++ "GI 1215 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
++UNUSUAL_DEV( 0x0af0, 0xd357, 0x0000, 0x0000,
++ "Option",
++ "GI 1505 SD-Card",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ 0 ),
++
+ /* Reported by Ben Efros <ben@pc-doctor.com> */
+ UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000,
+ "Seagate",
diff --git a/usb/usb-usblp-remove-checks-no-longer-needed-with-the-new-runtime-pm-system.patch b/usb/usb-usblp-remove-checks-no-longer-needed-with-the-new-runtime-pm-system.patch
new file mode 100644
index 00000000000000..e5eac903633487
--- /dev/null
+++ b/usb/usb-usblp-remove-checks-no-longer-needed-with-the-new-runtime-pm-system.patch
@@ -0,0 +1,107 @@
+From oliver@neukum.org Fri Jan 15 10:32:19 2010
+From: Oliver Neukum <oliver@neukum.org>
+Date: Mon, 28 Dec 2009 00:52:17 +0100
+Subject: USB: usblp: Remove checks no longer needed with the new runtime PM system
+To: Pete Zaitcev <zaitcev@redhat.com>, Greg KH <greg@kroah.com>, Alan Stern <stern@rowland.harvard.edu>, linux-usb@vger.kernel.org
+Message-ID: <200912280052.17202.oliver@neukum.org>
+
+
+From: Oliver Neukum <oliver@neukum.org>
+
+Under the new system a device cannot be suspended against
+the driver's wish. Therefore this condition no longer needs
+to be checked for.
+
+Signed-off-by: Oliver Neukum <oliver@neukum.org>
+Cc: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/class/usblp.c | 20 +++-----------------
+ 1 file changed, 3 insertions(+), 17 deletions(-)
+
+--- a/drivers/usb/class/usblp.c
++++ b/drivers/usb/class/usblp.c
+@@ -163,7 +163,6 @@ struct usblp {
+ unsigned char used; /* True if open */
+ unsigned char present; /* True if not disconnected */
+ unsigned char bidir; /* interface is bidirectional */
+- unsigned char sleeping; /* interface is suspended */
+ unsigned char no_paper; /* Paper Out happened */
+ unsigned char *device_id_string; /* IEEE 1284 DEVICE ID string (ptr) */
+ /* first 2 bytes are (big-endian) length */
+@@ -191,7 +190,6 @@ static void usblp_dump(struct usblp *usb
+ dbg("quirks=%d", usblp->quirks);
+ dbg("used=%d", usblp->used);
+ dbg("bidir=%d", usblp->bidir);
+- dbg("sleeping=%d", usblp->sleeping);
+ dbg("device_id_string=\"%s\"",
+ usblp->device_id_string ?
+ usblp->device_id_string + 2 :
+@@ -376,7 +374,7 @@ static int usblp_check_status(struct usb
+
+ static int handle_bidir (struct usblp *usblp)
+ {
+- if (usblp->bidir && usblp->used && !usblp->sleeping) {
++ if (usblp->bidir && usblp->used) {
+ if (usblp_submit_read(usblp) < 0)
+ return -EIO;
+ }
+@@ -503,11 +501,6 @@ static long usblp_ioctl(struct file *fil
+ goto done;
+ }
+
+- if (usblp->sleeping) {
+- retval = -ENODEV;
+- goto done;
+- }
+-
+ dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
+ _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) );
+
+@@ -914,8 +907,6 @@ static int usblp_wtest(struct usblp *usb
+ return 0;
+ }
+ spin_unlock_irqrestore(&usblp->lock, flags);
+- if (usblp->sleeping)
+- return -ENODEV;
+ if (nonblock)
+ return -EAGAIN;
+ return 1;
+@@ -968,8 +959,6 @@ static int usblp_rtest(struct usblp *usb
+ return 0;
+ }
+ spin_unlock_irqrestore(&usblp->lock, flags);
+- if (usblp->sleeping)
+- return -ENODEV;
+ if (nonblock)
+ return -EAGAIN;
+ return 1;
+@@ -1377,12 +1366,10 @@ static void usblp_disconnect(struct usb_
+ mutex_unlock (&usblp_mutex);
+ }
+
+-static int usblp_suspend (struct usb_interface *intf, pm_message_t message)
++static int usblp_suspend(struct usb_interface *intf, pm_message_t message)
+ {
+ struct usblp *usblp = usb_get_intfdata (intf);
+
+- /* we take no more IO */
+- usblp->sleeping = 1;
+ usblp_unlink_urbs(usblp);
+ #if 0 /* XXX Do we want this? What if someone is reading, should we fail? */
+ /* not strictly necessary, but just in case */
+@@ -1393,12 +1380,11 @@ static int usblp_suspend (struct usb_int
+ return 0;
+ }
+
+-static int usblp_resume (struct usb_interface *intf)
++static int usblp_resume(struct usb_interface *intf)
+ {
+ struct usblp *usblp = usb_get_intfdata (intf);
+ int r;
+
+- usblp->sleeping = 0;
+ r = handle_bidir (usblp);
+
+ return r;
diff --git a/usb/usb-use-binterfacenumber-in-bandwidth-allocations.patch b/usb/usb-use-binterfacenumber-in-bandwidth-allocations.patch
new file mode 100644
index 00000000000000..9707d39f00c944
--- /dev/null
+++ b/usb/usb-use-binterfacenumber-in-bandwidth-allocations.patch
@@ -0,0 +1,43 @@
+From sarah.a.sharp@linux.intel.com Fri Jan 15 11:01:06 2010
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Tue, 5 Jan 2010 14:33:29 -0800
+Subject: USB: Use bInterfaceNumber in bandwidth allocations.
+To: Greg KH <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>
+Message-ID: <20100105223329.GA31824@xanatos>
+
+
+USB devices do not have to sort interfaces in their descriptors based on
+the interface number, and they may choose to skip interface numbers. The
+USB bandwidth allocation code for installing a new configuration assumes
+the for loop variable will match the interface number. Make it use the
+interface number (bInterfaceNumber) in the descriptor instead.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -1670,11 +1670,16 @@ int usb_hcd_alloc_bandwidth(struct usb_d
+ }
+ }
+ for (i = 0; i < num_intfs; ++i) {
++ struct usb_host_interface *first_alt;
++ int iface_num;
++
++ first_alt = &new_config->intf_cache[i]->altsetting[0];
++ iface_num = first_alt->desc.bInterfaceNumber;
+ /* Set up endpoints for alternate interface setting 0 */
+- alt = usb_find_alt_setting(new_config, i, 0);
++ alt = usb_find_alt_setting(new_config, iface_num, 0);
+ if (!alt)
+ /* No alt setting 0? Pick the first setting. */
+- alt = &new_config->intf_cache[i]->altsetting[0];
++ alt = first_alt;
+
+ for (j = 0; j < alt->desc.bNumEndpoints; j++) {
+ ret = hcd->driver->add_endpoint(hcd, udev, &alt->endpoint[j]);
diff --git a/usb/usb-visor-fix-dma-buffers-on-stack.patch b/usb/usb-visor-fix-dma-buffers-on-stack.patch
new file mode 100644
index 00000000000000..aae3adefbc9a94
--- /dev/null
+++ b/usb/usb-visor-fix-dma-buffers-on-stack.patch
@@ -0,0 +1,85 @@
+From jhovold@gmail.com Fri Jan 15 10:45:47 2010
+From: Johan Hovold <jhovold@gmail.com>
+Date: Mon, 28 Dec 2009 23:01:57 +0100
+Subject: USB: visor: fix DMA buffers on stack
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <jhovold@gmail.com>
+Message-ID: <1262037718-31424-14-git-send-email-jhovold@gmail.com>
+
+
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/visor.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+--- a/drivers/usb/serial/visor.c
++++ b/drivers/usb/serial/visor.c
+@@ -807,10 +807,14 @@ static int clie_3_5_startup(struct usb_s
+ {
+ struct device *dev = &serial->dev->dev;
+ int result;
+- u8 data;
++ u8 *data;
+
+ dbg("%s", __func__);
+
++ data = kmalloc(1, GFP_KERNEL);
++ if (!data)
++ return -ENOMEM;
++
+ /*
+ * Note that PEG-300 series devices expect the following two calls.
+ */
+@@ -818,36 +822,42 @@ static int clie_3_5_startup(struct usb_s
+ /* get the config number */
+ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ USB_REQ_GET_CONFIGURATION, USB_DIR_IN,
+- 0, 0, &data, 1, 3000);
++ 0, 0, data, 1, 3000);
+ if (result < 0) {
+ dev_err(dev, "%s: get config number failed: %d\n",
+ __func__, result);
+- return result;
++ goto out;
+ }
+ if (result != 1) {
+ dev_err(dev, "%s: get config number bad return length: %d\n",
+ __func__, result);
+- return -EIO;
++ result = -EIO;
++ goto out;
+ }
+
+ /* get the interface number */
+ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+ USB_REQ_GET_INTERFACE,
+ USB_DIR_IN | USB_RECIP_INTERFACE,
+- 0, 0, &data, 1, 3000);
++ 0, 0, data, 1, 3000);
+ if (result < 0) {
+ dev_err(dev, "%s: get interface number failed: %d\n",
+ __func__, result);
+- return result;
++ goto out;
+ }
+ if (result != 1) {
+ dev_err(dev,
+ "%s: get interface number bad return length: %d\n",
+ __func__, result);
+- return -EIO;
++ result = -EIO;
++ goto out;
+ }
+
+- return generic_startup(serial);
++ result = generic_startup(serial);
++out:
++ kfree(data);
++
++ return result;
+ }
+
+ static int treo_attach(struct usb_serial *serial)
diff --git a/usb/usb-xhci-fix-compile-issues-with-xhci_get_slot_state.patch b/usb/usb-xhci-fix-compile-issues-with-xhci_get_slot_state.patch
new file mode 100644
index 00000000000000..7173d0fb650165
--- /dev/null
+++ b/usb/usb-xhci-fix-compile-issues-with-xhci_get_slot_state.patch
@@ -0,0 +1,52 @@
+From sarah.a.sharp@linux.intel.com Fri Jan 15 10:53:27 2010
+From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Date: Mon, 4 Jan 2010 12:20:17 -0800
+Subject: USB: xhci: Fix compile issues with xhci_get_slot_state()
+To: Greg KH <gregkh@suse.de>
+Cc: Randy Dunlap <randy.dunlap@oracle.com>, linux-usb@vger.kernel.org
+Message-ID: <20100104202017.GA9403@xanatos>
+
+
+Randy Dunlap reported this error when compiling the xHCI driver:
+
+linux-next-20100104/drivers/usb/host/xhci.h:1214:
+sorry, unimplemented: inlining failed in call to 'xhci_get_slot_state': function body not available
+
+The xhci_get_slot_state() function belongs in xhci-dbg.c, since it
+involves debugging internal xHCI structures. However, it is only used in
+xhci-hcd.c. Some toolchains may have issues since the inlined function
+body is not in the xhci.h header file. Remove the inline keyword to avoid
+this.
+
+Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
+Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
+Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/xhci-dbg.c | 2 +-
+ drivers/usb/host/xhci.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/host/xhci-dbg.c
++++ b/drivers/usb/host/xhci-dbg.c
+@@ -406,7 +406,7 @@ static void dbg_rsvd64(struct xhci_hcd *
+ }
+ }
+
+-inline char *xhci_get_slot_state(struct xhci_hcd *xhci,
++char *xhci_get_slot_state(struct xhci_hcd *xhci,
+ struct xhci_container_ctx *ctx)
+ {
+ struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -1210,7 +1210,7 @@ void xhci_dbg_erst(struct xhci_hcd *xhci
+ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci);
+ void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring);
+ void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int last_ep);
+-inline char *xhci_get_slot_state(struct xhci_hcd *xhci,
++char *xhci_get_slot_state(struct xhci_hcd *xhci,
+ struct xhci_container_ctx *ctx);
+
+ /* xHCI memory management */