Commit Graph

153 Commits

Author SHA1 Message Date
Sagar Dharia bc4c3bf0bf slim_ngd: Handle invalid/timeout TX errors gracefully
Invalid transactions can cause timeout or NACK TX errors.
Clear completion object reference for pending TX messages and print
TX BAM pipe descriptors and status registers for such transactions.
TX timeouts during connect/disconnect port error conditions should
clear completion object reference for acklowledgement receipt
to avoid referring to stale completion object later.

Change-Id: I81018df8cab59b43753c46c8a49a5066b794fda6
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-12-02 17:49:19 -07:00
Kiran Gunda 88d8ba18ff slim_msm: effective management of data ports
The current implementaion of data ports management
assumes that the ports are allocated contiguously,
which is not a correct assumption.
This patch addresses this limitation and handles
the data ports which are allocated non-contiguously.

Change-Id: I04e83bc525a50db4d0a37028498be848af018bb5
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-11-21 01:26:11 -08:00
Linux Build Service Account 78469aec5b Merge "slim_ngd: Avoid unnecessary pipe connect/disconnect for msg queues" 2014-11-20 15:36:48 -08:00
Sagar Dharia e04d0b0faa slim_ngd: Avoid unnecessary pipe connect/disconnect for msg queues
If slimbus satellite device retains its logical address after power
vote, it is safe to assume that BAM HW did not get reinitialized.
Use that logic to disconnect TX/RX message queues to avoid
disconnecting and reconnecting them during every power up/down vote

Change-Id: I906c4f5f01ed076066a084a8aa10d8e4d4825e33
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-11-14 15:47:35 -07:00
Sagar Dharia bc2e68fb8e slim_ngd: Ensure device state consistency with runtime-pm during SSR
During ADSP SSR, client's thread calling runtime-pm resume will
fail since ADSP is unreachable. Make sure such power-up/resume attempt
is blocked until ADSP comes up by using mutex during device-state
transition.

Change-Id: Ie85e52bb2974aaee9654eb8fa1cc60fe37c61b75
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-11-13 14:49:25 -07:00
Sagar Dharia 1e095a5bdb slim_ngd: Use DSP before-shutdown notification for DSP SSR
QMI_SERVER_EXIT notification comes too late (after the DSP has
shutdown). This can result in unclocked access by BAM if there was
in-flight transaction. Use BEFORE_SHUTDOWN notification of SSR
framework instead to make sure in-flight transaction is finished
before DSP turns off its resources.

CRs-Fixed: 730552
Change-Id: If3c2787c74ffa7743772e5e37eac2f768e239050
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-11-03 13:48:06 -07:00
Linux Build Service Account ef65849b06 Merge "ngd_slim: Ignore pm_runtime_get error when runtime-pm is not enabled" 2014-10-11 14:53:34 -07:00
Sagar Dharia dc3ac13724 ngd_slim: Ignore pm_runtime_get error when runtime-pm is not enabled
Controller power-up uses different code-path when runtime-pm is not
enabled.

Change-Id: Ibe2f119fd8f43edb657f8f623879dea4730811f4
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-09-16 17:06:28 -06:00
Sagar Dharia d15bc209dd slim_msm: Handle ADSP SSR gracefully for apps-owned data channels
Usually the data channels are owned by codec, or by ADSP itself. If
apps itself is involved in data-transfer on the channels, make sure
the BAM pipes, or the port-registers in question are not accessed
while ADSP is restarting.

Change-Id: I9476c7389dbf89d902f0ef6572f3f755f0575f7b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-09-15 17:24:18 -06:00
Naveen Kaje 9776549cde slimbus: Cleanup dev_list when device is removed
Remove a device's list-entry from controller's
device-list when that device is removed.

Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Change-Id: I068bf34b6692dad33332f4b9baf49e768f5b2736
2014-09-05 17:26:00 -06:00
Mitchel Humpherys aed22e6d2c slim_msm: fix LPAE builds (64-bit division)
We can't currently divide 64-bit numbers on LPAE builds. Currently,
slim-msm.c is using a physical address as part of a division operation,
resulting in the following linker error:

      LD      init/built-in.o
    drivers/built-in.o: In function `msm_slim_tx_msg_return':
    drivers/slimbus/slim-msm.c:432: \
        undefined reference to `__aeabi_uldivmod'

Fix this by casting the physical address to an unsigned long.

Change-Id: I396697158c57c80240ccd039006422afd684f47d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
2014-07-23 18:06:53 -07:00
Sagar Dharia 6085240248 slim_msm: support non-blocking writes from slimbus MSM controller
Provide non-blocking write support so that clients can queue multiple
writes, or larger transfers without performance implications.
TX buffer is created and descriptors out of this buffer
are submitted to HW to transmit data.
Descriptor is returned to 'available' pool of TX buffer when HW
interrupt for transmission status is recieved.

Change-Id: Icc2af6bf4f770c8cadb9bd2ef7be0f95eb22c5d8
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-07-15 15:57:28 -06:00
Linux Build Service Account dee710f640 Merge "ngd_slim: Fix return paths in transfer function" 2014-07-03 21:11:15 -07:00
Sagar Dharia 7241199fd0 ngd_slim: Fix return paths in transfer function
Return right away if resume fails when runtime-pm is not
enabled. Consolidate return paths if controller power-on
vote fails when runtime-pm is enabled.

CRs-Fixed: 677689
Change-Id: Ia8887dd87df6dba4f93638650794bfcdc7d1ff75
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-07-03 09:34:03 -06:00
Linux Build Service Account e351ce21e1 Merge "Slim-msm: Add NULL pointer checks" 2014-06-27 05:29:28 -07:00
Sagar Dharia 59f078c679 ngd_slim: Register with QMI service in the slave-notification thread
Slave notification thread is used to notify slaves when QMI server
(hosted by slimbus msater driver) on the remote execution environment
has come up. Use that thread's entry point to do QMI service
registration as well since doing so in probe may trigger another
probe by the QMI service leading to boot-up stalling.

