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=unavailable 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 E89D2C3A5A6 for ; Thu, 29 Aug 2019 06:45:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C84E62073F for ; Thu, 29 Aug 2019 06:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727892AbfH2Gpz (ORCPT ); Thu, 29 Aug 2019 02:45:55 -0400 Received: from hel-mailgw-01.vaisala.com ([193.143.230.17]:47641 "EHLO hel-mailgw-01.vaisala.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbfH2Gpz (ORCPT ); Thu, 29 Aug 2019 02:45:55 -0400 IronPort-SDR: FqoXct+zFHhJMNCd/gHRyGElCirhOi+C4lY5TP0Jdt5YObFMePTZWwBJIWo7z2WZ3Y5kftHqgB hDDmIYuJI7fMepslUtSpeC1aKdFYaL7eop6x/+xs3JzpuXqKYjDVnBOTBjxbmklSBBC8YWtXr1 pNpC0RBskdgH+pdZpvV82wGx0oJZ+Vf1nKA+2k+ujn/XIHVAo/STu/3KBG5pySLgQbB6zJhdj7 ICOAgt8ZeK5xBNCx3gmhmEeQza4zWhYfVvkXRmUdsBFcUvQOv8+38Ps+GBoCpS9j7qw7JFh4Tm 0L0= X-IronPort-AV: E=Sophos;i="5.64,442,1559509200"; d="scan'208";a="230033197" Subject: Re: [v5] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w To: Biwen Li , a.zummo@towertech.it, alexandre.belloni@bootlin.com, leoyang.li@nxp.com, broonie@kernel.org Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190829021418.4607-1-biwen.li@nxp.com> From: Nandor Han Message-ID: <65a85fb2-0482-2007-4a84-b622e5308c3d@vaisala.com> Date: Thu, 29 Aug 2019 09:45:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190829021418.4607-1-biwen.li@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Aug 2019 06:45:49.0936 (UTC) FILETIME=[65139F00:01D55E35] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/29/19 5:14 AM, 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 > LGTM +1 Nandor