2 drivers/usb/gadget/pxa2xx_udc.c | 88 ++++++++++++++++++++++------------------
3 drivers/usb/gadget/pxa2xx_udc.h | 4 +
4 2 files changed, 53 insertions(+), 39 deletions(-)
6 --- g26.orig/drivers/usb/gadget/pxa2xx_udc.c 2008-02-19 12:47:06.000000000 -0800
7 +++ g26/drivers/usb/gadget/pxa2xx_udc.c 2008-02-19 14:07:17.000000000 -0800
8 @@ -103,6 +103,12 @@ static const char ep0name [] = "ep0";
9 #error "Can't configure both IXP and PXA"
12 +/* IXP doesn't yet support <linux/clk.h> */
13 +#define clk_get(dev,name) NULL
14 +#define clk_enable(clk) do { } while (0)
15 +#define clk_disable(clk) do { } while (0)
16 +#define clk_put(clk) do { } while (0)
20 #include "pxa2xx_udc.h"
21 @@ -934,20 +940,31 @@ static void udc_disable(struct pxa2xx_ud
22 /* We disable the UDC -- and its 48 MHz clock -- whenever it's not
25 -static int pullup(struct pxa2xx_udc *udc, int is_active)
26 +static int pullup(struct pxa2xx_udc *udc)
28 - is_active = is_active && udc->vbus && udc->pullup;
29 + int is_active = udc->vbus && udc->pullup && !udc->suspended;
30 DMSG("%s\n", is_active ? "active" : "inactive");
34 - if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
35 - DMSG("disconnect %s\n", udc->driver
36 - ? udc->driver->driver.name
38 - stop_activity(udc, udc->driver);
42 + /* Enable clock for USB device */
43 + clk_enable(udc->clk);
49 + if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
50 + DMSG("disconnect %s\n", udc->driver
51 + ? udc->driver->driver.name
53 + stop_activity(udc, udc->driver);
56 + /* Disable clock for USB device */
57 + clk_disable(udc->clk);
64 @@ -958,9 +975,9 @@ static int pxa2xx_udc_vbus_session(struc
65 struct pxa2xx_udc *udc;
67 udc = container_of(_gadget, struct pxa2xx_udc, gadget);
68 - udc->vbus = is_active = (is_active != 0);
69 + udc->vbus = (is_active != 0);
70 DMSG("vbus %s\n", is_active ? "supplied" : "inactive");
71 - pullup(udc, is_active);
76 @@ -975,9 +992,8 @@ static int pxa2xx_udc_pullup(struct usb_
77 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
80 - is_active = (is_active != 0);
81 - udc->pullup = is_active;
82 - pullup(udc, is_active);
83 + udc->pullup = (is_active != 0);
88 @@ -1146,11 +1162,6 @@ static void udc_disable(struct pxa2xx_ud
90 udc_clear_mask_UDCCR(UDCCR_UDE);
92 -#ifdef CONFIG_ARCH_PXA
93 - /* Disable clock for USB device */
94 - clk_disable(dev->clk);
98 dev->gadget.speed = USB_SPEED_UNKNOWN;
100 @@ -1191,11 +1202,6 @@ static void udc_enable (struct pxa2xx_ud
102 udc_clear_mask_UDCCR(UDCCR_UDE);
104 -#ifdef CONFIG_ARCH_PXA
105 - /* Enable clock for USB device */
106 - clk_enable(dev->clk);
109 /* try to clear these bits before we enable the udc */
110 udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR);
112 @@ -1286,7 +1292,7 @@ fail:
113 * for set_configuration as well as eventual disconnect.
115 DMSG("registered gadget driver '%s'\n", driver->driver.name);
121 @@ -1329,7 +1335,8 @@ int usb_gadget_unregister_driver(struct
128 stop_activity(dev, driver);
131 @@ -2131,13 +2138,11 @@ static int __init pxa2xx_udc_probe(struc
135 -#ifdef CONFIG_ARCH_PXA
136 dev->clk = clk_get(&pdev->dev, "UDCCLK");
137 if (IS_ERR(dev->clk)) {
138 retval = PTR_ERR(dev->clk);
143 pr_debug("%s: IRQ %d%s%s\n", driver_name, irq,
144 dev->has_cfr ? "" : " (!cfr)",
145 @@ -2250,10 +2255,8 @@ lubbock_fail0:
146 if (dev->mach->gpio_vbus)
147 gpio_free(dev->mach->gpio_vbus);
149 -#ifdef CONFIG_ARCH_PXA
156 @@ -2269,7 +2272,9 @@ static int __exit pxa2xx_udc_remove(stru
167 @@ -2289,9 +2294,7 @@ static int __exit pxa2xx_udc_remove(stru
168 if (dev->mach->gpio_pullup)
169 gpio_free(dev->mach->gpio_pullup);
171 -#ifdef CONFIG_ARCH_PXA
175 platform_set_drvdata(pdev, NULL);
176 the_controller = NULL;
177 @@ -2317,10 +2320,15 @@ static int __exit pxa2xx_udc_remove(stru
178 static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
180 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
181 + unsigned long flags;
183 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
184 WARN("USB host won't detect disconnect!\n");
186 + udc->suspended = 1;
188 + local_irq_save(flags);
190 + local_irq_restore(flags);
194 @@ -2328,8 +2336,12 @@ static int pxa2xx_udc_suspend(struct pla
195 static int pxa2xx_udc_resume(struct platform_device *dev)
197 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
198 + unsigned long flags;
201 + udc->suspended = 0;
202 + local_irq_save(flags);
204 + local_irq_restore(flags);
208 --- g26.orig/drivers/usb/gadget/pxa2xx_udc.h 2008-02-19 12:47:06.000000000 -0800
209 +++ g26/drivers/usb/gadget/pxa2xx_udc.h 2008-02-19 12:57:42.000000000 -0800
210 @@ -119,7 +119,9 @@ struct pxa2xx_udc {
219 #define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200))
220 struct timer_list timer;