Change-Id: I06b1bcfd9aa3d570554971acacd5d7b1dc20fd1c
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-06-20 13:21:32 -06:00
Kiran Gunda eb2f3ead20 Slim-msm: Add NULL pointer checks
Don't access the qmi pointers in qmi_exit function
when the qmi_init is failed, as these pointers are
freed in qmi_init if any error occured.

Change-Id: I5c13fe7b5ba08bf29329aad4a6cbf6fc4601260a
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-06-18 17:36:08 +05:30
Eric Holmberg 9f4800553d msm: ipc_logging: add client version support
If clients use custom serialization functions, then they may need to
define a version for deserialization support for log extraction.

Add client version support.

Change-Id: Id135f06d4142de39275b5d0caab88708d5496b5e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
2014-05-27 13:56:54 -06:00
Sagar Dharia 53eb18ad35 ngd_slim: Decouple clock pause from power down/up
NGD slimbus driver itself can never send out clock pause sequence
for slimbus protocol on the HW lines since it can only be sent by
a manager device (which is controlled by ADSP when NGD driver is
instantiated from apps side).
Previously, clock pause of slimbus framework was coupled with power
down/up. That is not correct, since manager device may or may not
decide to send clock-pause on the HW lines. (e.g. if apps is inactive,
but some client on ADSP is active, clock-pause sequence won't be sent
over the bus.
Decouple power-on/off from clock pause to avoid giving incorrect
impression to clients on apps side about clock-pause state. Mark
clock-pause as unsupported by setting wakup function pointer to NULL
instead since this controller on apps cannot send it on HW lines.

CRs-Fixed: 667165
Change-Id: I382bca153deb2fed1d0f0672adaebde1e122dc68
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-05-19 16:42:42 -06:00
Kiran Gunda b970f20dce slim_msm_ngd: Add IPC logging support
Add IPC logging support for improved debugging
per device, and in memory to avoid using kernel
dmesg logs.

Logs are captured in four levels.
1) error level ---> All fatal errors are logged
2) warn level  ---> error level logs +
Warning messages are logged
3) Info level  ---> Error level +
warn level + the required information
for debugging is logged
4) Debug level ----> error level + warn level +
info level logs + extra information
for debugging are logged

Procedure to change the debug level at runtime:
==============================================
cd sys/devices/ctrl_num(eg:1234).slim
echo <log_level> > debug_mask

Procedure to collect the logs at run time:
=========================================
adb shell cat sys/kernel/debug/ipc_logging/ctrl_num.slim/log_cont
|tee slimbus.txt

CRs-Fixed: 645838
Change-Id: If183533472ee61b2d8cf458d228dd4ae2124dd37
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-04-17 12:51:07 +05:30
Linux Build Service Account 2a9b24f26b Merge "Slim_ngd: Don't create the device node per SSR" 2014-04-09 05:20:13 -07:00
Sagar Dharia a88867c2a0 slim_msm: Handle external-modem shutdown differently than restart
External modem may shutdown in cases other than subsystem-restart.
In that case, the power-up notification may not happen.
Handle such a scenario and make sure runtime-pm vote is not held
for more time than required, and that slave-device up/down/reset
notifications happen as expected if slimbus was down.

CRs-Fixed: 645450
Change-Id: I5fef2393c835d06c5ce1dc4f9cb62d418620211b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-04-08 18:27:08 -06:00
Kiran Gunda 320e892680 Slim_ngd: Don't create the device node per SSR
Observe the device crash due to the device node
gets created per ADSP SSR when the logical address
query succeeds at the first attempt.
This patch makes sure that the device node creation
happened only once  by declaring another variable to
track the logical address retry.

CRs-Fixed: 640381
Change-Id: I3d947fcbc575af7cb431255772aa9cb64d2df6b6
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-04-08 18:47:24 +05:30
Naveen Kaje c5eab7ea9b msm-slim-ngd: Read configurable external modem identifier
When an external modem is used, read the config from dt and use the
value in subsystem restart callback registration.

CRs-Fixed: 612775
Change-Id: I5e40e98a60c304c82741914157191cfb2f0697d5
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-03-26 15:50:58 -06:00
Sagar Dharia 186f5c0eae slim_ngd: notify slaves in some MDM restart scenarios
If MDM restarts when it had active framer, bus may lose sync.
Send device-down notification if that happens, and corresponding
reset-device and device-up notifications to slaves so that they
can act to restore their devices' communication over slimbus

CRs-Fixed: 612775
Change-Id: I83f22b9bcf18912c7c9507ea099691ed71d86a9f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-03-26 15:48:38 -06:00
Kiran Gunda c04d87105e Slim_ngd: Modify waiting mechanism in kthread
wait_for_completion_timeout() is not a good option in
kthread as it leads to scheduling the kthread on the every timeout.
Hence modify it to wait_for_completion() from
wait_for_completion_timeout().

Change-Id: Iaa29e997fd1cd5cb02f9ba44e69e1700b31736ae
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-03-20 14:17:12 +05:30
Naveen Kaje d366c37be6 slim-ngd: change log level of slave_notify completion
Change the logging of slave_notify completion to debug to avoid
excessive logging.

Change-Id: Ie8e4ec1c7db786a20212f828d1432ea64e87ccd7
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2014-03-14 16:40:17 -06:00
Sagar Dharia 9f8c6e83d2 slim_ngd: Use QMI server up notification instead of APR for probing
Slimbus QMI-server can reside on any other remote processor.
Avoid depedency on APR (for APR state) by utilizing QMI server-up
notification for slimbus hardware initialization from apps processor.

Change-Id: I85e268d08e5c4cfc9c53513199784813200f0223
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-03-10 20:37:34 +05:30
Linux Build Service Account 72d541c4f7 Merge "slim-ngd: NULL pointer check for client buffer" 2014-02-26 21:23:13 -08:00
Sagar Dharia 1f66f596a0 slimbus: Use physical address type where physical address is used
Use physical address type for buffers using physical address.
(e.g. interaction with data-mover engine)

Change-Id: If0c02f13562c762c6effcea82a1e3c351ec2e288
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-02-12 20:39:15 -07:00
Sagar Dharia 0bd06ffe30 slim_ngd: Support REPEAT_CHANGE_VALUE user message
REPEAT_CHANGE_VALUE user message is used to transfer high amount of
messaging data efficiently.

