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 8515EC433F5 for ; Wed, 23 Feb 2022 02:34:50 +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=yDLyQdmTLRjaW9+qaJR4A3fnyBKyoNwhYJgjExXcOI8=; b=Kh9DxoUmI7zofY Vw7YP7aomQdS+J4we5TqJhhO0FAfokNo2Q8MqJBZQ/KP28wM4JuL/BuS4GRkD0q1LJbuKuQV2n4Qe O3RpHh0+ioujZ1pNRQ0pOvmuFLiBAUp2ejebcfbe9Ya0JW6I5I3pACEQcWcRG3yV07UG3u+PRvyYY kdOyCkeV1gjBLotJc496GRdcbhWBc3Oo4wpl19DaQYd7Vw7AL+FpIJQHofDi6X/MUIa7/N7Im6TPy f0VkJf/UNa96GUuJU5A9vAfOzEtcA0Zz/jEMhdj3ROtJ5RELsdz3v7SooFXtW/hdLNo8TLd8Qnh9u rwM+j0JKNf/+eCLro2cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMhT1-00CKet-Se; Wed, 23 Feb 2022 02:33:24 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMhSN-00CKL7-Iv; Wed, 23 Feb 2022 02:32:45 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 665C861526; Wed, 23 Feb 2022 02:32:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4514CC340E8; Wed, 23 Feb 2022 02:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645583561; bh=p3NpOOloCl+up0CATJ/0J6lmGf3pYfYwJI3ux1MhqfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/Roze0u7XsorpaiXZJk500RKk4DMig+cXtx51Sac+VNX/5SnekYyAhH/sstxdX89 IVJyTp+1VQaTqGvTYD2BwkY74c8pkn0Y6iYTkqLfGmc4yoRhzGrWsAjB+XJvY0uOnv /vburDZRQ1nxHLf5mh310Ql+z/ndIf/5iwRqVgnMnKBub7Uqv9jJ45efQiZtb83+vQ XG0OHJKe/Wu8acMoca80tnaQptXUsHwUqVHWNtH+LKqnvfp7MMqlYTSY5zP76SaqIO aiQ0hGzfrsVBlm8u9PgQg3KsbV1CEmcZLl6MSBNf0DYPl3QG24/4DDP1zk4bfMRuW5 DX2u9okNHgixg== 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.14 03/10] i2c: bcm2835: Avoid clock stretching timeouts Date: Tue, 22 Feb 2022 21:32:26 -0500 Message-Id: <20220223023233.242468-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223023233.242468-1-sashal@kernel.org> References: <20220223023233.242468-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_183243_681113_4B4CC8D9 X-CRM114-Status: GOOD ( 13.91 ) 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 4d19254f78c8a..db1ab9ccc30e7 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) @@ -398,6 +403,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