summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'i2c/for-5.2' of ↵Linus Torvalds2019-05-0936-844/+3017
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - API for late atomic transfers (e.g. to shut down via PMIC). We have a seperate callback now which is called under clearly defined conditions. In-kernel users are converted, too. - new driver for the AMD PCIe MP2 I2C controller - large refactoring for at91 and bcm-iproc (both gain slave support due to this) - and a good share of various driver improvements anf fixes * 'i2c/for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (57 commits) dt-bindings: i2c: riic: document r7s9210 support i2c: imx-lpi2c: Use __maybe_unused instead of #if CONFIG_PM_SLEEP i2c-piix4: Add Hygon Dhyana SMBus support i2c: core: apply 'is_suspended' check for SMBus, too i2c: core: ratelimit 'transfer when suspended' errors i2c: iproc: Change driver to use 'BIT' macro i2c: riic: Add Runtime PM support i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc() i2c: mux: pca954x: allow management of device idle state via sysfs i2c: mux: pca9541: remove support for unused platform data i2c: mux: pca954x: remove support for unused platform data dt-bindings: i2c: i2c-mtk: add support for MT8516 i2c: axxia: use auto cmd for last message i2c: gpio: flag atomic capability if possible i2c: algo: bit: add flag to whitelist atomic transfers i2c: stu300: use xfer_atomic callback to bail out early i2c: ocores: enable atomic xfers i2c: ocores: refactor setup for polling i2c: tegra-bpmp: convert to use new atomic callbacks i2c: omap: Add the master_xfer_atomic hook ...
| * i2c: imx-lpi2c: Use __maybe_unused instead of #if CONFIG_PM_SLEEPAnson Huang2019-05-031-8/+3Star
| | | | | | | | | | | | | | | | | | Use __maybe_unused for power management related functions instead of #if CONFIG_PM_SLEEP to simply the code. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Acked-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c-piix4: Add Hygon Dhyana SMBus supportPu Wen2019-05-032-4/+12
| | | | | | | | | | | | | | | | | | | | The Hygon Dhyana CPU has the SMBus device with PCI device ID 0x790b, which is the same as AMD CZ SMBus device. So add Hygon Dhyana support to the i2c-piix4 driver by using the code path of AMD. Signed-off-by: Pu Wen <puwen@hygon.cn> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: apply 'is_suspended' check for SMBus, tooWolfram Sang2019-05-033-5/+19
| | | | | | | | | | | | | | | | | | | | | | We checked I2C calls, but not SMBus. Refactor the helper to an inline function and use it for both, I2C and SMBus. Fixes: 9ac6cb5fbb17 ("i2c: add suspended flag and accessors for i2c adapters") Reported-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: ratelimit 'transfer when suspended' errorsWolfram Sang2019-05-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two problems with WARN_ON() here. One: It is not ratelimited. Two: We don't see which adapter was used when trying to transfer something when already suspended. Implement a custom ratelimit once per adapter and use dev_WARN there. This fixes both issues. Drawback is that we don't see if multiple drivers are trying to transfer with the same adapter while suspended. They need to be discovered one after the other now. This is better than a high CPU load because a really broken driver might try to resend endlessly. Fixes: 9ac6cb5fbb17 ("i2c: add suspended flag and accessors for i2c adapters") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@vger.kernel.org # v5.1+
| * Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux into ↵Wolfram Sang2019-05-035-36/+87
| |\ | | | | | | | | | | | | | | | | | | | | | i2c/for-5.2 Mainly some pca954x work, i.e. removal of unused platform data support and added support for sysfs interface for manipulating/examining the idle state. And then a mechanical cocci-style patch.
| | * i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()Gustavo A. R. Silva2019-04-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = devm_kzalloc(dev, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Peter Rosin <peda@axentia.se>
| | * i2c: mux: pca954x: allow management of device idle state via sysfsRobert Shearman2019-04-211-8/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behaviour, by default, to not deselect after each transfer is unsafe when there is a device with an address that conflicts with another device on another mux on the same parent bus, and it may not be convenient to use devicetree to set the deselect mux, e.g. when running on x86_64 when ACPI is used to discover most of the device hierarchy. Therefore, provide the ability to set the idle state behaviour using a new sysfs file, idle_state as a complement to the method of instantiating the device via sysfs. The possible behaviours are disconnect, i.e. to deselect all channels from the mux, as-is (the default), i.e. leave the last channel selected, and set a predetermined channel. The current behaviour of leaving the channel as-is after each transaction is preserved. Signed-off-by: Robert Shearman <robert.shearman@att.com> Signed-off-by: Peter Rosin <peda@axentia.se>
| | * i2c: mux: pca9541: remove support for unused platform dataRobert Shearman2019-04-211-7/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no in-tree users of the platform data, so remove it to simplify the code slightly. Remove the now unused pca954x.h platform data header. Signed-off-by: Robert Shearman <robert.shearman@att.com> Signed-off-by: Peter Rosin <peda@axentia.se>
| | * i2c: mux: pca954x: remove support for unused platform dataRobert Shearman2019-04-211-20/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no in-tree users of the pca954x platform data and the per-channel deselect configuration complicates efforts to export the configuration to user-space in a way that could be applied to other muxes. Therefore, remove support for the pca954x platform data. Signed-off-by: Robert Shearman <robert.shearman@att.com> Signed-off-by: Peter Rosin <peda@axentia.se>
| * | i2c: iproc: Change driver to use 'BIT' macroRay Jui2019-04-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Change the iProc I2C driver to use the 'BIT' macro from all '1 << XXX' bit operations to get rid of compiler warning and improve readability of the code Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: riic: Add Runtime PM supportGeert Uytterhoeven2019-04-231-19/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace explicit clock handling by Runtime PM calls, - Streamline Runtime PM handling in error paths, - Enable Runtime PM in .probe(), - Disable Runtime PM in .remove(), - Make sure the device is runtime-resumed when disabling interrupts in .remove(). Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by: Chris Brandt <chris.brandt@renesas.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: axxia: use auto cmd for last messageAdamski, Krzysztof (Nokia - PL/Wroclaw)2019-04-161-38/+19Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some recent commits to this driver were trying to make sure the TSS interrupt is not generated on busy system due to 25ms timer expiring between commands. It can still happen, however if STOP command is not issued on time at the end of the transmission. If wait_for_completion in axxia_i2c_xfer_msg() would not return after 25ms of getting an interrupt, TSS will be generated and idev->err_msg will be set to -ETIMEDOUT which will be returned from the axxia_i2c_xfer_msg(), even though the transfer did actually succeed (STOP is automatically issued when TSS triggers). Fortunately, apart from already used manual and sequence commands, the controller also has so called auto command. It works just like manual mode but it but an automatic STOP is issued when either transfer length is met or NAK is received from slave device. This patch changes the axxia_i2c_xfer_msg() function so that auto command is used for last message in transaction letting hardware manage issuing STOP. TSS is disabled just after command transferring last message finishes. Auto command, just like sequence, ends with SS interrupt instead of SNS so handling of both had to be unified. The axxia_i2c_stop() is no longer needed as the transfer can only end with following conditions: - fully successful - then last message was send by AUTO command and STOP was issued automatically - NAK received - STOP is issued automatically by controller - arbitration lost - STOP should not be issued as we don't control the bus - IP interrupt received - this is sent when transfer length is set to 0 for auto/sequence command. The check for that is done before START is send so no STOP is required - TSS received between commands - STOP is issued by the controller Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: gpio: flag atomic capability if possibleWolfram Sang2019-04-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If switching GPIOs does not sleep, then we can support atomic transfers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: algo: bit: add flag to whitelist atomic transfersWolfram Sang2019-04-161-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new xfer_atomic callback to check a newly introduced flag to whitelist atomic transfers. This will report configurations which worked accidently. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: stu300: use xfer_atomic callback to bail out earlyWolfram Sang2019-04-161-15/+10Star
| | | | | | | | | | | | | | | | | | | | | | | | Use the new callback to reject atomic transfers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: ocores: enable atomic xfersWolfram Sang2019-04-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The driver already has the routine in place, tie it to the new callback. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: ocores: refactor setup for pollingWolfram Sang2019-04-161-11/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By properly setting up the algorithm at probe time, we can skip the check at every transfer. This allows us to get rid of the flags completely. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: Andrew Lunn <andrew@lunn.ch> Acked-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: tegra-bpmp: convert to use new atomic callbacksWolfram Sang2019-04-161-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver did handle this internally, convert it to use the new callbacks. Reviewed-by: Timo Alho <talho@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: omap: Add the master_xfer_atomic hookWolfram Sang2019-04-161-13/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the master_xfer_atomic hook to enable i2c transactions in irq disabled contexts like the poweroff case. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Keerthy <j-keerthy@ti.com> [wsa: simplified code a little: 'timeout = !ret'] Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: demux: handle the new atomic callbacksWolfram Sang2019-04-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the parent has an atomic callback, we need to translate it the same way as the non-atomic callback. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: mux: populate the new *_atomic callbacksWolfram Sang2019-04-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the parent adapter has atomic_xfer callbacks, populate them for the mux adapter as well. We can use the same translation function as for the non-atomic xfer callback. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Peter Rosin <peda@axentia.se> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: core: introduce callbacks for atomic transfersWolfram Sang2019-04-163-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had the request to access devices very late when interrupts are not available anymore multiple times now. Mostly to prepare shutdown or reboot. Allow adapters to specify a specific callback for this case. Note that we fall back to the generic {master|smbus}_xfer callback if this new atomic one is not present. This is intentional to preserve the previous behaviour and avoid regressions. Because there are drivers not using interrupts or because it might have worked "accidently" before. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Stefan Lengfeld <contact@stefanchrist.eu> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: core: use I2C locking behaviour also for SMBUSWolfram Sang2019-04-163-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If I2C transfers are executed in atomic contexts, trylock is used instead of lock. This behaviour was missing for SMBUS, although a lot of transfers are of SMBUS type, either emulated or direct. So, factor out the locking routine into a helper and use it for I2C and SMBUS. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: core: remove use of in_atomic()Wolfram Sang2019-04-162-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit cea443a81c9c ("i2c: Support i2c_transfer in atomic contexts") added in_atomic() to the I2C core. However, the use of in_atomic() outside of core kernel code is discouraged and was already[1] when this code was added in early 2008. The above commit was a preparation for commit b7a3670131c7 ("i2c-pxa: Add polling transfer"). Its commit message says explicitly it was added "for cases where I2C transactions have to occur at times interrup[t]s are disabled". So, the intention was 'disabled interrupts'. This matches the use cases for atomic I2C transfers I have seen so far: very late communication (mostly to a PMIC) to powerdown or reboot the system. For those cases, interrupts are disabled then. It doesn't seem that in_atomic() adds value. After a discussion with Peter Zijlstra[2], we came up with a better set of conditionals to match the use case. The I2C core will soon gain an extra callback into bus drivers especially for atomic transfers to make them more generic. The code deciding which transfer to use (atomic/non-atomic) should mimic the behaviour which locking to use (trylock/lock). This is why we add a helper for it. [1] https://lwn.net/Articles/274695/ [2] http://patchwork.ozlabs.org/patch/1067437/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Stefan Lengfeld <contact@stefanchrist.eu> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: brcmstb: remove unused struct memberWolfram Sang2019-04-151-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | No further occurences in the driver. Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: mediatek: Add i2c support for MediaTek MT8183Qii Wang2019-04-151-2/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add i2c compatible for MT8183. Compare to MT2712 i2c controller, MT8183 has different register offsets. Ltiming_reg is added to adjust low width of SCL. Arb clock and dma_sync are needed. Signed-off-by: Qii Wang <qii.wang@mediatek.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: mediatek: Add i2c and apdma sync in i2c driverQii Wang2019-04-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When i2c and apdma use different source clocks, we should enable synchronization between them. Signed-off-by: Qii Wang <qii.wang@mediatek.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: mediatek: Add arb clock in i2c driverQii Wang2019-04-151-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two i2c controllers are internally connected to the same GPIO pins, the arb clock is needed to ensure that the waveforms do not interfere with each other. And we also need to enable the interrupt to find arb lost, old i2c controllers also have the bit. Signed-off-by: Qii Wang <qii.wang@mediatek.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: mediatek: Add offsets array for new i2c registersQii Wang2019-04-151-59/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | New i2c registers would have different offsets, so we use different offsets array to distinguish different i2c registers version. Signed-off-by: Qii Wang <qii.wang@mediatek.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: isch: Remove unnecessary acpi.h includeBjorn Helgaas2019-04-031-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 54fb4a05af0a ("i2c: Check for ACPI resource conflicts") included <linux/acpi.h> so we could use acpi_check_region(). Commit fd46a0064af1 ("i2c: convert i2c-isch to platform_device") removed the use of acpi_check_region() but not the include. Remove the now-unnecessary include of <linux/acpi.h>. No functional change intended. Fixes: fd46a0064af1 ("i2c: convert i2c-isch to platform_device") Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: nomadik: remove an unnecessary NULL check in nmk_i2c_remove()Dan Carpenter2019-04-031-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "res" can't be NULL because it's a pointer to somewhere in the middle of the "adev" struct. Also probe() succeeded so there is no need to check here. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: add NIC I2C supportRayagonda Kokatanur2019-04-031-5/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add NIC I2C support to the iProc I2C driver. Access to the NIC I2C base registers requires going through the IDM wrapper to map into the NIC's address space Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: use wrapper for read/write accessRayagonda Kokatanur2019-04-031-63/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the following wrapper for read/write access of iProc i2c registers: u32 iproc_i2c_rd_reg(struct bcm_iproc_i2c_dev *iproc_i2c, u32 offset) void iproc_i2c_wr_reg(struct bcm_iproc_i2c_dev *iproc_i2c, u32 offset, u32 val) This preps the driver for support of indirect register access required by certain SoCs with this iProc I2C block integrated Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: add polling supportRayagonda Kokatanur2019-04-031-117/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add polling support to the iProc I2C driver. Polling mode is activated when the driver fails to obtain an interrupt ID from device tree Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: Add support for more master error statusMichael Cheng2019-04-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for more master error status including FIFO underrun and RX FIFO full Signed-off-by: Michael Cheng <ccheng@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: Add slave mode supportShreesha Rajashekar2019-04-032-6/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add slave mode support to the iProc I2C driver. Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Michael Cheng <ccheng@broadcom.com> Signed-off-by: Shreesha Rajashekar <shreesha.rajashekar@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: iproc: Extend I2C read up to 255 bytesShreesha Rajashekar2019-04-031-22/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add support to allow I2C master read transfer up to 255 bytes. Signed-off-by: Shreesha Rajashekar <shreesha@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: at91: Convert to use struct i2c_timingsAndy Shevchenko2019-03-272-16/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using custom variables and parser, convert the driver to use the ones provided by I2C core. No functional change intended. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: Add drivers for the AMD PCIe MP2 I2C controllerElie Morisse2019-03-255-0/+1080
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MP2 controllers have two separate busses, so may accommodate up to two I2C adapters. Those adapters are listed in the ACPI namespace with the "AMDI0011" HID, and probed by a platform driver. Communication with the MP2 takes place through MMIO registers, or through DMA for more than 32 bytes transfers. This is major rework of the patch submitted by Nehal-bakulchandra Shah from AMD (https://patchwork.kernel.org/patch/10597369/). Most of the event handling of v3 was rewritten to make it work with more than one bus (e.g on Ryzen-based Lenovo Yoga 530), and this version contains many other improvements. Signed-off-by: Elie Morisse <syniurge@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: at91: added slave mode supportJuergen Fitschen2019-03-245-4/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Slave mode driver is based on the concept of i2c-designware driver. Signed-off-by: Juergen Fitschen <me@jue.yt> [ludovic.desroches@microchip.com: rework Kconfig and replace IS_ENABLED by defined] Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: at91: split driver into core and master fileJuergen Fitschen2019-03-244-468/+522
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The single file i2c-at91.c has been split into core code (i2c-at91-core.c) and master mode specific code (i2c-at91-master.c). This should enhance maintainability and reduce ifdeffery for slave mode related code. The code itself hasn't been touched. Shared functions only had to be made non-static. Furthermore, includes have been cleaned up. Signed-off-by: Juergen Fitschen <me@jue.yt> [ludovic.desroches@microchip.com: fix checkpatch errors and use SPDX] Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: at91: segregate master mode specific code from probe and init funcJuergen Fitschen2019-03-241-35/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to implement slave mode support for the at91 hardware we have to segregate all master mode specific function parts from the general parts. The upcoming slave mode patch will call its sepcific probe resp. init function instead of the master mode functions after the shared general code has been executed. This concept has been influenced by the i2c-designware driver. Signed-off-by: Juergen Fitschen <me@jue.yt> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: rcar: wait for data empty before starting DMAWolfram Sang2019-03-201-7/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sending with DMA, the driver transfers the first byte with PIO (as documented). However, it started DMA right after the first byte was written. This worked, but was not according to the datasheet which suggests to wait until data register was empty again. Implement this. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: rcar: let DMA enable routine return success statusWolfram Sang2019-03-201-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | We will need to know if enabling DMA was successful in a later patch. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: rcar: sanity check for minimal DMA lengthWolfram Sang2019-03-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a macro for the hardcoded value and apply a build check. If it is not met, the driver logic will not work anymore. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: i2c-stm32f7: improve loopback in timing algorithmNicolas Le Bayon2019-03-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids useless loops inside the I2C timing algorithm. Actually, we support only one possible solution per prescaler value. So after finding a solution with a prescaler, the algorithm can switch directly to the next prescaler value. Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com> Signed-off-by: Bich Hemon <bich.hemon@st.com> Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * | i2c: designware: Add support for an interface clockPhil Edworthy2019-03-203-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Synopsys I2C Controller has an interface clock, but most SoCs hide this away. However, on some SoCs you need to explicitly enable the interface clock in order to access the registers. Therefore, add support for an optional interface clock. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Gareth Williams <gareth.williams.jx@renesas.com> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | | Merge tag 'usb-5.2-rc1' of ↵Linus Torvalds2019-05-081-0/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB/PHY updates from Greg KH: "Here is the big set of USB and PHY driver patches for 5.2-rc1 There is the usual set of: - USB gadget updates - PHY driver updates and additions - USB serial driver updates and fixes - typec updates and new chips supported - mtu3 driver updates - xhci driver updates - other tiny driver updates Nothing really interesting, just constant forward progress. All of these have been in linux-next for a while with no reported issues. The usb-gadget and usb-serial trees were merged a bit "late", but both of them had been in linux-next before they got merged here last Friday" * tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (206 commits) USB: serial: f81232: implement break control USB: serial: f81232: add high baud rate support USB: serial: f81232: clear overrun flag USB: serial: f81232: fix interrupt worker not stop usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA usb: dwc3: Fix default lpm_nyet_threshold value usb: dwc3: debug: Print GET_STATUS(device) tracepoint usb: dwc3: Do core validation early on probe usb: dwc3: gadget: Set lpm_capable usb: gadget: atmel: tie wake lock to running clock usb: gadget: atmel: support USB suspend usb: gadget: atmel_usba_udc: simplify setting of interrupt-enabled mask dwc2: gadget: Fix completed transfer size calculation in DDMA usb: dwc2: Set lpm mode parameters depend on HW configuration usb: dwc2: Fix channel disable flow usb: dwc2: Set actual frame number for completed ISOC transfer usb: gadget: do not use __constant_cpu_to_le16 usb: dwc2: gadget: Increase descriptors count for ISOC's usb: introduce usb_ep_type_string() function usb: dwc3: move synchronize_irq() out of the spinlock protected block ...
| * \ \ Merge 5.1-rc7 into usb-nextGreg Kroah-Hartman2019-05-031-1/+3
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need this to make the usb-gadget branch merge cleaner. And for testing to keep from hitting the same issues already fixed. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>