From c138ecfa6108edee17fabfa56285b00f66641659 Mon Sep 17 00:00:00 2001 From: Sevak Arakelyan Date: Mon, 23 Jan 2017 15:01:23 -0800 Subject: usb: dwc2: gadget: Set TX FIFO depths to calculated defaults Remove legacy DWC2_G_P_LEGACY_TX_FIFO_SIZE array for TX FIFOs. Update dwc2_set_param_tx_fifo_sizes function to calculate and assign default average FIFO depth to each member of g_tx_fifo_size array. Total FIFO size, EP Info block's size, FIFO operation mode and device operation mode are taken into consideration during the calculation. Cc: Stefan Wahren Signed-off-by: Sevak Arakelyan Signed-off-by: John Youn Signed-off-by: Felipe Balbi --- drivers/usb/dwc2/params.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/usb/dwc2/params.c') diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 8e5039e2d3fc..016fff0cb887 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -207,12 +207,16 @@ static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg) static void dwc2_set_param_tx_fifo_sizes(struct dwc2_hsotg *hsotg) { struct dwc2_core_params *p = &hsotg->params; - u32 p_tx_fifo[] = DWC2_G_P_LEGACY_TX_FIFO_SIZE; + int depth_average; + int fifo_count; + int i; + + fifo_count = dwc2_hsotg_tx_fifo_count(hsotg); memset(p->g_tx_fifo_size, 0, sizeof(p->g_tx_fifo_size)); - memcpy(&p->g_tx_fifo_size[1], - p_tx_fifo, - sizeof(p_tx_fifo)); + depth_average = dwc2_hsotg_tx_fifo_average_depth(hsotg); + for (i = 1; i <= fifo_count; i++) + p->g_tx_fifo_size[i] = depth_average; } /** -- cgit v1.2.1