Enable coarse-det-usb irq for charger OVP monitor. When insert a
high voltage charger, coarse-det-usb irq trigger, after wait for
usb valid debounce time, check the OVP condition, and report usb
health state; When an OVP happened in the process of charging, a
falling usbin valid_irq trigger, check OVP condition in usb plug
out condition, and report the usb health state.
Userspace can use the charger health state change to pop up
warning message when a charger, which exceeds the OVP threshold,
is connected.
Change-Id: Idedcdd7084aa24505675cf016d869444a89ca46c
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
UMS(usb mass storage) need a new lun for internal
storage.So add a new lun number for internal mass storage.
Change-Id: I17ccb8f85d458567a1f1b35366b8b0834397601f
Signed-off-by: Jin Wu <jinw@codeaurora.org>
Currently dwc3 driver will allocate fifo size of maximum endpoint
packet size for TX endpoints depending on operating speed. Due
to this, double buffering may not work for TX endpoints in both high
speed and superspeed. Hence implement policy that allocates 3KB of
fifo for all bulk and isochronous endpoints irrespective of speed.
Policy is to allocate 3KB for bulk and isochronous endpoints and
allocate maximum packet size for control and interrupt endpoints.
This policy will improve the TX throughput numbers for function
drivers like MTP, mass storage. But side effect is we can't accomodate
more than nine bulk + isochronous endpoints in non QDSS composition
and five bulk + isochronous endpoints in QDSS composition. Otherwise
last interfaces in the USB composition will not work.
CRs-Fixed: 532070
Change-Id: I5e947f21f25fada7829c84eba45980295497cfbc
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
On few legacy platforms, USB PHY is having dedicated reset clk.
It is used to reset USB PHY after putting USB PHY into low power
mode and for calibration of USB PHY. Putting USB PHY into low
power mode is causing ulpi read/write timeout as expected USB PHY
reset clk is not available on newer platform. Hence remove USB PHY
reset clk usage and related reset code.
For 28nm PHY, Reset USB PHY after resestting USB LINK. Also reset
USB PHY using USB_PHY_PON bit with USB_OTG_HS_PHY_CTRL register
after programming USB PHY Override registers as suggested with
hardware programming guidelines. Also debug out important USB
register when ulpi read/write timeout is seen with USB PHY.
CRs-Fixed: 511102
CRs-Fixed: 511397
Change-Id: I8f0f49211a64aa6eac7643cd91a652aed40132e3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB PHY is provided sleep clock on few platform which is
required to enable for USB PHY functionality. Hence add
support to vote sleep clock if it exists.
CRs-Fixed: 518353
Change-Id: I67006bfe3fbe9b3ad3e1d1e2ddb0e8e060437bd7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
There can be SOFs underway after suspending the port
(setting susp bit) which leads to phy lockup or unexpected
device disconnections on some platforms. Fix for this is to halt
the controller before setting port suspend bit to avoid such issues.
There are similar SOF related PHY issues for RESET and RESUME.
There already exists a platform_data or DT parameter:
'phy_sof_workaround' which enables all these SOF related workarounds.
But, some hardwares have RESET and RESUME SOF issues fixed but only
SUSPEND SOF issues is present. For these add pdata and DT parameter
to enable only SUSPEND SOF workaround.
CRs-fixed: 510136
Change-Id: I57d7fb11616e96b606f9f0c80bf3222fca27bb5d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Since it might take 150ms for QCA6234 to initialize from boot code
when receiving HSIC bus reset.
Add delay between the HSIC bus reset and enumeration.
Change-Id: I78520e290e7b7c5e8c686a303cb1cd63bde520ae
Signed-off-by: Ming-yi Lin <mylin@codeaurora.org>
Allow voltage_max property to be written from user space. The USB
power supply input voltage can be limited by writing into
/sys/class/power_supply/usb/voltage_max sysfs file. The user space
charger detection application uses this property value to place
an appropriate voltage request to the charger.
Change-Id: Id997a97dee073d0d8f877b58470ca2f70e89065e
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Currently msm_otg driver allows VDD minimization during host bus
suspend and depends on MPM for USB remote wakeup on platforms,
where D+ and D- lines are routed to MPM. As part of VDD minimization,
PHY will be put into retention state in which pull down resistors
are disabled. This scenario could cause issues without HW rework of
connecting pull down resistors on data lines. Hence don't allow
XO shutdown during host bus suspend if session is active.
Change-Id: Ic7274072cc4f266574cf45030bcadc469091c333
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
The userspace charger detection takes place when a standard dedicated
charger is connected. We handover the detection part to userspace
after detecting the dedicated charger. Create a character device
called /dev/usb_ext_chg to expose hardware register access and a
mechanism to vote against low power mode. Add POWER_SUPPLY_PROP_TYPE
property to power_supply_property array to send charger type information
in power supply uevent.
CRs-Fixed: 500279
Change-Id: I538601a423e5bc87e98d29690c0da50b96f8e481
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Remove usage of the global context variable in the gadget and DBM
functions by passing a dwc3_msm pointer directly. This will allow
the driver to eventually support multiple instances.
Change-Id: I0fdc5d703b3fd445e83226534f07743461c96f4c
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Remove usage of the global context variable in the MHL functions by
adding an additional parameter to the callback function signature.
This will allow the driver to eventually support multiple instances.
Change-Id: I9e01838f6c0d51b5cd210e46d151b2ed9179d087
Signed-off-by: Jack Pham <jackp@codeaurora.org>
For bam2bam scenarios, the usb bam driver starts low power mode (lpm)
after bus suspend or cable disconnect and after the handshake with
the ipa peer bam is completed.
So far, only msm otg state machine was responsible for setting the core
into lpm. The problem is that in some race conditions, for example when
disconnection of the pipes in usb bam happened sooner than the
disconnection in the msm otg state machine, the lpm was started too soon
by the usb bam, therefore caused a crash for accessing lpm HW by the
msm otg.
This change make sure that the usb bam will not start lpm unless the
msm otg state machine has been tried to do so. In that case the usb bam
will save this state as 'pending' lpm, and will start the lpm later in
case the handshake with the ipa has not finished yet.
CRs-Fixed: 509452
Change-Id: I2f2697589e2e45d91b57d31bec6aebd6d2b8110f
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
/dev/usb_ext_chg device file interface supports mmap and its current
implementation allows any address for mapping. Fix it by mapping only
charger block register address space. The user space does not need to
pass any physical address in mmap. Implement an ioctl to tell the
offset from which the first charger block register is available. User
space adds this offset to the virtual address returned by mmap to access
charger detection registers.
The MSM_USB_EXT_CHG_INFO ioctl also returns the charger block type
(QSCRATCH/ULPI) to user space. Use the ioctl interface for blocking
low power mode while charger detection takes place in user space.
Change-Id: Ie27988e1989564124b40cf7c40c8eb67dac99c65
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
On some platforms, DP and DM lines are routed to MPM for detecting
data lines transition during VDD minimization. Hence allow VDD
minimization during host bus suspend and depend on MPM for usb remote
wakeup on platforms where detection of peripherals are supported
through MPM interrupt.
Change-Id: I8d72ebf83cab014e3c4839484982c9ae115757a1
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Some peripherals cannot wakeup from XO shutdown with in-band resume
signalling. Assert resume gpio before driving resume to bring
peripheral out of XO shutdown and detect usb bus resume.
CRs-Fixed: 497866
Change-Id: I2a277fd232871c07abeeb9035752d59ee13398f8
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Out of band resume cannot be used when selective suspend
is enabled as hub driver can resume/suspend the port. Add
support to disable selective suspend on platforms which
does not support usual in-band resume signalling.
Change-Id: I1ec604325fd7fd33a0eb7e80eb7d2b1d7b10189b
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
CERR is 2bit down error counter that keeps track of number of consecutive
errors detected on single usb transaction. When set to non zero value, hw
decrements the count and updates qTD when transaction fails. If counter
reaches zero, hw marks the qTD inactive and triggers the interrupt. When
CERR is programmed to zero, hw ignores transaction failures. EHCI stack
programs the CERR to 3 by default. Some peripherals might not work
correctly when CERR is set to 3. Add support to disable CERR in such
platforms.
Change-Id: I750fbe13d70e5f7359c4e1ee1fb649ebe9ec9946
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Link Power Management (a.k.a. L1) is similar to the existing usb bus
suspend/resume/remote-wakeup, but has transitional latencies of tens
of microseconds between power states (instead of three to greater than
20 millisecond latencies of the USB 2.0 suspend/resume).
Change-Id: I8ae493534702e658c24f384a6b705b08e9ea9d05
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
Some platforms require voting for NOC bandwidth (and PNOC clocks)
when enabling/disabling USB clocks. It is also recommended to have
NOC running when USB is active or in session.
Hence, allow such platforms to specify MIN BUS vote along with NONE
(or inactive) and MAX USB votes. If MIN vote is not specified then
driver treats NONE vote as MIN vote.
Overall platforms should be passing these votes based on that:
NO vote is used when USB cable is not connected or there is no USB
session. MAX vote is used when USB is operating in peripheral mode
and MIN vote is used for any other scenario e.g. host mode or when
turning off USB clocks as part of putting USB in low power state.
MIN vote shouldn't be a significant value to avoid increase in power
numbers.
CRs-Fixed: 494654
Change-Id: Ia4498356b026963f7a6fda8a30ecbd9c1cd98924
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Floated charger means "D+/D- floated charger". According batt
charging spec 1.2, during primary detection, the DP voltage
is VDP_SRC, DM voltage may not exceed VDAT_REF, it's same to
standard downstream port(SDP). Introducing data contact
detection(DCD) here to distinguish between SDP and floated
charger. If DCD detected, it's SDP, otherwise floated charger
is detected.
Change-Id: Id7655f7209408092da84a09e3ab6f5c5a764ef78
Signed-off-by: zhenhuah <zhenhuah@codeaurora.org>
Due to limited number of HSIC endpoints, to support
more than existing number of control and data channels,
driver needs to MUX all the data channels as well as
the control channels into one HSIC interface. MUX
support is enabled on PID 0x9075. MUX header is added
to IP/control packet based on the channel id while
transmitting to mdm device. Similarly, while receiving
driver removes and parses the MUX header and based on
channel id it forwards IP/control packet to appropriate
network interface/control channel.
Change-Id: If37c672347ab47be6e02d4efd33a70c46486b5f1
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This change fixes the way ci13xxx_msm driver is probed. The
driver will not be created by device tree, but will be created
by the msm_otg.
Change-Id: I82f9b0ccb601f12364c3b6e3c681dc607d3f9af5
Signed-off-by: Amit Blay <ablay@codeaurora.org>
Add DTS parameter to allow bypassing AHB async bridge, so
that The bridge on the slave AHB is always used.
Change-Id: I03ff1bb531a5c342c427dbbd16d7d4af508fba29
Signed-off-by: Amit Blay <ablay@codeaurora.org>
This change ensure correct sequence with the ipa resource manager
to obtain or release the producer and consumer resources upon
hsic host suspend/resume sequences which involve entering/exiting
to low power mode.
Change-Id: Iec77b9a24a3192a19de93c813b416baca26c7a77
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
This change adds support for power collapse for tethering
functions of the USB device for cable connect/disconnect
scenarios.
The implication of this is that upon cable connect/disconnect
USB goes into low power mode, after handling a handshake via
resource manager with the IPA-A2 for graceful disconnection
of the pipes.
Change-Id: Ieb16812a4b9433d383862ff617d1f247c389f6ac
Signed-off-by: Lena Salman <esalman@codeaurora.org>
Park mode improves throughput by forcing host controller to perform
three consecutive transactions. However, it can cause packet
corruption in some h/w platforms. Disable it on V1 and V2 h/w
to workaround h/w bug. Enable it on V2.1 h/w as packet corrution
h/w bug is fixed on it.
Change-Id: I0ce0e333863a1b67755c0809f5a831b8ffc38d5e
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
Some platforms may have configuration to allow USB controller
work with any of the two HSPHYs present. By default driver
configures USB core to use primary HSPHY. Add support to allow
user select 2nd HSPHY using DT parameter.
Change-Id: I605aadf8109db385644a690fc945f482331bb347
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Some old version HSIC PHY has hardware BUG where due to a race condition
between h/w initiating SOF (start of frames) and finishing port reset
can cause PHY lockup. This may result in enumeration failure. Similar
race conditions exist for resume and suspend scenarios as well.
Currently driver is enabling software workarounds for the same on all
hardware revisions. As these BUGs are fixed on latest HSIC PHYs, make
the workaround selection configurable using DT or board files and enable
these only for the affected targets.
CRs-fixed: 471128
Change-Id: I37e88bdff1f664f8782d1bc5125a4fee1b3ea78d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB core clk is derived different ways on different platforms.
Sometime it is being derived from DFAB or AXI or having dedicated
clk. USB core can not tolerate any frequency change at runtime due
to hardware limitation. Hence it is must to set USB core clk to Max
supported clk frequency.
This change inquires Max supported clk frequency for USB Core clk
and request to set the same using Linux clock driver provided APIs.
Change-Id: I56780d4f8b4422efd2fca690d4b73c80f530444d
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This change add the support for activating more than
one usb core in the system in bam to bam mode.
Potentially, we can have up to three usb cores in
the system: HSUSB, HSIC and DWC3.
This change simplify the USB BAM driver design, such that
we can easily define bam to bam paths for more than one usb
core concurrently with flexible peer BAMs configuration.
Change-Id: Ie5acb68f29e30cb6c14d2afd957ac8e21cc7beba
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
some peripherals connected to hsic controller cannot wakeup from XO
shutdown using in-band bus resume signalling. If present, use resume
gpio to bring peripherals out of XO shutdown before resuming the bus.
Change-Id: I7b80c95f31e854a09e673a9367ab85e4977a0fa0
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Drop whitespace, unused Kconfigs, and bad Makefile entries. Undo
code movement, remove dead function, and delete entire files that
we don't compile that make our code divergent from upstream. No
functional difference.
Change-Id: I1150b3d4b317fb5180c5d26e2366dccb28a6bf43
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>