Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF706C433F5 for ; Wed, 23 Feb 2022 02:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RXxV8cIlL2VsnaoKAuVgUjguaGvIUkhTzvE0NUSkuN0=; b=jhvHbkjL9XqNSf KnP/u+HppfBGCEfgRS9F87IPeYfl+SmIMsAoG3Ha5lBgqjOEjL/dybqlFJNyNKsT3FoIxPg10EFNk bhkPaEwSLR9l5m2g1VY6f6bnej0lgsyPhE2mXtS9d75UoHS/tswqe8SMuWLpzGSIB4zw4beIO+N8u ux2HtT9XUCB0AoqY1Mpxjf06OWcqF7ZotxEmmDHqhEVZgPvljRRQXjYf129OoQ+DjM/QWFTWb4JRs XBpTMUcO7pGOOHVRV2Gib+ErSISVE/2oyeIZixLlWs9oCKfFfzgQ0yjfNaaVXz5DHnE3ew8iWnvU3 ShPC3CzsQ6/9VsXGqBIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMhTW-00CKy8-1P; Wed, 23 Feb 2022 02:33:54 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMhSp-00CKYE-FM; Wed, 23 Feb 2022 02:33:14 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10BCCB81E11; Wed, 23 Feb 2022 02:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 447D4C340E8; Wed, 23 Feb 2022 02:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645583588; bh=0J4jcFKw6gaKR0MPzB8D3qoZdK16pSHJvlNpqL7WFAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKjhbzAMYJ2u58WEyfxI5D4sFnFSHHXxFVnuTmcp4+9c2U8v8odEUB1k6NiShHqv/ 1bSRtcI6I46kM293F0zE4erMdKQZA3NUwBUKzQ8xu9cD/PzxbHbY+jqJZHVTgqVxRZ qjFomkUz1es8uc0EV5v5m41EWsaI2TsFE8EDWxRiytSi479m7M6d/LFSk5GBx4PA2c 3A9QWSNwKB07+VNBFZzNNyrNDvbxR5Q5J73kztcQifRlEwHZLH2Zx5Yw1ckyKHSk1u NpKbfyFQ0B0Sga23byVNol0mirb6C84aanNqT4G86mM1L23diitaxR/pJY2EC9wULG oMR0B7rd+4KyQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Anholt , Stefan Wahren , Wolfram Sang , Sasha Levin , nsaenz@kernel.org, f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, prabhakar.mahadev-lad.rj@bp.renesas.com, linux-i2c@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 4.9 3/9] i2c: bcm2835: Avoid clock stretching timeouts Date: Tue, 22 Feb 2022 21:32:54 -0500 Message-Id: <20220223023300.242616-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223023300.242616-1-sashal@kernel.org> References: <20220223023300.242616-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_183311_742638_0A32A524 X-CRM114-Status: GOOD ( 14.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Eric Anholt [ 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 Signed-off-by: Stefan Wahren BugLink: https://github.com/raspberrypi/linux/issues/3064 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel