diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-15 12:15:23 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-15 12:15:23 -0800 |
| commit | d8090ba7e175e4c220bd0027e9631d0116891ce0 (patch) | |
| tree | b8cc5b4a4a4a760e85710e74c3010dedf9367813 /usb | |
| parent | 2b0ec05ccfa354c1ecf71a59d1fe887abe78d97e (diff) | |
| download | patches-d8090ba7e175e4c220bd0027e9631d0116891ce0.tar.gz | |
lots of usb patches
Diffstat (limited to 'usb')
43 files changed, 3812 insertions, 0 deletions
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 */ |
