diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2008-03-04 09:48:37 -0500 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-04-06 17:15:07 -0400 |
commit | 5d4c2707cf605fbf205b6d0a3c63d07204295f22 (patch) | |
tree | 8718fd7fe896b70a4911c4eb88ab98ee95203f6d /drivers/usb | |
parent | 6fdf5e67fe8d3c83500dad9acae985132c2459a3 (diff) |
atmel_usba: Kill copy_to_fifo() and copy_from_fifo()
These functions do exactly the same as memcpy_toio() and
memcpy_fromio() respectively.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 55 |
1 files changed, 4 insertions, 51 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index af8b2a3a2d4a..33a797bf413f 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -324,53 +324,6 @@ static int vbus_is_present(struct usba_udc *udc) | |||
324 | return 1; | 324 | return 1; |
325 | } | 325 | } |
326 | 326 | ||
327 | static void copy_to_fifo(void __iomem *fifo, const void *buf, int len) | ||
328 | { | ||
329 | unsigned long tmp; | ||
330 | |||
331 | DBG(DBG_FIFO, "copy to FIFO (len %d):\n", len); | ||
332 | for (; len > 0; len -= 4, buf += 4, fifo += 4) { | ||
333 | tmp = *(unsigned long *)buf; | ||
334 | if (len >= 4) { | ||
335 | DBG(DBG_FIFO, " -> %08lx\n", tmp); | ||
336 | __raw_writel(tmp, fifo); | ||
337 | } else { | ||
338 | do { | ||
339 | DBG(DBG_FIFO, " -> %02lx\n", tmp >> 24); | ||
340 | __raw_writeb(tmp >> 24, fifo); | ||
341 | fifo++; | ||
342 | tmp <<= 8; | ||
343 | } while (--len); | ||
344 | break; | ||
345 | } | ||
346 | } | ||
347 | } | ||
348 | |||
349 | static void copy_from_fifo(void *buf, void __iomem *fifo, int len) | ||
350 | { | ||
351 | union { | ||
352 | unsigned long *w; | ||
353 | unsigned char *b; | ||
354 | } p; | ||
355 | unsigned long tmp; | ||
356 | |||
357 | DBG(DBG_FIFO, "copy from FIFO (len %d):\n", len); | ||
358 | for (p.w = buf; len > 0; len -= 4, p.w++, fifo += 4) { | ||
359 | if (len >= 4) { | ||
360 | tmp = __raw_readl(fifo); | ||
361 | *p.w = tmp; | ||
362 | DBG(DBG_FIFO, " -> %08lx\n", tmp); | ||
363 | } else { | ||
364 | do { | ||
365 | tmp = __raw_readb(fifo); | ||
366 | *p.b = tmp; | ||
367 | DBG(DBG_FIFO, " -> %02lx\n", tmp); | ||
368 | fifo++, p.b++; | ||
369 | } while (--len); | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | |||
374 | static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) | 327 | static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) |
375 | { | 328 | { |
376 | unsigned int transaction_len; | 329 | unsigned int transaction_len; |
@@ -387,7 +340,7 @@ static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) | |||
387 | ep->ep.name, req, transaction_len, | 340 | ep->ep.name, req, transaction_len, |
388 | req->last_transaction ? ", done" : ""); | 341 | req->last_transaction ? ", done" : ""); |
389 | 342 | ||
390 | copy_to_fifo(ep->fifo, req->req.buf + req->req.actual, transaction_len); | 343 | memcpy_toio(ep->fifo, req->req.buf + req->req.actual, transaction_len); |
391 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); | 344 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); |
392 | req->req.actual += transaction_len; | 345 | req->req.actual += transaction_len; |
393 | } | 346 | } |
@@ -476,7 +429,7 @@ static void receive_data(struct usba_ep *ep) | |||
476 | bytecount = req->req.length - req->req.actual; | 429 | bytecount = req->req.length - req->req.actual; |
477 | } | 430 | } |
478 | 431 | ||
479 | copy_from_fifo(req->req.buf + req->req.actual, | 432 | memcpy_fromio(req->req.buf + req->req.actual, |
480 | ep->fifo, bytecount); | 433 | ep->fifo, bytecount); |
481 | req->req.actual += bytecount; | 434 | req->req.actual += bytecount; |
482 | 435 | ||
@@ -1231,7 +1184,7 @@ static int do_test_mode(struct usba_udc *udc) | |||
1231 | } else { | 1184 | } else { |
1232 | usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE); | 1185 | usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE); |
1233 | usba_writel(udc, TST, USBA_TST_PKT_MODE); | 1186 | usba_writel(udc, TST, USBA_TST_PKT_MODE); |
1234 | copy_to_fifo(ep->fifo, test_packet_buffer, | 1187 | memcpy_toio(ep->fifo, test_packet_buffer, |
1235 | sizeof(test_packet_buffer)); | 1188 | sizeof(test_packet_buffer)); |
1236 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); | 1189 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); |
1237 | dev_info(dev, "Entering Test_Packet mode...\n"); | 1190 | dev_info(dev, "Entering Test_Packet mode...\n"); |
@@ -1536,7 +1489,7 @@ restart: | |||
1536 | } | 1489 | } |
1537 | 1490 | ||
1538 | DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo); | 1491 | DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo); |
1539 | copy_from_fifo(crq.data, ep->fifo, sizeof(crq)); | 1492 | memcpy_fromio(crq.data, ep->fifo, sizeof(crq)); |
1540 | 1493 | ||
1541 | /* Free up one bank in the FIFO so that we can | 1494 | /* Free up one bank in the FIFO so that we can |
1542 | * generate or receive a reply right away. */ | 1495 | * generate or receive a reply right away. */ |