diff options
author | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:36 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:36 -0400 |
commit | 0499bdeb1dec30325aa282a83f9374fa849aa01c (patch) | |
tree | 30f16c5516460e8b205d6be967017c9b8c90d4a4 /drivers/usb/gadget | |
parent | 4d96372e6daae89166fed7883ee092dc8db80b21 (diff) |
ARM: OMAP: DMA: Remove __REG access
Remove __REG access in DMA code, use dma_read/write instead:
- dynamically set the omap_dma_base based on the omap type
- omap_read/write becomes dma_read/write
- dma channel registers are read with dma_ch_read/write
Cc: David Brownell <david-b@pacbell.net>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 881d74c3d964..86c029a8d998 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -491,32 +491,6 @@ static int read_fifo(struct omap_ep *ep, struct omap_req *req) | |||
491 | 491 | ||
492 | /*-------------------------------------------------------------------------*/ | 492 | /*-------------------------------------------------------------------------*/ |
493 | 493 | ||
494 | static inline dma_addr_t dma_csac(unsigned lch) | ||
495 | { | ||
496 | dma_addr_t csac; | ||
497 | |||
498 | /* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is | ||
499 | * read before the DMA controller finished disabling the channel. | ||
500 | */ | ||
501 | csac = OMAP_DMA_CSAC_REG(lch); | ||
502 | if (csac == 0) | ||
503 | csac = OMAP_DMA_CSAC_REG(lch); | ||
504 | return csac; | ||
505 | } | ||
506 | |||
507 | static inline dma_addr_t dma_cdac(unsigned lch) | ||
508 | { | ||
509 | dma_addr_t cdac; | ||
510 | |||
511 | /* omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is | ||
512 | * read before the DMA controller finished disabling the channel. | ||
513 | */ | ||
514 | cdac = OMAP_DMA_CDAC_REG(lch); | ||
515 | if (cdac == 0) | ||
516 | cdac = OMAP_DMA_CDAC_REG(lch); | ||
517 | return cdac; | ||
518 | } | ||
519 | |||
520 | static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start) | 494 | static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start) |
521 | { | 495 | { |
522 | dma_addr_t end; | 496 | dma_addr_t end; |
@@ -527,7 +501,7 @@ static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start) | |||
527 | if (cpu_is_omap15xx()) | 501 | if (cpu_is_omap15xx()) |
528 | return 0; | 502 | return 0; |
529 | 503 | ||
530 | end = dma_csac(ep->lch); | 504 | end = omap_get_dma_src_pos(ep->lch); |
531 | if (end == ep->dma_counter) | 505 | if (end == ep->dma_counter) |
532 | return 0; | 506 | return 0; |
533 | 507 | ||
@@ -537,15 +511,11 @@ static u16 dma_src_len(struct omap_ep *ep, dma_addr_t start) | |||
537 | return end - start; | 511 | return end - start; |
538 | } | 512 | } |
539 | 513 | ||
540 | #define DMA_DEST_LAST(x) (cpu_is_omap15xx() \ | ||
541 | ? OMAP_DMA_CSAC_REG(x) /* really: CPC */ \ | ||
542 | : dma_cdac(x)) | ||
543 | |||
544 | static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start) | 514 | static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start) |
545 | { | 515 | { |
546 | dma_addr_t end; | 516 | dma_addr_t end; |
547 | 517 | ||
548 | end = DMA_DEST_LAST(ep->lch); | 518 | end = omap_get_dma_dst_pos(ep->lch); |
549 | if (end == ep->dma_counter) | 519 | if (end == ep->dma_counter) |
550 | return 0; | 520 | return 0; |
551 | 521 | ||
@@ -596,7 +566,7 @@ static void next_in_dma(struct omap_ep *ep, struct omap_req *req) | |||
596 | 0, 0); | 566 | 0, 0); |
597 | 567 | ||
598 | omap_start_dma(ep->lch); | 568 | omap_start_dma(ep->lch); |
599 | ep->dma_counter = dma_csac(ep->lch); | 569 | ep->dma_counter = omap_get_dma_src_pos(ep->lch); |
600 | UDC_DMA_IRQ_EN_REG |= UDC_TX_DONE_IE(ep->dma_channel); | 570 | UDC_DMA_IRQ_EN_REG |= UDC_TX_DONE_IE(ep->dma_channel); |
601 | UDC_TXDMA_REG(ep->dma_channel) = UDC_TXN_START | txdma_ctrl; | 571 | UDC_TXDMA_REG(ep->dma_channel) = UDC_TXN_START | txdma_ctrl; |
602 | req->dma_bytes = length; | 572 | req->dma_bytes = length; |
@@ -654,7 +624,7 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req) | |||
654 | omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF, | 624 | omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF, |
655 | OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, | 625 | OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual, |
656 | 0, 0); | 626 | 0, 0); |
657 | ep->dma_counter = DMA_DEST_LAST(ep->lch); | 627 | ep->dma_counter = omap_get_dma_dst_pos(ep->lch); |
658 | 628 | ||
659 | UDC_RXDMA_REG(ep->dma_channel) = UDC_RXN_STOP | (packets - 1); | 629 | UDC_RXDMA_REG(ep->dma_channel) = UDC_RXN_STOP | (packets - 1); |
660 | UDC_DMA_IRQ_EN_REG |= UDC_RX_EOT_IE(ep->dma_channel); | 630 | UDC_DMA_IRQ_EN_REG |= UDC_RX_EOT_IE(ep->dma_channel); |
@@ -834,7 +804,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel) | |||
834 | 804 | ||
835 | /* channel type P: hw synch (fifo) */ | 805 | /* channel type P: hw synch (fifo) */ |
836 | if (cpu_class_is_omap1() && !cpu_is_omap15xx()) | 806 | if (cpu_class_is_omap1() && !cpu_is_omap15xx()) |
837 | OMAP1_DMA_LCH_CTRL_REG(ep->lch) = 2; | 807 | omap_set_dma_channel_mode(ep->lch, OMAP_DMA_LCH_P); |
838 | } | 808 | } |
839 | 809 | ||
840 | just_restart: | 810 | just_restart: |
@@ -881,7 +851,7 @@ static void dma_channel_release(struct omap_ep *ep) | |||
881 | else | 851 | else |
882 | req = NULL; | 852 | req = NULL; |
883 | 853 | ||
884 | active = ((1 << 7) & OMAP_DMA_CCR_REG(ep->lch)) != 0; | 854 | active = omap_get_dma_active_status(ep->lch); |
885 | 855 | ||
886 | DBG("%s release %s %cxdma%d %p\n", ep->ep.name, | 856 | DBG("%s release %s %cxdma%d %p\n", ep->ep.name, |
887 | active ? "active" : "idle", | 857 | active ? "active" : "idle", |