Commit Graph

466 Commits

Author SHA1 Message Date
Pavankumar Kondeti
9a434d1163 USB: OTG: msm: Add support for proprietary charger detection
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>
2013-02-27 18:14:51 -08:00
Hemant Kumar
5192c55046 EHCI: HSIC: Add debug support for HSIC system error
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
2013-02-27 18:14:40 -08:00
Ido Shayevitz
4a77e8ab1d usb: gadget: Match gadget and gadget_driver according to usb_core_id
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>
2013-02-27 18:14:08 -08:00
Vamsi Krishna
a197142a84 usb: ehci: Avoid phy lockup due to SOFs during port reset
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>
2013-02-27 18:12:54 -08:00
Amit Blay
042d742d21 usb: otg: Fix USB remote-wakeup with LPM
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>
2013-02-27 18:12:38 -08:00
Ido Shayevitz
1fc5741fd2 usb: msm_hsusb: Add include to linux/hrtimer
This fixes a compilation problem.

Change-Id: Ie8a8ffb5f16351a6590f8743b1b2639c1cb6da73
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
2013-02-27 18:12:25 -08:00
Amit Blay
f7b891b01e usb: gadget: hsic: Add support for VDDCX corner voting
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>
2013-02-27 18:11:43 -08:00
Vijayavardhan Vennapusa
d58272c741 USB: msm_otg: Don't allow TCXO shutdown in host bus suspend
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>
2013-02-25 11:36:53 -08:00
Amit Blay
934d48ee63 usb: gadget: Add support for USB going into LPM on bus suspend
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>
2013-02-25 11:36:51 -08:00
Jack Pham
40e27e760e usb: msm_otg: system resume only resumes hardware when needed
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>
2013-02-25 11:36:49 -08:00
Ofir Cohen
616c0c9a37 usb: gadget: Vote for SWFI when USB cable is connected
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>
2013-02-25 11:36:49 -08:00
Vijayavardhan Vennapusa
840f731512 USB: OTG: Fix PHY stuck issue in USB HOST mode
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>
2013-02-25 11:36:47 -08:00
Mayank Rana
d9bbfe6fb3 msm_hsusb: Vote for corner of VDD CX instead of voltage of VDD CX
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>
2013-02-25 11:36:46 -08:00
Stephen Boyd
9d27192644 Revert "usb: msm_otg: Migrate to clock apis for XO voting"
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>
2013-02-25 11:36:38 -08:00
Vijayavardhan Vennapusa
395698c2bc USB: OTG: msm: Add support for SRP and HNP
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>
2013-02-25 11:36:34 -08:00
Manu Gautam
4dd770891d msm: 8960: usb: Add msm_bus vote when cable is connected
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>
2013-02-25 11:36:30 -08:00
Stephen Boyd
8c5bc3e42c usb: msm_otg: Migrate to clock apis for XO voting
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>
2013-02-25 11:36:29 -08:00
Pavankumar Kondeti
d92234d06f USB: OTG: msm: Implement data contact detection based on timeout
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>
2013-02-25 11:36:25 -08:00
Manu Gautam
bdfa754b30 msm: clock: Use device names to distinguish between USB clocks
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>
2013-02-25 11:36:21 -08:00
Ofir Cohen
22add5aa36 usb: gadget: fix crash on USB cable disconnection
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>
2013-02-25 11:36:20 -08:00
Anji jonnala
3da9c3c4da USB: OTG: prevent idle standalone PC when USB cable is connected.
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>
2013-02-25 11:36:14 -08:00
Anji jonnala
a6bfaac458 usb: msm_otg: vote and unvote for TCXO through XO API
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>
2013-02-25 11:36:13 -08:00
Amit Blay
29a0e4da3e usb: otg: Upgrade support for PHY retention mode
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>
2013-02-25 11:36:12 -08:00
Pavankumar Kondeti
9fff2227bf msm: Add device tree support for HSUSB
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>
2013-02-25 11:36:11 -08:00
Pavankumar Kondeti
d6865ca34a USB: OTG: msm: Fix ACA implementation
Synopsis 28nm PHY has two different circuits for detecting changes on
ID line.  ID_DIG is designed for detecting ID_float vs ID_gnd.  ID_ACA
is designed for detecting RID_A, RID_B, RID_C states.  These are mutually
exclusive and enabling both circuits has undefined behavior.  Enable
ID_ACA upon VBUS high or ID_gnd events to detect further ACA states.

ACA ID_GND threshold range is overlapped with OTG ID_FLOAT threshold range.
Hence PHY ID_DIG circuit can not be used for detecting ACA ID_GND.  Use
PMIC ID circuit for detecting both OTG and ACA ID_GND.

