aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-01-09i2c: designware: prevent signals from aborting I2C transfersMika Westerberg
If a process receives signal while it is waiting for I2C transfer to complete, an error is returned to the caller and the transfer is aborted. This can cause the driver to fail subsequent transfers. Also according to commit d295a86eab2 (i2c: mv64xxx: work around signals causing I2C transactions to be aborted) I2C drivers aren't supposed to abort transactions on signals. To prevent this switch to use wait_for_completion_timeout() instead of wait_for_completion_interruptible_timeout() in the designware I2C driver. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Christian Ruppert <christian.ruppert@abilis.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit e42dba569fceca5d59a88571370785e9ce9775b8) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: imx: Let device core handle pinctrlFabio Estevam
Since commit ab78029 (drivers/pinctrl: grab default handles from device core), we can rely on device core for handling pinctrl. So remove devm_pinctrl_get_select_default() from the driver. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 76b1f723c4f54c2ab05307da3cc5c39e421b029b) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: stu300: do not request a specific clock nameLinus Walleij
We have used the default clock associated with the block for a long time, only heuristics in the clock system has made this work anyway. This needs to be done away with as we start probing this driver and its clocks exclusively from the device tree. Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> (cherry picked from commit 2165f836c8f7036491fae41e9bc327a3cdf2fea3) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: stu300: device tree supportLinus Walleij
This adds device tree support for the ST DDC I2C driver known as "stu300" in the kernel tree. Reviewed-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> (cherry picked from commit 8c58d891576c726bb8217842e955827ba8bb405a) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09of: remove #ifdef from linux/of_platform.hArnd Bergmann
A lot of code uses the functions from of_platform.h when built for devicetree-enabled platforms but can also be built without them. In order to avoid using #ifdef everywhere in drivers, this makes all the function declarations visible, which means we can use "if (IS_ENABLED(CONFIG_OF))" in driver code and get build coverage over the code but let the compiler drop the reference in the object code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 8a46f4f7f95f2bece108998a2e1b87b58f99d590) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09<linux/of_platform.h>: fix compilation warnings with DT disabledSergei Shtylyov
Fix the following compilation warnings (in Simon Horman's renesas.git repo): In file included from arch/arm/mach-shmobile/setup-r8a7779.c:24:0: include/linux/of_platform.h:107:13: warning: ‘struct of_device_id’ declared inside parameter list [enabled by default] include/linux/of_platform.h:107:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] include/linux/of_platform.h:107:13: warning: ‘struct device_node’ declared inside parameter list [enabled by default] <linux/of_platform.h> only #include's headers with definitions of the above mentioned structures if CONFIG_OF_DEVICE=y but uses them even if not. One solution is to move some #include's out of #ifdef CONFIG_OF_DEVICE and use incomplete declarations for the rest of the structures where the #ifdef move doesn't help... Reported-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com> (cherry picked from commit d450f445f9a654080a6be4094376c2192d9a1f36) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09of: remove CONFIG_OF_DEVICERob Herring
CONFIG_OF_DEVICE is always selected when CONFIG_OF is enabled, so remove it and simplify of_platform.h and of_device.h headers. This also fixes !OF compiles using of_platform_populate. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit ba166e900b502b74b9425881caa94f94891b0a1f) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: designware: add Intel BayTrail ACPI IDMika Westerberg
This is the same controller as on Intel Lynxpoint but the ACPI ID is different (8086F41). Add support for this. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 5a7e6bd809ca2f06bd669bd477ad3d6b48a3dd9f) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: designware: always clear interrupts before enabling themMika Westerberg
If the I2C bus is put to a low power state by an ACPI method it might pull the SDA line low (as its power is removed). Once the bus is put to full power state again, the SDA line is pulled back to high. This transition looks like a STOP condition from the controller point-of-view which sets STOP detected bit in its status register causing the driver to fail subsequent transfers. Fix this by always clearing all interrupts before we start a transfer. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org (cherry picked from commit 2a2d95e9d6d29e726cc294b65391917ed2e32bf4) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: designware: fix RX FIFO overrunJosef Ahmad
i2c_dw_xfer_msg() pushes a number of bytes to transmit/receive to/from the bus into the TX FIFO. For master-rx transactions, the maximum amount of data that can be received is calculated depending solely on TX and RX FIFO load. This is racy - TX FIFO may contain master-rx data yet to be processed, which will eventually land into the RX FIFO. This data is not taken into account and the function may request more data than the controller is actually capable of storing. This patch ensures the driver takes into account the outstanding master-rx data in TX FIFO to prevent RX FIFO overrun. Signed-off-by: Josef Ahmad <josef.ahmad@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org (cherry picked from commit e6f34cea56f5b95498070eaa9f4aa3ba4a9e4f62) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: designware-pci: drop superfluous {get|put}_deviceWolfram Sang
Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> (cherry picked from commit aaedeb6f198a44bdfa98a012cc3c07a48e126b16) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: designware-plat: drop superfluous {get|put}_deviceWolfram Sang
Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> (cherry picked from commit be7fbe6a8b4dd5b75db5a600bcd8de87f4761d85) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: switch to use runtime PM autosuspendMika Westerberg
Using autosuspend helps to reduce the resume latency in situations where another I2C message is going to be started soon. For example with HID over I2C touch panels we get several messages in a short period of time while the touch panel is in use. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 43452335224bc0cbd605c6aee82b5c9c33e94cc6) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: use usleep_range() in the busy-loopMika Westerberg
This is not an atomic context so there is no need to use mdelay() but instead use usleep_range(). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 1451b91ffef5a2ac7df28a6d8fc270ccbee5d8ac) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: enable/disable the controller properlyMika Westerberg
The correct way to disable or enable the controller is to wait until the DW_IC_ENABLE_STATUS register bit matches the bit we program into DW_IC_ENABLE register. This procedure is described in the DesignWare I2C databook. By doing this we can be sure that the controller is in correct state once the function returns. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 3ca4ed8715a6677ce2cdd7aa471685e653b5114d) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: use dynamic adapter numbering on LynxpointMika Westerberg
It is not good idea to mix static and dynamic I2C adapter numbering. In this particular case on Lynxpoint we had graphics I2C adapter which took the first numbers preventing the designware I2C driver from using the adapter numbers it preferred. Since Lynxpoint support was just introduced and there is no hardware available outside Intel we can fix this by switching to use dynamic adapter numbering instead of static. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit efe7d640ef486c4c0c305641dbcacc6918542b76) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware-pci: use managed functions pcim_* and devm_*Andy Shevchenko
This makes the error handling much more simpler than open-coding everything and in addition makes the probe function smaller an tidier. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 76cf3fc844a46b5cdb94da98bffcbd45d4c355b8) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware-pci: use dev_err() instead of printk()Andy Shevchenko
With dev_err() we can get the device instance printed as well and is pretty much standard to use dev_* macros in the drivers anyway. In addition correct the indentation of probe() arguments. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit ca0c1ff528a332e6f83d4566c2c8eb05b108c83c) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: move to managed functions (devm_*)Andy Shevchenko
This makes the error handling much more simpler than open-coding everything and in addition makes the probe function smaller and tidier. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 1cb715ca46946b1ad32735d11830a84a433f2b1b) Conflicts: drivers/i2c/busses/i2c-designware-platdrv.c Change devm_ioremap_resource() to devm_request_and_ioremap() due to devm_ioremap_resource() only available after v3.9. Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09ACPI / I2C: Use parent's ACPI_HANDLE() in acpi_i2c_register_devices()Rafael J. Wysocki
The ACPI handle of struct i2c_adapter's dev member should not be set, because this causes that struct i2c_adapter to be associated with the ACPI device node corresponding to its parent as the second "physical_device", which is incorrect (this happens during the registration of struct i2c_adapter). Consequently, acpi_i2c_register_devices() should use the ACPI handle of the parent of the struct i2c_adapter it is called for rather than the struct i2c_adapter's ACPI handle (which should be NULL). Make that happen and modify the i2c-designware-platdrv driver, which currently is the only driver for ACPI-enumerated I2C controller chips, not to set the ACPI handle for the struct i2c_adapter it creates. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Aaron Lu <aaron.lu@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit b34bb1ee71158d5b0f9028fb98afd026202bcfe9) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: gpio: Add support for deferred probingJean Delvare
GPIOs may not be available immediately when i2c-gpio looks for them. Implement support for deferred probing so that probing can be attempted again later when GPIO pins are finally available. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 1b295c839b3931244f37cb52265017b298518f69) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: tegra: assume CONFIG_OF, remove platform dataStephen Warren
Tegra only supports, and always enables, device tree. Remove all ifdefs and runtime checks for DT support from the driver. Platform data is therefore no longer required. Delete the header that defines it. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 49a64ac555f1dabd2b94325553187d0db6ecac16) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: Add bus recovery infrastructureViresh Kumar
Add i2c bus recovery infrastructure to i2c adapters as specified in the i2c protocol Rev. 03 section 3.1.16 titled "Bus clear". http://www.nxp.com/documents/user_manual/UM10204.pdf Sometimes during operation i2c bus hangs and we need to give dummy clocks to slave device to start the transfer again. Now we may have capability in the bus controller to generate these clocks or platform may have gpio pins which can be toggled to generate dummy clocks. This patch supports both. This patch also adds in generic bus recovery routines gpio or scl line based which can be used by bus controller. In addition controller driver may provide its own version of the bus recovery routine. This doesn't support multi-master recovery for now. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> [wsa: changed gpio type to int and minor reformatting] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 5f9296ba21b3c395e53dd84e7ff9578f97f24295) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: Remove unneeded xxx_set_drvdata(..., NULL) callsDoug Anderson
There is simply no reason to be manually setting the private driver data to NULL in the remove/fail to probe cases. This is just extra cruft code that can be removed. A few notes: * Nothing relies on drvdata being set to NULL. * The __device_release_driver() function eventually calls dev_set_drvdata(dev, NULL) anyway, so there's no need to do it twice. * I verified that there were no cases where xxx_get_drvdata() was being called in these drivers and checking for / relying on the NULL return value. This could be cleaned up kernel-wide but for now just take the baby step and remove from the i2c subsystem. Reported-by: Wolfram Sang <wsa@the-dreams.de> Reported-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Jean Delvare <khali@linux-fr.org> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de> (cherry picked from commit 55827f4aa6442ddd1d6a4e1e32f2f457eb113c22) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c: nomadik: adopt pinctrl supportPatrice Chotard
Amend the I2C nomadik pin controller to optionally take a pin control handle and set the state of the pins to: - "default" on boot, resume and before performing an i2c transfer - "idle" after initial default, after resume default, and after each i2c xfer - "sleep" on suspend() This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle, and for runtime cases inbetween I2C transfers. Signed-off-by: Patrice Chotard <patrice.chotard@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> [wsa: fixed braces on one else-branch] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> (cherry picked from commit 24e9e157d5197e469a414d0f52ce04e8b539a715) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: add support for Intel LynxpointMika Westerberg
Intel Lynxpoint has two I2C controllers. These controllers are enumerated from ACPI namespace with IDs INT33C2 and INT33C3. Add support for these to the I2C DesignWare platform driver. This is based on the work of Dirk Brandewie. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> (cherry picked from commit b61b14154b19e1ef1da9c1e283f0cf93470e0c70) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: add minimal support for runtime PMMika Westerberg
In order to save power the device should be put to low power states whenever it is not being used. We implement this by enabling minimal runtime PM support. There isn't much to do for the device itself as it is disabled once the last transfer is completed but subsystem/domain runtime PM hooks can save more power by power gating the device etc. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> (cherry picked from commit 7272194ed391f9db8bb320c50d715e7e6bba8ff3) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09i2c-designware: always set the STOP bit after last byteMika Westerberg
If IC_EMPTYFIFO_HOLD_MASTER_EN is set to one, the DesignWare I2C controller doesn't generate STOP on the bus when the FIFO is empty. This violates the rules of Linux I2C stack as it requires that the STOP is issued once the i2c_transfer() is finished. However, there is no way to detect this from the hardware registers, so we must make sure that the STOP bit is always set once the last byte of the last message is transferred. This patch is based on the work of Dirk Brandewie. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> (cherry picked from commit 17a76b4b32aca7c19df6988213dfe2eb4b631431) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dma: dw: allow shared interruptsChew, Chiau Ee
In the PC world is quite possible that devices are sharing the same interrupt line. The patch prepares dw_dmac driver to such cases. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 3783cef876e0f24e93a11f1a76cc0b3fe7ea8d94) Conflicts: drivers/dma/dw/core.c The conflict is due to from v3.11 onward, dw_dmac.c and dw_dmac_pci.c files are being split into multiple files, mainly pci.c, platform.c, core.c and placed in a new folder "dw" under /drivers/dma directory. Resolve the conflict by porting the code churn within this commit from core.c file into dw_dmac.c file. Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dma: acpi-dma: parse CSRT to extract additional resourcesAndy Shevchenko
Since we have CSRT only to get additional DMA controller resources, let's get rid of drivers/acpi/csrt.c and move its logic inside ACPI DMA helpers code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit ee8209fd026b074bb8eb75bece516a338a281b1b) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: add ACPI supportAndy Shevchenko
Since we have proper ACPI DMA helpers implemented, the driver may use it. This patch introduces custom filter function together with acpi_device_id table. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 42c91ee71d6dfa074b4c79abb95eb095430f83af) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dmaengine: call acpi_dma_request_slave_channel as wellAndy Shevchenko
The slave device could be enumerated by ACPI. In that case the dma_request_slave_channel should use the acpi_dma_request_slave_channel() helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 4e82f5ddd1e46fadc3a3c5aafdaec2d1416de9fe) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dma: acpi-dma: introduce ACPI DMA helpersAndy Shevchenko
There is a new generic API to get a DMA channel for a slave device (commit 9a6cecc8 "dmaengine: add helper function to request a slave DMA channel"). In similar fashion to the DT case (commit aa3da644 "of: Add generic device tree DMA helpers") we introduce helpers to the DMAC drivers which are enumerated by ACPI. The proposed extension provides the following API calls: acpi_dma_controller_register(), devm_acpi_dma_controller_register() acpi_dma_controller_free(), devm_acpi_dma_controller_free() acpi_dma_simple_xlate() acpi_dma_request_slave_chan_by_index() acpi_dma_request_slave_chan_by_name() The first two should be used, for example, at probe() and remove() of the corresponding DMAC driver. At the register stage the DMAC driver supplies a custom xlate() function to translate a struct dma_spec into struct dma_chan. Accordingly to the ACPI Fixed DMA resource specification the only two pieces of information the slave device has are the channel id and the request line (slave id). Those two are represented by struct dma_spec. The acpi_dma_request_slave_chan_by_index() provides access to the specifix FixedDMA resource by its index. Whereas dma_request_slave_channel() takes a string parameter to identify the DMA resources required by the slave device. To make a slave device driver work with both DeviceTree and ACPI enumeration a simple convention is established: "tx" corresponds to the index 0 and "rx" to the index 1. In case of robust configuration the slave device driver unfortunately needs to call acpi_dma_request_slave_chan_by_index() directly. Additionally the patch provides "managed" version of the register/free pair i.e. devm_acpi_dma_controller_register() and devm_acpi_dma_controller_free(). Usually, the driver uses only devm_acpi_dma_controller_register(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 1b2e98bc1e35ebe1f65c3db62c8317096ad7f2c8) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: remove unnecessary ENODEV checkAndy Shevchenko
If CONFIG_OF is not set the of_node of the device will always be NULL. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit f5b9b77eea1f9aaf7725872be4b382f5530bb41e) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dmaengine: dw_dmac: simplify master selectionArnd Bergmann
The patch to add the common DMA binding added a dummy dw_dma_slave structure into the dw_dma_chan structure in order to configure the masters correctly. It turns out that this can be simplified if we pick the DMA masters in the dwc_alloc_chan_resources function instead and save them in the dw_dma_chan structure directly. This could be simplified further once all users that today use dw_dma_slave for configuration get converted to device tree based setup instead. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: linux-arm-kernel@lists.infradead.org Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit f776076b9fa82d630651c9af56359d80fce86d68) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: rename DT related methods to reflect their belongingAndy Shevchenko
Since we will have not only DT cases in future let's rename DT related methods to reflect their belonging. The rename was done as follows: struct dw_dma_filter_args -> struct dw_dma_of_filter_args dw_dma_generic_filter() -> dw_dma_of_filter() dw_dma_xlate() -> dw_dma_of_xlate() dw_dma_id_table -> dw_dma_of_id_table There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit bd2e6b664055a115a85be81af0ceb022726c5aef) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: fix style of the commentsAndy Shevchenko
Let's use capital letter as a first one in the comments. There is no functional changes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 75c6122526f931ee7c23df9a05f0091b65c95e02) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dma: Make the 'mask' parameter of __dma_request_channel constLars-Peter Clausen
The 'mask' parameter is not modified in __dma_request_channel and really shouldn't be. Make this explicit by making the parameter const. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit a53e28da574a40bcc9f78f5d0b0b60570182595b) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dmaengine: add dma_request_slave_channel_compat()Matt Porter
Adds a dma_request_slave_channel_compat() wrapper which accepts both the arguments from dma_request_channel() and dma_request_slave_channel(). Based on whether the driver is instantiated via DT, the appropriate channel request call will be made. This allows for a much cleaner migration of drivers to the dmaengine DT API as platforms continue to be mixed between those that boot using DT and those that do not. Suggested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Matt Porter <mporter@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 864ef69b2d9b34e7c85baa9c5c601d5e735b208a) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: don't wait for FIFO_EMPTY endlessly in dwc_chan_pauseAndy Shevchenko
When we pause the channel after transfer is completed we might stuck in the dwc_chan_pause() because the FIFO_EMPTY flag will never be asserted. To avoid the endless loop we introduce a timeout here (*). The proper solution is to somehow get the residue in FIFO and avoid busyloop when transfer is done, but this task is not simple and fast. Unfortunately we can't use cpu_relax() in conjunction with jiffies checker, due to we have interrupts disabled by spin_lock_irqsave() and there is a big chance that no interrupts will come to update the jiffies.. (*) The worst case is AHB write * FIFO size / hclk = 5.12 us, where AHB write = 2 cycles, hclk = 100 MHz, burst size = 1 byte, FIFO size = 256 bytes. The proposed 40us timeout might be considered as a big one, though we enter to that state only when we have the transfer already completed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 123b69ab8020bc035b6d940417fbcc7aa27fd2b1) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: adjust slave_id accordingly to request line baseAndy Shevchenko
On some hardware configurations we have got the request line with the offset. The patch introduces convert_slave_id() helper for that cases. The request line base is came from the driver data provided by the platform_device_id table. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit bce95c63ef1bcf528ea45c41505eb4c21560d92d) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dmaengine: dw_dma: fix endianess for DT xlate functionArnd Bergmann
As reported by Wu Fengguang's build robot tracking sparse warnings, the dma_spec arguments in the dw_dma_xlate are already byte swapped on little-endian platforms and must not get swapped again. This code is currently not used anywhere, but will be used in Linux 3.10 when the ARM SPEAr platform starts using the generic DMA DT binding. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit f73bb9b35596e045feacdf4d2fd32cfb087e2411) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dmaengine: dw_dmac: move to generic DMA bindingArnd Bergmann
The original device tree binding for this driver, from Viresh Kumar unfortunately conflicted with the generic DMA binding, and did not allow to completely seperate slave device configuration from the controller. This is an attempt to replace it with an implementation of the generic binding, but it is currently completely untested, because I do not have any hardware with this particular controller. The patch applies on top of the slave-dma tree, which contains both the base support for the generic DMA binding, as well as the earlier attempt from Viresh. Both of these are currently not merged upstream however. This version incorporates feedback from Viresh Kumar, Andy Shevchenko and Russell King. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Vinod Koul <vinod.koul@linux.intel.com> Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit f9c6a655a94042f94c0adb30d07d93cfd8915e95) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: apply default dma_mask if neededAndy Shevchenko
In some cases we got the device without dma_mask configured. We have to apply the default value to avoid crashes during memory mapping. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 877e86f28385407f05c5aa4e397d4ccb3233f01a) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
2014-01-09dmaengine: move drivers/of/dma.c -> drivers/dma/of-dma.cVinod Koul
as requested by Rob Suggested-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 5fa422c922c2599dbfd960faf6dfca2411cc3f99) Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
2014-01-09dw_dmac: add support for Lynxpoint DMA controllersMika Westerberg
Intel Lynxpoint PCH Low Power Subsystem has DMA controller to support general purpose serial buses like SPI, I2C, and HSUART. This controller is enumerated from ACPI namespace with ACPI ID INTL9C60. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit cfdf5b6cc5985014a7ce891093f4fd0ae2d27ca6) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
2014-01-09dw_dmac: return proper residue valueAndy Shevchenko
Currently the driver returns full length of the active descriptor which is wrong. We have to go throught the active descriptor and substract the length of each sent children in the chain from the total length along with the actual data in the DMA channel registers. The cyclic case is not handled by this patch due to len field in the descriptor structure is left untouched by the original code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 4702d5244ca947263e8b7eb2ba6d8721e80c46e2) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
2014-01-09dw_dmac: fill individual length of descriptorAndy Shevchenko
It will be useful to have the length of the transfer in the descriptor. The cyclic transfer functions remained untouched. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 176dcec50f3f0bc46f11b983c1a3bbc2dd3514fd) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
2014-01-09dw_dmac: introduce total_len field in struct dw_descAndy Shevchenko
By this new field we distinguish a total length of the chain and the individual length of each descriptor in the chain. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 30d38a3286b140ae8cea84a93cde1f112e352aaf) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
2014-01-09dw_dmac: remove unnecessary tx_list field in dw_dma_chanAndy Shevchenko
The soft LLP mode is working for active descriptor only. So, we do not need to have a copy of its pointer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit fdf475fa40f1468cf43a72b270f74dc6a4a5c905) Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>