usb: dwc_otg_310: hcd: limit max size of aligned buffer

Limit the max size of aligned buffer to 64K. Because
64K buffer is enough for most of usb transfers, and
the aligned buffer is a coherent DMA buffer allocated
by dma_alloc_coherent, too large buffer may cause
coherent DMA memory allocation failure on some platforms.

Change-Id: Ib4895349be93d7a298f5cd08c609f1a8a81d2610
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2018-03-30 12:48:14 +08:00
committed by Tao Huang
parent bbc53fb321
commit 55aaa15dde
2 changed files with 2 additions and 0 deletions

View File

@@ -1240,6 +1240,7 @@ static int assign_and_init_hc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh)
uint32_t buf_size;
if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) {
buf_size = hcd->core_if->core_params->max_transfer_size;
buf_size = buf_size > 65536 ? 65536 : buf_size;
} else {
buf_size = 4096;
}

View File

@@ -69,6 +69,7 @@ void dwc_otg_hcd_qh_free(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh)
buf_size = 4096;
} else {
buf_size = hcd->core_if->core_params->max_transfer_size;
buf_size = buf_size > 65536 ? 65536 : buf_size;
}
DWC_DEV_DMA_FREE(buf_size, qh->dw_align_buf,
qh->dw_align_buf_dma);