Link controller can not generate PHY_ALT interrupt in host mode. But the
corresponding PHY register reflects the actual ID state.  Hence implement
polling to read PHY register to detect ID_GND --> ID_A, ID_A --> ID_B
transitions.  That means low power mode can not be allowed in host mode.
Also disallow suspending the device attached on the root hub.  Otherwise
PHY is put into suspend state automatically upon setting SUSP bit in PORTSC
register.

Link controller can not generate asynchronous interrupt for ID_ACA changes
in low power mode.  Hence disallow low power mode in ID_B and ID_C states.

USB_MSM_ACA is not selected by default. If it selected, ACA states can be
detected and low power mode is not allowed in host mode.  Writing "enable"
to <debugfs>/msm_otg/aca enables ACA irrespective of USB_MSM_ACA selection.
This is meant for debugging only.

Change-Id: I51e80d803a583c5bdffc8111696943c04958f604
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:10 -08:00
Vijayavardhan Vennapusa
98a85ae180 usb: msm_otg: Vote for EXT_3P3V regulator for MHL connector
In case of 8960 Liquid, need to vote for EXT_3P3V regulator
to avoid usb connection lost as MHL analog switch is powered
by this regulator.

Change-Id: Ifc36d7916a5407801fdf43357176efa264d160bd
CRs-fixed: 315979
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:36:06 -08:00
Amit Blay
1046a3580a usb: otg: Add usb_hs_system_clk to OTG driver for MSM9615
This change add usb system clock support to OTG Driver.
System clock is a 60MHZ input clock to the USB ChipIdea core.
This clock is required starting from MDM9615.

This change also removes the enforcement for using a phy_reset_clk
for reseting the PHY. Starting from MDM9615, PHY reset is not implemented.
The core is reset together with the PHY using "usb_hs_clk" signal.

Change-Id: Ifa4155269dd46a97a7e57dd28050663a12f54c70
Signed-off-by: Amit Blay <ablay@codeaurora.org>
2013-02-25 11:36:04 -08:00
Pavankumar Kondeti
4cae8cc316 USB: OTG: msm: Fix POWER_AND_CLOCK_MANAGEMENT register offset
The current code defines an incorrect offset for POWER_AND_CLOCK_MANAGEMENT
register.  This patch corrects it and also makes use of set/clear offset
registers to save 2 ulpi read access during suspend and resume.

Change-Id: I3f3881cade4df208d2fd0be567462c48be420e8d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:36:00 -08:00
Anji jonnala
791188bf77 USB: OTG: Implement aggressive power management while going to LPM
USB HW can turn off the voltage regulators, OTG comparators and can
enable PHY retention mode as a part of aggressive power management while
going to LPM provided that PMIC has capability to detect the VBUS/ID
change and doesn't have any leakage currents while turning off the
regulators.
8960 doesn't have the leakage currents and PM8921 has capability to
detect VBUS and ID change. Hence Implement the aggressive power management
for 8960.
Initialize the PHY capabilities to support aggressive power management
in the probe and use it to implement aggressive power management.

Change-Id: If3e966b0c81b3588caa5ca93e9e877e4f777892c
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
2013-02-25 11:36:00 -08:00
Pavankumar Kondeti
a70e231d55 USB: OTG: msm: Implement Accessory Charger Adapter (ACA) detection
Accessory Charger Adapter allows a single USB port to be attached to both
a charger and another device at the same time.  USB device when acting as
host does not have to supply VBUS power instead can draw current from
charger port.  USB device when acting as peripheral draw current from
charger port which can supply more than the standard PC.  Different
configurations are detected via Id resistance change.

Change-Id: Id2cc26c31a652eea9edf23aa57b2db9140dddb93
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:35:52 -08:00
Pavankumar Kondeti
428d4d3c59 USB: OTG: msm: Prevent system suspend when USB is active
Prevent system suspend when USB is active to meet strict USB spec
timings by acquiring wakelock.  The wake lock is released after
putting the hardware in low power mode.

Change-Id: Ia22555a59b281f070ef5ca68bd6e02cd1672f930
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:35:51 -08:00
Vijayavardhan
686378dc2d USB: OTG: msm: Add support PMIC ID interrupt
PHY OTG comparators can be disabled for maximum power savings.  PHY
can not generate ID interrupt in this case.  As USB id line is routed
to PM8921 on MSM8960, depend on PM8921 for ID interrupt.

Change-Id: If375274d30235f7e950e284fabc72a4d6b5bc269
Signed-off-by: Vijayavardhan <vvreddy@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:35:50 -08:00
Ofir Cohen
71c90e215d usb: ci13xxx_udc: Add SPS BAM-to-BAM support
Adding new support to enable USB-Peripheral
BAM-to-BAM transactions.
Changes were added to the UDC to support
"legacy/regular" USB transfers and
endless BAM-to-BAM transfers.

