Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5382621rdb; Wed, 13 Dec 2023 07:14:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSw5aIFNqX7D0S/BvN9MjtIgf9rA5P1ngMBnlsICngXzXFBG1PXdsutmVnZRP3o3dlVY3l X-Received: by 2002:a05:6a00:27a1:b0:6ce:2df5:48b with SMTP id bd33-20020a056a0027a100b006ce2df5048bmr4453921pfb.32.1702480444137; Wed, 13 Dec 2023 07:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702480444; cv=none; d=google.com; s=arc-20160816; b=YvWLiB7HXt0vN4kJe6nk8CNMzN/+/h+7EYhyZ48D0JQHKu+zpHhZrEOWn1BhEO0lfE 0BTTisPQ4csvfKgaT4a/YrWSljViUXEtFuVH1XHZgsfPjhAcdEQCY3eRsPvyYu0UsSKC X0H9b1ZMS0zhtgluZlGKaUX2DD4iNG8WoQwexhpufqKNWpxt5cHptHfU76LKqhKQ5QkQ aHDy1GEtT7EG9iryoX0GhoJLSovQo+6m/bw0Dd2bGV4LuNgOEUcg37K0XRRYYtXon/vp dL9CbvBEUWrKZMQTr00nzcJobqjC3frddM24ih5/B989/5HtQ2nzY3LeanU498ZxrMnp zYww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=h0QNwsIsxCVCFnb61YiC0y8uyBswFifMu55wtofMhKA=; fh=TrF4wlLHwPbNRvrizfxZNtbZjmnTJlsY86m5mAbhric=; b=0GnsVoaqH8u4rcygvgkGSCv3Z24pt7a2TMeIKwWIr2A1vgEDrA0fUMJ0ix5IH5L7IR j+FVvGJmHaqSHDj0Zeg8xeh3q6nKz8ZISBzi8py/99no0Jv9hLiNfNMaw2u9VWoNdeDF hvTVE3E23OTypYPGjQVWux5U8qQAhEXG6r92eCdvtfrd7nPF38wNfud7UdmlIwDGZnAd 15qyjiChMw8z9RosUfbymZlvcaowqIfYJO5sEFtCQV6OTBuHlGZL83o7yABqogy2x1wH CGSLJ48VEGSIwI+P8uLkzgpUypvd8PwqngKCTlG1/mxmxqDQxtRZO+3xhLu3w/Fv/jno fQXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UfZX8Aj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ko12-20020a056a00460c00b006d09877dca8si4603213pfb.60.2023.12.13.07.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:14:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UfZX8Aj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id ADDCE824E7AF; Wed, 13 Dec 2023 07:14:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442095AbjLMPNc (ORCPT + 99 others); Wed, 13 Dec 2023 10:13:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442258AbjLMPNa (ORCPT ); Wed, 13 Dec 2023 10:13:30 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1568CB0; Wed, 13 Dec 2023 07:13:37 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BDBP9iL006807; Wed, 13 Dec 2023 07:13:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=h0QNwsIs xCVCFnb61YiC0y8uyBswFifMu55wtofMhKA=; b=UfZX8Aj0ErqBfh2mlJAzJlfz 9i+DM64msaTL1/IclVsrPG3bCuoYvvxngzgaNMu60pp3NanQn7aLo/TY3sVbUrfE vVHtw67pa5jwOceuNy6yNB3XKjcLy6Yc9IF3iJwfwTT0CojkWTObKCPQq3tf7JaW 0G+YIqfdQ9G3ejop6rLicLMw3Tnw7Jl8YfbqqghvewWRRrCNJ5spNyUGTQ9lNBKE b1zcUEUizrMTj40YwsFbYx9BU9tjYQB1a8U7zb8jxuhXlR8cl9cmGIa1b5KXfdvG ayrqrnoqqEai4i5DyKT1jRDXEH8U0VBLCBlWmo8rsbnK3cEGMFr2dFw7u0uXbg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uybqmgras-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 07:13:23 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 13 Dec 2023 07:13:21 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 13 Dec 2023 07:13:21 -0800 Received: from dc3lp-swdev041.marvell.com (dc3lp-swdev041.marvell.com [10.6.60.191]) by maili.marvell.com (Postfix) with ESMTP id 97E905B6943; Wed, 13 Dec 2023 07:13:19 -0800 (PST) From: Elad Nachman To: , , , CC: , Subject: [PATCH v3 0/1] i2c: busses: i2c-mv64xxx: fix arb-loss i2c lock Date: Wed, 13 Dec 2023 17:13:11 +0200 Message-ID: <20231213151312.1165115-1-enachman@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: fW9T9wHimsPpN25zWGrXT3Fd-nLuGaFD X-Proofpoint-ORIG-GUID: fW9T9wHimsPpN25zWGrXT3Fd-nLuGaFD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:14:01 -0800 (PST) From: Elad Nachman i2c: busses: i2c-mv64xxx: fix arb-loss i2c lock Some i2c slaves, mainly SFPs, might cause the bus to lose arbitration while slave is in the middle of responding. This means that the i2c slave has not finished the transmission, but the master has already finished toggling the clock, probably due to the slave missing some of the master's clocks. This was seen with Ubiquity SFP module. This is typically caused by slaves which do not adhere completely to the i2c standard. The solution is to change the I2C mode from mpps to gpios, and toggle the i2c_scl gpio to emulate bus clock toggling, so slave will finish its transmission, driven by the manual clock toggling, and will release the i2c bus. v3: 1) Remove unused / un-initialized variable 2) Replace devm_pinctrl_get() with pinctrl_get() and pinctrl_put() pair in probe and device removal. 3) Replace atomic sleeps with usleep_range() 4) Rework comment to start with a capital letter v2: 1) Explain more about cause of issue in commit message 2) Change variable name to something clearer 3) Leave space between comments 4) Remove redundant blank line 5) Add error message if pinctrl get failed 6) Move gpio request to probe function 7) Fix commenting style 8) Explain in comments why 10 togglings are required 9) Move from mdelay to udelay, reducing delay time 10) Explain in comments what is the value written to the reset register. 11) Explain why fallthrough is required (generate stop condition) 12) Explain why in case of missing i2c arbitration loss details, driver probe will not fail, in order to be backward compatible with older dts files Elad Nachman (1): i2c: busses: i2c-mv64xxx: fix arb-loss i2c lock drivers/i2c/busses/i2c-mv64xxx.c | 118 ++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) -- 2.25.1