diff options
author | Anatolij Gustschin <agust@denx.de> | 2011-06-25 17:37:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-01 17:20:39 -0400 |
commit | 3140d5b2664309253ba465a14c89fe4f59c0359b (patch) | |
tree | d888bbeea10a668ef3df6b5ebf2f326fbc8c0f68 | |
parent | daf54f1f363a61c618662ef66d4bf09d2b090941 (diff) |
USB: fsl_udc_core: fix build breakage when building for ARM arch
Commit 09ba0def (USB: fsl_udc_core: prepare for SoCs with
BE registers and descriptors) introduced build breakage
on ARM arch. Fix it by setting accessors using a static
inline function which is a nop when compiling the driver
for ARM arch.
Commit 2ea6698 (USB: fsl_udc_core: support device mode of
MPC5121E DR USB Controller) caused another breakage on ARM
by using flush_dcache_range(). Don't use it, convert to the
DMA API usage instead. USB2.0CV Halt Endpoint Test succeeds
on PPC. Tested both on ARM i.MX31 and mpc5121 PPC, also with
CONFIG_DMA_API_DEBUG enabled.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 36 |
1 files changed, 24 insertions, 12 deletions
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) |