linux/drivers/i2c/busses
Grygorii Strashko d959b0f790 i2c: davinci: generate STP always when NACK is received
commit 9ea359f731 upstream.

According to I2C specification the NACK should be handled as follows:
"When SDA remains HIGH during this ninth clock pulse, this is defined as the Not
Acknowledge signal. The master can then generate either a STOP condition to
abort the transfer, or a repeated START condition to start a new transfer."
[I2C spec Rev. 6, 3.1.6: http://www.nxp.com/documents/user_manual/UM10204.pdf]

Currently the Davinci i2c driver interrupts the transfer on receipt of a
NACK but fails to send a STOP in some situations and so makes the bus
stuck until next I2C IP reset (idle/enable).

For example, the issue will happen during SMBus read transfer which
consists from two i2c messages write command/address and read data:

S Slave Address Wr A Command Code A Sr Slave Address Rd A D1..Dn A P
<--- write -----------------------> <--- read --------------------->

The I2C client device will send NACK if it can't recognize "Command Code"
and it's expected from I2C master to generate STP in this case.
But now, Davinci i2C driver will just exit with -EREMOTEIO and STP will
not be generated.

Hence, fix it by generating Stop condition (STP) always when NACK is received.

This patch fixes Davinci I2C in the same way it was done for OMAP I2C
commit cda2109a26 ("i2c: omap: query STP always when NACK is received").

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reported-by: Hein Tibosch <hein_tibosch@yahoo.es>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-16 09:34:26 -08:00
..
Kconfig i2c: i801: enable Intel BayTrail SMBUS 2014-06-07 10:28:19 -07:00
Makefile i2c: Add bus driver for for OSIF USB i2c device. 2014-01-13 13:56:56 +01:00
i2c-acorn.c i2c: acorn: is tristate and should use module.h 2014-01-24 18:21:11 +01:00
i2c-ali15x3.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-ali1535.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-ali1563.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-amd756-s4882.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-amd756.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-amd8111.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-at91.c i2c: at91: don't account as iowait 2014-11-14 09:00:13 -08:00
i2c-au1550.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-bcm-kona.c i2c: i2c-bcm-kona: Fix module build 2013-11-26 14:00:57 +01:00
i2c-bcm2835.c i2c: bcm2835: Linking platform nodes to adapter nodes 2013-11-28 09:47:53 +01:00
i2c-bfin-twi.c i2c: bfin-twi: Remove casting the return value which is a void pointer 2013-09-30 06:02:33 +02:00
i2c-cbus-gpio.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-cpm.c i2c: cpm: Fix build by adding of_address.h and of_irq.h 2014-03-24 14:54:21 +01:00
i2c-davinci.c i2c: davinci: generate STP always when NACK is received 2014-12-16 09:34:26 -08:00
i2c-designware-core.c i2c: designware: Mask all interrupts during i2c controller enable 2014-06-07 10:28:27 -07:00
i2c-designware-core.h i2c: designware: make HCNT/LCNT values configurable 2013-08-28 11:11:10 +02:00
i2c-designware-pcidrv.c i2c: designware-pci: drop superfluous {get|put}_device 2013-04-19 20:22:10 +02:00
i2c-designware-platdrv.c Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-11-18 15:50:07 -08:00
i2c-diolan-u2c.c i2c: i2c-diolan-u2c: different usb endpoints for DLN-2-U2C 2013-11-26 13:49:33 +01:00
i2c-eg20t.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-elektor.c i2c: remove __dev* attributes from subsystem 2012-12-22 20:13:45 +01:00
i2c-exynos5.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-gpio.c i2c: Include linux/of.h header 2013-10-30 16:46:30 +01:00
i2c-highlander.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-hydra.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-i801.c i2c: i801: enable Intel BayTrail SMBUS 2014-06-07 10:28:19 -07:00
i2c-ibm_iic.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-ibm_iic.h
i2c-imx.c i2c: imx: propagate irq error code in probe 2014-01-03 17:40:38 +01:00
i2c-iop3xx.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-iop3xx.h i2c-iop3xx: add iomem annotation 2011-01-04 00:53:37 +00:00
i2c-isch.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-ismt.c i2c: ismt: use correct length when copy buffer 2014-10-05 14:52:11 -07:00
i2c-kempld.c i2c: Fix Kontron PLD prescaler calculation 2013-08-05 10:31:18 +02:00
i2c-mpc.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-mv64xxx.c i2c: mv64xxx: continue probe when clock-frequency is missing 2014-10-05 14:52:11 -07:00
i2c-mxs.c Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-11-18 15:50:07 -08:00
i2c-nforce2-s4985.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-nforce2.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-nomadik.c i2c: nomadik: remove platform data header 2014-01-09 23:02:42 +01:00
i2c-nuc900.c i2c: use dev_get_platdata() 2013-08-19 19:46:30 +02:00
i2c-ocores.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-octeon.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-omap.c i2c: omap: fix i207 errata handling 2014-12-16 09:34:26 -08:00
i2c-parport-light.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-parport.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-parport.h Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-pasemi.c i2c: remove __dev* attributes from subsystem 2012-12-22 20:13:45 +01:00
i2c-pca-isa.c i2c: remove __dev* attributes from subsystem 2012-12-22 20:13:45 +01:00
i2c-pca-platform.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-piix4.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-pmcmsp.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-pnx.c i2c: pnx: Use devm_*() functions 2014-01-16 11:15:50 +01:00
i2c-powermac.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-puv3.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-pxa-pci.c i2c: Remove unneeded xxx_set_drvdata(..., NULL) calls 2013-02-22 00:25:50 +01:00
i2c-pxa.c i2c: move OF helpers into the core 2013-08-23 10:22:20 +02:00
i2c-rcar.c i2c: rcar: bail out on zero length transfers 2014-06-07 10:28:27 -07:00
i2c-riic.c i2c: riic: add driver 2014-01-02 15:56:52 +01:00
i2c-robotfuzz-osif.c i2c: Add bus driver for for OSIF USB i2c device. 2014-01-13 13:56:56 +01:00
i2c-s3c2410.c i2c: s3c2410: resume race fix 2014-06-07 10:28:27 -07:00
i2c-s6000.c i2c: use dev_get_platdata() 2013-08-19 19:46:30 +02:00
i2c-s6000.h i2c: Change mail address of Oskar Schirmer 2012-05-17 15:15:56 +02:00
i2c-scmi.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-sh7760.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-sh_mobile.c i2c: sh_mobile: Convert to clk_prepare/unprepare 2013-10-31 12:45:44 +01:00
i2c-sibyte.c i2c/mips: Fix error return codes from Sibyte i2c bus driver 2010-07-10 09:42:47 +02:00
i2c-simtec.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-sirf.c i2c: sirf: retry 3 times as sometimes we get random noack and timeout 2013-08-28 11:46:03 +02:00
i2c-sis96x.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-sis630.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-sis5595.c i2c: remove __dev* attributes from subsystem 2012-12-22 20:13:45 +01:00
i2c-st.c Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-11-18 15:50:07 -08:00
i2c-stu300.c treewide: fix comments and printk msgs 2014-01-07 15:06:07 +01:00
i2c-taos-evm.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-tegra.c i2c: tegra: use reset framework 2013-12-11 16:44:04 -07:00
i2c-tiny-usb.c i2c: i2c-tiny-usb: Remove RobotFuzz USB vendor:product ID 2014-01-13 13:56:52 +01:00
i2c-versatile.c i2c: move OF helpers into the core 2013-08-23 10:22:20 +02:00
i2c-via.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-viapro.c Update Jean Delvare's e-mail address 2014-01-29 20:40:08 +01:00
i2c-viperboard.c i2c: viperboard: remove superfluous assignment 2014-01-09 22:18:33 +01:00
i2c-wmt.c Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-11-18 15:50:07 -08:00
i2c-xiic.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
i2c-xlr.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00
scx200_acb.c i2c: Remove unneeded xxx_set_drvdata(..., NULL) calls 2013-02-22 00:25:50 +01:00
scx200_i2c.c i2c: delete non-required instances of include <linux/init.h> 2014-01-24 18:24:31 +01:00