CRs-Fixed: 503461
Change-Id: I2762ad858b27ac84597f4eaf22fc6f3d14232d76
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-02-12 20:33:06 -07:00
Sagar Dharia e7b7f90367 slimbus: Enable clients to send user messages to devices.
Slimbus protocol allows user messages of destination referred, or
source referred type to be sent to a slimbus device.
Provide framework to support such messages. Note that, controller
may not support all user messages.

CRs-Fixed: 503461
Change-Id: I3644c6d671a620122095ace64da64c4e71eb9607
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-02-12 20:30:52 -07:00
Sagar Dharia 6665eb703c slim_ngd: Handle error flags before handling SENT flag
It's possible that error flags were set alongwith SENT flag for
TX transaction status. In such a scenario, error flag status should
be handled (and SENT flag should be cleared). Move error-flag
handling ahead of SENT flag handling to avoid interrupt being called
twice, and completion being set twice.

Change-Id: I13f28df0a0448790069bd103422dc1cd6c7ac408
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-02-12 19:02:29 -07:00
Dipen Parmar 7f918cb5c7 msm: sps: remove sps header file
Remove the sps header file from older location as sps
driver and clients need to use new header file from
new location include/linux.

Resolve the warnings/errors from client drivers due to
new sps header changes.

Change-Id: I1cdb87756abf3425a9bb5d8bf89cd1aa03a01716
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-02-05 15:31:11 -08:00
Kiran Gunda 64e29070fd slim-ngd: NULL pointer check for client buffer
There is the chance of passing NULL pointer by the client
during the Slimbus/Codec transactions. Hence add NULL
pointer check for client buffer aswell.

CRs-Fixed: 608324
Change-Id: I161e8f04401afebb64ed72d5f392a67feb6ec13a
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2014-02-04 07:45:27 +05:30
Linux Build Service Account e6171f8378 Merge "msm: Move PIL and SSR headers" 2014-01-28 23:35:35 -08:00
Linux Build Service Account f2f2c38e38 Merge "slim_ngd: Fix logical address notification mechanism" 2014-01-28 01:16:48 -08:00
Linux Build Service Account d63411224e Merge "slim_ngd: Return success for resource removal requests if HW restarts" 2014-01-28 01:16:41 -08:00
Vikram Mulukutla bd91122223 msm: Move PIL and SSR headers
Architectural changes in the ARM Linux kernel require moving
some MSM specific headers related to the peripheral image
loader and the subsystem restart drivers to include/soc/qcom.

subsystem_restart.h is used by external modules and thus
leave a proxy in include/soc/qcom for now. Once external modules
switch over to this new include path, the header in the
old location can be deleted.

Change-Id: I0680dc34481d09170ce2609259c5318a9e6dbf37
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-01-27 19:08:06 -08:00
Linux Build Service Account 11ab1d1490 Merge "slim_msm: ngd: Return success for channel removal during ADSP SSR" 2014-01-24 21:10:24 -08:00
Sagar Dharia b29669b783 slim_ngd: Fix logical address notification mechanism
It's possible that multiple slaves report present/absent and expect
corresponding notifications concurrently. Avoid using controller
resources where possible, and use list_for_each_safe to allow
changes to the device-list during list traversal.

Change-Id: I371c48d25a0953f5f1909c904e8fd80b599d16b3
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-01-24 18:18:18 -07:00
Sagar Dharia 2ccab9be19 slim_ngd: Return success for resource removal requests if HW restarts
Channel and ports are removed when HW restarts. Return success to
client channel removal, port disconnection requests when slimbus HW
is restarting.

Change-Id: Ifc9a3bb80023c823a7776a16fe32e5b59b181350
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-01-23 02:28:34 -07:00
Karthikeyan Ramasubramanian 1f5cbc30b3 qcom: qmi: Support multi-platform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in generic functionality
directories instead of specific mach directories.

Move QMI Interface driver to to the drivers/soc/qcom location.

Change-Id: Ib36d8857e5839ac5ab802646b97b010a6b7d5d23
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2014-01-20 18:26:07 -07:00
Sagar Dharia 47bfc95a61 slim_msm: ngd: Return success for channel removal during ADSP SSR
Slimbus master component resides on ADSP when this driver is used.
Wehn ADSP restarts, slimbus component goes down and bus is not
operational until it comes back up. During restart, slimbus clients
are notified since their device goes down, and the clients remove
channels and/or disconnect ports. Since bus is not operational,
return success for channel removal/port disconnection calls so that
the channel, port state is consistent with HW (not active, removed)

Change-Id: Ia2707ed9f3fc3573b5746c8e42fa7f229e0dea4f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-01-20 15:35:27 -07:00
Sagar Dharia dc70628cfe slimbus: Remove unnecessary pointer type-cast
Use correct format-specifier in debug-log to remove pointer
type-cast

Change-Id: I304d2e04185b694b14fba41124abba165df8dacf
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-01-08 19:00:02 -07:00
Sagar Dharia df8e3c868a slimbus: Provide framer-booted notification to slimbus device drivers
When slimbus resets (due to bus reset sequence, or after it shuts down
and comes up), framer boots up and starts clocking the bus.
Devices on the bus may be in undefined state at that time. Callback
is provided to slimbus device drivers so that controller can report
framer-booted notification so that drivers can take necessary action
to put devices in reset state so that they can acquire sync, report
present, and be operational.

Change-Id: I6068063ef32c91a67c246f9ee727b4724c11f5f2
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2014-01-02 14:37:49 -08:00
Asish Bhattacharya de06bb1c13 msm: qdsp6v2: reorganize kernel driver under misc drivers.
This is needed as the drivers are registering under misc driver
but exists under arch/arm/mach

