There is a possibility of runtime suspend in the middle of
data transfer on the rx data path of driver. This results in
the completion of data transfer on bulk IN endpoint with short
packet or integral multiple of 512 bytes. Hence for -ENOENT
transfer status check for non zero data length and pass it to
the consumer in the userspace.
CRs-Fixed: 382161
Change-Id: I72407e8879b6b3b7a9456c1234eec71970272495
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
The MODEM requires RTS to be cleared for RmNET use case.
The original code clear all SMD tiocm bits upon USB connection.
This fix leaves the RTS bit set, which is the SMD default.
Change-Id: Ie3aaa285c9a1598dfd7408f062ea7af2f391a7dd
CRs-Fixed: 370682
Signed-off-by: Amit Blay <ablay@codeaurora.org>
New function driver to support Standard ECM with adaptions to
QCOM chipsets (Data path is over SPS BAM-to-BAM).
Standard ECM function was added to android gadget.
CRs-Fixed: 358338
Change-Id: Ic1ed2f7ee7ac50601ba5dc43d06c28bffe2c5c23
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
This utilities is based on Ethernet-over-USB link layer utilities and
contains QC specific implementation (using SPS BAM-to-BAM for data
channel).
Change-Id: Iec417b4df57c34d1ba9368495c7a489c36ddf6dc
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Updating diag include file to avoid using mach/msm_hsusb.h which is
deprecated, and update u_bam to include this file as well.
Change-Id: Ia61accc65eb86fe750c3be6dcb0726e480becdae
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
To operate correctly, USB core requires to be reset clearing
any initialization settings performed by other components
e.g. bootloader during bootup.
MSM platforms support two kinds of hardware resets:
1. Conventional synchronous reset where clocks to the
blocks must be ON while issuing the reset, and
2. Asynchronous reset which requires clocks to be OFF.
Driver can determine the supported reset methodology on the
platform based on availability of alt_core_clk.
Change-Id: Ia062818ecbf4b0cec44e55f013b762d3ee51b249
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Queuing a request on a disabled endpoint during composition switch leads
to prime failure. Hence return -EINVAL if a request is queued on a disabled
endpoint.
Also, in f_mtp, block queuing a request in OUT ep in receive_file_work, if
the device state is STATE_OFFLINE.
Change-Id: I0e706d5280a2460baf6ab05dbf97a09c59b642fb
CRs-Fixed: 378207
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Add UASP function to Android supported functions array. UASP
function depend on Target core. Provide empty functions when
Target core is not enabled.
Change-Id: I959f26ebd63e036dae041708d0ad6169213a3cf0
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The write buffer is allocated twice in bot_send_write_request
function. Fix this by removing additional memory allocation.
Change-Id: I3253c149c3703621be30d0f84499d6af0aff8bc8
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Driver probe is returning 0(success) in case of error
returned by APIs called in msm_otg_probe(). This is causing
NULL pointer exceptions during system wide suspend as
driver data for platform device is not set.
CRs-Fixed: 379532
Change-Id: I194e9386ba8de6d88ab102a467793f8b2f03083a
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This change enhances the android gadget to support more than one
android device. Implemented in order to support HSIC/HSUSB concurrent
mode.
This feature allows to fully run two compositions concurrently on the
HSUSB and HSIC USB cores, besides the following two restrictions:
1. Cannot run some function driver, for example rmnet, both on HSUSB
and HSIC concurrently. Each composition should have a different set
of function drivers.
2. Mass storage can only run on the primary HSUSB core.
Change-Id: I3f57cd237c0499cb6776c17d660bed82be852697
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
MHL discovery is initiated upon detecting ID ground state.
This happens via an ID interrupt or charger detection work.
Allow low power mode when MHL cable is connected.
Change-Id: I3565817b53eb444509cf56269103921814147af9
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Abhishek Kharbanda <akharban@codeaurora.org>
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
usb_wwan driver continues pushing rx data buffer to tty node
even if it is removed during device disconnect. This may cause
watchdog bark as driver unnecessarily loops through the list of
rx buffers and tries to push it to tty layer while holding
spin lock with interrupts disabled.
CRs-Fixed: 377066
Change-Id: I5569a4948aba89fd1d0d8ea5e8910ce2e0c8e917
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
An ASYNC interrupt is an indication by hardware that some
activity has happended on USB lines in LPM (low power mode),
and USB software should now bring it out of LPM.
Ideally, hardware should give one more interrupt after coming
out of LPM so that USB driver can process that accordingly.
But, sometimes this interrupt is not generated from h/w for
remote wakeup event in host mode. Hence, resume root hub on
receiving the ASYNC interrupt from hardware in Host mode.
CRs-Fixed: 369298
CRs-Fixed: 368948
Change-Id: Ifb166c1f3c749ab8c615308ab52d85ccdc666733
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
commit c9cb205f (USB: android: Add a new LUN as CD-ROM in mass-storage)
access platform data without checking for NULL. This causes a kernel
panic on targets which don't have platform data.
Change-Id: I4542b0dce81604706f90b7f6e851ed47c04a941c
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add runtime power management support in the driver which allows
putting the hardware in low power state, turning off LDOs
and releasing wakelock.
This LPM (aka low power state) support is currently added as part
of USB disconnect and wall-charger connect. LPM support would
later be extended to USB bus suspend as well. Also, support for PHY
retention mode and VDD minimization would be added later.
This commit also adds debugfs nodes that can used to simulate
cable connect and disconnects as A or B device. Following are
the nodes:
-->msm_dwc3/id : Boolean value
-->msm_dwc3/bsv : Boolean value
-->msm_dwc3/connect : can be set to enable/disable
User should first update id/bsv values before enabling 'connect'.
dwc3-msm device is parent of dwc3-core and its runtime PM is managed
by dwc3_otg driver which is responsible for the state transitions
based on notifications from DWC3 h/w or ext_xceiver (using PMIC) for
cable connect and disconnect. This change also allows dwc3 gadget and
host to acquire PM count for the case when dwc3-otg is not present -
e.g. host and device only configurations.
Change-Id: Idd9a59c1ffd46bd98228c9fd4441f668b763534d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Proprietary chargers pull D+/- to specific voltages between 2.0-3.3V
(VLGC) for identification. The DM voltage may not exceed VLGC due
to pull-down resistor. Hence a proprietary charger is detected as
a Standard downstream port (SDP). Gadget speed is used to differentiate
between SDP and proprietary charger.
In charger detection work, if the connected charger is not SDP (or) CDP
then re-schedule the work again and if it returns invalid charger, mark
it as proprietary charger.
CRs-Fixed: 377915
Change-Id: I4223c0724c00aea7e755cd07b349c9e597d7960d
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Split Target based USB-Gadget driver (tcm_usb_gadget.c) into composite
driver (tcm_usb_gadget.c) and Function driver (f_tcm.c). This is
required for other composite drivers like Android to include Target
based USB function (UASP) along with other functions.
Composite drivers can include f_tcm.c like any other function and
register a callback function. This callback function is called
when Target Fabric is enabled via configfs. This callback can be
used to enable enumeration with host.
Change-Id: I36beea07bb3641a224694c157849ecec347d5943
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
GUSB3PIPECTL[22] bit is for enabling/disabling receiver detection in
either U3 or Rx.Detect states. It should be '0' by default to enable
receiver detection. But it is overridden with '1' on cores revision <
2.30a. Fix this in software.
CRs-Fixed: 377848
Change-Id: I9500f687f386330ed3c686f46365c08b8c8b0d28
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
GUCTL[31:22] indicate the time period (in ns) of the reference clock
that is used to generate Isochronous Timestamp Packets (ITP). This
value should be 8ns (125 MHz) by default. But it is overridden with
0 on cores revision < 2.30a. Fix this in software.
CRs-Fixed: 377846
Change-Id: I827540eb9d2f1ffc65b6f30200b6c0e575bc52d2
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add a new LUN(lun0) which will be exposed as a CD-ROM having the
attributes ro(read-only) & removable as enabled.
This CD-ROM lun is used for saving read-only files which can be used
for system requirements.
Change-Id: Idff5aea8bce233e8b77a4b689323a2f1eb2523e1
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
As this driver communicates over HSUART transport medium
to QSC modem, change the name to hsuart.
Change-Id: I349ef14450ac6b9369dc4183d95fa7e966fc43b9
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Flush control endpoints from ep_dequeue and set request completion
to NULL once calling completion handler of function driver. This will
make sure that all control endpoint requests are flushed in disconnect.
CRs-Fixed: 373672
Change-Id: I7506c2e53d13f137ae6f222a06fbcc0dee77f68e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently reading PMIC ID line status immediately once PMIC interrupt
is triggered. This leads to returning wrong ID line state sometimes
and causes not detecting connected devices. Hence add debouncing time
of 5msec for PMIC ID line state to settle down before reading PMIC
ID status.
CRs-Fixed: 371552
Change-Id: I4a5eae1d3759b5cc5c7ab70c4bde900a57ec1bd1
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
After the UDC class conversion, there is no reason to
limit the kernel to have only one UDC controller in the system.
Change-Id: I15d1eef19187e772131ae217452dc22e294f4a78
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Set usb_core_id property in the platform data of four devices:
1. usb_core_id = 0 for the HSUSB ci13xxx device
2. usb_core_id = 1 for the HSIC ci13xxx device
3. usb_core_id = 0 for the HSUSB android device
4. usb_core_id = 1 for the HSIC android device (new device added)
Change-Id: I28fd5afeb2a137864868d799cd51d23bd9812be3
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Seeing spurious PMIC BSV interrupt while otg is in A host mode. Hence
ignore PMIC BSV interrupts in this cases.
CRs-Fixed: 373645
Change-Id: I99c13c22e2485f2a891bfb3dd7870794ca86296b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Proprietary chargers pull D+/- to specific voltages between 2.0-3.3V
(VLGC) for identification. The DM voltage may not exceed VLGC due
to pull-down resistor. Hence a proprietary charger is detected as
a Standard downstream port (SDP). Read line state to distinguish
between SDP and proprietary charger. The DP voltage would exceed
VLGC for proprietary chargers.
D- can be greater than VLGC when a low speed device is attached via
Accessory charger adapter (ACA-A). Hence mark the charger as ACA-A
if ID resistance is RID_A and D- > VLGC
CRs-Fixed: 368688
Change-Id: I3497efbe025abf150078a19d69254f75f5df5b2a
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add data aggregation support using RNDIS Multi Packet feature
to achieve better UDP Downlink throughput. Max 3 RNDIS Packets
aggregated into one RNDIS Packet with this implementation.
With this change, seeing UDP Downlink throughput increase
from 90 Mbps to above 100 Mbps when using Iperf and sending
data more than 100 Mbps.
CRs-Fixed: 352010
Change-Id: I7c353d21d60002b66c08181fd621f9ab8753cb0f
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Halt the system when HSIC system error happens and dump HSIC
link registres. Also, save the address of msm_hsic_hcd
structure to a global pointer.
CRs-Fixed: 375536
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Change-Id: Ia346778911f610338f38492bc1ff0e8a9c7a87c7
DWC3 has separate irq line for OTG interrupts (e.g. ID / BSV).
These interrupts are needed to detect cable connect and disconnect
events. Hence, request for this interrupt line from OTG driver.
Also, update device tree binding documentation for DWC3 core.
Change-Id: Ie97e4b3b5dcf840eabeb01b5c5d6531a8a70a3c9
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB DP and DM lines are routed to USB PHY via MHL transmitter chip
if it is present on the board. MHL transmitter route USB DP and DM
lines to MSM based on the High Speed Switch position. The regulator
controlling this switch is different across targets. For example
this switch is powered up by 3.3V regulator on 8960 Liquid and it is
5V regulator on 8930 fluid. Hence rename existing "mhl_ext_3p3v"
supply name to a generic name "mhl_usb_hs_switch".
Change-Id: I35a6240fdbb01fa6b695a52968cd141d9418def7
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The current code disables charging when the usb is operating in host
mode. This unnecessarily stops charging from the DC path. The board
layout (the ovp fet and otg path) is assumed to support host mode and
charging from dc path.
Also make the usb driver change the power supply framework's scope
property instead of calling 8921 charger apis directly.
CRs-Fixed: 373365
Change-Id: I2a9fb32de22cbe68e26078b97a7d83c40272a370
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Adding new usb_core_id property which is used to match an instance
of struct usb_gadget to an instance of struct usb_gadget_driver.
This will allow constructing more then one usb periheral stack.
This new property is optional and if not specified in both the gadget
and gadget driver then it will have the default value of zero.
Change-Id: Idbab46ed76267ab4827319f2f9efe67c91b50dbd
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
The current code is calling cancel_delayed_work_sync() from interrupt
handler which is causing scheduling while atomic bug.
If host sends reset or cable is disconnected, before the remote wakeup
work is scheduled, we may end up sending wakeup signaling. But this
work can not be canceled from interrupt handler as it involves sleeping.
Check wakeup conditions before initiating the remote wakeup in work
function.
Change-Id: I150ecadfd6669ec5a01b65298d330183596ba2c7
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
In isr_setup_status_phase(), driver is not checking whether
the pointer is NULL before checking udc->status. Otherwise
it leads to crash. Fix it by checking for NULL.
CRs-Fixed: 367725
Change-Id: I1a74e176671dac734899cc91b3ef6db8300e08e1
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Set the flag that enables the host controller to send zero-length
packets if the payload size is a multiple of the max packet size
(typically 512 bytes) in order to avoid cases in which the device
may stall while waiting for more data.
CRs-fixed: 373737
Change-Id: I779d00837a12bcd1d7df12b77ac1f1f5aab0fe68
Signed-off-by: Jack Pham <jackp@codeaurora.org>
There is a possibility of HSIC phy getting locked up if RUN/STOP
bit is set before finishing the resume signaling. Hence do not
set the RUN/STOP bit before setting PORT_RESUME bit. Since
PORT_RESUME bit gets cleared automatically by HSIC HW after bus
resume is completed, need to set RUN/STOP bit right after that.
CRs-Fixed: 372145
Change-Id: Icb9effefe14c10f13cfbb3d8f1840c8bdd96aea4
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Remove dead code that fails to compile. It refers to some
sysfs entry that never appeared to be written.
Change-Id: If2b4e3ad3077fba039569fe131c614b4220d7140
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Remove local definition of 'enum usb_vdd_value' which is now
defined in msm_hsusb.h
Change-Id: I75735f9421703f0c4466d3058b9f64cfd3e79746
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
HSUSB PHY is taking time to update the dTD status(INFO_ACTIVE) of the
queued request. So this is checked after a 10us delay, as a data stall
issue is seen without this delay.
Time to get dTD status updated is not deterministic and adding 10us delay
is reducing FTP download throughput. Hence check the status of dTD every
1us for 10 times instead of waiting for 10us.
CRs-Fixed: 371338
Change-Id: Ied0a0792b38a11835df058a187e8974a7cd6671b
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
wwan driver is dropping the data if tty is throttled or unable to
accept more data. Add flow control between wwan and tty to fix
random data dropping.
CRs-Fixed: 373449
Change-Id: I524ee5e505e2e7e88df8fd669ae65bada4b235bf
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
This change triggers remote wakeup upon queuing a transfer
for a suspended device.
Change-Id: I895e7dce6a013f2b329020591b6201bdc0fa1c90
CRs-Fixed: 367423
Signed-off-by: Amit Blay <ablay@codeaurora.org>
msm_otg_set_suspend relies on the state machine to determine if
a state transition will properly put the transceiver in low power
mode. However, if it succeeds, and is called again to perform the
same operation, the resulting pm_runtime_resume will unnecesarily
bring the device out of low power mode before suspending it again.
This scenario can happen if the otg device is already runtime-
suspended, and a system suspend calls this function again, causing
a temporary resume. However, the controller IRQ will be triggered
due to a port change and will cause the system suspend to abort.
The fix is to simply return if the function is being called to
suspend but the transceiver is already suspended.
CRs-fixed: 366134
Change-Id: Ie391b6b67beeff0030e4fc4b94a54f0e84e824bc
Signed-off-by: Jack Pham <jackp@codeaurora.org>
There could be race condition between h/w initiating sof
(start of frames) and finishing port reset. This can
cause hsic phy lockup, which results in enumeration failure.
Avoid this race condition by:
1. Moving to the old enumeration sequence where set_address is
initiated before get_device descriptor. This results in one
port reset instead of two port resets.
2. Halt usb controller before initiating port reset and start it after
port reset is complete. This is tricky because PORT_RESET bit
automatically clears when h/w completes the reset and failure to
start the controller within 3ms causes the peripheral device to
suspend resulting in enumeration failure. Hence, after setting
port reset bit forcefully drive strobe/data lines to reset using
ulpi interface and once port reset is complete, disable forceful
reset and start the controller in atomic context.
CRs-fixed: 364458, 359930
Change-Id: I49a2eac8043eb3001956c7ee9ead2c3a901524db
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
xcvr clock needs to be turned off before de-asserting clock
reset to hsic controller to prevent phy lock up. However, xcvr
clock is defined as parent of system clock, which is always on
during hsic controller reset, prevents xcvr clock being turned
off. Turn off system clock to turn off both system & xcvr clocks
during hsic controller clock reset. Also, simplify reset routine
by removing unnecessary code and delays.
Change-Id: Ic5fb667b4686a724d5ecfc034770f1e7db92b4d6
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Remove next_string_id resetting. This field was already updated in probe
time when calling the android_bind function for the manufacturer id and
for the product id. Thus could not be reset in the store_enable function
that is called after, and override those string ids.
Change-Id: I2cf84ec7252dea0701927fab31f6ec1feb35d63f
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>