Initialize the DMA operations for the MDT data
DMA allocation.
Change-Id: If8eae5e91b4145be8d9e5eeeb28c14cda88e617f
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
This is a snapshot of PIL, SSR and SYSMON drivers and libraries as
of msm-3.18 commit
5cef33a285e91869cebe40a25e6294ae1e5fc9cc
(Merge "ASoC: msm: Update the AFE clock API support")
Change-Id: Ibebddee32b15fbcb5b18cceac43769d3309e609c
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
A check that the intermediate firmware actually contains data
is performed before returning from request_firmware. Perform
this check only if we're actually using the intermediate
buffer.
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Add an additional path, /firmware/image to the list of fw paths
that request_firmware looks into for the firmware images.
Change-Id: I4b9164f222bf0a8546072de97838bf9d49dd8252
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
Currently, when _request_firmware() fails to find the firmware
from the default /lib location, a couple of error messages are
printed denoting the same. Change the print level for these
messages from dev_warn to dev_dbg as it is fairly common to
have the user-space helper loading the firmware for us.
Change-Id: I5e06b3785f58e85eda45d32130b9acbc75cd2c0a
Signed-off-by: Deepak Katragadda <dkatraga@codeaurora.org>
[vmulukut: adjusted for upstream changes]
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Don't use the fw pointer before performing the null
check on it.
Change-Id: I303f71681647e2acb0b7e340b8f8580436cfb19d
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Some implementations may need to know the size of a
region allocated by map_fw_mem in the context of the
unmap_fw_mem callback. Add this as an argument to the
callback signature.
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Some callers of request_firmware_direct may need additional
context to be able to map firmware memory. Allow private data
to be passed in with request_firmware_direct, and send this
data along with the [unmap|map]_fw_mem callbacks.
Change-Id: I05a15eb46cc663a4476b784e30e80182a28e10c3
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[joshc: dropped PIL portions, fixed trivial conflict in firmware.h due
to API rename]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
[vmulukut: adjusted for upstream merge conflicts]
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
On devices with low memory, using request_firmware on rather
large firmware images results in a memory usage penalty that
might be unaffordable. Introduce a new API that allows the
firmware image to be directly loaded to a destination address
without using any intermediate buffer.
Change-Id: I51b55dd9044ea669e2126a3f908028850bf76325
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[joshc: renamed request_firmware_direct to request_firmware_into_buf,
avoiding namespace conflict]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
[vmulukut: upstream merge conflict fixups]
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[dkeitel: upstream merge conflict fixups]
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Some low memory systems with complex peripherals cannot
afford to have the relatively large firmware images taking
up valuable memory during suspend and resume. Change the
internal implementation of firmware_class to disallow
caching based on a configurable option. In the near future,
variants of request_firmware will take advantage of this
configurability.
Change-Id: I44be7ce3b308b642fb018086def99fcb800a1109
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[joshc: reworked to use opt_flags instead of 'nocache' bool in fw_desc]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
[vmulukut: adjusted for upstream additions to opt_flags]
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Introduce a firmware descriptor structure that makes it
easier to pass around various configuration options in the
internal implementation of firmware_class.
Change-Id: I5c1da222bccd568fabb26da5baccaa4035331efd
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[joshc: reworked to make use of upstream's opt_flags member]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
[vmulukut: adjusted for upstream changes to opt_flags]
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[dkeitel: resolved merge conflicts]
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Initialize reserved memory as part of of_platform_device_create_pdata.
Change-Id: I6bb6ba8279af6771cb61087405cb915f4a0602b3
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
As part of the 4.4 upgrade an incorrect merge
conflict resolution in dma-mapping caused the
function __dma_alloc_coherent to not work correctly.
Fix this by changing correctly resolving the merge conflict
resolution.
Change-Id: I5b2411187768f2e3c4292a7c28cd742f5eb2dc54
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Kernel version 4.4 has deprecated the use of *pct versions for 64 bit
targets. Hence moving to vct as recommended.
Change-Id: Ibabf3eb28f58daccd58cde207262b34ed3b1c04f
Use vct instead of pct()
Change-Id: Ibabf3eb28f58daccd58cde207262b34ed3b1c04f
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Existing PSCI implementation supports platform coordinated means of low
power modes where cluster low power modes are aggregated at the platform
level. Adding support for OS initiated scheme, where is OS is responsible
for selecting cluster low power modes based on last man determination. With
OS initiated scheme, the OS can make better cluster decisions based on
wakeup times of CPUs within a cluster.
To this effect, in OS initiated schemes, the composite state ID is computed
by the idle driver before calling into the cpu_suspend API. The PSCI driver
is modified to use the composite ID to distinguish between retention and
non-retention states.
Change-Id: Iee5533676a28a8f6beb7942dcb908f2fa3518d78
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Conflicts:
arch/arm64/kernel/psci.c
LPM modes can fail if there is a pending IPI interrupt at GIC CPU
interface. On some usecases frequent failure of LPM modes can
cause power and performance degradation. Hence, prevent cluster
low power modes when there is a pending IPI on cluster CPUs.
Change-Id: Id8a0ac24e4867ef824e0a6f11d989f1e1a2b0e93
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Conflicts:
arch/arm/kernel/smp.c
arch/arm64/kernel/smp.c
Compile drivers/power/qcom based on CONFIG_ARCH_QCOM instead of
CONFIG_ARCH_MSM
Fix use of __get_cpu_var and convert to this__cpu_ptr
Change-Id: I7152d74f9d495f9ab7af0cfd2f3695c9461469fb
Only PSCI compatible targets are supported moving forward. Remove drivers
that are used in legacy power collapse support.
Change-Id: I022bef78433c9693d3cb8752091c2c0ed2e4e994
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
When the system suspend is happening, last core disables
the non-sec interrupts at QGIC by setting the GRPEN1_EL1_NS
to ZERO. This makes core not seen any non-sec interrupts
and would result into system do not wake up from any of
interrupts. Do not touch GRPEN1_EL1_NS register while
system is going into suspend.
Change-Id: I7d6c5047fb4743df187fe49fba18b64db3179bc9
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Conflicts:
drivers/irqchip/irq-gic-common.h
The use of clockevents_notify is deprcated and targeted APIs are used
instead of the clockevents_notify callbacks. Switch broadcast timer
notifications to tick_broadcast_enter and tick_broadcast_exit.
Change-Id: I3441873eb4009b105db04f4a18d28ae9ccd07e95
Cluster pm notifications without level information increases difficulty
and complexity for the registered drivers to figure out when the last
coherency level is going into power collapse.
Send notifications with level information that allows the registered
drivers to easily determine the cluster level that is going in/out of
power collapse.
There is an issue with this implementation. GIC driver saves and
restores the distributed registers as part of cluster notifications. On
newer platforms there are multiple cluster levels are defined (e.g l2,
cci etc). These cluster level notofications can happen independently.
On MSM platforms GIC is still active while the cluster sleeps in idle,
causing the GIC state to be overwritten with an incorrect previous state
of the interrupts. This leads to a system hang. Do not save and restore
on any L2 and higher cache coherency level sleep entry and exit.
Change-Id: I31918d6383f19e80fe3b064cfaf0b55e16b97eb6
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
This is a snapshot of the Sleep driver and realted functionality as of
e70ad0cd5efdd9dc91a77dcdac31d6132e1315c1 on msm-3.18 branch
Change-Id: I98fec26849898c5c66abbb1b094439780c23964d
To wake up from system sleep, the MPM driver needs to keep track of enabled
GPIO interrupts. Add gpio_arch_extn to support monitoring of GPIO interrupts
Change-Id: If97f566e11eaab452e4b55db1a05e5457f1a8d3f
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
MSM chipsets rely on arch_extn to get the necessary functionality. Add them
until a upstream solution can be arrived at.
Change-Id: I773a3e82ca81b1c49cf2581f5288cacaeb6c6db0
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
This snapshot is taken as of msm-3.18 commit e70ad0cd (Promotion of
kernel.lnx.3.18-151201.)
Change-Id: I93b163cdd379e3cb9601512d2a06424987b5a132
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Enable DWC3, QUSB and QMP PHY drivers to support the USB
controller hardware. Also enable XHCI_HCD for USB host mode.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
For host mode operation, the DWC3 driver instantiates an XHCI
device directly using platform_device_alloc()/_add() instead of
using typical device population methods (i.e. DT or ACPI).
In the latter cases, there is additional setup involved beyond
the allocation itself, not the least of which is DMA setup.
On ARM64 the recent commit 1dccb598df ("arm64: simplify
dma_get_ops") sets the default DMA operations to dummy ops. This
causes a regression as this directly created XHCI platform device
now fails probe when the call to dma_set_mask_and_coherent() is
unable to proceed due to dma_supported() returning false.
Since we know that the XHCI device is a child of DWC3 and hence
is also DMA-capable, fix this in the DWC3 host driver by simply
calling arch_setup_dma_ops() after allocating the platform_device.
Signed-off-by: Jack Pham <jackp@codeaurora.org>
In some of host machine reboot usecases, it has been found that
multiple suspend events are being received before usb device is
being enumerated with host including receiving suspend before
BUS RESET. This suspend event is being seen due to not host
initiated suspend but due to LINE state at that point and may
put USB Host and Device out of sync where host may not send any
more BUS RESET which would cause USB device enumeration as unknown
device with host machine. Fix this issue by honouring suspend
event only when USB enumeration speed is known.
CRs-Fixed: 717151
Change-Id: I201f106d1be71716eaa7a6246d2187889ea53a9c
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This patch is a squash of several commits from msm-3.18 that
add support for dual-role switching (formerly known as "OTG")
to the DWC3 and XHCI platform drivers.
Based on the following commits:
usb: dwc3: Introduce OTG driver for dwc3
usb: dwc3-msm: Add support for LPM on cable disconnect
DWC3: Enable XHCI host in OTG mode
USB: dwc3: Add support for host bus suspend
usb: dwc3 / xhci_plat: Call xhci_suspend/resume when entering/exiting LPM
USB: dwc3: gadget: Implement gadget_vbus_draw() API
USB: gadget: dwc3: Fix composition switch issue during cable disconnect
usb: dwc3: notify gadget disconnect upon VBUS low
usb: dwc3: msm: Remove last of dwc3_otg
dwc3: Reset USB controller/PHY after psy connect indication at bootup
dwc3: Use otg_sm_work state machine for host and device only mode
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Composition switch to GSI transport based composition from
another GSI transport based composition requires power on
reset of USB controller to synchronize operation with USB
wrapper for GSI. Specifically GSI_EN bit cannot be
cleared without performing usb controller reset. Hence
introduce gadget restart operation to simulate vbus off
and vbus on and perform this operation from gsi bind
config.
Change-Id: Ie4695807c73c2d14c0d9e17c486f34a90fd93ddb
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
After the device remote wake up some USB hosts are driving bus
resume for longer than 3 seconds. As a result link state change does
not happen within 3 seconds and remote wake up fails. In worst case
it is observed that usb host is driving bus resume for 8 seconds.
Hence increase the timeout value to 16 seconds.
CRs-Fixed: 803183
Change-Id: I1cbb29ccd2b4e264c032d7237efcfd87cef71942
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
If remote wakeup request is received during system resume where
resume_early is still processing, pm_runtime_get_sync returns -EACCES error
as pm_runtime framework is disabled between late_suspend and early_resume.
Due to failure of this API controller did not exit LPM. This leads to
unclocked access of registers as part of remote wakeup processing causing
target to crash.
Fix this by checking for return value of pm_runtime_get_sync, and queuing
dwc3_gadget_wakeup_work again with intermediate delay of 100ms for maximum
of 20 times.
Change-Id: I8e2215ef9ee708e86356622e85fd2f23a18f7944
Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
In case of remote wakeup interrupt, dwc3_gadget_wakeup_work()
does a pm_runtime_get_sync() and dwc3_gadget_wakeup_interrupt()
does not notify OTG state machine about this state change.
Due to which OTG will be still in B_SUSPEND state.
Now when bus suspend happens, since OTG state machine is already in
B_SUSPEND state, it does not do a pm_runtime_put_autosuspend() and the
count is not decremented.
To fix, this do an unconditional pm_runtime_get_sync() and
pm_runtime_put_noidle() in dwc3_gadget_wakeup_work() to avoid any
unclocked register access. In dwc3_gadget_wakeup_interrupt() kick in
SM machine in all cases and handle the remote wakeup same as host
initiated resume, by clearing the B_SUSPEND bit so that OTG state machine
moves to B_PERIPHERAL state.
CRs-fixed: 829205
Change-Id: I270df517d5dd58fe28bf0087e0ba951c4e9e15ba
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
Moving into U0 state is being confirmed by polling for 100ms after
performing remote wakeup from device. In some of cases where host is
taking more time to respond, remote wakeup is failing. Also USB
specification does not define any limit for the host response time.
Hence this change replaces polling mechnism by using LINK status
change event notification with core and increase host response time
from 100ms to 3 seconds. It also makes sure that composite_resume()
is being called after remote wakeup is completed succesfully.
It removes some of flag used to avoid race between bus suspend/resume
and fuction suspend/resume as those are serialize and not required
anymore.
CRs-Fixed: 712681
Change-Id: I71285daf117282c738e139e9a05ead6ef16dd202
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Events may get generated for Link Power Management L1
Suspend and Resume. The suspend case currently ignores
L1 and only proceeds to call the gadget driver suspend
routines if it is for L2/U3 entry. However, the resume
callback doesn't make this distinction, which will
result in the gadget layer resume getting called for
which there had not been a previous suspend.
Instead of relying on reading the DWC3_DSTS register for
U0 and U3 state, update dwc->link_state directly on receiving
reset/wakeup and suspend/disconnect interrupts respectively.
Change-Id: Ifaa71d2e85bd797154f368e7623bc8ff94b6a727
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
[jackp@codeaurora.org: Squashed with "usb: dwc3: gadget: Update
link_state based on receiving interrupt" and "dwc3: gadget: Update
link_state flag on receiving wakeup_interrupt" ]
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Add a DT property that decides whether to allow controller
low power mode upon bus suspend, which will be invoked by
the OTG state machine.
It is also required to take the core out of LPM in case
ep_queue is called by the upper layers. In this case,
remote wakeup sequence will be initiated once the core
is out of LPM.
[jackp@codeaurora.org: Squashed with dwc3 changes from
"usb: dwc3: Add new OTG state OTG_STATE_B_SUSPENDED"]
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Upstream commit 636e2a2cae
(usb: dwc3: gadget: drop dwc3 manual phy control) removed the
support to suspend the PHYs since the recent controller versions
can do that automatically.
But MSM targets, still do not have the latest controller and hence
adding back the functionality to suspend/resume SS phy.
Change-Id: I02a7ae8daf194a645f3582480f5a6b7d504b32ec
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Targets supporting h/w accelerated path over GSI require
GSI specific configuration of USB controller.
Add support to enable h/w accelerated path to IPA.
Include operations to configure USB endpoints as
GSI capable, allocate TRBs that are associated with
GSI capable endpoints, perform operations on these
endpoints, and enable the GSI wrapper in DWC3 controller.
This allows a function driver to use GSI based h/w
accelerated data path.
Change-Id: I62688c70a04b1fdab3e522e0af759ebab69d92d7
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
commit a0c760181ca874 ("usb: dwc3: Reset the transfer resource index
on SET_INTERFACE") was resetting the start_config_issued flag on
receiving SetInterface request. But in cases where transfer resource
index is shared between two endpoints and if both are trying to do a
transfer then transfer on one of the endpoints will fail, since the
transfer resource index will be acquired by the first endpoint
and when the second endpoint tries to get the same transfer resource
index, it will fail and hence STARTTRANSFER command also fails on second
endpoint.
Reverting this change ensures endpoints get allocated with unique
transfer resource index.
CRs-fixed: 953585
Change-Id: I7800356e455900cc39b9463366275c68db777199
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
Move interrupt handling from threaded IRQ context to a tasklet.
This may help in reducing latencies associated with starvation
caused by high priority softirq over threaded USB IRQ.
Change-Id: I2f988be9c484a6ee59236d9dfd7f06f07414ee96
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
Commit 5ad02fb813 ("usb: dwc3: gadget: move isoc endpoint check
to unlocked set_halt") moved usb isochronous endpoint check form
dwc3_gadget_ep_set_halt() to __dwc3_gadget_ep_set_halt().
dwc3_gadget_ep_set_halt() API is being called explicitly by USB
function driver to stalls USB endpoints whereas
__dwc3_gadget_ep_set_halt() API is also being called to stall ep0
on receiving invalid setup packet or not able to queue response
to setup packet. It is not supposed to have any descriptors with
ep0 early stage of enumeration process. Hence revert change which
makes sure to check usb endpoint type against isochronous before
halting endpoint with dwc3_gadget_ep_set_halt() instead of
__dwc3_gadget_ep_set_halt().
Change-Id: I24b3e78613bf89340c812e353dafaf384ac4a057
Signed-off-by: Mayank Rana <mrana@codeaurora.org>