diff options
author | Li Jun <b47624@freescale.com> | 2014-07-03 03:38:42 +0800 |
---|---|---|
committer | Peng Fushi <fushi.peng@freescale.com> | 2014-09-22 13:52:54 +0800 |
commit | 7d66a59d050e27adea21a79407f656295c95c1af (patch) | |
tree | 67fd9c1c750beb5e083951b05d93fe091b6cc0a7 | |
parent | 5c823af0549c3207f6b8bfc1b7771a74d540238a (diff) |
ENGR00331423 usb: host: Use non-bufferable memory allocation for dma.
This patch changes usb host dma allocation to be non-bufferable to fix
data coherent issue.
Signed-off-by: Li Jun <b47624@freescale.com>
-rw-r--r-- | drivers/usb/core/buffer.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ehci-mem-iram.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/ehci-mem.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 8 |
4 files changed, 15 insertions, 13 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 687ddb897ed8..3b34868499b4 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -117,9 +117,10 @@ void *hcd_buffer_alloc( for (i = 0; i < HCD_BUFFER_POOLS; i++) { if (size <= pool_max[i]) - return dma_pool_alloc(hcd->pool[i], mem_flags, dma); + return dma_pool_alloc_nonbufferable(hcd->pool[i], + mem_flags, dma); } - return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags); + return dma_alloc_noncached(hcd->self.controller, size, dma, mem_flags); } void *hcd_buffer_alloc_nonbufferable( diff --git a/drivers/usb/host/ehci-mem-iram.c b/drivers/usb/host/ehci-mem-iram.c index fd7b42b22758..a77240cc298a 100644 --- a/drivers/usb/host/ehci-mem-iram.c +++ b/drivers/usb/host/ehci-mem-iram.c @@ -275,10 +275,11 @@ static struct ehci_qtd *ehci_qtd_alloc(struct ehci_hcd *ehci, gfp_t flags) if (dma != 0) qtd = (struct ehci_qtd *)(g_iram_addr + (dma - g_iram_base)); else - qtd = dma_pool_alloc(ehci->qtd_pool, flags, &dma); + qtd = dma_pool_alloc_nonbufferable(ehci->qtd_pool, + flags, &dma); } else - qtd = dma_pool_alloc(ehci->qtd_pool, flags, &dma); + qtd = dma_pool_alloc_nonbufferable(ehci->qtd_pool, flags, &dma); if (qtd != NULL) { ehci_qtd_init(ehci, qtd, dma); @@ -337,7 +338,7 @@ static struct ehci_qh *ehci_qh_alloc(struct ehci_hcd *ehci, gfp_t flags) qh = (struct ehci_qh *)(g_iram_addr + (dma - g_iram_base)); else qh = (struct ehci_qh *) - dma_pool_alloc(ehci->qh_pool, flags, &dma); + dma_pool_alloc_nonbufferable(ehci->qh_pool, flags, &dma); ++g_debug_qH_allocated; if (qh == NULL) { panic("run out of i-ram for qH allocation\n"); @@ -492,7 +493,7 @@ static int ehci_mem_init(struct ehci_hcd *ehci, gfp_t flags) goto fail; ehci->periodic = (__le32 *) - dma_alloc_coherent(ehci_to_hcd(ehci)->self.controller, + dma_alloc_noncached(ehci_to_hcd(ehci)->self.controller, ehci->periodic_size * sizeof(__le32), &ehci->periodic_dma, 0); diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index 12f70c302b0b..a2bfe98235c8 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c @@ -51,7 +51,7 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags) struct ehci_qtd *qtd; dma_addr_t dma; - qtd = dma_pool_alloc (ehci->qtd_pool, flags, &dma); + qtd = dma_pool_alloc_nonbufferable(ehci->qtd_pool, flags, &dma); if (qtd != NULL) { ehci_qtd_init(ehci, qtd, dma); } @@ -88,7 +88,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) if (!qh) goto done; qh->hw = (struct ehci_qh_hw *) - dma_pool_alloc(ehci->qh_pool, flags, &dma); + dma_pool_alloc_nonbufferable(ehci->qh_pool, flags, &dma); if (!qh->hw) goto fail; memset(qh->hw, 0, sizeof *qh->hw); @@ -225,7 +225,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) /* Hardware periodic table */ ehci->periodic = (__le32 *) - dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller, + dma_alloc_noncached(ehci_to_hcd(ehci)->self.controller, ehci->periodic_size * sizeof(__le32), &ehci->periodic_dma, 0); if (ehci->periodic == NULL) { diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 8949b239decc..0c674f3ab25c 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -1272,8 +1272,8 @@ itd_urb_transaction ( itd_dma = itd->itd_dma; } else { spin_unlock_irqrestore (&ehci->lock, flags); - itd = dma_pool_alloc (ehci->itd_pool, mem_flags, - &itd_dma); + itd = dma_pool_alloc_nonbufferable(ehci->itd_pool, + mem_flags, &itd_dma); spin_lock_irqsave (&ehci->lock, flags); if (!itd) { iso_sched_free(stream, sched); @@ -1971,8 +1971,8 @@ sitd_urb_transaction ( sitd_dma = sitd->sitd_dma; } else { spin_unlock_irqrestore (&ehci->lock, flags); - sitd = dma_pool_alloc (ehci->sitd_pool, mem_flags, - &sitd_dma); + sitd = dma_pool_alloc_nonbufferable(ehci->sitd_pool, + mem_flags, &sitd_dma); spin_lock_irqsave (&ehci->lock, flags); if (!sitd) { iso_sched_free(stream, iso_sched); |