Change-Id: I9cd75901184a4fdff6f796019152bc6e29eed6c3
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
2013-12-24 11:11:10 +05:30
Linux Build Service Account f0a55e137e Merge "slim_msm: Add support for external MDM restart" 2013-11-21 23:15:31 -08:00
Naveen Kaje 76c6b0e127 slim_msm: Add support for external MDM restart
If external MDM restarts when MDM slimbus channels are active, it
is possible that the MDM framer was clocking the bus, and ADSP was
not active. Make sure apps wakes up ADSP and checks the framer status
so that slimbus is clocked by ADSP instead of MDM, and communication
over slimbus is restored.

CRs-Fixed: 539637
Change-Id: I931ec418687b590934bac133979c0c7d608f1266
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
2013-11-21 09:31:57 -07:00
Linux Build Service Account de612b6d32 Merge "Slimbus: Correct the conditional check during channel removal" 2013-11-19 22:05:32 -08:00
Kiran Gunda 90789f1e00 Slimbus: Correct the conditional check during channel removal
Use actual channel number to check if the channel to be
removed is present in the define_chan list before removing
it, instead of using the internal channel number used by
the frame work.

CRs-Fixed: 555260
Change-Id: I4c9521f7d228ca43c155fedf2c9ba5b8f86e2d3a
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2013-11-19 15:26:14 +05:30
Linux Build Service Account a5e6d430a7 Merge "slim_ngd: Add NULL pointer check apart from error check" 2013-10-28 09:02:43 -07:00
Sagar Dharia 7700a04250 slimbus: Manage channel slots only if framework manages bandwidth
If slimbus controller overrides bandwidth management, channel slots
should not be managed since controller is expected to do that.
Slimbus controller will go into idle mode due to this change when
channel setup/teardown is done. Make sure controller can transition
states correctly in runtime-pm suspend, and system-suspend case.

Change-Id: Id41aed822e3c98af8c1fe7db3a3527a1206739be
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-10-24 12:40:18 -06:00
Kiran Gunda 6599f780c1 slim_ngd: Add NULL pointer check apart from error check
Check against NULL pointer after allocating
the memory for msm_slim_ctrl structure pointer
dynamically to avoid unexpected crashes.

Earlier this pointer is checked only for error
codes. In this patch NULL pointer check is also
added.

CRs-Fixed: 562417
Change-Id: I5cd731144f88b89ee412d19f110b3df6426186f7
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2013-10-22 15:47:25 +05:30
Karthikeyan Ramasubramanian 188045167b msm: qmi: Match service version and instance during lookup
The remote subsystems construct instance_id from the version and service-
registered instance information. The version field is used to identify the
compatibility between client and service. The instance field is used to
uniquely identify a service from multiple instances of the same service_id
and version.

Currently the kernel QMI client interface matches only the instance during
the service lookup. Update the kernel QMI client interface to construct
instance_id from the version and instance information during lookup.

Change-Id: I2a4124ca8179d175d47c9468e907568a74281901
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-10-01 11:36:07 -06:00
Sagar Dharia 7906425082 slim_msm: Rectify physical address type
Make sure physical address type is of correct type as per LPAE
specifications

Change-Id: I9ec7a846e0fc14efd3627d141bb2228c8e56b2cc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-18 23:15:39 -07:00
Sagar Dharia 3083c46358 slim_ngd: Handle runtime-pm resume error gracefully
Runtime-pm resume for satellite driver may fail if ADSP is going
through subsystem-restart. Handle that error, and set runtime-pm's
status to suspended if resume fails. Resume typically fails due to
failure to wake slimbus from pause_clock. Make sure another wakeup
can be tried later when ADSP comes back up

Change-Id: Ie9b798f5506de89a37491dbc3798acaa24b98808
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:20:39 -07:00
Sagar Dharia c56b8ee8a8 slim_ngd: Make sure transaction is not dereferenced after it's freed
Every read transaction over slimbus is a set of one transmit and one
receive. Receive part frees meta-data for the read transaction since
it is no longer needed, and the transaction-ID can be reused.
Make sure that the transmit function doesn't try to dereference the
transaction meta-data after possibly receiving a response.

CRs-fixed: 515802
Change-Id: Id736ad368d4944a6aabc89f4ff295d664bc5efa0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:18:54 -07:00
Sagar Dharia 2364ccc170 slimbus: Add support for report-absent and device-down notification
device_down callback will be called when the device sends
report-absent message per slimbus specification, or if the device
cannot be reached due to some other reason (e.g. bus going down).
device_up will be called when the device sends reports present again.

Change-Id: Ie48c2e3891b55cb1ec9c675a32cdb0a568fdcc18
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:18:28 -07:00
Sagar Dharia d4f19232b0 slim_msm: Get platform-specific information from platform-data
Number of pipes available to application processor for data channels,
and product-code field of enumeration address needed for setting
these pipes can be different for different platforms.
Store this platform-specific information in platform-data, and get
it from Device-Tree if applicable.

Change-Id: I9a0ee0f34231ce33e08bbc6dc6d0ed51a3aca9e0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:06:55 -07:00
Sagar Dharia 43c2d0f718 slimbus: Fix port allocation and deallocation for manager's ports
Since Manager's ports don't have any direction when allocated, make
sure the direction is not checked when connect-port is called on a
manager port. Ensure that controller's port resourced are freed-up
when dealloc_mgrports is called.

Change-Id: I588408276cbee020623666b08433b57475cf47cc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:03:59 -07:00
Sagar Dharia 9d41f291bb slim_msm: Optimize slimbus data port's connection with BAM pipe
Slimbus data port on apps side can be connected in any diretion (as
source, or as destination). BAM pipe connected to that port should
only be disconnected/reconnected if this port direction changes.
This helps with reducing calls to connect/disconnect BAM pipes.
Allocate descriptors to avoid getting descriptor-space from the
common pool and free them only when the port is deallocated.

Change-Id: Ie31acdb9e4c4bba12f1cc70d0c9ad7bf471b3056
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:03:58 -07:00
Sagar Dharia cd4bc8def9 slim_msm: Signal client's completion for per transfer notification
Slimbus ports are connected to BAM pipes and ports inform the pipe
when descriptor's data transfer is done. Clients queue a completion
per descrptor when that descriptor is processed. This completion will
get overwritten if client queues multiple descriptors. Use
per-transfer user-data as client's completion to avoid this problem.
This also reduces controller-driver involvement in data transfer.

