usb: dwc3-msm: Enable EP events only after GSI doorbell is updated

USB GSI hardware wrapper monitors USB interrupters for any events
on GSI EPs and rings GSI_DBL if there is any event. Since, GSI
doorbell can be enabled/disabled for all endpoints at a time and
not per endpoint, there is always a possibility of GSI wrapper
getting enabled before DBL_ADDR is programmed for all GSI_EPs.

Consider a case when there are multiple GSI functions present in
the composition (e.g. ADPL and RNDIS/RMNET) and ADPL function's
data_path_enable happens first which enables GSI wrapper.
And if for some reason there is a delay between RNDIS/RMNET EPs'
start_xfer and doorbell address update (and GSI wrapper is
already enabled by ADPL) then hardware may try to ring GSI_DBL
with address-0 on receiving XFER_IN_PROGRESS event.

This can be avoided by deferring enable of USB GSI EP's endpoint
events until doorbell address is programmed. It requires not
enabling EP events as part of EP_CONFIG on INIT and instead
issuing MODIFY EP_CONFIG command later for GSI EPs.
Similar issue exists for function suspend/resume when dealing
with more than one GSI interfaces in a composition. In that case
when all interfaces have disabled or blocked doorbell on its
function suspend, function resume of first interface unblocks
doorbell for all endpoint and can result in issues as corresponding
xdci channel might still be in suspended state. Fix this by also
disabling EP events when blocking doorbell so that unless EP events
are enabled again, hardware shouldn't access doorbell.

Change-Id: Ibe857fd04de7c6f1b4e74b4b1e55d711d73af2cc
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
3 files changed