Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3914986rdb; Mon, 11 Dec 2023 04:02:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZMezcNEz0Onv0dDflMNoOnFNYfWrR2JqhRcI054rbkwuN43kf4f/SMdBxODb+aErUcQ5x X-Received: by 2002:a17:903:c3:b0:1d0:b24d:f933 with SMTP id x3-20020a17090300c300b001d0b24df933mr1451400plc.118.1702296168829; Mon, 11 Dec 2023 04:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702296168; cv=none; d=google.com; s=arc-20160816; b=anDVOEunlmL+Yo21bS968WYK7JpoASVIBqykUe9FAJsIFIT+U+pXaGfS6m66DH9UDG OSG5DH8ugMvK0fsuZIEYrrdruAO0clEcdL2XR9q3dAJXPAdxHXkbNWrWNu2rK6pPFSpF qkPtgTOC8f0OrQVVEIZQ/N6xcfChzxvz3LCboIfvWrIUBgbJniwOeFktB0aJhDR13P+w AyHo+AaE7wlHEb65eYh/pfYYYkh7WK+pW69O9sFtuAqX1D16HyFnk7JlemDJxoZGZkXa SOR32mcNCG52L4JTHmqSbcAc5pLSzXPXj+7ZT9Ijb+SkdEjF1Q4G9nhvLfquER9Cau6U sidQ== 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=UBOzKnXjyfY1FFkByFhlYlf7pTZMva2mc4yeIob4mNqZQV6wzEr7/LGEoaqwkvMy9T FFnuyp38LiIgwxF80fzp831ZLt8bOhSUqHPnKOJNj3gRpu9h+YU8aWAw0Rj61N1GdP0F 9nfR+db879fuuzezZa5cU38qaZXqsmNrJuynKhhxfaHDuMh+f44ubO21b3nBQjM1086h bmWgwa01flyMhlwvHXi5+/bw16b8KuQgExYqZqOHDCwB8xwwqu2M0rY8DuN15OgkWaJt lfME/kNSQtuRL4d0BuPc2bZyclkxjRFSf8JegtzQXNRrpe/6Yr139wDjIKFhlZfrW6TZ ocgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=awCT9xfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h13-20020a170902f7cd00b001d07d6916f4si5951277plw.592.2023.12.11.04.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 04:02:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=awCT9xfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 70A1F809E70B; Mon, 11 Dec 2023 04:02:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbjLKMCV (ORCPT + 99 others); Mon, 11 Dec 2023 07:02:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234851AbjLKMBt (ORCPT ); Mon, 11 Dec 2023 07:01:49 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81080137; Mon, 11 Dec 2023 04:01:40 -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 3BB9IEYK009898; Mon, 11 Dec 2023 04:01:36 -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=awCT9xfCMKHJgzaWicpcLmAs jqpxb/mwQpK+R3grVz1y1fz19XU3JY9JzCLkzWVWWg3nU5VTUuTPEhAPjGHL8HwV gAi37qrDqv2ka9m2TSpRZ9yp/gsm8wYgJCQ0R9ns797zPHkx6kYybjLOe745Ebkd CGYNWxwBLFqeMsOWtVh185ka3CFgUDaL/20qrVngQbGdsqIzyDCyutopq1i9vCS8 Jt0s2VpWbkdSV0tSBjkIqZVvKf0qTaavWBwb6JY/PVam6BTY+Hp7qERcZzud1EDm v/nYAiYeM5KpqbqheIhZHhtJxVMYOX9kh4iY9jHoDmdaOqvJACDm82sbea9qpQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uwyp4gfjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 04:01:36 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 11 Dec 2023 04:01:35 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 11 Dec 2023 04:01:34 -0800 Received: from dc3lp-swdev041.marvell.com (dc3lp-swdev041.marvell.com [10.6.60.191]) by maili.marvell.com (Postfix) with ESMTP id 530E63F7045; Mon, 11 Dec 2023 04:01:33 -0800 (PST) From: Elad Nachman To: , , , CC: , Subject: [PATCH v3 0/1] i2c: busses: i2c-mv64xxx: fix arb-loss i2c lock Date: Mon, 11 Dec 2023 14:01:28 +0200 Message-ID: <20231211120129.3719469-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-ORIG-GUID: _89VZfFsXvVH5A_7vJDI7Kvq921FjJ-J X-Proofpoint-GUID: _89VZfFsXvVH5A_7vJDI7Kvq921FjJ-J 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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 04:02:42 -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