USB: gadget: rndis: Allow reading of 'rx_trigger' attribute value

rx_trigger attribute is used by userspace to kickstart RX
once end to end data path is setup on USB connection.
Currently this attribute is write only. Make it readable
so that userspace can read it back during fast USB connect
disconnect scenarios which results in net core missing to
send NETLINK DISCONNECT events. Userspace can read this back
on CONNECT to figure out any missed disconnect events.

Change-Id: Ief1d93b1e29103336b672cf0e8abcfe881aaa617
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB: gadget: u_bam_data: Check USB state under spinlock

While starting/stopping endless transfers, USB may get
disconnected. This is checked using port_data just before
calling usb_ep_queue. But, this is possibility of disconnect
happening after this check resulting in NULL pointer
dereference when accessing port_usb->in/out EPs. Fix this
by checking for cable connection under spinlock and using
a copy of EP context for calling usb_ep_queue.

Change-Id: I196650223f1350a5c5cc2cd173a67dc3c64c2dc6
CRs-fixed: 756048
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Merge "USB: gadget: rndis: Allow reading of 'rx_trigger' attribute value"
Merge "USB: gadget: u_bam_data: Check USB state under spinlock"
usb: gadget: ci13xxx: Cancel pending suspend work before resuming h/w

Composite driver can try to disable pull-up (or disconnect) to carry
out composition switch after bus suspend. There is a possible race in
this scenario between OTG driver trying to suspend hardware and UDC
checking for this state before disabling/enabling pull-up.
Hence, flush OTG driver's suspend work before checking LPM state in UDC.

Change-Id: Id3e6dfda8a41b79678db3388d9d4685a547be9d4
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Merge "usb: gadget: ci13xxx: Cancel pending suspend work before resuming h/w"
usb: gadget: qc_ecm: Remove setting of cdev and func to NULL

If host doesn't support remote wakeup and while performing
bus suspend functionality, currently cdev and func are being
set to NULL from ecm_qc_bam_disconnect(). Due to which resuming
device would never able to re-established USB IPA BAM
functionality. Fix this issue by removing setting of cdev and
func to NULL using data_inteface_up flag to check this condition
which would handle case where suspend is being received before
SET_ALT(1) is sent from host.

Change-Id: I35076382916c3df720f256a2ac19c36c4da79407
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
usb: gadget: qc_ecm: Fix bus resume case after PC wakeup from sleep

With remote wakeup disable from host, USB IPA BAM Pipes are being
disconnected while performing USB bus suspend functionality and ECM
IPA driver is notified as USB cable disconnect event. On resume case,
those pipes are re-connected and ECM IPA driver is notified as USB
cable connect event. While performing USB IPA disconnect sequence,
ecm_mdm_ready_trigger is not being updated (i.e. set to false). Hence
on resume case received ECM network interface UP notification is
ignored to queue TX/RX transfers which results in no data transfer
between host and device for ECM interface. Fix this issue by setting
ecm_mdm_ready_trigger flag to false while performing USB bus suspend
functionality.

Change-Id: I2f0c3f4bbaedce8e7b9df6458b01bfe88ed9f8b7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
usb_bam: Allow HSUSB BAM to be enabled on bootup itself

HSUSB BAM is not NDP BAM and it must be enabled early before
starting peripheral controller to avoid switching USB core mode
from legacy to BAM with ongoing data transfers.
Also, there could be a possibility that USB OTG driver puts USB
in LPM after its probe incase USB is not connected and before
USB BAM driver is probed. This may result in unclocked access
while enabling USB BAM. To handle this make sure that USB BAM
is probed only after USB OTG and use pm_runtime APIs before
enabling HSUSB BAM.

Change-Id: I4b0fe14d046fbaa485e832a0aed7026e340be225
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
ARM: dts: msm: Enable HSUSB BAM early and don't RESET it on connect

HSUSB BAM is not NDP BAM and it must be enabled early before
starting peripheral controller to avoid switching USB core mode
from legacy to BAM with ongoing data transfers.
Additionally resetting HSUSB BAM requires switching USB core from
BAM to legacy and back to BAM mode. As this operation is not
recommended while USB is active, don't reset BAM on every connect
and just pipe reset should be fine.

Change-Id: Ie21477b8ded402dd8fb173b7eb067072ba72aca4
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Merge "usb_bam: Allow HSUSB BAM to be enabled on bootup itself"
Merge "ARM: dts: msm: Enable HSUSB BAM early and don't RESET it on connect"
Merge "usb: gadget: qc_ecm: Remove setting of cdev and func to NULL"
Merge "usb: gadget: qc_ecm: Fix bus resume case after PC wakeup from sleep"