[u-boot] usb: dwc_hcd: fix cache consistency issue
This commit is contained in:
@ -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, ®->Host.hchn[ch_num].hctsizn);
|
||||
writel((uint32_t)aligned_buf, ®->Host.hchn[ch_num].hcdman);
|
||||
writel(hcchar.d32, ®->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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user