Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2309501rwl; Thu, 13 Apr 2023 04:55:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/WpINX7wwFgD0JhR6hyxJyt2ZZATWSgVdqdlaj8Neuj6MjSncRltpijM3BFg2ZFmEhIBI X-Received: by 2002:aa7:df0d:0:b0:504:9ba0:4f83 with SMTP id c13-20020aa7df0d000000b005049ba04f83mr1942364edy.7.1681386947211; Thu, 13 Apr 2023 04:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681386947; cv=none; d=google.com; s=arc-20160816; b=MHs6QQJXIsGSvSwbz4h035MXQFzQ9IKF3AfnuxdyzdYoncc6zD40fJZUfMTXfeEPtP HNk0rgL+b7KagApyUwk9UfAvJmncm7p4MbqsGIkUITlkeXMx6CiBa3clvzZtT1IB/54c u124dbnEXvMAu1rLqYqBJgm5tXwCOsW+1g/jgPB2/e3PtZZPGly2lDTCfymdYcezdWZ+ KTtWN9zm1vAR9lFQwQGDfhKxAj/DutQRH6LqPyTQH4dddDLW4a3bGj4z+1R+uxTMdI6G p+jDldR1lNUB2o5n6J/+mwD1/vMvrvQgZzivJr2CGeytXHNt1vajanchcexsYty7T3iv RA4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KuiWSZ3342zAqQGbhgSFaorsuA9xgUbVSygSFrKlNE4=; b=EZKWQDazYijmlktjB6Xnynh//8gFzkXVDtVxUFpTVvwH+0kmXsz1IFYV9FScdn55si HuyXpZYMgdKQ3L504YdXGgjKLCRPcsZ4fiBbb6KdSeh0Uw6V/EUdFh2Ntsv6oeDz5kUW t8ZXyntcbgMFr9wCcrz3CvrHjbMQ47oEbnaYhaqXWmtgGZdWdQgZTw0k0uF9TxS8JDpN wHeH0B2hHG06nptVvAeH+pYsXxwQ0KJLZXntHsGV54aAdqAdgf8aClyS1F9uImK2OZe6 km3tbxMlfFbQ4rk2NXH+zUQO3v8ZpwrTYIKK9h2woXXLijehwx83EbiFTNF0Qvn1YRpT WEhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=FD3Ckiwv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gz15-20020a170907a04f00b0094e0c5b5fcdsi1735332ejc.799.2023.04.13.04.55.22; Thu, 13 Apr 2023 04:55:47 -0700 (PDT) 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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=FD3Ckiwv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbjDMLyK (ORCPT + 99 others); Thu, 13 Apr 2023 07:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjDMLyI (ORCPT ); Thu, 13 Apr 2023 07:54:08 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 654F286AD; Thu, 13 Apr 2023 04:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=KuiWSZ3342zAqQGbhgSFaorsuA9xgUbVSygSFrKlNE4=; b=FD3CkiwvA9LG35m6InUFSO6WBi ARu8HUkatt+GMlPtoV03+wL0P/kcPqh/vcdEWta57SaTN4JwkCXi73S3G0+kGx7XTjxYkqKwQjf2v OVoMtc2BjIK6HBFsIu4UFtOskX2LJQ4ufFZhXVXd+ZDoIMPgHk52oqwhNRai3AInaf6c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pmvWa-00ABJJ-4p; Thu, 13 Apr 2023 13:54:00 +0200 Date: Thu, 13 Apr 2023 13:54:00 +0200 From: Andrew Lunn To: Matthias Schiffer Cc: Peter Korsgaard , Federico Vaga , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux@ew.tq-group.com, Gregor Herburger Subject: Re: [PATCH v2] i2c: ocores: generate stop condition after timeout in polling mode Message-ID: References: <20230413093737.15303-1-matthias.schiffer@ew.tq-group.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413093737.15303-1-matthias.schiffer@ew.tq-group.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED 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 Thu, Apr 13, 2023 at 11:37:37AM +0200, Matthias Schiffer wrote: > From: Gregor Herburger > > In polling mode, no stop condition is generated after a timeout. This > causes SCL to remain low and thereby block the bus. If this happens > during a transfer it can cause slaves to misinterpret the subsequent > transfer and return wrong values. > > To solve this, pass the ETIMEDOUT error up from ocores_process_polling() > instead of setting STATE_ERROR directly. The caller is adjusted to call > ocores_process_timeout() on error both in polling and in IRQ mode, which > will set STATE_ERROR and generate a stop condition. > > Fixes: 69c8c0c0efa8 ("i2c: ocores: add polling interface") > Signed-off-by: Gregor Herburger > Signed-off-by: Matthias Schiffer Reviewed-by: Andrew Lunn Andrew