USB: pxa27x_udc: minor fixes

Minor fixes to pxa27x udc driver :
- don't clobber driver model bus_id field
- wrong endianess fix (no functional change; cpu is little-endian)
- double udc disable fix
- resume/suspend fix (OTG hold bit)
- make driver pxa27x dependant (check cpu at runtime)

Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Robert Jarzmik and committed by Greg Kroah-Hartman 5a59bc54 6def7553

+16 -9
+8 -9
drivers/usb/gadget/pxa27x_udc.c
··· 1546 INIT_LIST_HEAD(&dev->gadget.ep0->ep_list); 1547 dev->udc_usb_ep[0].pxa_ep = &dev->pxa_ep[0]; 1548 ep0_idle(dev); 1549 - strcpy(dev->dev->bus_id, ""); 1550 1551 /* PXA endpoints init */ 1552 for (i = 0; i < NR_PXA_ENDPOINTS; i++) { ··· 1745 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i); 1746 } 1747 1748 - le16_to_cpus(&u.r.wValue); 1749 - le16_to_cpus(&u.r.wIndex); 1750 - le16_to_cpus(&u.r.wLength); 1751 - 1752 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n", 1753 u.r.bRequestType, u.r.bRequest, 1754 - u.r.wValue, u.r.wIndex, u.r.wLength); 1755 if (unlikely(have_extrabytes)) 1756 goto stall; 1757 ··· 2292 { 2293 struct pxa_udc *udc = platform_get_drvdata(_dev); 2294 2295 - udc_disable(udc); 2296 } 2297 2298 #ifdef CONFIG_PM ··· 2358 * Upon exit from sleep mode and before clearing OTGPH, 2359 * Software must configure the USB OTG pad, UDC, and UHC 2360 * to the state they were in before entering sleep mode. 2361 - * 2362 - * Should be : PSSR |= PSSR_OTGPH; 2363 */ 2364 2365 return 0; 2366 } ··· 2383 2384 static int __init udc_init(void) 2385 { 2386 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); 2387 return platform_driver_probe(&udc_driver, pxa_udc_probe); 2388 }
··· 1546 INIT_LIST_HEAD(&dev->gadget.ep0->ep_list); 1547 dev->udc_usb_ep[0].pxa_ep = &dev->pxa_ep[0]; 1548 ep0_idle(dev); 1549 1550 /* PXA endpoints init */ 1551 for (i = 0; i < NR_PXA_ENDPOINTS; i++) { ··· 1746 ep_err(ep, "wrong to have extra bytes for setup : 0x%08x\n", i); 1747 } 1748 1749 ep_dbg(ep, "SETUP %02x.%02x v%04x i%04x l%04x\n", 1750 u.r.bRequestType, u.r.bRequest, 1751 + le16_to_cpu(u.r.wValue), le16_to_cpu(u.r.wIndex), 1752 + le16_to_cpu(u.r.wLength)); 1753 if (unlikely(have_extrabytes)) 1754 goto stall; 1755 ··· 2296 { 2297 struct pxa_udc *udc = platform_get_drvdata(_dev); 2298 2299 + if (udc_readl(udc, UDCCR) & UDCCR_UDE) 2300 + udc_disable(udc); 2301 } 2302 2303 #ifdef CONFIG_PM ··· 2361 * Upon exit from sleep mode and before clearing OTGPH, 2362 * Software must configure the USB OTG pad, UDC, and UHC 2363 * to the state they were in before entering sleep mode. 2364 */ 2365 + PSSR |= PSSR_OTGPH; 2366 2367 return 0; 2368 } ··· 2387 2388 static int __init udc_init(void) 2389 { 2390 + if (!cpu_is_pxa27x()) 2391 + return -ENODEV; 2392 + 2393 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); 2394 return platform_driver_probe(&udc_driver, pxa_udc_probe); 2395 }
+8
drivers/usb/gadget/pxa27x_udc.h
··· 484 #define ep_warn(ep, fmt, arg...) \ 485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg) 486 487 #endif /* __LINUX_USB_GADGET_PXA27X_H */
··· 484 #define ep_warn(ep, fmt, arg...) \ 485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg) 486 487 + /* 488 + * Cannot include pxa-regs.h, as register names are similar. 489 + * So PSSR is redefined here. This should be removed once UDC registers will 490 + * be gone from pxa-regs.h. 491 + */ 492 + #define PSSR __REG(0x40F00004) /* Power Manager Sleep Status */ 493 + #define PSSR_OTGPH (1 << 6) /* OTG Peripheral Hold */ 494 + 495 #endif /* __LINUX_USB_GADGET_PXA27X_H */