Change-Id: I528fa0c2358b1c172db6e65c5d23b174b2ce367b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:03:57 -07:00
Sagar Dharia a46de58e5d slim_msm: Report flow-error and mask apps slimbus port interrupts
Apps side slimbus ports may overflow/underflow if BAM pipes connected
to those ports don't have descriptors scheduled.
Report such errors and mask the port interrupts until BAM pipes have
descriptors scheduled to avoid interrupts firing multiple times.

Change-Id: I4a2bf716ad0a9ee4f71c4ee36b84826b9d90e3b8
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 17:03:57 -07:00
Sagar Dharia e383c0062d slim_msm: Support TX message queues
TX message queues are setup using BAM descriptors and event to
notify when the descriptor is done. This type of access ensures
lesser interrupts for slimbus controller, and offloads CPU from
copying message buffer into registers.
At this time, TX message queues are enabled on non-ported generic
device per HW recommendation.

Change-Id: I26423ef4d9fb3d54594d64555417f9a0c1dac37d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 16:50:13 -07:00
Sagar Dharia d679294301 slim_ngd: Support reserving message bandwidth for clients
Message bandwidth can be reserved by clients to do message-intensive
transactions over Slimbus. While slimbus framework supports that,
NGD driver was missing corresponding code to send this request to
master driver on ADSP. This patch adds that support.

Change-Id: If6a340746816658ac0aa1b4bd7c2270205eb6d4a
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 16:30:54 -07:00
Sagar Dharia a15741c342 slim_msm: Retry capability message in case HW NACKs it.
HW may NACK initial capability message if it was in process of
acquiring sync. Capability message is used to setup communication
between master and satellite and should not be lost due to NACKs.
Retry this message a few times before deeming master as unreachable.

CRs-fixed: 471340
Change-Id: Ifa805f299dcefc4ecc09db784dc236be28950747
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 16:23:12 -07:00
Sagar Dharia 8cc26030ee slim_msm: Do not disconnect BAM pipe if ADSP HW goes down
BAM pipe HW resources (e.g. RX message queue) are in ADSP.
When ADSP HW is reset, these resources won't be clocked and won't be
accessible. sps_disconnect programs such HW resources.
Make sure the HW resources are not touched in event of ADSP HW reset

Change-Id: Id336cc258e2e3466e5a0be65cbff662f9d611c6e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 16:19:24 -07:00
Sagar Dharia 727626b5dd slimbus: Handle channel control correctly if controller manages BW
If bandwidth allocation is managed by controller (and not framework),
channel control commands from all clients should be sent to the
controller.

Change-Id: Ibdd27c35a48818efdd55a0a84c52fbb9671cdb77
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 16:08:45 -07:00
Kiran Gunda ae8ed66b2a slim_msm: Reading the smaller length messages properly
If the smaller length messages(<= 4 Bytes) like REPORT_ABSENT
are received over slimbus, the master driver is reading the
excessive length than required. Due to that the next messages
over slimbus are getting corrupted. This patch fixes this issue
and also handles the REPORT_ABSENT message sent by the third party
slimbus client devices.

CRs-Fixed: 431529
Change-Id: I7b3c07a94603482a6a9a7645ade70228144703bc
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2013-09-04 16:05:06 -07:00
Sagar Dharia b4e076fa32 slimbus: Add slimbus device driver unregistration function
slim_driver_unregister is added to reverse effects of
slim_driver_register. That way a slimbus device driver can be
registered when driver module is loaded, and unregistered when
the driver module is unloaded.

CRs-Fixed: 441540
Change-Id: Iae64f84c99d5027c9b55c3fde5fe71c6a550354e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:53:26 -07:00
Sagar Dharia 65c2ebc1bc slim_ngd: Rely on pm_runtime resume to put device in active state
Since we use auto-suspend feature of pm_runtime (to avoid thrashing
between low-power and active state of device), it's possible that
device was not put in low power mode by pm_runtime suspend. System
suspend puts the device in low power mode in this case. However, if
pm_runtime's status is set to suspended for the device, we can safely
change system-resume to no-op. Next pm_runtime active request will
then put the device in active state.
If runtime_pm is not supported, then make sure the device becomes
active in first transaction after system-suspend, instead of
system-resume.

Change-Id: I595040572dba7a7a65ba1148803fe6138f0937e3
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:53:19 -07:00
Sagar Dharia 30a02fff17 slim_ngd: Handle possibility of ADSP idle power collapse
When slimbus on apps removes its QMI vote for slimbus on ADSP, it's
possible that ADSP may decide to do idle power collapse. During this,
slimbus HW and corresponding BAM HW will get reset.
While removing active vote from ADSP, BAM pipe for slimbus RX is
disconnected, so that it is not affected when the BAM HW on ADSP is
reset.
After sending QMI active vote to ADSP, driver checks HW state to
determine if the ADSP HW indeed was reset. If it was not reset, BAM
pipe is reconnected.
If it's deemed that the ADSP HW was reset, slimbus HW portion is
reprogrammed, communication with slimbus driver on ADSP is established
again using capability message. BAM pipe is reconnected at this time,
and slimbus is ready for use.

Change-Id: Ie0ad838e3790650f4f240fa7b78a2b8296316efd
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:50:19 -07:00
Sagar Dharia 8fc83c694f slim_ngd: Re-initialize Slimbus NGD controller when ADSP restarts
Slimbus manager HW is controlled from ADSP. When ADSP restarts, NGD
controller goes in inactive state, and BAM pipes are disconnected.
When ADSP comes up later, controller is re-initialized and all slaves
on this controller are re-assigned logical address. BAM pipes are
reconnected as well. These steps are done after ADSP slimbus HW
informs NGD controller that it has come up.

CRs-Fixed: 419384
Change-Id: Ic1ba1fe14adeb9661de3735a0afc8e4b05fa4606
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:48:53 -07:00
Kenneth Heitke 4035119fc5 slim_msm: Fix QMI message lengths
The QMI request and response descriptors have a maximum message length
field that is incorrectly set.  The length needs to be specified as the
expected maximum length of the QMI messages once it is encoded and not
the length of the request or response structure.  Specifying the
incorrect length could result in data corruption.

