diff options
| -rw-r--r-- | drivers/usb/core/message.c | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 36 |
2 files changed, 26 insertions, 12 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 64c7ab4702df..e0719b4ee189 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -1286,6 +1286,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
| 1286 | interface); | 1286 | interface); |
| 1287 | return -EINVAL; | 1287 | return -EINVAL; |
| 1288 | } | 1288 | } |
| 1289 | if (iface->unregistering) | ||
| 1290 | return -ENODEV; | ||
| 1289 | 1291 | ||
| 1290 | alt = usb_altnum_to_altsetting(iface, alternate); | 1292 | alt = usb_altnum_to_altsetting(iface, alternate); |
| 1291 | if (!alt) { | 1293 | if (!alt) { |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 2cd9a60c7f3a..4e4833168087 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
| @@ -46,7 +46,6 @@ | |||
| 46 | #include <asm/system.h> | 46 | #include <asm/system.h> |
| 47 | #include <asm/unaligned.h> | 47 | #include <asm/unaligned.h> |
| 48 | #include <asm/dma.h> | 48 | #include <asm/dma.h> |
| 49 | #include <asm/cacheflush.h> | ||
| 50 | 49 | ||
| 51 | #include "fsl_usb2_udc.h" | 50 | #include "fsl_usb2_udc.h" |
| 52 | 51 | ||
| @@ -118,6 +117,17 @@ static void (*_fsl_writel)(u32 v, unsigned __iomem *p); | |||
| 118 | #define fsl_readl(p) (*_fsl_readl)((p)) | 117 | #define fsl_readl(p) (*_fsl_readl)((p)) |
| 119 | #define fsl_writel(v, p) (*_fsl_writel)((v), (p)) | 118 | #define fsl_writel(v, p) (*_fsl_writel)((v), (p)) |
| 120 | 119 | ||
| 120 | static inline void fsl_set_accessors(struct fsl_usb2_platform_data *pdata) | ||
| 121 | { | ||
| 122 | if (pdata->big_endian_mmio) { | ||
| 123 | _fsl_readl = _fsl_readl_be; | ||
| 124 | _fsl_writel = _fsl_writel_be; | ||
| 125 | } else { | ||
| 126 | _fsl_readl = _fsl_readl_le; | ||
| 127 | _fsl_writel = _fsl_writel_le; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | |||
| 121 | static inline u32 cpu_to_hc32(const u32 x) | 131 | static inline u32 cpu_to_hc32(const u32 x) |
| 122 | { | 132 | { |
| 123 | return udc_controller->pdata->big_endian_desc | 133 | return udc_controller->pdata->big_endian_desc |
| @@ -132,6 +142,8 @@ static inline u32 hc32_to_cpu(const u32 x) | |||
| 132 | : le32_to_cpu((__force __le32)x); | 142 | : le32_to_cpu((__force __le32)x); |
| 133 | } | 143 | } |
| 134 | #else /* !CONFIG_PPC32 */ | 144 | #else /* !CONFIG_PPC32 */ |
| 145 | static inline void fsl_set_accessors(struct fsl_usb2_platform_data *pdata) {} | ||
| 146 | |||
| 135 | #define fsl_readl(addr) readl(addr) | 147 | #define fsl_readl(addr) readl(addr) |
| 136 | #define fsl_writel(val32, addr) writel(val32, addr) | 148 | #define fsl_writel(val32, addr) writel(val32, addr) |
| 137 | #define cpu_to_hc32(x) cpu_to_le32(x) | 149 | #define cpu_to_hc32(x) cpu_to_le32(x) |
| @@ -1277,6 +1289,11 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
| 1277 | req->req.complete = NULL; | 1289 | req->req.complete = NULL; |
| 1278 | req->dtd_count = 0; | 1290 | req->dtd_count = 0; |
| 1279 | 1291 | ||
| 1292 | req->req.dma = dma_map_single(ep->udc->gadget.dev.parent, | ||
| 1293 | req->req.buf, req->req.length, | ||
| 1294 | ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 1295 | req->mapped = 1; | ||
| 1296 | |||
| 1280 | if (fsl_req_to_dtd(req) == 0) | 1297 | if (fsl_req_to_dtd(req) == 0) |
| 1281 | fsl_queue_td(ep, req); | 1298 | fsl_queue_td(ep, req); |
| 1282 | else | 1299 | else |
| @@ -1348,9 +1365,6 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
| 1348 | /* Fill in the reqest structure */ | 1365 | /* Fill in the reqest structure */ |
| 1349 | *((u16 *) req->req.buf) = cpu_to_le16(tmp); | 1366 | *((u16 *) req->req.buf) = cpu_to_le16(tmp); |
| 1350 | 1367 | ||
| 1351 | /* flush cache for the req buffer */ | ||
| 1352 | flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8); | ||
| 1353 | |||
| 1354 | req->ep = ep; | 1368 | req->ep = ep; |
| 1355 | req->req.length = 2; | 1369 | req->req.length = 2; |
| 1356 | req->req.status = -EINPROGRESS; | 1370 | req->req.status = -EINPROGRESS; |
| @@ -1358,6 +1372,11 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
| 1358 | req->req.complete = NULL; | 1372 | req->req.complete = NULL; |
| 1359 | req->dtd_count = 0; | 1373 | req->dtd_count = 0; |
| 1360 | 1374 | ||
| 1375 | req->req.dma = dma_map_single(ep->udc->gadget.dev.parent, | ||
| 1376 | req->req.buf, req->req.length, | ||
| 1377 | ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 1378 | req->mapped = 1; | ||
| 1379 | |||
| 1361 | /* prime the data phase */ | 1380 | /* prime the data phase */ |
| 1362 | if ((fsl_req_to_dtd(req) == 0)) | 1381 | if ((fsl_req_to_dtd(req) == 0)) |
| 1363 | fsl_queue_td(ep, req); | 1382 | fsl_queue_td(ep, req); |
| @@ -2354,7 +2373,6 @@ static int __init struct_udc_setup(struct fsl_udc *udc, | |||
| 2354 | struct fsl_req, req); | 2373 | struct fsl_req, req); |
| 2355 | /* allocate a small amount of memory to get valid address */ | 2374 | /* allocate a small amount of memory to get valid address */ |
| 2356 | udc->status_req->req.buf = kmalloc(8, GFP_KERNEL); | 2375 | udc->status_req->req.buf = kmalloc(8, GFP_KERNEL); |
| 2357 | udc->status_req->req.dma = virt_to_phys(udc->status_req->req.buf); | ||
| 2358 | 2376 | ||
| 2359 | udc->resume_state = USB_STATE_NOTATTACHED; | 2377 | udc->resume_state = USB_STATE_NOTATTACHED; |
| 2360 | udc->usb_state = USB_STATE_POWERED; | 2378 | udc->usb_state = USB_STATE_POWERED; |
| @@ -2470,13 +2488,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
| 2470 | } | 2488 | } |
| 2471 | 2489 | ||
| 2472 | /* Set accessors only after pdata->init() ! */ | 2490 | /* Set accessors only after pdata->init() ! */ |
| 2473 | if (pdata->big_endian_mmio) { | 2491 | fsl_set_accessors(pdata); |
| 2474 | _fsl_readl = _fsl_readl_be; | ||
| 2475 | _fsl_writel = _fsl_writel_be; | ||
| 2476 | } else { | ||
| 2477 | _fsl_readl = _fsl_readl_le; | ||
| 2478 | _fsl_writel = _fsl_writel_le; | ||
| 2479 | } | ||
| 2480 | 2492 | ||
| 2481 | #ifndef CONFIG_ARCH_MXC | 2493 | #ifndef CONFIG_ARCH_MXC |
| 2482 | if (pdata->have_sysif_regs) | 2494 | if (pdata->have_sysif_regs) |