To avoid adding new vendor specific UDC file
to support the new feature and keep the UDC
as a generic as possiblea, USB request holds
a vendor specific data that distinguish between
the two transfer types.

USB BAM will be added in seperate commit.

Change-Id: I3211a122fe5236cda2dbe844b44f52a2b2063baf
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Signed-off-by: Amit Blay <ablay@codeaurora.org>
[sboyd: only take ci13xxx_udc part]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:35:37 -08:00
Pavankumar Kondeti
cfd5f553be USB: Add nop functions for !USB case
OTG drivers that use USB core functions like usb_add_hcd, usb_remove_hcd,
etc can be selected for gadget only mode without selecting CONFIG_USB.

Change-Id: Ie4b0c1703622cc9051ad9f50b8901f0005daeeb6
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:35:13 -08:00
Vijayavardhan Vennapusa
45156ca78b USB: gadget: composite: Process GetDescriptor(OTG) request
If gadget is OTG capable, respond to a GetDescriptor(OTG) request
with its OTG descriptor.  This patch adds a utility to function
to find and fill the requested descriptor.

Change-Id: I5b3624b1145d46179b0c4737e82a47c68604cab4
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:34:55 -08:00
Chiranjeevi Velempati
7a5110bae3 USB: gadget: Add CCID function driver
This USB CCID function driver will be a transport layer between
the userspace CCID component and the Windows Host. Data and control
commands from the Windows Host will be sent to the userspace component
and vice-versa.

Change-Id: I7f8084bff7c4faa46ef24d7bf2e773ccf5ebe9f3
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
2013-02-25 11:34:49 -08:00
Anna Perel
cce917a9ac usb: gadget: MBIM function driver for QCOM chipsets
This driver implements Mobile Broadband Interface Model protocol.
Control messages are transferred through QBI module
running in user space and communicating with mbim
using file operations interface android_mbim.
Data is transferred on SPS, Bam-to-Bam.

Change-Id: Ifc4b3f7e21b1a0dac377af272f9ae922ec9c7e2e
Signed-off-by: Anna Perel <aperel@codeaurora.org>
2013-02-25 11:34:48 -08:00
Stephen Boyd
d20a151d2a usb: android: Add DIAG function driver
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:34:48 -08:00
Ofir Cohen
521828cd2c usb: gadget: Vote for SWFI when USB cable is connected
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>
2013-02-25 11:34:42 -08:00
Hemant Kumar
3ae08d2caf EHCI: HSIC: Add support for suspend, resume and URB logging
This change logs suspend, resume and URB submission and
completion events for all the endpoints based on the mask
value set by module parameter. By default logging is enabled
for ep0 and efs sync interface.

Example:
To capture 2 in endpoint events
echo -n 4 > /sys/module/ehci_hcd/parameters/ep_addr_txdbg_mask
To capture 3 out endpoint events
echo -n 8 > /sys/module/ehci_hcd/parameters/ep_addr_rxdbg_mask
To print debug log events on ep0
cat /sys/kernel/debug/ehci_hsic_msm_dbg/show_ctrl_events
To print debug log events on other endpoints
cat /sys/kernel/debug/ehci_hsic_msm_dbg/show_data_events

Change-Id: I1ae78095f0323e957ee33df17e4451f13d4a09fb
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
[sboyd: Only take core/hcd.c part]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:34:38 -08:00
Vijayavardhan Vennapusa
2210347c11 USB: core: Add support for OTG automated compliance tests
1. Add OTG PET device to TPL. OTG device shall support this
device for allowing compliance automated testing.

2. Add otg_srp_reqd filed to gadget. OTG B-device shall enable
this flag when OTG PET (Protocol and Electrical Tester) that
acts as A-device sends Set Feature TEST_MODE with wIndex high
byte value = 0x06.  OTG PET expects B-device to initiate SRP
after the end of current session.

3. Add otg_vbus_off to usb_bus.  USB core enables this flag
when OTG PET enumerates with bcdDevice[0] field in its Device
Descriptor is equal to 1.  OTG PET expects A-device to turn off
the VBUS with in 5 sec of its disconnection which allows it to
initiate SRP.

3. Add support to identify OTG PET and start HNP quickly.

Change-Id: Ib1f4d835d00ca29ff8f980c94d75a3890507dedc
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
2013-02-25 11:34:36 -08:00
Pavankumar Kondeti
d53ef0ba6d USB: OTG Supplement Revision 2.0 updates
ADP (Attach Detection Protocol) is introduced to detect remote
device presence with out applying power on VBUS.  A-device
performs ADP probing and applies power on VBUS when remote device
is attached.  B-device perform ADP sensing and request session
via SRP when remote device is attached. B-device can claim their
ADP capability in OTG descriptor.