CRs-Fixed: 438809
Change-Id: I14aff6f823f0ba0685ee5678b99746364a8021db
Signed-off-by: Kenneth Heitke <kheitke@codeaurora.org>
2013-09-04 15:48:10 -07:00
Sagar Dharia d87960ed2f slimbus: Refine scope of controller and scheduler mutex locks
Controller mutex scope is restricted to controller specific data
structures, such as addressing table, transaction table.
Scheduler lock is used to protect scheduling data structures (such
as channels, and bandwidth).
This way, controller mutex is not needed when expensive
reconfiguration sequence(used for channel scheduling, bandwidth
management) is in progress. Transactions over messaging channel (such
as element read/writes, logical address assignment) can happen in
parallel and don't have to block on reconfiguration sequence which
only affects data channels.

CRs-Fixed: 426945
Change-Id: I2ca20aa76901ee19dba62874c86c2108fac9fa02
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:41:25 -07:00
Sagar Dharia ba02f4a322 slim_ngd: Incorporate power management for NGD slimbus controller
Slimbus QMI init/exit APIs are used to enable slimbus controller's
communication with counterpart on ADSP.
Slimbus QMI power request APIs are used to convey satellite(NGD)
slimbus controller's power requests.

Change-Id: I047627ef0641e942f5638ddba35b5b46ccb7fcb4
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:35:37 -07:00
Kenneth Heitke aabea1b769 slim_msm: Add QMI messaging support
QMI messaging is used to communicate with the LPASS SLIMbus driver to
handle master/slave configuration and voting for power control.

Change-Id: I5e6d8f1a405a99afe6e1d81495dd46d7ae983aa5
Signed-off-by: Kenneth Heitke <kheitke@codeaurora.org>
2013-09-04 15:35:19 -07:00
Sagar Dharia c58f9d4827 slim_ngd: Rectify define, removal messages per protocol
Populate required bits only as client handle while sending
channel define, removal messages to the master driver.
Previously, complete logical address was set as client handle
which would corrupt other fields in that byte if logical
address had non-zero MSBs. This patch fixes that problem.

Change-Id: I96e8a7917c1fe68e1c86f6837c0b9f8ee187ca3d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:34:48 -07:00
Sagar Dharia 1d75479f73 slimbus: Populate slimbus device's logical address during assignment
Slimbus device is assigned logical address when it reports present.
Make sure to populate the device's logical address (laddr) during
this assignment.

CRs-Fixed: 412148
Change-Id: Icb8d74f6ea71aff8f6cb30523002f7839e2cb028
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:34:11 -07:00
Sagar Dharia 3fd6449dd0 slimbus: Specify number of channels for the group in group handle
Use group handle instead of next element in channel's data structure
to identify how many channels were specified by a client in the group.
That way clients can specify different number of channels for shared
channels, and work with their own client-handle. Note that sequence of
channel still matters (so 2 clients sharing a channel should not
specify channels in different order, otherwise scheduling of the
channels will not be in the correct order)

CRs-Fixed: 415109
Change-Id: Idd636a500ee6449b16648a234b9e76fad21f2fcc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:34:11 -07:00
Stephen Boyd 7a824c7614 slim_msm: Fix unsafe locking in msm_sat_enqueue()
msm_sat_enqueue() calls spin_lock() and msm_sat_dequeue() calls
spin_lock_irqsave(). This leads to lockdep warnings about the
same lock being taken in interrupts on and interrupts off context
which can lead to a potential deadlock.

=================================
[ INFO: inconsistent lock state ]
3.4.0+ #382 Tainted: G        W
---------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
kworker/u:2/94 [HC1[1]:SC0[0]:HE0:SE1] takes:
 (&(&sat->lock)->rlock){?.+...}, at: [<c0348b80>] msm_sat_enqueue+0x20/0xb0
{HARDIRQ-ON-W} state was registered at:
  [<c00bd290>] __lock_acquire+0x664/0x8d8
  [<c00bd690>] lock_acquire+0x18c/0x1e8
  [<c06989a4>] _raw_spin_lock+0x38/0x48
  [<c0348b80>] msm_sat_enqueue+0x20/0xb0
  [<c0349338>] msm_slim_rxwq+0x278/0x42c
  [<c0349580>] msm_slim_rx_msgq_thread+0x94/0x1f8
  [<c008e480>] kthread+0x90/0xa0
  [<c000f438>] kernel_thread_exit+0x0/0x8
irq event stamp: 24219
hardirqs last  enabled at (24218): [<c0699188>] _raw_spin_unlock_irqrestore+0x3c/0x68
hardirqs last disabled at (24219): [<c06993f4>] __irq_svc+0x34/0x78
softirqs last  enabled at (24129): [<c00738a8>] irq_exit+0x54/0xa8
softirqs last disabled at (24108): [<c00738a8>] irq_exit+0x54/0xa8

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&(&sat->lock)->rlock);
  <Interrupt>
    lock(&(&sat->lock)->rlock);

 *** DEADLOCK ***

3 locks held by kworker/u:2/94:
 #0:  ((sat->satcl.name)){.+.+.+}, at: [<c0087124>] process_one_work+0x1e8/0x648
 #1:  ((&sat->wd)){+.+.+.}, at: [<c0087124>] process_one_work+0x1e8/0x648
 #2:  (&dev->tx_lock){+.+...}, at: [<c0349cac>] msm_xfer_msg+0xb4/0x51c

