Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2863077ybl; Thu, 29 Aug 2019 14:08:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw8OwkuKmeCrRwxkzW2wYm4M5oKqzAXBLqNYDgL5LsTjETbIMPnR/rubdpPFRk5hKVOsPG X-Received: by 2002:a17:902:7586:: with SMTP id j6mr4220494pll.8.1567112907000; Thu, 29 Aug 2019 14:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567112906; cv=none; d=google.com; s=arc-20160816; b=ZTgedP4bk3TS6B6DYIrHvaLNeU43cFCaBI0wtjuTgFDI8S30bvXyqJ3TdrLJB11D+L mdtka/Mwm4HYSTFgRsOfhbXQpgGUtYkv3FoIF0YFjdtDaKLrQiumV+/c/MglHncp94KD 9UWD5PIC0Mbj2I2bCWL5Rgjpx/a9qA/TZym9RbffuVPf++aeC4Ybl95o18qr66mC+zRJ twR/ZUT2bVIhZYsjOi6gC5ia82lPIEZQO/69+l8SM47gbKr6DtEH31SsGu6DLN2pnW/Y vPbe84xsjELKIAdKZoAF67hnzS4KTdYB3Rz/HQtgWgnrtsl/UCMiD9K4oHTKJIuLLbie yMUg== 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=8H7lxdQtWZgrPydkDxqKweTr3jOmtiCEmh0/OiAcqmw=; b=Fm6EXgNa4tj1OxxrYs7nQSs1qxT3lk+nd4P542i7GVZ7eDLmif04l+/0jekpCPev5Q iHZCVB4L5IK0QU9+RWQvSpFiF1isjnljIlGqp+E8sKt2kvYOvKSAcabBTuv2OsRZfOXe MYjDQoYUAqO28//4qUOOUW9XoYE1FPKUCdLlJvbGnPYeRP8sajwkG0keAXVcd5xIfme7 TR0RGw56DpOpNvfNYNMMHnW0BeJq5S2I0sJL/S3zzMBXp8VbPAxiKmHSI97fz2DVew/+ dMguZRr3Izrn6fGSvyDIC/fWbaQk9j+rLDzrMxhoLrM5wssxaew9JJNGP0nX64ivQfhY jbnw== 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 h15si3025944plr.87.2019.08.29.14.08.11; Thu, 29 Aug 2019 14:08:26 -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 S1728141AbfH2VGE (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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