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>
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);