stack backtrace:
[<c00151b0>] (unwind_backtrace+0x0/0x120) from [<c00b9d48>] (print_usage_bug+0x258/0x2c0)
[<c00b9d48>] (print_usage_bug+0x258/0x2c0) from [<c00ba12c>] (mark_lock+0x37c/0x68c)
[<c00ba12c>] (mark_lock+0x37c/0x68c) from [<c00bd20c>] (__lock_acquire+0x5e0/0x8d8)
[<c00bd20c>] (__lock_acquire+0x5e0/0x8d8) from [<c00bd690>] (lock_acquire+0x18c/0x1e8)
[<c00bd690>] (lock_acquire+0x18c/0x1e8) from [<c06989a4>] (_raw_spin_lock+0x38/0x48)
[<c06989a4>] (_raw_spin_lock+0x38/0x48) from [<c0348b80>] (msm_sat_enqueue+0x20/0xb0)
[<c0348b80>] (msm_sat_enqueue+0x20/0xb0) from [<c0348dc8>] (msm_slim_interrupt+0x1b8/0x4b0)
[<c0348dc8>] (msm_slim_interrupt+0x1b8/0x4b0) from [<c00d2ccc>] (handle_irq_event_percpu+0x118/0x3a4)
[<c00d2ccc>] (handle_irq_event_percpu+0x118/0x3a4) from [<c00d2f94>] (handle_irq_event+0x3c/0x5c)
[<c00d2f94>] (handle_irq_event+0x3c/0x5c) from [<c00d5c4c>] (handle_fasteoi_irq+0xd0/0x11c)
[<c00d5c4c>] (handle_fasteoi_irq+0xd0/0x11c) from [<c00d2ae4>] (generic_handle_irq+0x24/0x2c)
[<c00d2ae4>] (generic_handle_irq+0x24/0x2c) from [<c000f370>] (handle_IRQ+0x7c/0xc0)
[<c000f370>] (handle_IRQ+0x7c/0xc0) from [<c0008774>] (gic_handle_irq+0x6c/0xc4)
[<c0008774>] (gic_handle_irq+0x6c/0xc4) from [<c0699404>] (__irq_svc+0x44/0x78)
Exception stack(0xee061cd8 to 0xee061d20)
1cc0:                                                       00000001 eebda7c8
1ce0: 00000000 eebda400 20000013 c12b5430 ec96c168 c12b542c c12b5430 00000001
1d00: 20000013 ee061e14 3eb13eb1 ee061d20 c00ba520 c069918c 20000013 ffffffff
[<c0699404>] (__irq_svc+0x44/0x78) from [<c069918c>] (_raw_spin_unlock_irqrestore+0x40/0x68)
[<c069918c>] (_raw_spin_unlock_irqrestore+0x40/0x68) from [<c0279f2c>] (__debug_object_init+0x30c/0x344)
[<c0279f2c>] (__debug_object_init+0x30c/0x344) from [<c007b068>] (init_timer_on_stack_key+0x18/0x30)
[<c007b068>] (init_timer_on_stack_key+0x18/0x30) from [<c0695248>] (schedule_timeout+0x8c/0x4c0)
[<c0695248>] (schedule_timeout+0x8c/0x4c0) from [<c069768c>] (wait_for_common+0xec/0x164)
[<c069768c>] (wait_for_common+0xec/0x164) from [<c0349fc4>] (msm_xfer_msg+0x3cc/0x51c)
[<c0349fc4>] (msm_xfer_msg+0x3cc/0x51c) from [<c034a358>] (slim_sat_rxprocess+0x244/0x664)
[<c034a358>] (slim_sat_rxprocess+0x244/0x664) from [<c0087290>] (process_one_work+0x354/0x648)
[<c0087290>] (process_one_work+0x354/0x648) from [<c0089754>] (worker_thread+0x1a8/0x2a8)
[<c0089754>] (worker_thread+0x1a8/0x2a8) from [<c008e480>] (kthread+0x90/0xa0)
[<c008e480>] (kthread+0x90/0xa0) from [<c000f438>] (kernel_thread_exit+0x0/0x8)

Make this lock irqsafe as well so that this potential bug doesn't
occur.

Change-Id: Icbef6d1d749ee6ee81b079e19e57f22c38f00c68
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 15:32:47 -07:00
Sagar Dharia ec19023513 slim_ngd: Slimbus satellite controller driver
NGD (non-ported generic device, also known as satellite device) is
used to implement light-weight slimbus controller driver.
This driver is responsible for:
1. Communicating with codec (or any slimbus slave registered from
application processor side) directly using slimbus HW messaging
interface.
2. Communicating with the manager device (controller by master driver)
on LPASS to do bandwidth and data channel management. NGD takes these
requests from slimbus slave on application processor side and passes
them to the manager device using slimbus messaging itself.
SPS BAM is used for receiving messages to offload CPU, and to enable
receiving multiple messages before driver can process them.
Runtime-pm is used for power management. Controller is in active
power state when messaging and/or data-channels are active from
application processor side.

Change-Id: Iff53c0ca9b768a3dac3bccb5004fd2f96070af50
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:30:56 -07:00
Kiran Gunda 3c92fe1486 slimbus: Avoid same channel definition, removal in same sequence
Do not add the channel removal request to the remove list
when the client sends it right after the channel definition
without sending reconfigure_now request. Also remove the
channel define request from define list. This avoids
channel definition count being inconsistent, which may
lead to slimbus driver going into wrong state.

CRs-fixed: 409161
Change-Id: Iec4dd51d98416b7d769176bb1ef6cd2f5bacfa12
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2013-09-04 15:29:44 -07:00
Sagar Dharia d6d182a528 slim_msm: Allow remote management of pipes for MSM slimbus BAM
Slimbus BAM may not be locally owned and/or controlled. In that case,
a remote processor (e.g. LPASS) configures BAM and sets security
configurations for the BAM pipes.
Allow driver to choose whether BAM is locally or remotely managed.

Change-Id: I10741cb394428f525c1633e707e88e699aa63cf5
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:29:23 -07:00
Sagar Dharia d7ada53d7a slimbus: Allow controller to specify logical addresses
It is possible that the controller has fixed addressing table for
enumeration devices. In that case, logical address will be set by
controller and not by framework. get_laddr allows a controller to
assign logical address. Make sure framework allows such addressing
by not assuming that index into address table will represent logical
address.

Change-Id: I0e3873980c2ee2ece01237f450ecefff4e99aedc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:20:29 -07:00
Sagar Dharia ca1c8dba3d slimbus: Allow controller to override default scheduling algorithm
Framework provides a slimbus scheduling algorithm and controller may
choose to override it. e.g. controller will override this if it
supports fixed set of channels at a fixed clock gear.
In that case, it is controller's responsibility to act on client
requests and update channel scheduling, subframe coding information.

