Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7438754rwl; Fri, 30 Dec 2022 08:28:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXu5aZX/sE+ql/nJ3u7lXLdWJY7rPvoFizIm+j7tgNai8cTnzAfpJm7XxGwcY96YR+zUN6zO X-Received: by 2002:a05:6a20:a6a6:b0:ad:d4d6:5c1d with SMTP id ba38-20020a056a20a6a600b000add4d65c1dmr47906107pzb.14.1672417690243; Fri, 30 Dec 2022 08:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672417690; cv=none; d=google.com; s=arc-20160816; b=qFg6/ZJe/3t//oJlEnyBbqomVq4whGLcNm+5X8XIh45DqzziPp4Rl33YxM7FDraAAd 0h+/sxZDhXn9dxOZmMfgCS7y2jNhmYM4IdJ9gYGkOwa44RiUcT+8N5J+n3okbVepBTwW SDaPjr1+lqpfs/2EvD/uWOHDkzmsJJhx3ut1GDRT8HpPQqgGPJ97ouo+wsBKyzYOqMVN sxonb/iGSeAP2XsT2xbJc91/o7NizFx1SCEiSMBDmgFAqSGnBv+nKke1+eQAJkfqQxdQ x4AYtXj4nUyJKDaf8otkT823dxnc7agm8CP2LG+HIm4c1jJEW4TRiKsnHcIZXKG22wpn 8Jew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=m6P0zONzxU9chK7NRT1WFXI5megihbipvjA12TKsR1k=; b=Sfq9Cmb73yDHQxII76GQ6nn1pqrU76T0OdlWfxmDdGsNVJKDS1GQgOKrgDJK4ItHn2 Xocur7SWlGlGICD6RUzpk3rCr6bJzl5yBzyvX4MyQ2odwFHsMRX5jZEpngF+gIjd909n tR8C0XZvQieKY2zRHaEPCvS0bFf16nSo3U9K4deE1kVivVeOW6fnJYTpz+UEIDhjxgma 1Lri1ClAlSZuayPw7OVIa8A8G/tTrLHKkJef3qlfjqcvkFZttiTYl4IvAMF/VwZ2HZA3 9ge4vgN6RsBNva/mk7TApzHrfaW1tee8Eox9Vp9Vu4jBbckzB9XiH8wmaNYyMWBEoMXZ IQCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a637445000000b00476f59d84a6si23254229pgn.214.2022.12.30.08.28.01; Fri, 30 Dec 2022 08:28:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235130AbiL3QMf (ORCPT + 64 others); Fri, 30 Dec 2022 11:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234982AbiL3QMd (ORCPT ); Fri, 30 Dec 2022 11:12:33 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF7B1AA18 for ; Fri, 30 Dec 2022 08:12:32 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pBHzS-0006uc-RL; Fri, 30 Dec 2022 17:12:14 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pBHzN-0000y1-JX; Fri, 30 Dec 2022 17:12:09 +0100 Date: Fri, 30 Dec 2022 17:12:09 +0100 From: Oleksij Rempel To: Francesco Dolcini Cc: Primoz Fiser , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org, Shawn Guo , Sascha Hauer , upstream@lists.phytec.de, Marco Felsch , Oleksij Rempel , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, francesco.dolcini@toradex.com, wsa@kernel.org Subject: Re: [PATCH] i2c: imx: increase retries on arbitration loss Message-ID: <20221230161209.GA14776@pengutronix.de> References: <20221216084511.2576786-1-primoz.fiser@norik.com> <20221216094518.bevkg5buzu7iybfh@pengutronix.de> <20221216110227.GA12327@pengutronix.de> <20221216111308.wckibotr5d3q6ree@pengutronix.de> <5c2e0531-e7c3-1b37-35ed-c8e9795a0d18@norik.com> <41991ce2-3e88-5afc-6def-6e718d624768@norik.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 On Fri, Dec 30, 2022 at 03:40:58PM +0100, Francesco Dolcini wrote: > +Wolfram > > On Wed, Dec 28, 2022 at 09:01:46AM +0100, Primoz Fiser wrote: > > On 16. 12. 22 13:51, Francesco Dolcini wrote: > > > On Fri, Dec 16, 2022 at 01:23:29PM +0100, Primoz Fiser wrote: > > > > The only solid point in the thread seems to be that in that case we are not > > > > covering up the potential i2c hardware issues? > > > > > > I believe that in this case we should just have a warning in the kernel. > > > The retry potentially work-around a transient issue and we do not hide any hardware > > > issue at the same time. It seems an easy win-win solution. > > > > I would agree about throwing a warning message in retry case. > > > > Not sure how would it affect other i2c bus drivers using retries > 0. > > Retries might be pretty rare with i2c-imx but some other drivers set this to > > 5 for example. At least using _ratelimited printk is a must using this > > approach. > > Wolfram, Uwe, Oleksij > > Would it be acceptable to have a warning when we have I2C retries, and > with that in place enabling retries on the imx driver? > > It exists hardware that requires this to work correctly, Well, this is persistent confusion in this monolog. It will not make it correctly. > and at a > minimum setting the retry count from user space is not going to solve > potential issues during initial driver probe. I assume it is not clear from programmer point of view. Lets try other way: - The I2C slave could not correctly interpret the data on SDA because the SDA high or low-level voltages do not reach its appropriate input thresholds. This means: You have this: /-\ /-\ ----- 2.5Vcc ___/ \__/ \___ Instead of this: /-\ /-\ ----- 3.3Vcc / \ / \ ___/ \__/ \___ This is bad, because master or slave will not be able to interpret the pick level correctly. It may see some times 0 instead of 1. This means, what ever we are writing we are to the slave or reading from the slave is potentially corrupt and only __sometimes__ the master was able to detect it. - The I2C slave missed an SCL cycle because the SCL high or low-level voltages do not reach its appropriate input thresholds. This means, the bus frequency is too high for current configured or physical PCB designed. So, you will have different kind of corruptions and some times they will be detected. - The I2C slave accidently interpreted a spike etc. as an SCL cycle. This means the noise level is to high. The driver strange should be increased or PCB redesign should be made. May be there are more options. If not done, data corruption can be expected. None of this issue can be "fixed" by retries or made more "robust". Doing more retries means: we do what ever we do until the system was not able to detect the error. > To me the only reasonable solution is to have the retry enabled with a > sensible number (3? 5?), however there is a concern that this might > hide real hardware issues. There is real hardware issue. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |