commit 8e6edcb (usb: ehci: Avoid phy lockup due to SOFs during port
reset) implements a workaround for PHY lockup issue during port reset.
The workaround relies on a hardware debug feature which allows driving
strobe and data lines to reset using ULPI interface. This is not
working some times for unknown reason.
This patch implements a new reset sequence to workaround the PHY lockup
issue. The controller drive reset signaling for ~50 msec when reset bit
is set in PORTSC register. The controller automatically clears this bit
after finishing the reset signaling. The software can also finish the
reset signaling any time by clearing the reset bit.
According to USB2 spec, Host controller should drive reset signaling for
50 msec for root hub ports. But HSIC spec allows shorter reset signaling
time (20 msec). Clear the reset bit in PORTSC register after 20 msec and
start controller immediately to send SOF. Use controller internal timers
to achieve this. If reset bit is not cleared in time, perform the sequence
in a loop with interrupts disabled.
CRs-Fixed: 445659
Change-Id: I6b251ced8d47b9ece4a06e58baf15c69a8bb340f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Battery charging specification allows data contact detection (DCD)
timeout to be any value between 300 and 900 msec. As DCD is reliably
working, increase the timeout for detecting slow cable insertion cases.
DCD would fail with ACA-dock and ACA-A + HS/FS device. Use 750 msec
as timeout. The 150 msec (900 - 750) safe guard time compensates the
time taken from session valid to DCD enable. Decrese the DCD polling
period from 100 msec to 50 msec to exit DCD state quickly.
The 150 msec safe guard time compensates the time taken from session valid
to starting charger detection procedure.
CRs-Fixed: 437484
(cherry picked from commit ebb4a2d613128a2db288402bc834622a36e71956)
Conflicts:
drivers/usb/otg/msm_otg.c
Change-Id: I0e014d2ae0f9e00eaba179af2244924cf4561c90
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This change addresses following enhancements to debug
logging:-
1) Add data payload logging which is not currently
supported. This helps to sniff first 32 bytes of data
being sent and received. Data payload logging is
enabled by default. To disable data payload logging:-
echo 0 > /sys/module/ehci_hcd/parameters/enable_payload_log
2) Current urb submission event logging does not cover
root hub submissions, hence move urb submission logging
to hcd driver.
3) Current urb submission event logging does not return
the correct status if submission fails. Hence log the
return status of urb submission.
CRs-Fixed: 393294
Change-Id: Ic7e555e1545ec7d7b0e4042cd35235e0af26fb01
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit 4d50a43dce8645955d8ed739d7a183e62922c721)
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
HSIC controller should send SOF with in 3 msec after completing
the resume signal. If processor is in idle sleep state, the timer
interrupt generated by HSIC controller to indicate resume completion
gets delayed. If the interrupt handler is not run with in 3msec
after resume, the resume sequence is repeated. Disallow processor
idle sleep to avoid multiple resume cycles.
CRs-Fixed: 397154
Change-Id: Ibc8965ad8bcd94e0b1b1d39b5b2ad8f39cf51095
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 4f5dc3be7b2b9939bc7a1b9526ccb70d93b53361)
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Data contact detection (DCD) involves applying small amount of current on
D+ and waiting for it to go low. The D+ is pulled to low when the data
pins get contacted with the other device data pins.
The current code does not disable D+ pull-down resistor during DCD. If this
resistor is not disabled, the current applied on D+ becomes low immediately
even without connecting to any device. Fix it. Remove enable_dcd flag
from platform data as data contact detection is working reliably on all
targets supported by this driver.
(cherry picked from commit 768dcb817554a29b43e269e7cf77785a7f960754)
Change-Id: Idb34508f09dc74983fd2b55bd11f4073ec354e2f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
The control request will be used by the host to enable/disable USB audio
and the ioctl will be used by userspace to read the audio mode
Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: I48082ce473eb6577b0bf613be9ec27f2f5c19384
Interrupt threshold value is the maximum rate at which HSIC
controller will issue interrupts to processor. Increasing
this value results in fewer interrupts which may save power
as processor has to handle fewer interrupts. Side effect of
increasing this value is higher data latency. For fusion3,
set the ITC(interrupt threshold control) to 5 and default
for other targets. Also, allow ehci stack to set ITC value
per controller basis.
CRs-Fixed: 374661
Change-Id: I0e6bc210679ef211c2850ffbe1dfc80da2f65bf0
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Due to h/w bug in hsic controller, interrupts are disabled during
resume signalling (~20ms), commit: e404049ae, which may result in
below issues
1. Delayed MDP interrupts causing display stutters
2. Since default workqueue disables preemption for 20ms, the kernel
scheduler schedules out the worker thread for long time. It results
in MDM crash due to delayed response
To avoid busy loop, port resume is performed without disabling the
interrupts. Due to this if resume time constraint is not met then
don't start SOF and retry RESUME after some time. This delay (w/o SOF)
lets the device to enter SUSPEND state (after issuing remote wakeup)
and followed by RESUME after sometime. Also, Move the resume code to
hsic controller driver to avoid changes to ehci upstream code.
CRs-Fixed: 383752
Change-Id: Ic4768587bbb9a00d8cf495065ec9e14c46a5c1d4
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
ulpi_read() relies on jiffies to calculate the timeout
for read operation on phy register. Calling ulpi_read()
with interrupts disabled, freezes jiffies on local processor.
In case of phy lockup this results in infinite loop leading
to watchdog reset. Use loop counter for timeout instead of
jiffies for read operation to avoid watchdog reset.
CRs-Fixed: 388234
Change-Id: I1d46052b087c42b9f422b6f7eb691498fa104718
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This patch solves the problem of recognize usb link when the TA is slow to
connect.
Change-Id: I9ebd118a53175a272117a75b5a5a1554da9c3d8b
Signed-off-by: Iliyan Malchev <malchev@google.com>
Some USB cores have a separate IRQ line for issuing ASYNC
interrupts in LPM. This interrupt needs to be enabled only
when hardware is put in low power state.
Change-Id: Ie7de237ccbaa90294b20d3fce594ec280cb1641a
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Allow to USB clocks to remain on only for bus suspend case, but turn
off clocks for any other case, such as cable disconnect.
CRs-Fixed: 378955
Change-Id: I4d85b645cfd231126fbc160a0c14273066ce674c
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
When otg_control is set to OTG_PHY_CONTROL and PMIC interrupts are
not used for VBUS notification, a cable connection will fail to
wake up the device from VDD minimized low power mode. The MPM needs
to be configured to wake up the system when the USB_PHY_OTGSESSVLD
interrupt is triggered. As this interrupt may vary by SoC populate
it in the msm_otg_platform_data->mpm_otgsessvld_int member in the
various board files.
CRs-fixed: 376740
Change-Id: Ia54828f538c695ff6b28f5d7b2b49630a45cc673
Signed-off-by: Jack Pham <jackp@codeaurora.org>
The QDSS function driver supports high throughput debug information
delivery from the QDSS core to the host via the USB port.
Change-Id: Ia9397944d39d767c1200ad87aac67d5627233282
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
Currently as part of host bus suspend handling, voting for
XO shutdown and VDD minimization due to which devices connected
to HSUSB 3rd instance will not wakeup the system from system suspend.
Add support for USB remote wakeup feature for detecting devices
connected on HSUSB 3rd instance in case of VDD minimization provided
HW rework for routing D+ line to MPM is implemented.
CRs-Fixed: 380386
Change-Id: Ie8560b99c51efc466dfd257747bbf38bec6e6ba0
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Add USB bam changes to support QDSS in msm-8794.
Main additions:
Support device-tree files.
Add disconnect bam pipe support.
Add new API to retrieve pipe connection: get_bam2bam_connection_info.
Change-Id: I200d44dee319b8a9efda31b238c99202efddaa07
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
usbnet driver uses tasklet as bottom half handler. Since tasklet
runs in interrupt context in case of high throughput driver is
spending more time in interrupt context to process rx buffers
this is causing watch dog reset. Hence replace the tasklet with
workqueue to avoid watchdog reset.
CRs-Fixed: 378526
Change-Id: I8eac339e37d734dbaaf7a2e874d3974f562e8680
Signed-off-by: Hemant Kumar <hemantk@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>
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>
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>
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>
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>
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
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>
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>
Some of USB clocks have to be enabled in order for A2 to
be able to wake up USB.
Since USB now enters LPM upon USB bus suspend, this fix keeps
USB pclk & core_clk enabled, to allow waking up from A2.
A similar fix was already introduced for HSIC driver. This
change adds similar fix for USB.
Change-Id: Icd434132bc3dc3466dc7a55bb40603a3de3b4b2f
CRs-Fixed: 369189
Signed-off-by: Amit Blay <ablay@codeaurora.org>
This change add support in ci13xxx_msm_hsic driver and
ehci-msm-hsic driver for VDDCX corner voting.
In case a VDDCX corner resource is supported by the platform,
it will be used. Else, the legacy voting for specific voltage
level will be used.
Change-Id: Iae91d1c945f9b61340628b2fc7c7727e4cca6a1e
CRs-Fixed: 354458
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
Currently otg driver is voting to allow TCXO shutdown in host
bus suspend due to which devices connected in system suspend
are not getting detected. Hence don't allow TCXO shutdown in
host bus suspend.
As long term solution, need HW rework for detecting connecting
devices in host mode during system suspend. This is required to
route D+ and D- lines to MPM for monitoring interrupt during
system suspend.
CRs-Fixed: 366111
Change-Id: Ic478a0e327b104eec64b5cfe2bd1f9369f8ef72e
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
This change adds the ability of the msm_otg to go to LPM when
USB cable is connected and bus is suspended.
This ability is enabled by a board file parameter.
The msm_otg is notified about SUSPEND/RESUME events via the
UDC layer. New event for RESUME was defined for that.
Change-Id: Ic508f1898cc3b57ab76eccd379bea38ed363570b
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Part of commit d44455a0b838b1d691e63913f0b159552ac01803 introduced
a regression affecting resume behavior in that the controller's system
resume callback is being followed by an immediate runtime suspend; if
the system resume was caused by an OTG event, there would be a pending
runtime resume in the state machine function, which might fail due to
this race, causing the PHY to be unnecessarily reset.
This patch limits the actual hardware resumes to happen only when needed.
If a possible wakeup event such as VBUS or ID interrupt occurs while
in system suspend, don't allow runtime resume to execute in the wakeup
handler but rather defer the resuming to the system resume callback.
Also by incrementing the PM runtime usage counter within the system
resume, it may help prevent the premature runtime suspend from happening
immediately afterward. Otherwise, if there is no such OTG event, and
the controller is not a suspended host, do nothing.
If the bus is instead runtime suspended (and not system suspended) when
a wakeup event occurs, then normal runtime resume will bring the
hardware out of low power mode.
CRs-fixed: 358761
Change-Id: I4249690485949ecb3072e258859608ecea52ec9b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
To enable better power management and entering CPU idle states while
USB cable is connected and no USB SW involvement is required
(MSM BAM2BAM mode) a new SysFS was added.
This SysFS allow controlling USB voting and gives the ability
to save power consumption while USB is active.
default behavior is high QoS. to change the new SysFS
echo high/low to /sys/class/android_usb/android0/pm_qos
Change-Id: Ia73491cfddc3968e1d04423a1750c89fab5fefeb
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Disable PHY VBUS comparator if otg driver depends on PMIC
for VBUS and ID notifications. If enabled, VBUS comparator is
creating some noise to SESSVLD comparator and causing SESSVLD
comparator to trigger low due to which link state machine becomes
stuck as it operates solely on that value.
CRs-Fixed: 355991
Change-Id: Ieb8101f3063ebf9898da3ec9fd158c248a6cb15a
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
New platform uses RBCPR hardware feature, with that voting for
absolute voltage of VDD CX is not required. Hence vote for corner of
VDD CX which uses nominal corner voltage on VDD CX.
CRs-Fixed: 355399
Change-ID: I22a73c5a439c98195b907ff3d032eb675a557612
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This reverts commit 7dd2266ae3d3f1d2cb93d1d3bb40aecf23821e76.
It was a mistake to move the usb driver to the clock apis for XO
buffer voting. Due to an RPM design CXO and D0 are the same but
we would like to hide that from the users of the buffers.
Therefore the msm_xo driver itself remaps the D0 buffer request
to the cxo clock until the RPM is fixed.
Change-Id: I230de55d30a49fa5bcf0d07f40453f1e09c4a9b1
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This patch changes OTG driver to support different
OTG statemachine states for OTG2.0 complaince. It will
also enable to swap Host role between two OTG devices
via HNP and enable B device to request A device to start
VBUS session via SRP.
Change-Id: Ibe2519ff1570768f51e879af483a6f5c23b38d8f
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Drivers need to specify their bandwidth requirements to
bus-scaling driver to get guaranteed bandwidth on fabrics.
USB hardware uses a single buffer to transfer data across the
bus. As a result USB performance is highly dependent on system
fabric frequency as USB controller continuously sends NAKs on
the USB BUS unless complete buffer is filled/drained to the memory.
Hence, request for high bus bandwidth as long as USB cable is
connected to improve USB throughput.
While testing with Class-10 Extreme III SD cards, this patch
seems to improve the IN performance from 15MBps to 24MBps and
OUT performance from 11MBps to 16MBps.
CRs-Fixed: 327557
Change-Id: I21c284c611a09b1b12df9ae7a6f39e0b1bff45ef
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Use the clock APIs instead of the msm_xo APIs to vote on CXO.
This removes one more msm specific api from this driver and will
allow us to move XO control into the rpm clock driver.
Change-Id: Ie9344aad20651002e98f13cd3adb39680fbd93bd
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Data contact can be detected by either current source or timeout
methods. The current source method is not working for an unknown
reason. Implement timeout based data contact detection. The spec
allows any timeout between 300msec to 900msec. Use 600msec.
CRs-fixed: 330217
Change-Id: I67151d1412f43ba974cc1afb164d6473f89d2dbf
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Drivers should now use their device names to distinguish between
clocks of the same type rather than the clock name. Clock names
are updated to match the new naming convention.
CRs-Fixed: 327559
Change-Id: I78757806589e037a0655a63e7ee20c935214c99d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Crash was observed (9x15) when USB cable was
disconnected. Root cause was NULL pointer and
USB BAM reset due to USB PHY reset. On 9x15 no
reset on disconnect will be performed.
CRs-Fixed: 326999
Change-Id: I006afb8dcd225caf9280dd915f8af3edfaebff5a
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
When USB cable is connected, the mass storage function in the
device will get interrupts for every 3ms. Entering and exiting the
idle standalone PC itself will take around 3ms on 8960. Hence allowing
idle standalone PC when USB cable is connected causes processor to
spend most of the time in entering and exiting the idle standalone PC.
Hence Vote for minimum DMA latency to prevent idle standalone PC
when USB cable is connected.
Change-Id: Id625dc01f253ed553b2f65f08900022a8c6e1daa
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
USB PHY takes TCXO clock as input and using the PHY internal PLL,
gets the 480MHz clock for USB operations. While USB PHY is suspended,
the TCXO clock can be turned off.
On 8960 target, mandating that TCXO clock users must need to vote for
TCXO and if all the users vote for TCXO clock-off, then MSM can switch to
lower power clock and can run.
Change-Id: Ia9a91bca52a1003439a3a38bbd8eb835dbf349e1
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Current implementation supports PHY retention mode, when
VBUS detection is done by PMIC.
This change adds the support for PHY retention mode, for
the case where VBUS detection is done by USB PHY.
In that case, the PHY wakes up the MPM and CORE using its
High-Voltage interrupts.
Change-Id: I5fec518337413f175a8bc671897836affc55381c
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Add device tree support for MSM HSUSB. The OTG driver registers
gadget and host platform devices based on the operational mode.
This patch also updates the copper device tree source file with
HSUSB device specifics.
Change-Id: I0a50b0500d15f32ff65468cdb411398a80a20329
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>