aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/slimbus (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-09slimbus: qcom: add HAS_IOMEM dependencySrinivas Kandagatla1-0/+1
Below build failure was reported on UML, ERROR: "devm_ioremap_resource" [drivers/slimbus/slim-qcom-ctrl.ko] undefined! ERROR: "__ioread32_copy" [drivers/slimbus/slim-qcom-ctrl.ko] undefined! ERROR: "__iowrite32_copy" [drivers/slimbus/slim-qcom-ctrl.ko] undefined! ERROR: "devm_ioremap" [drivers/slimbus/slim-qcom-ctrl.ko] undefined! This patch fixes it by making qcom slimbus depend on HAS_IOMEM, as these are only defined when HAS_IOMEM is selected. Reported-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: qcom: Fix return value check in qcom_slim_probe()Wei Yongjun1-2/+2
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: Fix missing unlock on error in slim_msg_response()Wei Yongjun1-0/+1
Add the missing unlock before return from function slim_msg_response() in the error handling case. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: Use GFP_ATOMIC under spin lockWei Yongjun1-1/+1
A spin lock is taken here so we should use GFP_ATOMIC. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: make functions slim_ack_txn and slim_alloc_txbuf staticColin Ian King1-3/+4
The functions slim_ack_txn and slim_alloc_txbuf are local to the source and do not need to be in global scope, so make them static. Cleans up sparse warnings: symbol 'slim_ack_txn' was not declared. Should it be static? symbol 'slim_alloc_txbuf' was not declared. Should it be static? Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: fix retries comparison to correctly identify failed allocationColin Ian King1-1/+1
Currently the check for too many retries fails because retries is actually -1 when the retry loop terminates if no pbuf can be allocated because of the post decrement on retries. Fix this by not comparing retries with zero but instead check if it is negative. Detected by CoverityScan, CID#1463143 ("Logically dead code") and CID#1463144 ("Dereference after null check") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09slimbus: avoid null pointer dereference on msgColin Ian King1-2/+3
The pointer msg is checked to see if it is null at the start of the function and jumps to the error exit label reterr that then dereferences msg when it prints a dev_err error message. Avoid this potential null pointer dereference by only printing the error message if msg is not null. Detected by CoverityScan, CID#1463141 ("Dereference after null check") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-02slimbus: qcom-ctrl: use normal allocationArnd Bergmann1-8/+4
The previous patch addressed a warning but not the cause: drivers/slimbus/qcom-ctrl.c: In function 'qcom_slim_probe': drivers/slimbus/qcom-ctrl.c:584:9: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types] There are two things wrong here: - The naming is very confusing, we now have a member named 'phys' that doesn't refer to a phys_addr_t but a dma_addr_t. If we needed a dma address, it should be named 'dma' to avoid confusion, and to make it less likely that someone passes it into a function that expects a physical address. - The dma address is not used at all at this point. It may have been designed to support DMA in the future, but today it doesn't, so the only effect right now is to make transfers artificially slower by using uncached memory instead of cached memory for a temporary buffer. This removes the unused structure member and instead changes the code to call devm_kcalloc(), which matches the usage of the 'base' pointer as an array of temporary buffers. Fixes: db809859c8ce ("slimbus: qcom: fix incompatible pointer warning") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-31slimbus: qcom: fix incompatible pointer warningSrinivas Kandagatla1-1/+1
One of the pointer passed to dmam_alloc_coherent seems to be phys_addr_t * instead of dma_addr_t *. This address will be used by dma apis, so change this to proper type. Reported-by: kbuild test robot <fengguang.wu@intel.com> Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: qcom: Add runtime-pm support using clock-pauseSagar Dharia1-3/+98
Slimbus HW mandates that clock-pause sequence has to be executed before disabling relevant interface and core clocks. Runtime-PM's autosuspend feature is used here to enter/exit low power mode for Qualcomm's Slimbus controller. Autosuspend feature enables driver to avoid changing power-modes too frequently since entering clock-pause is an expensive sequence Signed-off-by: Sagar Dharia <sdharia@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: qcom: Add Qualcomm Slimbus controller driverSagar Dharia3-0/+665
This controller driver programs manager, interface, and framer devices for Qualcomm's slimbus HW block. Manager component currently implements logical address setting, and messaging interface. Interface device reports bus synchronization information, and framer device clocks the bus from the time it's woken up, until clock-pause is executed by the manager device. Signed-off-by: Sagar Dharia <sdharia@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: core: add common defines required for controllersSrinivas Kandagatla1-0/+33
This patch adds some common constant defines which are required for qcom slim controller driver. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: Add support for 'clock-pause' featureSagar Dharia5-2/+225
Per SLIMbus specification, a reconfiguration sequence known as 'clock pause' needs to be broadcast over the bus while entering low- power mode. Clock-pause is initiated by the controller driver. To exit clock-pause, controller typically wakes up the framer device. Since wakeup precedure is controller-specific, framework calls it via controller's function pointer to invoke it. Signed-off-by: Sagar Dharia <sdharia@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: Add messaging APIs to slimbus frameworkSagar Dharia3-1/+365
SLIMbus devices use value-element, and information elements to control device parameters (e.g. value element is used to represent gain for codec, information element is used to represent interrupt status for codec when codec interrupt fires). Messaging APIs are used to set/get these value and information elements. SLIMbus specification uses 8-bit "transaction IDs" for messages where a read-value is anticipated. Framework uses a table of pointers to store those TIDs and responds back to the caller in O(1). Caller can do synchronous and asynchronous reads/writes. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: core: add support to device tree helperSrinivas Kandagatla1-0/+50
This patch adds support to parse slim devices from device tree. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: core: Add slim controllers supportSagar Dharia2-0/+414
This patch adds support to slim controllers in the slim core, including some utility functions invoked by the controller and slim device drivers. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19slimbus: Add SLIMbus bus typeSagar Dharia3-0/+131
SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by MIPI (Mobile Industry Processor Interface) alliance. SLIMbus is a 2-wire implementation, which is used to communicate with peripheral components like audio-codec. SLIMbus uses Time-Division-Multiplexing to accommodate multiple data channels, and control channel. Control channel has messages to do device-enumeration, messages to send/receive control-data to/from SLIMbus devices, messages for port/channel management, and messages to do bandwidth allocation. The framework supports multiple instances of the bus (1 controller per bus), and multiple slave devices per controller. This patch adds support to basic silmbus core which includes support to SLIMbus type, slimbus device registeration and some basic data structures. Signed-off-by: Sagar Dharia <sdharia@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviwed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>