Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6637580imu; Wed, 14 Nov 2018 04:50:52 -0800 (PST) X-Google-Smtp-Source: AJdET5ccpeWGFpeb6kdx34d9mnelHbdnLAcSogxAkLt0YsL0PuoodWXMkWk8HGhDau2Hew2IKAuj X-Received: by 2002:a63:c00b:: with SMTP id h11mr1634343pgg.429.1542199852468; Wed, 14 Nov 2018 04:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542199852; cv=none; d=google.com; s=arc-20160816; b=xbn+2+XbzqT6QrajORfLN3LGVyigxYFYaqzE8EjXm39RY5ycRSLY9EquQsckwxoljC HFT7QFpAX4onZVbOJI6m3wnT8Ko1JgLtshGDnDpwsHcbXv6CtiQpmJprxYAR8HyzvIlQ aqm4arCXEfHI24l17FNP8pCfFKxQWVwiK44Osgp+0c3qI8eyfUplyQmZODUFecaX3aCF KNY2+MpMvpiYP9FrK43Nie9N5rPn/un/Rgsao+7nrc+A+9ekB1v7Zv5yo7BNW6vYtyFM e9sJkEqNCyHJ+k/SaZvSZtAcMk/uqlE3LwhuVKXbmK3yEHVLiMmkgpJ7v7iBH6o1okaS l0AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=7YZh+ABJuaB3OjSwUepEdCF20oNBmnbcQ1lHNRAjhu8=; b=wJ1ZHE/WZemSt9UwoBwLElwKkIDgorly943V4zur5jJ1vKiITbYIvrwDK+VXk28lMx PJprUl0oRuf45BQeoUZuguDvomXt28EXxLpYh0uG5EK2BvAdaXTQYp6JkohcqqrTDOm9 P3yPNrMlC8aI4BkMCVpwtBhFKjiVKhfVYvjqQvmh92fwd9r8Il4oqBx53b59i1oHa9G2 C3nwbWgfdbm1+8lgTP1EdUEueYeIcS7vez1RrCRgzpNt1HrAIgOMw6TP1vVfIeoxIJWt eNwA44BSS3msgXzMGJPkrd4aijeHgfUMx4KXvusOIzeZ71YvHc+JdlBU7yoUNFe4robq 6KKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si24274762plh.168.2018.11.14.04.50.37; Wed, 14 Nov 2018 04:50:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729807AbeKNWxR (ORCPT + 99 others); Wed, 14 Nov 2018 17:53:17 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:54124 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727731AbeKNWxR (ORCPT ); Wed, 14 Nov 2018 17:53:17 -0500 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23992408AbeKNMuGhQx2X (ORCPT + 1 other); Wed, 14 Nov 2018 13:50:06 +0100 Date: Wed, 14 Nov 2018 12:50:06 +0000 (GMT) From: "Maciej W. Rozycki" To: Alexandre Belloni cc: Alessandro Zummo , Matt Turner , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: m41t80: Complete error propagation from SMBus calls In-Reply-To: <20181114122005.GY29768@piout.net> Message-ID: References: <20181114095737.GV29768@piout.net> <20181114122005.GY29768@piout.net> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Nov 2018, Alexandre Belloni wrote: > > I think we can discuss that when I post the patches. The m41t80 driver > > currently does not work for me anyway and has to be fixed because of: > > > > i2c /dev entries driver > > i2c-sibyte: i2c SMBus adapter module for SiByte board > > i2c i2c-1: doesn't support I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_I2C_BLOCK > > > > and the persistent part is only one patch in the upcoming number of > > changes. > > Well, one of the solution for that (and tis is on my todo list) is to > convert the driver to use regmap which would take care of using the > proper i2c transfers. However, one of the concern when not having bock > accesses is that the registers are not latched (as you seem to know). > One thing I would like is then to avoid the multiple SEC register read > when not necessary. Unfortunately the SMBus host does not give much choice here. It does have some extensions for block transfers, but writes are limited to 5 bytes and reads to 7 bytes. The usual solution is to read repeatedly until the seconds match. For writes it is not a problem, because it takes less than 1 second to write all the clock registers, so if you start with seconds, then the data written will be consistent. The Xicor chip is worse as it uses 16-bit addresses and that is not handled by SMBus support in our I2C core, however apparently that can be simulated by byte writes with that particular chip. The SMBus host implements a protocol extension for 16-bit addressing, but I think it's not worth the hassle adding to SMBus support in our I2C core given how rare the Xicor setup are. Finally the SMBus host does support raw I2C transfers, but only with a polled bit-banged interface, where you need to time the loop correctly to get clocking of the individual bits right. I don't think we want to go down that path. Maciej