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. If clock
APIs fail, fallback on msm specific apis to vote for CXO.
Change-Id: I6520948b9fa0ed233b235d0fd9f828ad02bc2ae2
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
A new extended functional descriptor is added
to MBIM. This fix adds the required desciptor
to mbim usb enumerations.
Change-Id: I9c5adf3f704ef20cb7729639ae6d787f219d711d
CRs-Fixed: 432633
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
QDSS uses USB endpoints in DBM or BAM to BAM mode. In order
to reclaim the endpoint from DBM for normal use, USB hardware
has to be reset. To achieve this perform usb connection reset
as part of composition switch (qdss_disable) or qdss usb channel
close which resets hardware as well.
CRs-Fixed: 433485
Change-Id: Idc0062196322a0c71360419c6b134b7d15ccef9a
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Add support for USB-QTI(Qualcomm Tethering Interface)
interface through a user space device file mechanism. QTI
can now read and write QMI control packets from user space.
Change-Id: I199bcc8943576566b0b7a9589d248e04273e88da
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
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: I884cfcd8a53b111bc9434e47ef483dde64fcc1ed
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB may incorrectly send a ZLT when BAM clock gating is enabled.
This change is a software workaround, which will allow disabling
clock gating for a specific BAM.
CRs-Fixed: 420811
Change-Id: I865e396f5596b9cda57c1d1e27f57308c88acebe
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Add device tree support for ehci-msm2 driver for supporting
Host mode on HSUSB port. Also add required clock changes and
support for using second PHY for HSUSB operation.
Change-Id: I7bb47032afef011f90f5725347e12f29eb210ea9
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@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
Change-Id: Iecfcd58e4d8f13521061ce795cbf394eb2eab71d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB peripheral may be RESET as part of cable disconnect. This
disables corresponding BAM as well. Hence, add support in usb_bam
driver to reset BAM before connecting pipes based on the flag
passed as platform data or using device tree.
Change-Id: I3c3d7e7305728877039923853f0c8f9a644183f5
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
There are scenarios where the USB BAM has to be reset.
For example, when the peer BAM is being reset, the USB BAM
must be reset as well, otherwise the BAM-BAM connection will
go out of sync.
In order to reset the USB BAM, the USB controller has to disable
the BAM first. After the USB BAM reset is completed, the USB
controller has to re-enable the USB BAM.
So this change adds the support for USB BAM enable/disable.
This is done by adding an API to ci13xxx_msm. A function driver can
ask for BAM enable/disable by calling this API.
This change doesn't add the support for the USB BAM reset sequence.
CRs-Fixed: 424867
Change-Id: Ib5518fafe3765f86bb09d1ce10723ec733543b35
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Some peripherals share the USB connector, such as MHL, in which the ID
pin is queried for voltage level determining the type of cable
connected. Support this by allowing these peripherals to act as clients
that can register for ID event notification.
The registered callback is called upon ID state change, and when it
returns 0, USB assumes the client is now handling the connection from
this point. When the client is done, it will call the USB callback
(passed as function parameter) indicating offline, at which point USB
can continue to assume a USB connection.
Change-Id: I4abe2c8ba9610ffa28895dfeb641fb625ada7c51
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Add device tree support in SMSC HUB driver which also registers
platform_device for HSIC as its child. This allows SMSC HUB driver
to turn OFF clocks for power savings after HSIC is suspended.
Also add support for SMSC HUB to use dedicated clock as ref_clk
instead of XO.
Change-Id: I3e8828ddc232936df3e21c8e1158af92b16996a2
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
UDC and HCD call usb_phy_set_suspend() to enter/exit LPM during bus
suspend/resume. The current code simply return if the hardware is
already in the requested state. OTG driver resume the hardware upon
receiving remote wakeup from the attached peripheral. The OTG state
and state machine inputs are not updated later when HCD requests resume.
This OTG state is stuck in A_SUSPEND after bus resume and next suspend
requests are ignored.
CRs-fixed: 425108
Change-Id: I0dadca78c8ead9ccd48f25d958015885b28917c1
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
HSIC generates interrupt at 4ms interval. If idle power collapse
is enabled when HSIC is active, krait keeps on going into idle
power collapse requesting RPM to handle the sleep set requirement.
If HSIC interrupt comes after 4ms interval, krait comes out of idle
power collapse and it again ask RPM to handle this request therefore
keeps RPM busy handling requests due to frequent idle power collapse.
This has a power impact. Hence only allow standalone power collapse
when HSIC is active to avoid RPM involvement in assisting kraits to
power collapse. Vote for idle power collapse when HSIC goes to low
power mode.
Change-Id: Iee8bc1fa180499f2d26fbac955a6a6ed767fdeb4
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
The bMaxPower field in the configuration descriptor should be specified
in different units for super speed devices. This field units are 2mA for
high speed connection and 8mA for super speed connection.
Without this fix, USB3 SS host drivers refuse to configure the super speed
device since it request for too much current to draw.
Change-Id: I586b92940163089ae691b2bb627712a723e68e36
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
This change introduces a new module parameter,
which allows to use 1 second delay before entering Low
Power Mode, after USB cable is disconnected.
This change is needed, since for some platforms, there
are external HW blocks (e.g., A2) that interact with USB
shortly after USB cable is disconnected, and require USB
clocks to be enabled.
Change-Id: Ia63839e84ec1c7ab8816ad1b035f1026acaa1e66
Signed-off-by: Amit Blay <ablay@codeaurora.org>
* pkondeti/dwc3_apt:
usb: dwc3: gadget: fix pending isoc handling
usb: dwc3: core: fix incorrect usage of resource pointer
usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced
usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED
usb: dwc3: set up burst size only superspeed mode
usb: dwc3: core: memory ordering fix in close
usb: dwc3: gadget: warn about endpoint already enabled before changing ep name
usb: dwc3: core: use devm_iremap_nocache() version
usb: dwc3: gadget: Fix dwc3_stop_active_transfer for synchronization delay
usb: dwc3: gadget: correct missed isoc when endpoint is busy
usb: dwc3: gadget: Fix sparse warnings
usb: dwc3: ep0: make sure to reinitilize ep1 on STALL
usb: dwc3: ep0: fix status phase delayed status direction
usb: dwc3: ep0: drop XferNotReady(DATA) support
usb: dwc3: ep0: move DATA phase away from on-demand
usb: dwc3: ep0: ignore XferNotReady(STATUS) when we're not expecting it
usb: dwc3: ep0: drop dead code
usb: dwc3: ep0: split the special cases on ep0_queue
usb: dwc3: ep0: drop unnecessary variable
usb: dwc3: gadget: set Ignore Sequence Number bit from ConnectDone Event
usb: dwc3: return error in case of run/stop timeout
usb: dwc3: enable ACCEPT{U1,U2}ENA when SetConfiguration received
usb: dwc3: no need to clear INIT{U1,U2}ENA bits
usb: dwc3: keep default hird threshold value as 4b1100
usb: dwc3: correct set_halt implementation for ep0
usb: dwc3: ep0: prevent starting transfers twice on ep0
usb: dwc3: gadget: remove duplicated code from __dwc3_gadget_ep_set_halt
usb: dwc3: rename res_trans_idx to resource_index
usb: dwc3: gadget: split special cases of ep_queue()
usb: dwc3: remove WARN_ON from dwc_stop_active_transfer
USB: DWC3: Issue device soft reset before core soft reset
USB: DWC3: Put 100 ms delay for phy to be stable
usb: dwc3: Remove duplicate header file inclusion
usb: dwc3: giveback all queued request when ep disabled or reset received
usb: dwc3: fix giveback of queued request in ep_dequeue
usb: gadget: composite: fix ep->maxburst initialization
usb: dwc3: resume phy during gadget initialization on recent cores
usb: dwc3: Correct DWC3_DCTL_HIRD_THRES definition
usb: dwc3: gadget: ignore endpoint IRQs when endpoint is disabled
usb: dwc3: gadget: don't call stop_active_transfers() on disconnect
usb: dwc3: gadget: don't wait for ep cmd IRQ
usb: dwc3: gadget: drop useless code
usb: dwc3: Fix break from cleanup request loop
usb: dwc3: Fix missed isoc IN transaction
USB: DWC3: Correct DWC3_DSTS_SOFFN_MASK definition
USB: DWC3: Correct DWC3_TRB_SIZE_TRBSTS definition
USB: DWC3: Generate interrupt on each TRB as default option
usb: dwc3: ep0: rename dwc3_ep0_complete_req to dwc3_ep0_complete_status
usb: dwc3: ep0: be careful with endianness on SetSEL command
usb: dwc3: ep0: simplify error handling on dwc3_ep0_inspect_setup
usb: dwc3: gadget: move AcceptU1Ena and AcceptU2Ena to Reset IRQ
usb: dwc3: gadget: disable U1/U2 on disconnect
usb: dwc3: gadget: prevent DCTL register corruption
usb: dwc3: core: make sure evt->lpos is correctly initialized
usb: dwc3: support new revisions of DWC3 core
usb: dwc3: gadget: rename phy_power() to phy_suspend()
usb: dwc3: gadget: reinitialize retries
usb: dwc3: add definitions for new registers
usb: dwc3: gadget: remove trailing semicolon
usb: dwc3: ep0: fix a typo in comment
usb: dwc3: ep0: align on function signature
usb: dwc3: ep0: switch over to IS_ALIGNED
usb: dwc3: handle pending unaligned Control OUT data phase correctly
usb: dwc3: fix a WARN and a comment
usb: dwc3: Fix the dwc3 dependency
usb: dwc3: Update dwc3 udc to use usb_endpoint_descriptor inside the struct usb_ep
usb: dwc3: define DWC3_EP0_BOUNCE_SIZE
usb: dwc3: gadget: issue Update Transfer command after queuing isoc request
usb: dwc3: ep0: implement support for Set Isoch Delay request
usb: dwc3: gadget: increase setup buffer size
usb: dwc3: ep0: implement Set SEL support
usb: ch9: define Set SEL and Set Isoch Delay macros
usb: dwc3: gadget: implement Global Command support
usb: dwc3: ep0: add LPM handling
usb: dwc3: workaround: metastability state on Run/Stop bit
usb: dwc3: core: define more revision macros
Change-Id: Ifb6fafcec1ec533af10808baf05f1da163752af7
Signed-off-by: David Brown <davidb@codeaurora.org>
USB core driver sets the autosuspend delay to 1 sec for root hub and
its children by default. In case if delay needs to be changed for a
particular controller, it requires class driver to explicitly call
PM API to set the new values. Hence add a call back handler to set
autosuspend delay in controller driver. This makes class driver code
generic.
Change-Id: I62121651f0a9648a2909ca7eb4081a6c2567ed01
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
To further decouple and step away from using
proprietary APIs between individual driver
have the MSM OTG driver register its own USB
power supply to allow any charger driver to
subscribe to notifications for it and also
use the power_supply_set_online and
power_supply_set_present APIs to notfiy the driver
of USB connections.
For example the 8941 charger PMIC driver handles
the USBIN_VALID interrupt and has to call
power_supply_set_present to notify the OTG driver.
This can now be done from virtually any driver that
provides a supplicant power supply such as "battery"
and provides the external_power_changed callback.
Change-Id: I188d3177f200ab00a7080cd8a361c16728aa0f73
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
This commit removes USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED
Kconfig options. Since now kernel allows many UDC drivers to be
compiled, those options may turn to no longer be valid. For
instance, if someone decides to build UDC that supports super
speed and UDC that supports high speed only, the latter will be
"assumed" to support super speed since USB_GADGET_SUPERSPEED will
be selected by the former.
The test of whether CONFIG_USB_GADGET_*SPEED was defined was just
an optimisation which removed otherwise dead code (ie. if UDC is
not dual speed, there is no need to handle cases that can happen
if speed is high). This commit removes those checks.
Change-Id: Id30a3c984052b047eace5d57a4ac9061b53fb10c
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[pkondeti@codeaurora.org: resolved merge conflicts]
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
These are new requests introduced by USB 3.0
Specification. Gadget controllers should implement
them.
Change-Id: I9a84aca4921ad17e93f292fca3d991bbd2aac953
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
PNOC (Peripheral NOC) present on some MSM targets has
a hardware BUG which degrades the USB peripheral performance.
Fix this by adding a software workaround that changes the
USB mem-type attribute value (from 0 to 2) via VMIDMT.
Change-Id: I2249f1aa81c457032c6f8818f5c5d3820bea66d3
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
This driver presents a standard USB audio class interface to the host
and an ALSA PCM device to userspace
Change-Id: Ie20264ac86d21a1b1366491273034b755366d3c3
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@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
Change-Id: I48082ce473eb6577b0bf613be9ec27f2f5c19384
Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@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.
Change-Id: I1d2a622fc4b7622ebb3b33746a8a8d9361e01e57
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
If charger detection is performed before data pins are contacted, DCP
(Dedicated Charging Port) will be incorrectly detected as SDP (Standard
Downstream Port). The current code waits 700 msec for data pins contact
to happen. But if USB plug is inserted very slowly, charger detection
happen before data pins get contacted.
This patch implements a workaround to the above problem. Kick a 2 sec
timer after SDP is detected. This timer would not do anything if USB
is in low power mode or cable is disconnected or gadget speed is assigned.
If above conditions are not not true, read line state. The line state
would be "11" in case of DCP as D+ is already pulled to high by gadget
driver. If DCP is detected, stop gadget driver and enter B_IDLE state.
PMIC is notified about available current and USB is put into low power
mode.
CRs-fixed: 405253
Change-Id: I9181a4774cd98308752ad6c281107ec11bc4728c
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
To further decouple and step away from using
proprietary APIs between individual driver
have the MSM OTG driver register its own USB
power supply to allow any charger driver to
subscribe to notifications for it and also
use the power_supply_set_online and
power_supply_set_present APIs to notfiy the driver
of USB connections.
For example the 8941 charger PMIC driver handles
the USBIN_VALID interrupt and has to call
power_supply_set_present to notify the OTG driver.
This can now be done from virtually any driver that
provides a supplicant power supply such as "battery"
and provides the external_power_changed callback.
Change-Id: Ie4735a9d4cd5aaf249971bdf3e13efef83fdb983
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
In some cases, when USB enters into Low Powr Mode, USB PHY
regulators can be turned off to save power.
If USB PHY is used for VBUS detection, USB PHY regulators can't be
turned off, but it can be put into LPM, to be able to exit from Low
Power Mode upon VBUS detection. This change add this capability.
Change-Id: I4981fa7b611c7b0aadc8deb66e6b7e7a42f9a44e
CRs-Fixed: 369499
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Fix the following race condition:
1. Suspend interrupt is handled by suspend ISR
2. The msm_otg queue the suspend related task to sm_work
3. Reset interrupt is handled by reset ISR
4. The msm_otg queue the resume related task to sm_work
5. The reset ISR continues and start RESET handling
6. While 3-5, The sm_work handles the suspend and enters LPM
7. The sm_work handles the resume and exist LPM
The solution is to prevent such a race condition by deferring
entering LPM upon suspend by 500msecs. In that time, any RESUME
or RESET will cancel entering LPM.
Change-Id: I3cf254d359a8700e6ba530002a9351df6f312bcf
CRs-Fixed: 393245
Signed-off-by: Amit Blay <ablay@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>
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>
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>
USB 2.0 core doesn't support RESET ACK signal to BAM performing
pipe reset. Hence, request SPS to disable this otherwise USB BAM
reports errror during connect.
Change-Id: I54374a194faf2f886b07cd4aa9eae17f8e19ca52
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
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>