summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'i2c/for-4.2' of ↵Linus Torvalds2015-06-2535-221/+2730
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Highlights: - new drivers for Mediatek I2C, APM X-Gene, Broadcom Settop - major updates to at91, davinci - bugfixes to the mux infrastructure when dealing with the new quirk mechanism - more users for the bus recovery feature - further improvements to the slave framework Plus the usual bunch of smaller driver and core improvements and fixes. There is one patch removing old code from an ARM platform. This has been acked by the sh_mobile maintainer Simon Horman" * 'i2c/for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (48 commits) i2c: busses: i2c-bcm2835: limits cdiv to allowed values i2c: sh_mobile: use proper type for timeout i2c: sh_mobile: use adapter default for timeout i2c: rcar: use proper type for timeout i2c: rcar: use adapter default for timeout i2c: designware: Make sure the device is suspended before disabling runtime PM i2c: tegra: apply size limit quirk i2c: tegra: don't advertise SMBUS_QUICK i2c: octeon: remove unused signal handling i2c: davinci: Optimize SCL generation i2c: mux: pca954x: Use __i2c_transfer because of quirks i2c: mux: Use __i2c_transfer() instead of calling parent's master_xfer() i2c: use parent adapter quirks in mux i2c: bcm2835: clear reserved bits in S-Register ARM: shmobile: r8a7740: remove I2C errata handling i2c: sh_mobile: add errata workaround i2c: at91: fix code checker warnings i2c: busses: xgene-slimpro: fix incorrect __init declation for probe i2c: davinci: Avoid sending to own address i2c: davinci: Refactor i2c_davinci_wait_bus_not_busy() ...
| * i2c: busses: i2c-bcm2835: limits cdiv to allowed valuesSilvan Wicki2015-06-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Checks if the cdiv value is in between min (0x2) and max (0xFFFE) supported values by the bcm2835. If not, it returns -ENODEV. See page 33/34 of BCM2835-ARM-Peripherals.pdf for the DIV register. https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf Signed-off-by: Silvan Wicki <linux_wi@tinag.ch> [wsa: resolved a merge conflict] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: sh_mobile: use proper type for timeoutWolfram Sang2015-06-231-3/+4
| | | | | | | | | | | | | | | | wait_event_timeout returns long, not int. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: sh_mobile: use adapter default for timeoutWolfram Sang2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | 5 seconds is a very large timeout, and it is hardcoded. Use the default timeout from 'struct adapter' which is 1 second. It can also be modified from userspace for specific workloads via i2c-dev. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rcar: use proper type for timeoutWolfram Sang2015-06-231-1/+2
| | | | | | | | | | | | | | | | wait_event_timeout returns long, not int. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rcar: use adapter default for timeoutWolfram Sang2015-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | 5 seconds is a very large timeout, and it is hardcoded. Use the default timeout from 'struct adapter' which is 1 second. It can also be modified from userspace for specific workloads via i2c-dev. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: Make sure the device is suspended before disabling runtime PMMika Westerberg2015-06-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver calls pm_runtime_put() right before pm_runtime_disable() in its ->remove() hook to make sure clock is gated etc. However, it turns out that pm_runtime_put() only calls ->idle() hook without actually suspending anything. The following pm_runtime_disable() will prevent the driver from suspending thus leaving it "active". It is better to suspend the device synchronously to make sure it is actually suspended before disabling runtime PM from it. While there, undo call to pm_runtime_use_autosuspend(). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: tegra: apply size limit quirkWolfram Sang2015-06-211-0/+7
| | | | | | | | | | | | | | | | | | | | payload_size is a 12 bit field in the HW register, so add a limit for this size. That way we gracefully reject the message beforehand instead of generating an OOPS while transferring. Verified using some older Tegra2 documentation and a more recent Jetson TK1 board. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
| * i2c: tegra: don't advertise SMBUS_QUICKWolfram Sang2015-06-211-2/+2
| | | | | | | | | | | | | | This HW cannot send 0-byte-length messages and the driver discards them. So, we should not advertise SMBUS_QUICK. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: octeon: remove unused signal handlingNicholas Mc Guire2015-06-171-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 'commit 2637e5fd232d ("i2c: octeon: Fix i2c fail problem when a process is terminated by a signal")' removed the wait_event_interruptible_timeout to prevent half/mixed i2c messages from being sent/recievd but forgot to drop the signal handling case in the return handling. This just removes this dead code. While at it the return variable is adjusted to the type expected. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: davinci: Optimize SCL generationAlexander Sverdlin2015-06-171-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several cases where current clock configuration algorithm produces not optimal results: - truncation in "clk" calculation leads to the fact that actual BUS frequency will be always higher than spec except two exact module frequences 8MHz and 12MHz in the whole 7-12MHz range of permitted frequences - driver configures SCL HIGH to LOW ratio always 1 to 1 and this doesn't work well in 400kHz case, namely minimum time of LOW state (according to I2C Spec 2.1) 1.3us will not be fulfilled. HIGH to LOW ratio 1 to 2 would be more approriate here. Signed-off-by: Michael Lawnick <michael.lawnick@nokia.com> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mux: pca954x: Use __i2c_transfer because of quirksAlexander Sverdlin2015-06-172-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | pca9541 and pca954x are calling master_xfer() of the parent adapter directly thus bypassing the quirks checks of the adapter. Use __i2c_transfer() instead. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Tested-by: Łukasz Gemborowski <lukasz.gemborowski@nokia.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org Fixes: b7f625840267b1 ("i2c: add quirk checks to core")
| * i2c: mux: Use __i2c_transfer() instead of calling parent's master_xfer()Alexander Sverdlin2015-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newly introduced quirks infrastructure doesn't work for the devices behind MUXes because MUX's master_xfer() calls parent's master_xfer() directly without checking the quirks. Instead of duplicating check code in MUX just call __i2c_transfer() instead. This has a side effect on tracing (messages will appear on both MUX bus and parent bus), but maybe that's not bad at the end. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Tested-by: Łukasz Gemborowski <lukasz.gemborowski@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org Fixes: b7f625840267b1 ("i2c: add quirk checks to core")
| * i2c: use parent adapter quirks in muxAlexander Sverdlin2015-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | Inherit parent adapter quirks in MUX in case the devices on the multiplexed buses are interested in the adapter limitations. Signed-off-by: Łukasz Gemborowski <lukasz.gemborowski@nokia.com> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org Fixes: b7f625840267b1 ("i2c: add quirk checks to core")
| * i2c: bcm2835: clear reserved bits in S-RegisterSilvan Wicki2015-06-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The datasheet mentions on page 31 that the bits 10-31 must be read as don't care and written as 0. https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf We cannot guarantee that we read bits 10-31 as always 0 (because the datasheet says read as don't care). We clear the bits with a bitmask to prevent writing back unknown data at the reserved bits. Signed-off-by: Silvan Wicki <linux_wi@tinag.ch> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * ARM: shmobile: r8a7740: remove I2C errata handlingWolfram Sang2015-06-171-55/+0
| | | | | | | | | | | | | | | | | | | | This is now done in the I2C driver. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: sh_mobile: add errata workaroundWolfram Sang2015-06-171-0/+40
| | | | | | | | | | | | | | | | | | | | | | This used to be in platform init code. We want it to do in the driver now. This is basically a code move and a new compatible added. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: fix code checker warningsCyrille Pitchen2015-06-111-3/+3
| | | | | | | | | | | | | | | | | | buf_len is a size_t, so unsigned, but was tested with '<= 0'. Reported-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: busses: xgene-slimpro: fix incorrect __init declation for probeFeng Kan2015-06-101-1/+1
| | | | | | | | | | | | | | | | Fix section mismatch error during kernel build for xgene_slimpro_i2c_probe function. It was incorrectly defined with __init declaration. Signed-off-by: Feng Kan <fkan@apm.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: davinci: Avoid sending to own addressAlexander Sverdlin2015-06-101-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Sending a message to own address locks the controller up in very bizarre state, it behaves as slave even if MDR register clearly states master. The controller remains in this state until reset. To avoid unnecessary timeouts simply avoid sending to own address. The controller cannot do this any way. Also, do not enable AAS IRQ, as the slave mode is not supported by the driver and the only possibility to trigger this IRQ is to send to own address. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: davinci: Refactor i2c_davinci_wait_bus_not_busy()Alexander Sverdlin2015-06-101-23/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | There are several problems in the function: - "to_cnt" variable does nothing - schedule_timeout() call without setting current state does nothing - "allow_sleep" parameter is not really used Refactor the function so that it really tries to wait. In case of timeout try to recover the bus. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: brcmstb: Add Broadcom settop SoC i2c controller driverKamal Dasu2015-06-104-0/+733
| | | | | | | | | | | | | | | | | | Adding support for i2c controller driver for Broadcom settop SoCs. Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> [wsa: removed superfluous owner in platform_driver] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: add support to FIFOsCyrille Pitchen2015-06-101-17/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When FIFOs are available and enabled, the driver now configures the Atmel eXtended DMA Controller to perform word accesses instead of byte accesses when possible. The actual access width depends on the size of the buffer to transmit. To enable FIFO support the "atmel,fifo-size" property must be set properly in the I2C controller node of the device tree. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: print hardware versionCyrille Pitchen2015-06-101-1/+4
| | | | | | | | | | | | | | | | | | | | The probe() function now prints the hardware version of the I2C controller. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> [wsa: s/version/hw version/] for clarity] Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: add support for new alternative command modeCyrille Pitchen2015-06-101-20/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The alternative command mode was introduced to simplify the transmission of STOP conditions and to solve timing and latency issues around them. This mode relies on a new register, the Alternative Command Register, which must be set at the same time as the Master Mode Register. This new register was designed to allow simple setup of basic combined transactions built from up to two unitary transactions. Indeed, the ACR is split into two areas, which describe one unitary transaction each. Each area is filled with Data Length 8bit counter, a Direction and a PEC Request bit. The PEC bit is only used in SMBus mode and is not supported by this driver yet. Also when using alternative command mode, the MREAD bit from the Master Mode Register is ignored. Instead the Direction bits from ACR are used to setup the direction, read or write, of each unitary transaction. Finally the 8bit counters must filled with the data length of their respective transaction. Then if only one transaction is to be used, the data length of the second one must be set to zero. At the moment, this driver uses only the first transaction. In addition to MMR and ACR, the Control Register also need to be written to enable the alternative command mode. That's the purpose of its ACMEN bit, which stands for Alternative Command Mode Enable. Note that the alternative command mode is compatible with the use of the Internal Address Register. So combined transactions for eeprom read are actually implemented with the Internal Address Register. This register is written with up to 3 bytes, which are the internal address sent to the slave through the first write transaction. Then the first area of the ACR describe the write transaction to follow, which carries the data to be read from the eeprom. The second area of the ACR is not used so its Data Length 8bit counter is cleared. For each byte sent or received by the device, the Data Length 8bit counter is decremented. When it reaches 0, a STOP condition is automatically sent. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: update documentation for DT bindingsCyrille Pitchen2015-06-101-2/+28
| | | | | | | | | | | | | | | | | | | | | | add a new value "atmel,sama5d2-i2c" for the "compatible" property. add a new optional property "atmel,fifo-size" to enable FIFO support when available. add missing optional properties "dmas" and "dma-names". Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: use BIT() macro to define register bitsCyrille Pitchen2015-06-101-14/+15
| | | | | | | | | | | | | | | | | | This patch just fixes typo before applying later patches which will use register bits with index above 16. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: at91: fix a race condition when using the DMA controllerCyrille Pitchen2015-06-101-17/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For TX transactions, the TXCOMP bit in the Status Register is cleared when the first data is written into the Transmit Holding Register. In the lines from at91_do_twi_transfer(): at91_twi_write_data_dma(dev); at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); the TXCOMP interrupt may be enabled before the DMA controller has actually started to write into the THR. In such a case, the TXCOMP bit is still set into the Status Register so the interrupt is triggered immediately. The driver understands that a transaction completion has occurred but this transaction hasn't started yet. Hence the TXCOMP interrupt is no longer enabled by at91_do_twi_transfer() but instead by at91_twi_write_data_dma_callback(). Also, the TXCOMP bit in the Status Register in not a clear on read flag but a snapshot of the transmission state at the time the Status Register is read. When a NACK error is dectected by the I2C controller, the TXCOMP, NACK and TXRDY bits are set together to 1 in the SR. If enabled, the TXCOMP interrupt is triggered at the same time. Also setting the TXRDY to 1 triggers the DMA controller to write the next data into the THR. Such a write resets the TXCOMP bit to 0 in the SR. So depending on when the interrupt handler reads the SR, it may fail to detect the NACK error if it relies on the TXCOMP bit. The NACK bit and its interrupt should be used instead. For RX transactions, the TXCOMP bit in the Status Register is cleared when the START bit is set into the Control Register. However to unify the management of the TXCOMP bit when the DMA controller is used, the TXCOMP interrupt is now enabled by the DMA callbacks for both TX and RX transfers. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Cc: stable@vger.kernel.org #3.10 and later Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: iproc: Add suspend/resume supportRay Jui2015-06-031-0/+57
| | | | | | | | | | | | | | | | 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>
| * i2c: designware: Avoid unnecessary resuming during system suspendJisheng Zhang2015-06-031-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1fc2fe204cb9 ("i2c: designware: Add runtime PM hooks") adds runtime pm support using the same ops for system pm and runtime pm. When suspend to ram, the i2c host may have been runtime suspended, thus i2c_dw_disable() hangs. Previously, I fixed this issue by separating ops for system pm and runtime pm, then in the system suspend/resume path, runtime pm apis are used to ensure the device is at correct state. But as Mika Westerberg pointed out: it sounds a bit silly to resume the device just because you want to call i2c_dw_disable() for it before suspending again. He then suggested an elegant solution which keeps the device runtime suspended during system suspend with the help of 'dev->power.direct_complete'. This patch adopted this solution, and in fact Mika provided the main code. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: axxia: Add bus recovery functionalityAlexander Sverdlin2015-06-031-0/+41
| | | | | | | | | | | | | | | | | | Use recovery framework and implement bus recovery using "Bus Monitor" register. Tests show that shortening SDA to GND results in "completion" timeout with "BUSY" bit still set, so initiate recovery in this case. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: Reduce stack size of acpi_i2c_space_handler()Jarkko Nikula2015-06-031-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sizeof(struct i2c_client) is 1088 bytes on a CONFIG_X86_64=y build and produces following warning when CONFIG_FRAME_WARN is set to 1024: drivers/i2c/i2c-core.c: In function ‘acpi_i2c_space_handler’: drivers/i2c/i2c-core.c:367:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=] This is not critical given that kernel stack is 16 kB on x86_64 but lets reduce the stack usage by allocating the struct i2c_client from the heap. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: smbus: fix typo in commetShailendra Verma2015-06-011-1/+1
| | | | | | | | | | Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: algo-pca: fix typo in commentShailendra Verma2015-06-011-1/+1
| | | | | | | | | | Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: fix typo in commentShailendra Verma2015-06-011-1/+1
| | | | | | | | | | Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * I2C: mediatek: Add driver for MediaTek MT8173 I2C controllerEddie Huang2015-06-011-29/+74
| | | | | | | | | | | | | | | | | | | | | | | | Add mediatek MT8173 I2C controller driver. Compare to I2C controller of earlier mediatek SoC, MT8173 fix write-then-read limitation, and also increase message size to 64kb. Signed-off-by: Xudong Chen <xudong.chen@mediatek.com> Signed-off-by: Liguo Zhang <liguo.zhang@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * I2C: mediatek: Add driver for MediaTek I2C controllerXudong Chen2015-06-014-0/+737
| | | | | | | | | | | | | | | | | | | | | | | | The mediatek SoCs have I2C controller that handle I2C transfer. This patch include common I2C bus driver. This driver is compatible with I2C controller on mt65xx/mt81xx. Signed-off-by: Xudong Chen <xudong.chen@mediatek.com> Signed-off-by: Liguo Zhang <liguo.zhang@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: check for proper length of the reg propertyWolfram Sang2015-06-011-1/+1
| | | | | | | | | | | | | | | | int is vague, let's simply use the type of the variable in question. 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: slave: add error messages to slave coreWolfram Sang2015-06-011-5/+17
| | | | | | | | | | | | | | | | | | Inform users what went wrong from the core, so drivers don't have to do it. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: slave: docs: be more precise about the prerequsitesWolfram Sang2015-06-011-10/+15
| | | | | | | | | | | | | | | | | | | | There was some confusion what was needed to utilize the slave support, so let's be more precise about this. Add an introductory paragraph to the development section while we are here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rcar: report slave capabilities to usersWolfram Sang2015-06-011-1/+2
| | | | | | | | | | | | Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: add FUNC flag for slave capabilitiesWolfram Sang2015-06-011-0/+1
| | | | | | | | | | | | | | | | So users can check in advance if there is slave support. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: add SLIMpro I2C device driver on APM X-Gene platformFeng Kan2015-05-124-0/+494
| | | | | | | | | | | | | | | | | | | | Add SLIMpro I2C device driver on APM X-Gene platform. This I2C device driver use the SLIMpro Mailbox driver to tunnel message to the SLIMpro coprocessor to do the work of accessing I2C components. Signed-off-by: Feng Kan <fkan@apm.com> Signed-off-by: Hieu Le <hnle@apm.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: omap: implement bus recoveryFelipe Balbi2015-05-121-4/+65
| | | | | | | | | | | | | | | | | | implement bus recovery methods for i2c-omap so we can recover from situations where SCL/SDA are stuck low. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: constify platform_device_idKrzysztof Kozlowski2015-05-124-4/+4
| | | | | | | | | | | | | | | | The platform_device_id is not modified by these drivers and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: omap: Add calls for pinctrl state selectPascal Huerst2015-05-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This adds calls to pinctrl subsystem in order to switch pin states on suspend/resume if you provide a "sleep" state in DT. If no "sleep" state is provided in the DT, these calls turn to NOPs, so we don't need error checking here. Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com> Reviewed-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: Allow compile test of GPIO consumers if !GPIOLIBGeert Uytterhoeven2015-05-122-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Fix kerneldoc warningsShubhrajyoti Datta2015-05-121-0/+1
| | | | | | | | | | | | | | | | info(drivers/i2c/busses/i2c-xiic.c:55): Scanning doc for struct xiic_i2c Warning(drivers/i2c/busses/i2c-xiic.c:79): No description found for parameter 'endianness' Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: Increase wait timeout to 1 secondDoug Anderson2015-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although unlikely, it is remotely possible for an i2c command to need more than 200ms complete. Unlike smbus, i2c devices can clock stretch for an unspecified amount of time. The longest time I've seen specified for a device is 144ms (bq27541 battery gas), but one could imagine a device taking a bit slower. 1 second "ought to be enough for anyone." The above is not the only justifcation for going above 200ms for a timeout, though. It turns out that if you've got a large number of printks going out to a serial console, interrupts on a CPU can be disabled for hundreds of milliseconds. That's not a great situation to be in to start with (maybe we should put a cap in vprintk_emit()) but it's pretty annoying to start seeing unexplained i2c timeouts. Note that to understand why we can timeout when printk has interrupts disabled, you need to understand that on current Linux ARM kernels interrupts are routed to a single CPU in a multicore system. Thus, you can get: 1. CPU1 is running rk3x_i2c_xfer() 2. CPU0 calls vprintk_emit(), which disables all IRQs on CPU0. 3. I2C interrupt is ready but is set to only run on CPU0, where IRQs are disabled. 4. CPU1 timeout expires. I2C interrupt is still ready, but CPU0 is still sitting in the same vprintk_emit() 5. CPU1 sees that no interrupt happened in 200ms, so timeout. A normal system shouldn't see i2c timeouts anyway, so increasing the timeout should help people debugging without hurting other people excessively. Signed-off-by: Doug Anderson <dianders@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | Merge branch 'mailbox-for-next' of ↵Linus Torvalds2015-06-2512-19/+304
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.linaro.org/landing-teams/working/fujitsu/integration Pull mailbox updates from Jassi Brar. * 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration: mailbox/bcm2835: Fix mailbox full detection. dt: mailbox: Remove 'mbox-names property is discouraged' message from binding mailbox: Add ability for clients to request channels by name mailbox: Enable BCM2835 mailbox support dt/bindings: Add binding for the BCM2835 mailbox driver mailbox: Fix up error handling in mbox_request_channel() mailbox: Make mbox_chan_ops const mailbox: altera: Add dependency on HAS_IOMEM