Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1138472ybl; Fri, 16 Aug 2019 09:29:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqydi9zWLh/S4l4D+cCuktvgc5MAixLzpWe9/SOeEkhmeOx47AlnDpRzCnnF/FewMjPk1i+F X-Received: by 2002:a17:902:f01:: with SMTP id 1mr9789329ply.337.1565972973301; Fri, 16 Aug 2019 09:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565972973; cv=none; d=google.com; s=arc-20160816; b=WoN2gbTFw3ANQbTeFpWn9V3oX685WVCBXXbz4x6LVZdVTv02ApNSQ5UkhxeQu8tQlI HUWImMtYy4U621g0qyb91mZFd6HbkdGVaqgiwt6Y+26lXGdnjS3UprVHlstY0FStfOSF Bq1YlbihILL0P3MT7jLG96MPTB0cUklDbMQWeE+6OKc9dmAqEyVLUXCwdjPAPSI0ZPzc V0oclXpL2PwIbZ1rQpLgQmBfAoIRJ3FulgJY85+D2U6aXysZn3/Y/zkkPZhEW2jq9gWE MFkA4DyfoQsbP5GPW6VxNR3gYhPm4T/9aCSSiUK/vRltweVQWImfMRmAtX8xUxkMl7eB XyLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KgKrJ23b0ftb/inQzxjtftegO5w64fmjP4Th0aCbIvw=; b=siIvcuZSl0zlZHxwJxFmg5Z8fyAIZL2rZby4X0ssqkW0eh3y4JJmtsSkHgzYmf+5p0 JxViZVTLyFTO3QgVWdWT8NPX52WIBnuWgjFfu7pw3Nh4Zo6pBOD0ZSVzJNLsFGA9dtvD WmqR46/H2XSHRF6zbaMf1tskRNn34L+gC936jsDmNJ8d8nn+LNpPlqdOH5W6kA9pOhgU EhgC9wh/1szNfgI3bQ5OM0tFVFW3HnNAIJS34dVOgxPUcexDd23OarB4CfoVtCZjoNHh o2L6jvfBBuCtEtiUzs5hYFpYCUaTjBSSP5ljdCU7wXtT1WDQxKKT1KbpksrGMNjAht0l N9Vg== 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 ck3si4328123plb.429.2019.08.16.09.29.18; Fri, 16 Aug 2019 09:29:33 -0700 (PDT) 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 S1727032AbfHPQ22 (ORCPT + 99 others); Fri, 16 Aug 2019 12:28:28 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:60161 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbfHPQ21 (ORCPT ); Fri, 16 Aug 2019 12:28:27 -0400 X-Originating-IP: 90.65.161.137 Received: from localhost (lfbn-1-1545-137.w90-65.abo.wanadoo.fr [90.65.161.137]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id BE01E60002; Fri, 16 Aug 2019 16:28:25 +0000 (UTC) Date: Fri, 16 Aug 2019 18:28:25 +0200 From: Alexandre Belloni To: Li Yang Cc: Biwen Li , a.zummo@towertech.it, linux-rtc@vger.kernel.org, lkml Subject: Re: [v2] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Message-ID: <20190816162825.GE3545@piout.net> References: <20190816024636.34738-1-biwen.li@nxp.com> <20190816080417.GB3545@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/08/2019 10:50:49-0500, Li Yang wrote: > On Fri, Aug 16, 2019 at 3:05 AM Alexandre Belloni > wrote: > > > > On 16/08/2019 10:46:36+0800, Biwen Li wrote: > > > Issue: > > > - # hwclock -w > > > hwclock: RTC_SET_TIME: Invalid argument > > > > > > Why: > > > - Relative patch: https://lkml.org/lkml/2019/4/3/55 , this patch > > > will always check for unwritable registers, it will compare reg > > > with max_register in regmap_writeable. > > > > > > - In drivers/rtc/rtc-pcf85363.c, CTRL_STOP_EN is 0x2e, but DT_100THS > > > is 0, max_regiter is 0x2f, then reg will be equal to 0x30, > > > '0x30 < 0x2f' is false,so regmap_writeable will return false. > > > > > > - Root cause: the buf[] was written to a wrong place in the file > > > drivers/rtc/rtc-pcf85363.c > > > > > > > This is not true, the RTC wraps the register accesses properly and this > > This performance hack probably deserve some explanation in the code comment. :) > > > is probably something that should be handled by regmap_writable. > > The address wrapping is specific to this RTC chip. Is it also > commonly used by other I2C devices? I'm not sure if regmap_writable > should handle the wrapping case if it is too special. > Most of the i2c RTCs do address wrapping which is sometimes the only way to properly set the time. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com