summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2023-08-24 17:02:26 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2023-08-24 17:18:59 +0900
commit148984e9cee3532fe11331fcab83f729a41e6bf4 (patch)
treec7c321994a9f53aeaf627639d3dc75eb9be34ebf
parent2328c5c76fccc1d784ba5ed9562e7caa75be08d8 (diff)
downloadlinux-starfive-148984e9cee3532fe11331fcab83f729a41e6bf4.tar.gz
linux-starfive-148984e9cee3532fe11331fcab83f729a41e6bf4.tar.bz2
linux-starfive-148984e9cee3532fe11331fcab83f729a41e6bf4.zip
WORKAROUND: usb: cdns3: Restore onchip memory reservationaccepted/tizen/unified/riscv/20230828.003411
Restore onchip meory reservation of disable in_ep when hw configuration is not done as a workaround. Without restoring, disabling and re-enabling eps causes check failure of onchip memory reseration size. This fixes usb communication failure of ffs_func_set_alt() calling usb_ep_disable() and usb_ep_enable() for all ep. Note: for non workaround, it should calculate exact reservation size from ep type and usb speed and should restore out_ep memory reservation when there is no more enabled out_ep. Change-Id: Ifca0052f96fd777036e01b9ddb7ae6af54bba911 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
-rw-r--r--drivers/usb/cdns3/cdns3-gadget.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 1dcadef933e3..ede4935826f3 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -2452,6 +2452,16 @@ static int cdns3_gadget_ep_disable(struct usb_ep *ep)
trace_cdns3_gadget_ep_disable(priv_ep);
+ /*
+ * WORKAROUND: before hw configuration, restore onchip memory
+ * reservation for each disabled in_ep with ep_buf_size
+ *
+ * for out_ep, only one onchip buffer is reused.
+ */
+ if (!priv_dev->hw_configured_flag)
+ if (!!priv_ep->dir)
+ priv_dev->onchip_used_size -= priv_dev->ep_buf_size;
+
cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
ep_cfg = readl(&priv_dev->regs->ep_cfg);