Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3270715pxa; Tue, 25 Aug 2020 16:54:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHQsENRmfIsJf+wg13IbXYv1IRchTMYsELvd+LlzBgV4wjZOCkuxsw2hAdKrbQh8ZPEsu7 X-Received: by 2002:a50:fd94:: with SMTP id o20mr9323921edt.357.1598399647567; Tue, 25 Aug 2020 16:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598399647; cv=none; d=google.com; s=arc-20160816; b=f5XLzpivIF6mg7TjB+cZP/mu/aqo72ZHmSQGQnnmJAgL1W+xVG7Jl3CJ0hbBdtc2su IZ+y8FKrfTig8M9sXoxfvoPLiapNW0fJ+Z/82eOd3d/DmMmnU/4nzqtpuT3ks3TjdZlb 9+hnUoHzGTtPJIG9/dVUHyXqRD6lPu9PFXZQGxPeUJAAJZPHI2+hjOVe9bshhL4Ze7mU oSc20MCxwPRMdw/azv/YzZHmPgONF/swctShN8S3r2e/KWVeIKWsiV8oFw46ZgV7iGEP ICEsm0N6eIVmdAcNw/MGCO5JX6wu4eTdF1rGvbBteOKOho/QVYYw1v+4njwbUE/CqATr XdfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=1/SW2vjNPlrriQiwwO52kATB5J8rZwQWtE44Dcf8ycE=; b=kmkcQWsDB3W368O1mPHfQKx1jqUHHRS0ZQODiFhKcdxtfe4oxGVvb2JzQVVOgLMBFc JS67tV1taMHvAiFXRet4VZsMmJQ23iKS9qOAMKfXzfZ1iKM6WBZd/XGdlFzxoquRnQ9L xlkhv1ltwEzEmnn5IKk1Q+2jBohrzS0y64jcDUAQM60oPyYsujg+2PH7A8p37qpSZfJj v2iG9hJHyIxk7t5dcIF9Y5zmyy1uMmnuatk7E3OKH//Nr46IgH9I7JhNhxcavzv0BIkq e3zdpQ2ZTVZzTr2/elLS31N1unhipsvT6NDjxz2n/09fha+SMbzbfVxR1qBPaz+uysim KAKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si258912edp.413.2020.08.25.16.53.41; Tue, 25 Aug 2020 16:54:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbgHYXuu (ORCPT + 99 others); Tue, 25 Aug 2020 19:50:50 -0400 Received: from anchovy3.45ru.net.au ([203.30.46.155]:55394 "EHLO anchovy3.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbgHYXut (ORCPT ); Tue, 25 Aug 2020 19:50:49 -0400 Received: (qmail 18469 invoked by uid 5089); 25 Aug 2020 23:44:07 -0000 Received: by simscan 1.2.0 ppid: 18331, pid: 18332, t: 0.0840s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.22?) (preid@electromag.com.au@203.59.235.95) by anchovy2.45ru.net.au with ESMTPA; 25 Aug 2020 23:44:06 -0000 Subject: Re: [PATCH 2/4] i2c: at91: implement i2c bus recovery To: Wolfram Sang , Codrin.Ciubotariu@microchip.com, kamel.bouhara@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com References: <20191002144658.7718-1-kamel.bouhara@bootlin.com> <20191002144658.7718-3-kamel.bouhara@bootlin.com> <20191021202044.GB3607@kunai> <724d3470-0561-1b3f-c826-bc16c74a8c0a@bootlin.com> <1e70ae35-052b-67cc-27c4-1077c211efd0@microchip.com> <20191024150726.GA1120@kunai> <65d83bb0-9a0c-c6e2-1c58-cb421c69816c@electromag.com.au> <20200825132846.GA1753@kunai> From: Phil Reid Message-ID: <8deeae50-2d67-d728-7afd-1b8f1b7a927e@electromag.com.au> Date: Wed, 26 Aug 2020 07:44:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200825132846.GA1753@kunai> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/2020 21:28, Wolfram Sang wrote: > Hi Phil, > > yes, this thread is old but a similar issue came up again... > > On Fri, Oct 25, 2019 at 09:14:00AM +0800, Phil Reid wrote: > >>> >>>> So at the beginning of a new transfer, we should check if SDA (or SCL?) >>>> is low and, if it's true, only then we should try recover the bus. >>> >>> Yes, this is the proper time to do it. Remember, I2C does not define a >>> timeout. >>> >> >> FYI: Just a single poll at the start of the transfer, for it being low, will cause problems with multi-master buses. >> Bus recovery should be attempted after a timeout when trying to communicate, even thou i2c doesn't define a timeout. >> >> I'm trying to fix the designware drivers handling of this at the moment. > > I wonder what you ended up with? You are right, a single poll is not > enough. It only might be if one applies the new "single-master" binding > for a given bus. If that is not present, my best idea so far is to poll > SDA for the time defined in adapter->timeout and if it is all low, then > initiate a recovery. > On my todo list still. Our system eventually recovers at the moment and the multi-master bus doesn't contain anything that's time critical to our systems operation. -- Regards Phil Reid ElectroMagnetic Imaging Technology Pty Ltd Development of Geophysical Instrumentation & Software www.electromag.com.au 3 The Avenue, Midland WA 6056, AUSTRALIA Ph: +61 8 9250 8100 Fax: +61 8 9250 7100 Email: preid@electromag.com.au