public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 3/9] i2c: bcm2835: Avoid clock stretching timeouts
       [not found] <20220223023300.242616-1-sashal@kernel.org>
@ 2022-02-23  2:32 ` Sasha Levin
  2022-02-23  2:32 ` [PATCH AUTOSEL 4.9 8/9] i2c: qup: allow COMPILE_TEST Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2022-02-23  2:32 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Eric Anholt, Stefan Wahren, Wolfram Sang, Sasha Levin, nsaenz,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	prabhakar.mahadev-lad.rj, linux-i2c, linux-rpi-kernel,
	linux-arm-kernel

From: Eric Anholt <eric@anholt.net>

[ Upstream commit 9495b9b31abe525ebd93da58de2c88b9f66d3a0e ]

The CLKT register contains at poweron 0x40, which at our typical 100kHz
bus rate means .64ms. But there is no specified limit to how long devices
should be able to stretch the clocks, so just disable the timeout. We
still have a timeout wrapping the entire transfer.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
BugLink: https://github.com/raspberrypi/linux/issues/3064
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-bcm2835.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 7ed09865cb4b9..4729c14b75017 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -28,6 +28,11 @@
 #define BCM2835_I2C_FIFO	0x10
 #define BCM2835_I2C_DIV		0x14
 #define BCM2835_I2C_DEL		0x18
+/*
+ * 16-bit field for the number of SCL cycles to wait after rising SCL
+ * before deciding the slave is not responding. 0 disables the
+ * timeout detection.
+ */
 #define BCM2835_I2C_CLKT	0x1c
 
 #define BCM2835_I2C_C_READ	BIT(0)
@@ -313,6 +318,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 	adap->dev.of_node = pdev->dev.of_node;
 	adap->quirks = &bcm2835_i2c_quirks;
 
+	/*
+	 * Disable the hardware clock stretching timeout. SMBUS
+	 * specifies a limit for how long the device can stretch the
+	 * clock, but core I2C doesn't.
+	 */
+	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0);
 	bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);
 
 	ret = i2c_add_adapter(adap);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH AUTOSEL 4.9 8/9] i2c: qup: allow COMPILE_TEST
       [not found] <20220223023300.242616-1-sashal@kernel.org>
  2022-02-23  2:32 ` [PATCH AUTOSEL 4.9 3/9] i2c: bcm2835: Avoid clock stretching timeouts Sasha Levin
@ 2022-02-23  2:32 ` Sasha Levin
  2022-02-24 22:39   ` Pavel Machek
  1 sibling, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2022-02-23  2:32 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wolfram Sang, Sasha Levin, krzysztof.kozlowski, robh,
	semen.protsenko, yangyicong, sven, jie.deng, bence98,
	lukas.bulwahn, linux-i2c

From: Wolfram Sang <wsa@kernel.org>

[ Upstream commit 5de717974005fcad2502281e9f82e139ca91f4bb ]

Driver builds fine with COMPILE_TEST. Enable it for wider test coverage
and easier maintenance.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 759c621a860a9..be4b7b1ad39b6 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -783,7 +783,7 @@ config I2C_PXA_SLAVE
 
 config I2C_QUP
 	tristate "Qualcomm QUP based I2C controller"
-	depends on ARCH_QCOM
+	depends on ARCH_QCOM || COMPILE_TEST
 	help
 	  If you say yes to this option, support will be included for the
 	  built-in I2C interface on the Qualcomm SoCs.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 4.9 8/9] i2c: qup: allow COMPILE_TEST
  2022-02-23  2:32 ` [PATCH AUTOSEL 4.9 8/9] i2c: qup: allow COMPILE_TEST Sasha Levin
@ 2022-02-24 22:39   ` Pavel Machek
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2022-02-24 22:39 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Wolfram Sang, krzysztof.kozlowski, robh,
	semen.protsenko, yangyicong, sven, jie.deng, bence98,
	lukas.bulwahn, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On Tue 2022-02-22 21:32:59, Sasha Levin wrote:
> From: Wolfram Sang <wsa@kernel.org>
> 
> [ Upstream commit 5de717974005fcad2502281e9f82e139ca91f4bb ]
> 
> Driver builds fine with COMPILE_TEST. Enable it for wider test coverage
> and easier maintenance.

I don't believe this is suitable for stable.

Best regards,
								Pavel
								
> +++ b/drivers/i2c/busses/Kconfig
> @@ -783,7 +783,7 @@ config I2C_PXA_SLAVE
>  
>  config I2C_QUP
>  	tristate "Qualcomm QUP based I2C controller"
> -	depends on ARCH_QCOM
> +	depends on ARCH_QCOM || COMPILE_TEST
>  	help
>  	  If you say yes to this option, support will be included for the
>  	  built-in I2C interface on the Qualcomm SoCs.
> -- 
> 2.34.1

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-24 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220223023300.242616-1-sashal@kernel.org>
2022-02-23  2:32 ` [PATCH AUTOSEL 4.9 3/9] i2c: bcm2835: Avoid clock stretching timeouts Sasha Levin
2022-02-23  2:32 ` [PATCH AUTOSEL 4.9 8/9] i2c: qup: allow COMPILE_TEST Sasha Levin
2022-02-24 22:39   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox