summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-bcm-iproc.c
AgeCommit message (Collapse)Author
2019-11-17i2c: iproc: Add i2c repeated start capabilityLori Hikichi
Enable handling of i2c repeated start. The current code handles a multi msg i2c transfer as separate i2c bus transactions. This change will now handle this case using the i2c repeated start protocol. The number of msgs in a transfer is limited to two, and must be a write followed by a read. Signed-off-by: Lori Hikichi <lori.hikichi@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Icarus Chau <icarus.chau@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Shivaraj Shetty <sshetty1@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-09-24Merge branch 'i2c/for-5.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - new driver for ICY, an Amiga Zorro card :) - axxia driver gained slave mode support, NXP driver gained ACPI - the slave EEPROM backend gained 16 bit address support - and lots of regular driver updates and reworks * 'i2c/for-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits) i2c: tegra: Move suspend handling to NOIRQ phase i2c: imx: ACPI support for NXP i2c controller i2c: uniphier(-f): remove all dev_dbg() i2c: uniphier(-f): use devm_platform_ioremap_resource() i2c: slave-eeprom: Add comment about address handling i2c: exynos5: Remove IRQF_ONESHOT i2c: stm32f7: Make structure stm32f7_i2c_algo constant i2c: cht-wc: drop check because i2c_unregister_device() is NULL safe i2c-eeprom_slave: Add support for more eeprom models i2c: fsi: Add of_put_node() before break i2c: synquacer: Make synquacer_i2c_ops constant i2c: hix5hd2: Remove IRQF_ONESHOT i2c: i801: Use iTCO version 6 in Cannon Lake PCH and beyond watchdog: iTCO: Add support for Cannon Lake PCH iTCO i2c: iproc: Make bcm_iproc_i2c_quirks constant i2c: iproc: Add full name of devicetree node to adapter name i2c: piix4: Add ACPI support i2c: piix4: Fix probing of reserved ports on AMD Family 16h Model 30h i2c: ocores: use request_any_context_irq() to register IRQ handler i2c: designware: Fix optional reset error handling ...
2019-08-30i2c: iproc: Make bcm_iproc_i2c_quirks constantNishka Dasgupta
Static structure bcm_iproc_i2c_quirks, of type i2c_adapter_quirks, is only used when being assigned to constant field quirks of a variable having type i2c_adapter. Hence make bcm_iproc_i2c_quirks constant as well to prevent it from unintended modification. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-08-30i2c: iproc: Add full name of devicetree node to adapter nameLori Hikichi
Add the full name of the devicetree node to the adapter name. Without this change, all adapters have the same name making it difficult to distinguish between multiple instances. The most obvious way to see this is to use the utility i2c_detect. e.g. "i2c-detect -l" Before i2c-1 i2c Broadcom iProc I2C adapter I2C adapter i2c-0 i2c Broadcom iProc I2C adapter I2C adapter After i2c-1 i2c Broadcom iProc (i2c@e0000) I2C adapter i2c-0 i2c Broadcom iProc (i2c@b0000) I2C adapter Now it is easy to figure out which adapter maps to a which DT node. Signed-off-by: Lori Hikichi <lori.hikichi@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-08-30i2c: iproc: Stop advertising support of SMBUS quick cmdLori Hikichi
The driver does not support the SMBUS Quick command so remove the flag that indicates that level of support. By default the i2c_detect tool uses the quick command to try and detect devices at some bus addresses. If the quick command is used then we will not detect the device, even though it is present. Fixes: e6e5dd3566e0 (i2c: iproc: Add Broadcom iProc I2C Driver) Signed-off-by: Lori Hikichi <lori.hikichi@broadcom.com> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-08-01i2c: iproc: Fix i2c master read more than 63 bytesRayagonda Kokatanur
Use SMBUS_MASTER_DATA_READ.MASTER_RD_STATUS bit to check for RX FIFO empty condition because SMBUS_MASTER_FIFO_CONTROL.MASTER_RX_PKT_COUNT is not updated for read >= 64 bytes. This fixes the issue when trying to read from the I2C slave more than 63 bytes. Fixes: c24b8d574b7c ("i2c: iproc: Extend I2C read up to 255 bytes") Cc: stable@kernel.org Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-05-27i2c: iproc: Add multi byte read-write support for slave modeRayagonda Kokatanur
Add multiple byte read-write support for slave mode. Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2019-04-23i2c: iproc: Change driver to use 'BIT' macroRay Jui
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>
2019-04-03i2c: iproc: add NIC I2C supportRayagonda Kokatanur
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>
2019-04-03i2c: iproc: use wrapper for read/write accessRayagonda Kokatanur
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>
2019-04-03i2c: iproc: add polling supportRayagonda Kokatanur
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>
2019-04-03i2c: iproc: Add support for more master error statusMichael Cheng
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>
2019-04-03i2c: iproc: Add slave mode supportShreesha Rajashekar
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>
2019-04-03i2c: iproc: Extend I2C read up to 255 bytesShreesha Rajashekar
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>
2017-07-31i2c: use dev_get_drvdata() to get private data in suspend/resume hooksMasahiro Yamada
Several drivers call to_platform_device() to get platform_device and pass it to platform_get_drvdata(). In platform_get_drvdata(), the platform_device is converted back to struct device again. Use dev_get_drvdata() to avoid platform_device/device dance. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (for DesignWare only) Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-11-18i2c: constify i2c_adapter_quirks structuresJulia Lawall
Check for i2c_adapter_quirks structures that are only stored in the quirks field of an i2c_adapter structure. This field is declared const, so i2c_adapter_quirks structures that have this property can be declared as const also. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Ray Jui <ray.jui@broadcom.com> # for bcm-iproc Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-08-22i2c: don't print error when adding adapter failsWolfram Sang
The core will do this for us now. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-08-15i2c: bcm-iproc: Use complete() instead of complete_all()Daniel Wagner
There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). The usage pattern of the completion is: bcm_iproc_i2c_xfer_single_msg() reinit_completion() ... (activate the transfer) ... wait_for_completion_timeout() Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-11i2c: bcm-iproc: use new 8 bit address helper functionWolfram Sang
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-02-12i2c: iproc: Support larger TX transferRay Jui
The current iProc I2C driver only allows each TX transfer up to 63 bytes (the TX FIFO has a size of 64 bytes, and one byte is reserved for slave address). This patch enhances the driver to support TX transfer in each I2C message for up to 65535 bytes (a practical maximum, since member 'max_write_len' of 'struct i2c_adapter_quirks is of type 'u16') This works by loading up the I2C TX FIFO and enabling the TX underrun interrupt for each burst. After each burst of TX data is finished, i.e., when the TX FIFO becomes empty, the TX underrun interrupt will be triggered and another burst of TX data can be loaded into the TX FIFO. This repeats until all TX data are finished Signed-off-by: Ray Jui <rjui@broadcom.com> Tested-by: Icarus Chau <ichau@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-02-12i2c: iproc: Fix typo in the driverRay Jui
Fix typo in the driver from 'I2C_TIMEOUT_MESC' to 'I2C_TIMEOUT_MSEC' Signed-off-by: Ray Jui <rjui@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-02-12i2c: iproc: Add recovery mechanism in error caseRay Jui
Add proper recovery mechanism to the iProc I2C driver in error cases. Signed-off-by: Icarus Chau <ichau@broadcom.com> Signed-off-by: Ray Jui <rjui@broadcom.com> Tested-by: Icarus Chau <ichau@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> [wsa: whitespace fixes] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-06-03i2c: iproc: Add suspend/resume supportRay Jui
Add suspend/resume support to the Broadcom iProc I2C driver Signed-off-by: Ray Jui <rjui@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-03-13i2c: bcm-iproc: make use of the new infrastructure for quirksWolfram Sang
Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: Ray Jui <rjui@broadcom.com>
2015-02-17i2c: iproc: Add Broadcom iProc I2C DriverRay Jui
Add initial support to the Broadcom iProc I2C controller found in the iProc family of SoCs. The iProc I2C controller has separate internal TX and RX FIFOs, each has a size of 64 bytes. The iProc I2C controller supports two bus speeds including standard mode (100kHz) and fast mode (400kHz) Signed-off-by: Ray Jui <rjui@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Reviewed-by: Kevin Cernekee <cernekee@chromium.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>