Change-Id: I31fe72ef85f931900467b737652da7516d173dc5
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:20:13 -07:00
Sagar Dharia 4790085b20 slim_msm: Move out common functionality from MSM controller driver
Starting with new platforms, MSM slimbus controller can operate in
master mode or satellite mode. (Not in both modes for the same build)
Move out common functional code from the controller driver that can
be reused by satellite mode and master mode.

Change-Id: Idbc3fa93067f67f645981071ff6ad457c284576f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:19:08 -07:00
Sagar Dharia 6d687a59ed slim_msm: Satellite channel should not be deallocated more than once
It is possible that satellite channel deallocation is requested more
than once. (e.g. if the satellite times out waiting for response from
previous removal, then it will request removal again during
channel deallocation from its side).
Make sure that does not result in deallocating the channel more than
once.

CRs-fixed: 395926
Change-Id: I002635849bcaa7309de1fbddf1127c456bca6f20
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:17:22 -07:00
Sagar Dharia 378d4eda59 slim_msm: Retry initial sequence messages
Initial sequence messages (logical address assignment, and master
capability message) are very important messages to enable the
devices. It is possible that the device may NACK these messages
initially if it is in process of acquiring sync.
If these type of messages fail, retry a few times before actually
deeming the device unresponsive. Log the registers in case of NACKs
to better analyze the reason.

CRs-fixed: 396230
Change-Id: If0824f7ba962dbce068756e810a7bad8342373ec
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:16:50 -07:00
Sagar Dharia 5cb587b479 slimbus: Clear slimbus read transaction if synchronous read fails
Failed read transaction is removed from the table of active
transactions if the transaction fails

CRs-fixed: 396237
Change-Id: Idda4d8b5fa2cdfde8a049cc4af4d92e9e57f678a
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:16:15 -07:00
Sagar Dharia ed25c6ef69 slimbus: Decrement channel reference during reconfigure now
Slimbus clients can specify multiple add/remove channel requests
through control_ch API, followed by reconfiguration request (also
known as "commit request"). Clients may rely on the reconfiguration
request to actuate the channel activation/removal and not the
control-channel API.
So the channel reference should be decremented during reconfiguration
request, and not control_ch API.

CRs-Fixed: 389518
Change-Id: Id6ff57c6a4cad878e35004937fb08daf3b9afe7b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:14:32 -07:00
Sagar Dharia ef1f37a5dd slim_msm: Keep track of satellite reconfiguring a channel
With mutiple clients able to use the same channel, it is not correct
assumption that a channel was active due to satellite client's
reconfiguration only. So during sub-system restart of a satellite,
rely on satellite-reconfiguration vote for a channel instead of
channel status to remove channels that were setup by the satellite
before sub-system restart.

CRs-Fixed: 389514
Change-Id: I825381f15cb55396fece5b390d395c7f0a7580ff
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:14:21 -07:00
Joonwoo Park bc0e3404b8 slimbus: Defer probing slimbus until ADSP is ready
If slimbus master resides in ADSP, slimbus driver has to wait until it's
up and running.  Do probe deferral until ADSP is ready.

Change-Id: I31ba4e270331c3b5250758f604d0d0cde9537427
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2013-09-04 15:13:24 -07:00
Sagar Dharia 5cf36039d9 slimbus: Add slave devices to controller after controller HW is up
Register controller is only responsible for making sure slimbus
controller structure is initialized with framework. This should not
assume that slimbus controller's hardware programming is done (e.g. if
slave's probe is trying to get logical address, then that will fail if
controller is registered, but slimbus hardware programming is not
complete, since probe is called synchrounously when device is added.
So this API separates register controller from slave device
registration. It should be called by controller when its hardware
programming is complete.

Change-Id: I52fa5567fc072951c89f99c70507aa3b1e4e22af
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:13:22 -07:00
Sagar Dharia 2bf7b35388 slim: msm: Control interface clock if it's specified
Some platforms (e.g. 8974) have interface clock that is not ON by
default. Turn it ON during probe, and control it like core clock
if it needs to be controlled.

Change-Id: Ifffb4b7ea9afb5f3f1208b4b2b6638594ffca541
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:11:13 -07:00
Sagar Dharia 5213d06dd9 slimbus: Callback to indicate device report present message
Clients can register a callback (just like probe) and that callback
will be called when the client's device reports present per slimbus
specification. The callback is hosted in a workqueue to avoid doing
it in same context from which probe is called (and/or in the context
receiving report present message). Callback is called when the device
reports present for the first time after the bus is initialized.

Change-Id: I8396b87121950f99a09764d497bf2d4b1535565d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:10:41 -07:00
Sagar Dharia ae0100b285 slimbus: Fix channel concurrent usage during reconfiguration sequence
Reconfiguration sequence can lead to changes in channel segment
distribution and state. Since multiple clients can use 1 channel,
make sure channels cannot be manipulated when reconfiguration
sequence is in progress, and make sure that client doesn't send
reconfiguration sequence when no changes are pending to be sent
in the sequence from it.

CRs-Fixed: 383406
Change-Id: Ib5f0bc32f67f51f118fa417a2e580c8dc87ef0d0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:07:04 -07:00
Sagar Dharia f53a5d5093 slim:msm: Change to register access for RX path if required
MSM controller for slimbus usually uses a BAM pipe to receive control
data. However, some targets may not have a BAM pipe assinged for
receiving this data. In that case, RX data should be received using
direct register access instead.
Introduce a Device-Tree property to change this access.

Change-Id: I9bb1502f25e0e855937bc6fb4131f55348d04794
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:06:39 -07:00
Sagar Dharia 10ff35e796 slimbus: Export clock pause function
Previously this function was left-out to be exported by mistake.
Exporting the function helps any caller driver to be a module.

Change-Id: I2b9caca62821caea5ae92123689c6f8ddf2b207a
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2013-09-04 15:05:56 -07:00