[u-boot] usb: dwc_hcd: fix cache consistency issue

This commit is contained in:
Firefly
2015-08-17 16:17:23 +08:00
committed by djw
parent 700a9879aa
commit 43084a4a6d

View File

@ -482,6 +482,10 @@ dwc2_transfer(struct usb_device *dev, unsigned long pipe, int size,
if (do_copy && (dir == EPDIR_OUT))
memcpy(aligned_buf, data_buf, size);
if (dir == EPDIR_OUT)
flush_dcache_range(aligned_buf, aligned_buf +
roundup(size, ARCH_DMA_MINALIGN));
writel(hctsiz.d32, &reg->Host.hchn[ch_num].hctsizn);
writel((uint32_t)aligned_buf, &reg->Host.hchn[ch_num].hcdman);
writel(hcchar.d32, &reg->Host.hchn[ch_num].hccharn);
@ -492,6 +496,10 @@ dwc2_transfer(struct usb_device *dev, unsigned long pipe, int size,
/* Calculate actual transferred length */
transferred = (dir == EPDIR_IN) ? inpkt_length - ret : ret;
if (dir == EPDIR_IN)
invalidate_dcache_range(aligned_buf, aligned_buf +
roundup(transferred, ARCH_DMA_MINALIGN));
if (do_copy && (dir == EPDIR_IN))
memcpy(data_buf, aligned_buf, transferred);
}
@ -505,6 +513,7 @@ dwc2_transfer(struct usb_device *dev, unsigned long pipe, int size,
printf("%s Transfer stop code: %d\n", __func__, ret);
return ret;
}
return transferred;
}