Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1097492ybl; Fri, 16 Aug 2019 08:51:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxE2LKs+9CrexqfoAGw3o0slsBIlGAoXb7ZMYb/cyWBc6W1lgANANo9yplkl6qb2p1+6yqB X-Received: by 2002:aa7:9e04:: with SMTP id y4mr11306331pfq.18.1565970716729; Fri, 16 Aug 2019 08:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565970716; cv=none; d=google.com; s=arc-20160816; b=kVDCI9TLGHbkQOHyr/WV9bRBW770Hep3WdNa61kdRG5wU9CMVr4t9kQJ/4JquXQ66s KbDr9VhImCv7dulfCA+TB8qkXLMFzc0GeDby1vsugXGBUZWIufMrsRVdaVP+eQv+uQCs Pg5dc9YkytfHqN+PlTJ8pVp1eaNGG3Hsg4SDmL7B+QbOY/sqMvIPJz4JHza2W7H50a2a 2NF8vlT3Hu9FMLxtvKvK28pkQdVkbRf1j+l6/4LbXfDmV+MEDW4UQVH6Wip5uccMyrZv 3kDHAPXMoCmdY2xkjs1hsGpfz/LnvGnKqkq7Ly49VSbT4EptP2bMcS6mxQw8dCClZL/j 1p9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=cpK+BMDExYLxKFIAWTqR3c4ZIHj/f9hQfV0Jcdwx0mM=; b=S1LsQDoAACNFj9v9XCf2KnD/emt75x2nWj+qZigQ9Ou3IdKkqSgXRuVxhIEaIa6JsM xgIi5+P/unvbsImcO9NaT7M0DsUWuQBY78SnUiiDQRupFYCyOew1Aa8p9zr1N/5QAEJe KZzf0rthofTOQ5tLDgdsxM6N+FNZwE2bWyP6fi3PqPoQqfezdeHEFGhpTh5dtkXu7JN7 EFs4bOrbTZYBfsoXdLRIL5fB/Fw2Qgr8ZvYCTVaWu6msRiiuWdpK5ACcFTcJ///tGdVp jEo9KcAkdG8fuy/xhPjKDokEXJdAAS7DbbJGFZh8tZAX1E62G6E6bVBxTbQCe5W33WEv rs9Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si4132041pgh.41.2019.08.16.08.51.40; Fri, 16 Aug 2019 08:51:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727399AbfHPPvD (ORCPT + 99 others); Fri, 16 Aug 2019 11:51:03 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:41327 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbfHPPvC (ORCPT ); Fri, 16 Aug 2019 11:51:02 -0400 Received: by mail-ot1-f68.google.com with SMTP id o101so9989468ota.8; Fri, 16 Aug 2019 08:51:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cpK+BMDExYLxKFIAWTqR3c4ZIHj/f9hQfV0Jcdwx0mM=; b=MWYM7g/OXsleqz7qMX+1+CvQGWnGcyArOW+uq2iELv5ajRCphvI32L5D6ME8DQwyQm 0wvXU42fduQOUxvDniLMeGcTk3oh5c4C3MI7CHvUzp5OImAXN4/9lWLqhvh84TtK4h6Q sPJ2GJPbF2XaQOvo5tkBWW3wETyz6JkgVYvLl6/GCz02pisDdPmzkPe0vKXbWZHw4M9P Y07cqsZfO0DaWJRFOO9VOfe0ifO2WcxemwcTtErTiv5VU8wAOYs8ojk3BUgx94vstHPW gKBmAfWD1HpOFrr6VMmczmeMP6b6Btf0Ap+RewJNcmUBgBg+7JYA2nvu2THavgtjmQ6I +y4Q== X-Gm-Message-State: APjAAAUZwv/Oc0BoA0qCUQrs8aIqRJ4x48Ln2CJQu98vSpqUT7x08WxP gZuGPNpFFL1Z3whnN5qvIk6YVLQVCzs= X-Received: by 2002:a9d:6508:: with SMTP id i8mr8255954otl.355.1565970661625; Fri, 16 Aug 2019 08:51:01 -0700 (PDT) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com. [209.85.210.49]) by smtp.gmail.com with ESMTPSA id 20sm2260192otd.71.2019.08.16.08.51.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Aug 2019 08:51:01 -0700 (PDT) Received: by mail-ot1-f49.google.com with SMTP id e12so9941649otp.10; Fri, 16 Aug 2019 08:51:00 -0700 (PDT) X-Received: by 2002:a05:6830:1db2:: with SMTP id z18mr4982946oti.110.1565970660637; Fri, 16 Aug 2019 08:51:00 -0700 (PDT) MIME-Version: 1.0 References: <20190816024636.34738-1-biwen.li@nxp.com> <20190816080417.GB3545@piout.net> In-Reply-To: <20190816080417.GB3545@piout.net> From: Li Yang Date: Fri, 16 Aug 2019 10:50:49 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [v2] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w To: Alexandre Belloni Cc: Biwen Li , a.zummo@towertech.it, linux-rtc@vger.kernel.org, lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Leo