summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
Commit message (Collapse)AuthorAgeFilesLines
* i2c: s3c2410: Remove unnecessary label err_noclkTushar Behera2013-01-281-6/+3
| | | | | | | | err_noclk label redirects to a simple return statement. Move the return statement to the caller location and remove the label. Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: nomadik: drop superfluous variable initializationWolfram Sang2013-01-281-6/+3
| | | | | | | | cppcheck rightfully reports those as "reassigned a value before the old one has been used." Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Linus Walleij <linus.walleij@stericsson.com>
* i2c: nomadik: adopt pinctrl supportPatrice Chotard2013-01-281-0/+89
| | | | | | | | | | | | | | | | | | | 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>
* i2c: at91: add of_device_id entry for at91rm9200Joachim Eastwood2013-01-281-0/+3
| | | | | | Signed-off-by: Joachim Eastwood <manabian@gmail.com> Acked-by: Ludovic Ddesroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: tegra: add support for Tegra114 SoCLaxman Dewangan2013-01-281-14/+63
| | | | | | | | | | | | | | | | NVIDIA's Tegra114 has following enhanced feature in i2c controller: - Enable/disable control for per packet transfer complete interrupt. Earlier SoCs could not disable this. - Single clock source for standard/fast and HS mode clock speed. The clock divisor for fast/standard mode is added into the i2c controller to meet the HS and standard/fast mode of clock speed from single source. Add support for the above feature to make it functional on T114 SOCs. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c-designware: add support for Intel LynxpointMika Westerberg2013-01-281-3/+46
| | | | | | | | | | | 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>
* i2c-designware: add minimal support for runtime PMMika Westerberg2013-01-281-0/+10
| | | | | | | | | | | | | 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>
* i2c-designware: always set the STOP bit after last byteMika Westerberg2013-01-281-2/+14
| | | | | | | | | | | | | | | | 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>
* i2c: nforce2: fix coding style issuesLaurent Navet2013-01-281-76/+76
| | | | | | | | | | | | | | | | | | avoid these checkpatch.pl issues : - ERROR: "foo * bar" should be "foo *bar" - ERROR: switch and case should be at the same indent - ERROR: "(foo*)" should be "(foo *)" - ERROR: do not use assignment in if condition - ERROR: space required before the open parenthesis '(' - WARNING: suspect code indent for conditional statements - WARNING: quoted string split across lines - WARNING: space prohibited between function name and open parenthesis '(' - WARNING: line over 80 characters also add spaces around some "+", "=", "*" Signed-off-by: Laurent Navet <laurent.navet@gmail.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c-designware: add missing MODULE_LICENSEMika Westerberg2013-01-221-0/+4
| | | | | | | | The driver can also be built as a module so add MODULE_LICENSE for it. In addition add MODULE_DESCRIPTION as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: omap: fix draining irq handlingAaro Koskinen2013-01-221-2/+2
| | | | | | | | | | | | | | | | | | Commit 0bdfe0cb803dce699ff337c35d8e97ac355fa417 (i2c: omap: sanitize exit path) changed the interrupt handler to exit early and complete the transfer after the draining IRQ is handled. As a result, the ARDY may not be cleared properly, and it may cause all future I2C transfers to timeout with "timeout waiting for bus ready". This is reproducible at least with N900 when twl4030_gpio makes a long write (> FIFO size) during the probe (http://marc.info/?l=linux-omap&m=135818882610432&w=2). The fix is to continue until we get ARDY interrupt that completes the transfer. Tested with 3.8-rc4 + N900: 20 boots in a row without errors; without the patch the problem triggers after few reboots. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: omap: errata i462: fix incorrect ack for arbitration lost interruptAaro Koskinen2013-01-221-1/+1
| | | | | | | | | | | The errata handling function acks wrong interrupt in case of "Arbitration lost". Fix it. Discovered during code review, the real impact of the bug is unknown. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: sirf: register i2c_client from dt child-nodes in probe entryBarry Song2013-01-221-0/+4
| | | | | | | | | in probe() entry of i2c_driver, set the of node of adapter and call of_i2c_register_devices to register all i2c_client from dt child-nodes Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: mxs: Fix type of error codeFabio Estevam2013-01-221-1/+1
| | | | | | | | | | | | | | cmd_err is used to handle error code, so it should not be unsigned. This fixes the following warning when building with W=1 option: drivers/i2c/busses/i2c-mxs.c: In function 'mxs_i2c_xfer_msg': drivers/i2c/busses/i2c-mxs.c:331:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: stable@kernel.org
* i2c: mxs: Fix misuse init_completionMarek Vasut2013-01-211-1/+3
| | | | | | | | | | | | | | | | | | | The init_completion() call does reinit not only the variable carrying the flag that the completion finished, but also initialized the waitqueue associated with the completion. On the contrary, the INIT_COMPLETION() call only reinits the flag. In case there was anything still stuck in the waitqueue, subsequent call to init_completion() would be able to create possible race condition. This patch uses the proper function and moves init_completion() into .probe() call of the driver, to be issued only once. Note that such scenario is impossible, since two threads can never enter the mxs_i2c_xfer_msg(), since whole this section is protected by mutex in I2C core. This by no means allows this issue to exit though. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: remove __dev* attributes from subsystemBill Pemberton2012-12-2252-236/+230
| | | | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> (for ocores and mux-gpio) Acked-by: Havard Skinnemoen <hskinnemoen@gmail.com> (for i2c-gpio) Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> (for puf3) Acked-by: Barry Song <baohua.song@csr.com> (for sirf) Reviewed-by: Jean Delvare <khali@linux-fr.org> [wsa: Fixed "foo* bar" flaws while we are here] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* Merge branch 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linuxLinus Torvalds2012-12-1812-306/+1122
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull i2c-embedded changes from Wolfram Sang: - CBUS driver (an I2C variant) - continued rework of the omap driver - s3c2410 gets lots of fixes and gains pinctrl support - at91 gains DMA support - the GPIO muxer gains devicetree probing - typical fixes and additions all over * 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linux: (45 commits) i2c: omap: Remove the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE flag i2c: at91: add dma support i2c: at91: change struct members indentation i2c: at91: fix compilation warning i2c: mxs: Do not disable the I2C SMBus quick mode i2c: mxs: Handle i2c DMA failure properly i2c: s3c2410: Remove recently introduced performance overheads i2c: ocores: Move grlib set/get functions into #ifdef CONFIG_OF block i2c: s3c2410: Add fix for i2c suspend/resume i2c: s3c2410: Fix code to free gpios i2c: i2c-cbus-gpio: introduce driver i2c: ocores: Add support for the GRLIB port of the controller and use function pointers for getreg and setreg functions i2c: ocores: Add irq support for sparc i2c: omap: Move the remove constraint ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049 i2c: s3c2410: do not special case HDMIPHY stuck bus detection i2c: s3c2410: use exponential back off while polling for bus idle i2c: s3c2410: do not generate STOP for QUIRK_HDMIPHY i2c: s3c2410: grab adapter lock while changing i2c clock i2c: s3c2410: Add support for pinctrl ...
| * i2c: omap: Remove the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE flagShubhrajyoti D2012-11-281-2/+1
| | | | | | | | | | | | | | | | | | The OMAP_I2C_FLAG_RESET_REGS_POSTIDLE is not used anymore in the i2c driver. Remove the flag. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: at91: add dma supportLudovic Desroches2012-11-241-8/+298
| | | | | | | | | | | | | | | | | | | | | | | | Add dma support for Atmel TWI which is available on sam9x5 and later. When using dma for reception, you have to read only n-2 bytes. The last two bytes are read manually. Don't doing this should cause to send the STOP command too late and then to get extra data in the receive register. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: at91: change struct members indentationLudovic Desroches2012-11-241-15/+15
| | | | | | | | | | | | | | | | Replace tabs for struct members indentation by space to minimise line changes when adding new members which would require extra tabs to keep alignment. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: at91: fix compilation warningLudovic Desroches2012-11-241-1/+1
| | | | | | | | | | | | | | | | | | This patch fixes the following warning: drivers/i2c/busses/i2c-at91.c: In function ‘at91_twi_get_driver_data’: drivers/i2c/busses/i2c-at91.c:411:3: warning: return discards ‘const’ qualifier from pointer target type [enabled by default] Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: mxs: Do not disable the I2C SMBus quick modeMarek Vasut2012-11-221-1/+1
| | | | | | | | | | | | | | | | | | There is no reason to disable the I2C SMBus quick mode on this IP block. Enable it. This essentially fixes the problem with the "i2c-detect" command for probing the bus. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: mxs: Handle i2c DMA failure properlyMarek Vasut2012-11-221-0/+2
| | | | | | | | | | | | | | | | Properly terminate the DMA transfer in case the DMA PIO transfer or setup fails for any reason. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Remove recently introduced performance overheadsMark Brown2012-11-221-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The changes in "i2c-s3c2410: use exponential back off while polling for bus idle" remove the initial busy wait for I2C transfers to complete and replace it with usleep_range() calls which will schedule. Since for older SoCs I2C transfers would usually complete within an extremely small number of CPU cycles there is a win from not having to schedule. This happens because on the older SoCs the cores run at a smaller multiple of the speeds that the I2C bus is operating at; on more modern SoCs the busy wait is less likely to be effective. Fix the issue by restoring the busy wait, reducing the number of spins from 20 to 3 which covers the overwhelming majority of I2C transfers on the SoCs where the busy wait is effective. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Olof Johansson <olof@lixom.net> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: ocores: Move grlib set/get functions into #ifdef CONFIG_OF blockAndreas Larsson2012-11-221-34/+34
| | | | | | | | | | | | | | | | | | | | This moves the grlib set and get functions into the #ifdef CONFIG_OF block to avoid warnings of unimplemented functions when compiling with -Wunused-function when CONFIG_OF is not defined. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Add fix for i2c suspend/resumeAbhilash Kesavan2012-11-191-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The I2C driver makes a gpio_request during initialization. This request happens again on resume and fails due to the earlier successful request. Re-factor the code to only initialize the gpios during probe. Errors on resume without this: [ 16.020000] s3c-i2c s3c2440-i2c.0: gpio [42] request failed [ 16.020000] s3c-i2c s3c2440-i2c.1: gpio [44] request failed [ 16.020000] s3c-i2c s3c2440-i2c.2: gpio [6] request failed Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Fix code to free gpiosAbhilash Kesavan2012-11-191-0/+1
| | | | | | | | | | | | | | Store the requested gpios so that they can be freed on error/removal. Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: i2c-cbus-gpio: introduce driverAaro Koskinen2012-11-193-0/+311
| | | | | | | | | | | | | | | | | | | | | | | | | | Add i2c driver to enable access to devices behind CBUS on Nokia Internet Tablets. The patch also adds CBUS I2C configuration for N8x0 which is one of the users of this driver. Acked-by: Felipe Balbi <balbi@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: ocores: Add support for the GRLIB port of the controller and use ↵Andreas Larsson2012-11-161-18/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function pointers for getreg and setreg functions The registers in the GRLIB port of the controller are 32-bit and in big endian byte order. The PRELOW and PREHIGH registers are merged into one register. The subsequent registers have their offset decreased accordingly. Hence the register access needs to be handled in a non-standard manner using custom getreg and setreg functions. Add setreg and getreg functions for different register widths and let oc_setreg and oc_getreg use function pointers to call the appropriate functions. A type is added as the data of the of match table entries. A new entry with a different compatible string is added to the table. The type of that entry triggers usage of the custom grlib functions by setting the setreg and getreg function pointers. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: ocores: Add irq support for sparcAndreas Larsson2012-11-161-5/+6
| | | | | | | | | | | | | | | | | | | | | | Add sparc support by using platform_get_irq instead of platform_get_resource. There are no platform resources of type IORESOURCE_IRQ for sparc, but platform_get_irq works for sparc. In the non-sparc case platform_get_irq internally uses platform_get_resource. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: Move the remove constraintShubhrajyoti D2012-11-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Currently we just queue the transfer and release the qos constraints, however we do not wait for the transfer to complete to release the constraint. Move the remove constraint after the bus busy as we are sure that the transfers are completed by then. Acked-by: Jean Pihet <j-pihet@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: do not special case HDMIPHY stuck bus detectionDaniel Kurtz2012-11-161-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit "i2c-s3c2410: Add HDMIPHY quirk for S3C2440" added support for HDMIPHY with some special handling in s3c24xx_i2c_set_master: "due to unknown reason (probably HW bug in HDMIPHY and/or the controller) a transfer fails to finish. The controller hangs after sending the last byte, the workaround for this bug is resetting the controller after each transfer" The "unknown reason" was that the proper sequence for generating a STOP condition wasn't being followed as per the datasheet. Since this is fixed by "PATCH: i2c-s3c2410: do not generate STOP for QUIRK_HDMIPHY buses", remove the special handling. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: use exponential back off while polling for bus idleDaniel Kurtz2012-11-161-20/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, the i2c controller has finished emitting the i2c STOP before the driver reaches the bus idle polling loop. Optimize for this most common case by reading IICSTAT first and potentially skipping the loop. If the cpu is faster than the hardware, we wait for bus idle in a polling loop. However, since the duration of one iteration of the loop is dependent on cpu freq, and this i2c IP is used on many different systems, use a time based loop timeout (5 ms). We would like very low latencies to detect bus idle for the normal 'fast' case. However, if a device is slow to release the bus for some reason, it could hold off the STOP generation for up to several milliseconds. Rapidly polling for bus idle would seriously load the CPU while waiting for it to release the bus. So, use a partial exponential backoff as a compromise between idle detection latency and cpu load. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: do not generate STOP for QUIRK_HDMIPHYDaniel Kurtz2012-11-161-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The datasheet says that the STOP sequence should be: 1) I2CSTAT.5 = 0 - Clear BUSY (or 'generate STOP') 2) I2CCON.4 = 0 - Clear IRQPEND 3) Wait until the stop condition takes effect. 4*) I2CSTAT.4 = 0 - Clear TXRXEN Where, step "4*" is only for buses with the "HDMIPHY" quirk. However, after much experimentation, it appears that: a) normal buses automatically clear BUSY and transition from Master->Slave when they complete generating a STOP condition. Therefore, step (3) can be done in doxfer() by polling I2CCON.4 after starting the STOP generation here. b) HDMIPHY bus does neither, so there is no way to do step 3. There is no indication when this bus has finished generating STOP. In fact, we have found that as soon as the IRQPEND bit is cleared in step 2, the HDMIPHY bus generates the STOP condition, and then immediately starts transferring another data byte, even though the bus is supposedly stopped. This is presumably because the bus is still in "Master" mode, and its BUSY bit is still set. To avoid these extra post-STOP transactions on HDMI phy devices, we just disable Serial Output on the bus (I2CSTAT.4 = 0) directly, instead of first generating a proper STOP condition. This should float SDA & SCK terminating the transfer. Subsequent transfers start with a proper START condition, and proceed normally. The HDMIPHY bus is an internal bus that always has exactly two devices, the host as Master and the HDMIPHY device as the slave. Skipping the STOP condition has been tested on this bus and works. Also, since we disable the bus directly from the isr, we can skip the bus idle polling loop at the end of doxfer(). Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: grab adapter lock while changing i2c clockDaniel Kurtz2012-11-161-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We probably don't want to change I2C frequency while a transfer is in progress. The current implementation grabs a spinlock, but that only protected the writes to IICCON when starting a message, it didn't protect against clock changes in the middle of a transaction. Note: The i2c-core already grabs the adapter lock before calling s3c24xx_i2c_doxfer(), which ensures that only one caller is issuing a xfer at a time. This means it is not necessary to disable interrupts (spin_lock_irqsave) when changing frequencies, since there won't be any i2c interrupts if there is no on-going xfer. Lastly, i2c_lock_adapter() may cause the cpufreq_transition to sleep if if a xfer is in progress, but this is ok since cpufreq notifiers are called in a kernel thread, and there are already cases where it could sleep, such as when using i2c to update the output of a voltage regulator. Note: the cpufreq part of this change has no functional affect on exynos, where the i2c clock is independent of the cpufreq. But, there is a slight perfomance boost since we no longer need to lock/unlock an additional spinlock. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Add support for pinctrlTomasz Figa2012-11-161-4/+8
| | | | | | | | | | | | | | | | | | This patch adds support for pin configuration using pinctrl subsystem to the i2c-s3c2410 driver. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Convert to devm_request_and_ioremap()Mark Brown2012-11-161-28/+7
| | | | | | | | | | | | | | A small code saving and less error handling to worry about. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: s3c2410: Refactor ifdefs for PM_SLEEPMark Brown2012-11-161-1/+5
| | | | | | | | | | | | | | | | | | | | Use the PM_SLEEP ifdef for system suspend and resume. This is partly in preparation for adding runtime operations and partly because a user may in theory choose to enable runtime suspend but not system suspend. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: i2c-sh_mobile: fix spurious transfer request timed outShinya Kuribayashi2012-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that any of preceding register write operations to the I2C hardware block reached the module, and the write data is reflected in the registers, before leaving the interrupt handler. Otherwise, we'll suffer from spurious WAIT interrupts that lead to 'Transfer request timed out' message, and the transaction failed. Reported-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com> Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: i2c-sh_mobile: support I2C hardware block with a faster operating clockShinya Kuribayashi2012-11-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On newer SH-/R-Mobile SoCs, a clock supply to the I2C hardware block, which is used to generate the SCL clock output, is getting faster than before, while on the other hand, the SCL clock control registers, ICCH and ICCL, stay unchanged in 9-bit-wide (8+1). On such silicons, the internal SCL clock counter gets incremented every 2 clocks of the operating clock. This patch makes it configurable through platform data. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: i2c-sh_mobile: optimize ICCH/ICCL values according to I2C bus speedShinya Kuribayashi2012-11-161-49/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICCH/ICCL values is supposed to be calculated/optimized to strictly meet the timing specs required by the I2C standard. The resulting I2C bus speed does not matter at all, if it's less than 100 or 400 kHz. With this change, sh_mobile_i2c_icch() is virtually identical to sh_mobile_i2c_iccl(), but they're providing good descriptions of SH-/R-Mobile I2C hardware spec, and I'd leave them as separated. Also fix a typo in the comment, print icch/iccl values at probe, etc. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> [wsa: squashed two patches for bisectability] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: i2c-sh_mobile: calculate clock parameters at driver probing timeShinya Kuribayashi2012-11-161-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently SCL clock parameters (ICCH/ICCL) are calculated in activate_ch(), which gets called every time sh_mobile_i2c_xfer() is processed, while each I2C bus speed is system-defined and in general those parameters do not have to be updated over I2C transactions. The only reason I could see having it transaction-time is to adjust ICCH/ICCL values according to the operating frequency of the I2C hardware block, in the face of DFS (Dynamic Frequency Scaling). However, this won't be necessary. The operating frequency of the I2C hardware block can change _even_ in the middle of I2C transactions. There is no way to prevent it from happening, and I2C hardware block can work with such dynamic frequency change, of course. Another is that ICCH/ICCL clock parameters optimized for the faster operating frequency, can also be applied to the slower operating frequency, as long as slave devices work. However, the converse is not true. It would violate SCL timing specs of the I2C standard. What we can do now is to calculate the ICCH/ICCL clock parameters according to the fastest operating clock of the I2C hardware block. And if that's the case, that calculation should be done just once at driver-module-init time. This patch moves ICCH/ICCL calculating part from activate_ch() into sh_mobile_i2c_init(), and call it from sh_mobile_i2c_probe(). Note that sh_mobile_i2c_init() just prepares clock parameters using the clock rate and platform data provided, but does _not_ make any hardware I/O accesses. We don't have to care about run-time PM maintenance here. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: don't save a value only needed for read-clearingWolfram Sang2012-11-141-2/+1
| | | | | | | | | | Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
| * i2c: omap: cleanup the sysc writeShubhrajyoti D2012-11-141-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently after the reset the sysc is written with hardcoded values. The patch reads the sysc register and writes back the same value after reset. - Some unnecessary rev checks can be optimised. - Also due to whatever reason the hwmod flags are changed we will not reset the values. - In some of the cases the minor values of the 2430 register is different(0x37) in that case the autoidle setting may be missed. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: Restore i2c context alwaysShubhrajyoti D2012-11-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the restore is done based on the flag OMAP_I2C_FLAG_RESET_REGS_POSTIDLE. This helps the following - The driver is always capable of restoring regardless of the off mode support being there or not. - While testing omap2430 it is found that in case of certain error paths (timeout) a reset is done. However the restore never happens as it is dependent on the POSTIDLE flag. The other option would be to call a restore in the reset case. As there are only a few registers to be restored the penalty in the idle case should not be much. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: make reset a seperate functionShubhrajyoti D2012-11-141-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | Implement reset as a separate function. This will enable us to make sure that we don't do the calculation again on every transfer. Also at probe the reset is not added as the hwmod is doing that for us. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: re-factor omap_i2c_init functionShubhrajyoti D2012-11-141-40/+35
| | | | | | | | | | | | | | | | | | | | re-factor omap_i2c_init() so that we can re-use it for resume. While at it also remove the bufstate variable as we write it in omap_i2c_resize_fifo for every transfer. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * ARM: i2c: omap: Remove the i207 errata flagShubhrajyoti D2012-11-141-2/+1
| | | | | | | | | | | | | | | | | | The commit [i2c: omap: use revision check for OMAP_I2C_FLAG_APPLY_ERRATA_I207] uses the revision id instead of the flag. So the flag can be safely removed. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: remove the dtrevShubhrajyoti D2012-11-141-7/+5
| | | | | | | | | | | | | | | | | | The dtrev is used only for the comments. Remove the same and use the scheme instead to know if it is version2. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
| * i2c: omap: use revision check for OMAP_I2C_FLAG_APPLY_ERRATA_I207Shubhrajyoti D2012-11-141-1/+2
| | | | | | | | | | | | | | | | | | The errata i207 is enabled for 2430 and 3xxx. Use the revision check to enable the erratum instead. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
OpenPOWER on IntegriCloud