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 5CE75C4332F for ; Wed, 23 Feb 2022 02:34:10 +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=cIrFbFKGw4MncD ZAMf+kWGCQk1XzuTfAOLFzVHetZfnKe602m3I3WQWAl2fAHfEWcUkwiYteFLUmpQozrwuZ9D0EQuA SylL81K0qe+lEdfmXPLoJKdQKsdW2P5iIuHtPxjB0a4cYf+cFUWh0MWMsjT7EXoO3AOjreM10IYPL Z2DBnSJG61jeM/VUCPALaTyCeDwVL0k3sivNFriHhE1QvWsOgkk7lmdQn9yKj4Ba/eMvk25fq/mmR pLJ4q74M6FReDlB4UvKr9UPkWXm2ecuROE+dPlajRAuEFxv/o5OCsoxE+RfS9wVEzstEfI1w8FPwA i2YOAkzOHySzd4rru0AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMhSQ-00CKMF-PK; Wed, 23 Feb 2022 02:32:47 +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 1nMhRj-00CJyz-HC; Wed, 23 Feb 2022 02:32:05 +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 D9ABAB81E0F; Wed, 23 Feb 2022 02:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17E0DC340F0; Wed, 23 Feb 2022 02:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645583521; bh=p3NpOOloCl+up0CATJ/0J6lmGf3pYfYwJI3ux1MhqfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XduFcMFnw7mqDat/7/8p6vvOQc5WvLGuI/D9SLzJHIwBVl8a7ZlB3nICgnMgsKer0 IZQoNqc1N+FxSlzBG4tqyMZgfQP89k4YeaoRXQityRkBgUEVncU/v+DGV0D1OD3gv4 eCGHFm7DavJ7dkQjwNMCCJCVK5qjmTOv0kPRQJJEOCK4LmLTzkT1rVDlBKFOCpYwt7 XKhgOoFoOMzxRrOH5bInAYMQAnMzgVf5t+jUaqs905Zv9OVkBS7OLdxxBiZert52yJ XZg/rnQzm7ykhl+l10TZAhSlbwyvgGUatemLsO7ORrn+WdFVu4XaZzJxjirwgpzU7j zeSfKbWRcCvkQ== 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.19 03/13] i2c: bcm2835: Avoid clock stretching timeouts Date: Tue, 22 Feb 2022 21:31:42 -0500 Message-Id: <20220223023152.242065-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223023152.242065-1-sashal@kernel.org> References: <20220223023152.242065-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_183203_749007_0C324D9F 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