https://github.com/torvalds/linux
Revision 9ea359f7314132cbcb5a502d2d8ef095be1f45e4 authored by Grygorii Strashko on 01 December 2014, 15:34:04 UTC, committed by Wolfram Sang on 04 December 2014, 18:25:31 UTC
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 cda2109a26eb ("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>
Cc: stable@kernel.org
1 parent 7cc78f8
Raw File
Tip revision: 9ea359f7314132cbcb5a502d2d8ef095be1f45e4 authored by Grygorii Strashko on 01 December 2014, 15:34:04 UTC
i2c: davinci: generate STP always when NACK is received
Tip revision: 9ea359f
Kconfig.debug
config DEBUG_PAGEALLOC
	bool "Debug page memory allocations"
	depends on DEBUG_KERNEL
	depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
	depends on !KMEMCHECK
	select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC
	select PAGE_GUARD if ARCH_SUPPORTS_DEBUG_PAGEALLOC
	---help---
	  Unmap pages from the kernel linear mapping after free_pages().
	  This results in a large slowdown, but helps to find certain types
	  of memory corruption.

	  For architectures which don't enable ARCH_SUPPORTS_DEBUG_PAGEALLOC,
	  fill the pages with poison patterns after free_pages() and verify
	  the patterns before alloc_pages().  Additionally,
	  this option cannot be enabled in combination with hibernation as
	  that would result in incorrect warnings of memory corruption after
	  a resume because free pages are not saved to the suspend image.

config WANT_PAGE_DEBUG_FLAGS
	bool

config PAGE_POISONING
	bool
	select WANT_PAGE_DEBUG_FLAGS

config PAGE_GUARD
	bool
	select WANT_PAGE_DEBUG_FLAGS
back to top