From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1BE8C3A59F for ; Thu, 29 Aug 2019 21:06:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 796E623404 for ; Thu, 29 Aug 2019 21:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727919AbfH2VGE (ORCPT ); Thu, 29 Aug 2019 17:06:04 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:46611 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727108AbfH2VGE (ORCPT ); Thu, 29 Aug 2019 17:06:04 -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 relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 284A84000E; Thu, 29 Aug 2019 21:06:00 +0000 (UTC) Date: Thu, 29 Aug 2019 23:05:54 +0200 From: Alexandre Belloni To: Biwen Li Cc: a.zummo@towertech.it, leoyang.li@nxp.com, broonie@kernel.org, nandor.han@vaisala.com, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [v5] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Message-ID: <20190829210554.GN21922@piout.net> References: <20190829021418.4607-1-biwen.li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190829021418.4607-1-biwen.li@nxp.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On 29/08/2019 10:14:18+0800, Biwen Li wrote: > Issue: > - # hwclock -w > hwclock: RTC_SET_TIME: Invalid argument > > Why: > - Relative commit: 8b9f9d4dc511309918c4f6793bae7387c0c638af, this patch > will always check for unwritable registers, it will compare reg > with max_register in regmap_writeable. > > - The pcf85363/pcf85263 has the capability of address wrapping > which means if you access an address outside the allowed range > (0x00-0x2f) hardware actually wraps the access to a lower address. > The rtc-pcf85363 driver will use this feature to configure the time > and execute 2 actions in the same i2c write operation (stopping the > clock and configure the time). However the driver has also > configured the `regmap maxregister` protection mechanism that will > block accessing addresses outside valid range (0x00-0x2f). > > How: > - Split of writing regs to two parts, first part writes control > registers about stop_enable and resets, second part writes > RTC time and date registers. > > Signed-off-by: Biwen Li > --- > Change in v5: > - drop robust explanation > > Change in v4: > - use old scheme > - replace link to lkml.org with commit > - add proper explanation > > Change in v3: > - replace old scheme with new scheme: > increase max_register. > > Change in v2: > - add Why and How into commit message. > > drivers/rtc/rtc-pcf85363.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > Applied, thanks. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com