diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-03-04 12:08:21 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-03-04 12:08:21 -0800 |
| commit | 00f82e7db1770dfdf1e132a7c5051d73d32d57d9 (patch) | |
| tree | 0d1d29476af6e804bcb19e74d150fcd24c672fe2 /usb | |
| parent | 628ecee749980f311e3c1e94d1abadeae0ce7302 (diff) | |
| download | patches-00f82e7db1770dfdf1e132a7c5051d73d32d57d9.tar.gz | |
another usb patch
Diffstat (limited to 'usb')
| -rw-r--r-- | usb/usb-pxa2xx_udc-fix-misuse-of-clock-enable-disable-calls.patch | 249 | ||||
| -rw-r--r-- | usb/usb-replace-remaining-__function__-occurrences.patch | 20 |
2 files changed, 259 insertions, 10 deletions
diff --git a/usb/usb-pxa2xx_udc-fix-misuse-of-clock-enable-disable-calls.patch b/usb/usb-pxa2xx_udc-fix-misuse-of-clock-enable-disable-calls.patch new file mode 100644 index 00000000000000..d8136342826cb0 --- /dev/null +++ b/usb/usb-pxa2xx_udc-fix-misuse-of-clock-enable-disable-calls.patch @@ -0,0 +1,249 @@ +From david-b@pacbell.net Tue Mar 4 12:05:19 2008 +From: Dmitry Baryshkov <dbaryshkov@gmail.com> +Date: Fri, 22 Feb 2008 17:17:19 -0800 +Subject: USB: pxa2xx_udc: fix misuse of clock enable/disable calls +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Dmitry Baryshkov <dbaryshkov@gmail.com> +Message-ID: <200802221717.19562.david-b@pacbell.net> +Content-Disposition: inline + + +From: Dmitry Baryshkov <dbaryshkov@gmail.com> + +Fix pxa2xx_udc to balance calls to clk_enable/clk_disable. + +[db: remove inline #ifdefs for IXP non-support of <linux/clk.h> calls] + +Signed-off-by: Dmitry Baryshkov dbaryshkov@gmail.com +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/pxa2xx_udc.c | 88 ++++++++++++++++++++++------------------ + drivers/usb/gadget/pxa2xx_udc.h | 4 + + 2 files changed, 53 insertions(+), 39 deletions(-) + +--- a/drivers/usb/gadget/pxa2xx_udc.c ++++ b/drivers/usb/gadget/pxa2xx_udc.c +@@ -103,6 +103,12 @@ static const char ep0name [] = "ep0"; + #error "Can't configure both IXP and PXA" + #endif + ++/* IXP doesn't yet support <linux/clk.h> */ ++#define clk_get(dev,name) NULL ++#define clk_enable(clk) do { } while (0) ++#define clk_disable(clk) do { } while (0) ++#define clk_put(clk) do { } while (0) ++ + #endif + + #include "pxa2xx_udc.h" +@@ -934,20 +940,31 @@ static void udc_disable(struct pxa2xx_ud + /* We disable the UDC -- and its 48 MHz clock -- whenever it's not + * in active use. + */ +-static int pullup(struct pxa2xx_udc *udc, int is_active) ++static int pullup(struct pxa2xx_udc *udc) + { +- is_active = is_active && udc->vbus && udc->pullup; ++ int is_active = udc->vbus && udc->pullup && !udc->suspended; + DMSG("%s\n", is_active ? "active" : "inactive"); +- if (is_active) +- udc_enable(udc); +- else { +- if (udc->gadget.speed != USB_SPEED_UNKNOWN) { +- DMSG("disconnect %s\n", udc->driver +- ? udc->driver->driver.name +- : "(no driver)"); +- stop_activity(udc, udc->driver); ++ if (is_active) { ++ if (!udc->active) { ++ udc->active = 1; ++ /* Enable clock for USB device */ ++ clk_enable(udc->clk); ++ udc_enable(udc); + } +- udc_disable(udc); ++ } else { ++ if (udc->active) { ++ if (udc->gadget.speed != USB_SPEED_UNKNOWN) { ++ DMSG("disconnect %s\n", udc->driver ++ ? udc->driver->driver.name ++ : "(no driver)"); ++ stop_activity(udc, udc->driver); ++ } ++ udc_disable(udc); ++ /* Disable clock for USB device */ ++ clk_disable(udc->clk); ++ udc->active = 0; ++ } ++ + } + return 0; + } +@@ -958,9 +975,9 @@ static int pxa2xx_udc_vbus_session(struc + struct pxa2xx_udc *udc; + + udc = container_of(_gadget, struct pxa2xx_udc, gadget); +- udc->vbus = is_active = (is_active != 0); ++ udc->vbus = (is_active != 0); + DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); +- pullup(udc, is_active); ++ pullup(udc); + return 0; + } + +@@ -975,9 +992,8 @@ static int pxa2xx_udc_pullup(struct usb_ + if (!udc->mach->gpio_pullup && !udc->mach->udc_command) + return -EOPNOTSUPP; + +- is_active = (is_active != 0); +- udc->pullup = is_active; +- pullup(udc, is_active); ++ udc->pullup = (is_active != 0); ++ pullup(udc); + return 0; + } + +@@ -997,7 +1013,7 @@ static const struct usb_gadget_ops pxa2x + #ifdef CONFIG_USB_GADGET_DEBUG_FS + + static int +-udc_seq_show(struct seq_file *m, void *d) ++udc_seq_show(struct seq_file *m, void *_d) + { + struct pxa2xx_udc *dev = m->private; + unsigned long flags; +@@ -1146,11 +1162,6 @@ static void udc_disable(struct pxa2xx_ud + + udc_clear_mask_UDCCR(UDCCR_UDE); + +-#ifdef CONFIG_ARCH_PXA +- /* Disable clock for USB device */ +- clk_disable(dev->clk); +-#endif +- + ep0_idle (dev); + dev->gadget.speed = USB_SPEED_UNKNOWN; + } +@@ -1191,11 +1202,6 @@ static void udc_enable (struct pxa2xx_ud + { + udc_clear_mask_UDCCR(UDCCR_UDE); + +-#ifdef CONFIG_ARCH_PXA +- /* Enable clock for USB device */ +- clk_enable(dev->clk); +-#endif +- + /* try to clear these bits before we enable the udc */ + udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR); + +@@ -1286,7 +1292,7 @@ fail: + * for set_configuration as well as eventual disconnect. + */ + DMSG("registered gadget driver '%s'\n", driver->driver.name); +- pullup(dev, 1); ++ pullup(dev); + dump_state(dev); + return 0; + } +@@ -1329,7 +1335,8 @@ int usb_gadget_unregister_driver(struct + return -EINVAL; + + local_irq_disable(); +- pullup(dev, 0); ++ dev->pullup = 0; ++ pullup(dev); + stop_activity(dev, driver); + local_irq_enable(); + +@@ -2131,13 +2138,11 @@ static int __init pxa2xx_udc_probe(struc + if (irq < 0) + return -ENODEV; + +-#ifdef CONFIG_ARCH_PXA + dev->clk = clk_get(&pdev->dev, "UDCCLK"); + if (IS_ERR(dev->clk)) { + retval = PTR_ERR(dev->clk); + goto err_clk; + } +-#endif + + pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, + dev->has_cfr ? "" : " (!cfr)", +@@ -2250,10 +2255,8 @@ lubbock_fail0: + if (dev->mach->gpio_vbus) + gpio_free(dev->mach->gpio_vbus); + err_gpio_vbus: +-#ifdef CONFIG_ARCH_PXA + clk_put(dev->clk); + err_clk: +-#endif + return retval; + } + +@@ -2269,7 +2272,9 @@ static int __exit pxa2xx_udc_remove(stru + if (dev->driver) + return -EBUSY; + +- udc_disable(dev); ++ dev->pullup = 0; ++ pullup(dev); ++ + remove_debug_files(dev); + + if (dev->got_irq) { +@@ -2289,9 +2294,7 @@ static int __exit pxa2xx_udc_remove(stru + if (dev->mach->gpio_pullup) + gpio_free(dev->mach->gpio_pullup); + +-#ifdef CONFIG_ARCH_PXA + clk_put(dev->clk); +-#endif + + platform_set_drvdata(pdev, NULL); + the_controller = NULL; +@@ -2317,10 +2320,15 @@ static int __exit pxa2xx_udc_remove(stru + static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) + { + struct pxa2xx_udc *udc = platform_get_drvdata(dev); ++ unsigned long flags; + + if (!udc->mach->gpio_pullup && !udc->mach->udc_command) + WARN("USB host won't detect disconnect!\n"); +- pullup(udc, 0); ++ udc->suspended = 1; ++ ++ local_irq_save(flags); ++ pullup(udc); ++ local_irq_restore(flags); + + return 0; + } +@@ -2328,8 +2336,12 @@ static int pxa2xx_udc_suspend(struct pla + static int pxa2xx_udc_resume(struct platform_device *dev) + { + struct pxa2xx_udc *udc = platform_get_drvdata(dev); ++ unsigned long flags; + +- pullup(udc, 1); ++ udc->suspended = 0; ++ local_irq_save(flags); ++ pullup(udc); ++ local_irq_restore(flags); + + return 0; + } +--- a/drivers/usb/gadget/pxa2xx_udc.h ++++ b/drivers/usb/gadget/pxa2xx_udc.h +@@ -119,7 +119,9 @@ struct pxa2xx_udc { + has_cfr : 1, + req_pending : 1, + req_std : 1, +- req_config : 1; ++ req_config : 1, ++ suspended : 1, ++ active : 1; + + #define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200)) + struct timer_list timer; diff --git a/usb/usb-replace-remaining-__function__-occurrences.patch b/usb/usb-replace-remaining-__function__-occurrences.patch index e740b1130695fa..4d67f107e1f594 100644 --- a/usb/usb-replace-remaining-__function__-occurrences.patch +++ b/usb/usb-replace-remaining-__function__-occurrences.patch @@ -1592,7 +1592,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> device_destroy(usb_gadget_class, g_printer_devno); --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c -@@ -229,7 +229,7 @@ static int pxa2xx_ep_enable (struct usb_ +@@ -235,7 +235,7 @@ static int pxa2xx_ep_enable (struct usb_ || ep->bEndpointAddress != desc->bEndpointAddress || ep->fifo_size < le16_to_cpu (desc->wMaxPacketSize)) { @@ -1601,7 +1601,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -EINVAL; } -@@ -237,7 +237,7 @@ static int pxa2xx_ep_enable (struct usb_ +@@ -243,7 +243,7 @@ static int pxa2xx_ep_enable (struct usb_ if (ep->bmAttributes != desc->bmAttributes && ep->bmAttributes != USB_ENDPOINT_XFER_BULK && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { @@ -1610,7 +1610,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -EINVAL; } -@@ -246,13 +246,13 @@ static int pxa2xx_ep_enable (struct usb_ +@@ -252,13 +252,13 @@ static int pxa2xx_ep_enable (struct usb_ && le16_to_cpu (desc->wMaxPacketSize) != BULK_FIFO_SIZE) || !desc->wMaxPacketSize) { @@ -1626,7 +1626,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -ESHUTDOWN; } -@@ -277,7 +277,7 @@ static int pxa2xx_ep_disable (struct usb +@@ -283,7 +283,7 @@ static int pxa2xx_ep_disable (struct usb ep = container_of (_ep, struct pxa2xx_ep, ep); if (!_ep || !ep->desc) { @@ -1635,7 +1635,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> _ep ? ep->ep.name : NULL); return -EINVAL; } -@@ -455,7 +455,7 @@ void ep0start(struct pxa2xx_udc *dev, u3 +@@ -461,7 +461,7 @@ void ep0start(struct pxa2xx_udc *dev, u3 USIR0 = USIR0_IR0; dev->req_pending = 0; DBG(DBG_VERY_NOISY, "%s %s, %02x/%02x\n", @@ -1644,7 +1644,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } static int -@@ -645,20 +645,20 @@ pxa2xx_ep_queue(struct usb_ep *_ep, stru +@@ -651,20 +651,20 @@ pxa2xx_ep_queue(struct usb_ep *_ep, stru req = container_of(_req, struct pxa2xx_request, req); if (unlikely (!_req || !_req->complete || !_req->buf || !list_empty(&req->queue))) { @@ -1668,7 +1668,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -ESHUTDOWN; } -@@ -801,7 +801,7 @@ static int pxa2xx_ep_set_halt(struct usb +@@ -807,7 +807,7 @@ static int pxa2xx_ep_set_halt(struct usb if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name)) || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { @@ -1677,7 +1677,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -EINVAL; } if (value == 0) { -@@ -853,7 +853,7 @@ static int pxa2xx_ep_fifo_status(struct +@@ -859,7 +859,7 @@ static int pxa2xx_ep_fifo_status(struct ep = container_of(_ep, struct pxa2xx_ep, ep); if (!_ep) { @@ -1686,7 +1686,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -ENODEV; } /* pxa can't report unclaimed bytes from IN fifos */ -@@ -872,7 +872,7 @@ static void pxa2xx_ep_fifo_flush(struct +@@ -878,7 +878,7 @@ static void pxa2xx_ep_fifo_flush(struct ep = container_of(_ep, struct pxa2xx_ep, ep); if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { @@ -1695,7 +1695,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return; } -@@ -1806,7 +1806,7 @@ pxa2xx_udc_irq(int irq, void *_dev) +@@ -1813,7 +1813,7 @@ pxa2xx_udc_irq(int irq, void *_dev) static void nop_release (struct device *dev) { |