HNP polling is introduced for peripheral device to notify its wish
to become host.  Host device polls (i.e execute GetStatus())
peripheral and suspend the bus when peripheral returns host_request
True.

a_alt_hnp_support feature is obsoleted and a_hnp_support feature is
limited to legacy B-devices i.e compliant to older than Rev 2.0 spec.

Change-Id: I1a3c9d35b5e77282da8a47bafd8bc0cc4e5ae1fa
Signed-off-by: Pavankumar Kondeti <pkondeti@qualcomm.com>
2013-02-25 11:34:32 -08:00
Manu Gautam
9ed4650ef0 USB: EHCI: msm: Add support for EHCI based Host Controller
This patch adds support for EHCI compliant USB Host Controller
for Liquid on 8064.
This driver supports Host only mode and is different from ehci-msm
which relies on OTG driver for putting hardware in low pwer mode
and PHY initialization as well.

Change-Id: I84b63b2577311900a0b434f53df547bad62f6316
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2013-02-25 11:34:22 -08:00
Vijayavardhan Vennapusa
d054d4ecbb USB: EHCI: msm: Add support for HSIC based Host Controller
This patch adds support for EHCI compliant USB Host Controller
present in MSM chips. This Controller uses an HSIC PHY which
communicates with downstream devices using STROBE/DATA lines.

HSIC is a supplement to USB 2.0 specification and is preferred
for chip-to-chip interconnect (having maximum circuit length of
10cm) as it removes the analog transceivers.

Change-Id: Id54dcc802e606e0ff7dd31bc64671a797cd8bc09
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
2013-02-25 11:34:20 -08:00
Pavankumar Kondeti
6d746582c3 USB: otg: Add support for sending events to userspace
OTG specification insists no silent failures.  Add framework
for sending OTG failures/notifications to userspace.

The following events are defined in usb_otg_event type.
OTG_EVENT_DEV_CONN_TMOUT: Device connection timeout or device
	not responing.
OTG_EVENT_NO_RESP_FOR_HNP_ENABLE: Device is not responding to
	B_HNP_ENABLE feature request.
OTG_EVENT_HUB_NOT_SUPPORTED: Host does not support HUB class
	peripherals.
OTG_EVENT_DEV_NOT_SUPPORTED: Host does not support the attached
	peripheral.
OTG_EVENT_HNP_FAILED: HNP failed due to not meeting protocol
	timings.
OTG_EVENT_NO_RESP_FOR_SRP: No Response for B-device SRP request.

This patch adds a new method called send_event in otg_transceiver
structure.  OTG driver is notified about the event via send_event
method.  It is the responsibility of OTG driver to send the event
to userspace.  Two possible methods could be sending uevents or
providing an ioctl interface.

Change-Id: I4e518be406909fc4a9641890a3131d897a2c8636
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-02-25 11:34:16 -08:00
Ofir Cohen
006e91b4a3 usb: gadget: SPS BAM-to-BAM - USB BAM driver
USB BAM driver to support BAM-to-BAM
USB<->Peripheral transactions.

Change-Id: Ib49a41f5dcdccb6f6bff2492fa64ead40f18b870
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
2013-02-25 11:32:19 -08:00
Colin Cross
5500e4fab2 Merge commit 'v3.4' into android-3.4 2012-05-25 13:56:28 -07:00
Ming Lei
5b6e9bcdeb usbnet: fix skb traversing races during unlink(v2)
Commit 4231d47e6fe69f061f96c98c30eaf9fb4c14b96d(net/usbnet: avoid
recursive locking in usbnet_stop()) fixes the recursive locking
problem by releasing the skb queue lock before unlink, but may
cause skb traversing races:
	- after URB is unlinked and the queue lock is released,
	the refered skb and skb->next may be moved to done queue,
	even be released
	- in skb_queue_walk_safe, the next skb is still obtained
	by next pointer of the last skb
	- so maybe trigger oops or other problems

This patch extends the usage of entry->state to describe 'start_unlink'
state, so always holding the queue(rx/tx) lock to change the state if
the referd skb is in rx or tx queue because we need to know if the
refered urb has been started unlinking in unlink_urbs.

The other part of this patch is based on Huajun's patch:
always traverse from head of the tx/rx queue to get skb which is
to be unlinked but not been started unlinking.

Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cc: Oliver Neukum <oneukum@suse.de>
Cc: stable@kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-15 13:41:42 -04:00
Colin Cross
aadf030d84 Merge commit 'v3.4-rc5' into android-3.4 2012-05-01 15:47:09 -07:00
Colin Cross
957265bd4f Merge commit 'v3.4-rc4' into android-3.4 2012-04-27 14:03:45 -07:00