Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2414783ybl; Thu, 15 Aug 2019 11:25:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUm8DKI9QQhGUIXfN4EPfJzOGy9CekXOVUlex43VVBP3/9kbuS8KJcDEFY7qHuavnz0Oxg X-Received: by 2002:aa7:90c9:: with SMTP id k9mr6564813pfk.171.1565893537267; Thu, 15 Aug 2019 11:25:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1565893537; cv=pass; d=google.com; s=arc-20160816; b=zme1RLR6XDeVxILOhipzvPYPlckAE8wn4k3pUyt8IvUdU1rmGbIGUqf0rU3RbIZ19c gtFncYWXFJQlMOA8hd0GHJd5UqTk7pjq7VODP2opCz9uyFtme8tpy1h09K+cNaG66AdN w6tnwoaHYzB6bFqDS23C8YhT1armRZxx0ZmAPx9t6B6JPgzBsRlaqp4I04KLHoha9Z1u +3Eh7yTcRbIMxBg2PyOl6gudnQrkJi+uEjF1zj5nN8OYjOdLlun6NT5pcGpFGXTFCvLa 46JtufRBzAlhKc4rdw+sfML0T1iQB5bobH7+qXNv+VZBN1ERJPZTFTRSrbu0ICNms6Le mddg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=ZzXqH8RlVMsCCYXoyu4N9nEXihNXMsDqpJxyQHqH73I=; b=WhBmwFgU1SbCaFlCKo6WsJ78yAdrJQ3uEEDZlB6nAmhsqv4Z2LXVdtVD4wftr3A8Sp c0fMRFmPWY1vP5MDJUIE9O6BD5AAKGY+ORkJmRf2fVJYZ5Q8hR4DK5Lt/aoLz3gSeSko ducit6nPh/jy4QAHEu16ZKVRMpJgikDxQ7Dg5nqg2Xa4QkM/mN178UapDrXox3KbH/Q/ FyN5B3cLy0Hl5W9PX1gGWQN/1VsezzzVeEzY1M21I/ItOku5cuESLFvpiwvaZc7IAYfI mrHNGeQ4EGq5k5rLK9EB+cPAOis7WF+X0h1sFe8xBUb/eg1CFA6b2D0VjVQUw8pY/ViE //Ug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=FnhFzFzS; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (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 61si2359259plq.168.2019.08.15.11.25.21; Thu, 15 Aug 2019 11:25:37 -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; dkim=pass header.i=@nxp.com header.s=selector2 header.b=FnhFzFzS; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731648AbfHOSB1 (ORCPT + 99 others); Thu, 15 Aug 2019 14:01:27 -0400 Received: from mail-eopbgr60067.outbound.protection.outlook.com ([40.107.6.67]:48807 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731202AbfHOSB1 (ORCPT ); Thu, 15 Aug 2019 14:01:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ASkoJLDWNBOFufa6j6pGmoEgfAOTKLXDzmIELrf/1PAiCpCD5wo5LejUFBuvvcf5ZYZC+WJfZmdwIiNQ43AHyZfVImxBcwxVbpA2lECYBXN49sfDGcKPG+xF1fHMNpxCB2ns9jAGKDC+90lxkd+Fxl0i8jZsaGzKHVnxoGg2ZapyK7Fh6zX72Zno/Um1w8zjuq+XbekT3uqHUHlhqcwAHUAWpu5x/CHJmEu+899FuIiY62aAjgkcPkybKVAhOJQP+ZGjAUozxQ4PVJE3l6RnhYTQURuwXuI6Pi6yfcR8bpYR7JCVAoP6/8zuAM5KL8nCxr3A3xBDM/SCAXmq8oK6pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZzXqH8RlVMsCCYXoyu4N9nEXihNXMsDqpJxyQHqH73I=; b=k/MfkF89Mvx3p0rUSjgMhm1kVKg7ggy9mwKv9usAukvYkSkHJTDRz78qkkZdHHsc+TY/eqJ6NzlXRtWkv4DnQ+M84sgSbQDkLSyhbs0QT6Pxceg4f1QFKa305g1i2kOviEI9+LJjn6TjxiS0BXIzqiH/1FN5zmDEGa2wlClGU+mSd+bq/HEA4xM435AU5ZggZwKE9ZCil6dQB5O4yIVGSgd/LigLz+T+5mleS7Tl2gRib5GI3WZOJAhZj6zvJtuIjPCm42gesXZ0mo4BP2WierYdD7bqj6rCtp2hhjVE2I2xAKElx4I3h478UUV+/8DidE1c8ApNpwebcdc0dcuRYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZzXqH8RlVMsCCYXoyu4N9nEXihNXMsDqpJxyQHqH73I=; b=FnhFzFzSaN24WvYeiBfSw9zUVZJgappe+kt/n0KGQC5DBtUZ6JLAKoZy9Qv6b0VTnCHuQojISkg8ddf9TDhQmcUjmUj8lQ6f2bI/tj6UdDZwJtGjKHFjzvdaQb6kLMyfZc9VOMAy2cvDjrhUph3qmLKrQ5Xha6qxyIu8evnGtIA= Received: from VE1PR04MB6687.eurprd04.prod.outlook.com (20.179.235.152) by VE1PR04MB6368.eurprd04.prod.outlook.com (10.255.118.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.23; Thu, 15 Aug 2019 18:01:22 +0000 Received: from VE1PR04MB6687.eurprd04.prod.outlook.com ([fe80::3c54:f415:644a:15f9]) by VE1PR04MB6687.eurprd04.prod.outlook.com ([fe80::3c54:f415:644a:15f9%6]) with mapi id 15.20.2157.022; Thu, 15 Aug 2019 18:01:22 +0000 From: Leo Li To: Biwen Li , "a.zummo@towertech.it" , "alexandre.belloni@bootlin.com" CC: "linux-rtc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Thread-Topic: rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Thread-Index: AQHVUoSffVMVL9pU8EWFzlDe9z+sGab6+TgAgAChtoCAAOVX4A== Date: Thu, 15 Aug 2019 18:01:22 +0000 Message-ID: References: <20190814093249.40065-1-biwen.li@nxp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leoyang.li@nxp.com; x-originating-ip: [64.157.242.222] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6d4d1ded-c852-481a-4885-08d721aa954d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VE1PR04MB6368; x-ms-traffictypediagnostic: VE1PR04MB6368: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2043; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(189003)(199004)(13464003)(26005)(5660300002)(316002)(110136005)(6306002)(14444005)(229853002)(256004)(53546011)(305945005)(186003)(86362001)(6506007)(7736002)(478600001)(52536014)(66066001)(102836004)(53936002)(9686003)(54906003)(6436002)(64756008)(55016002)(81166006)(66476007)(66446008)(2906002)(8936002)(81156014)(14454004)(33656002)(2201001)(6246003)(66946007)(3846002)(76116006)(66556008)(99286004)(966005)(7696005)(76176011)(74316002)(486006)(476003)(4326008)(446003)(25786009)(6116002)(8676002)(71200400001)(71190400001)(2501003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR04MB6368;H:VE1PR04MB6687.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: IUebzMTH7M+Mg/GvT44VNqxHkYSvDa9H5T7JdHKYF11vDoIOsX4aJuuiBs42N2DaagbovLqXdAzthWsZWL1lDphLdRb8WErt+LxHVQJa3gx90IafQcsKm9zmXCeUp58nIS4mNoL92hBiuRGsxVZpMwbnQxf+xnXvKI/ekbMnGD8OFNFbihTcDATw3sKUUnnvw+eIkqka2sb6IZoio0AuwCGiuQSkmTYeBFigYsrHmOm4VDrEH12NFwBLmdfA5jQMwafLW44krnU3Aw5f2TiTJNhxJkBgwRrj+Ca4OTgYsbaSb6zQqisbuUPvRq2v8QDiXK37v0CS5nOl1QiJcssJkdLgOgtMuTx0zyielMqOVV89efXpAAOj91/O/Qn3mFEm3YhSgo83TUBVzxaIT0StsykZaALnckTU0Q1N0Yef6Ww= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d4d1ded-c852-481a-4885-08d721aa954d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Aug 2019 18:01:22.8361 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hlYVC5bSg9cJH/MRBsYFovNKh1SAyNRbg0Lr+Y+hAqO/1lQD6VproLbYixZ70ijxb/LB9hGz1QPc5HzmB0FP1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6368 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Biwen Li > Sent: Wednesday, August 14, 2019 11:15 PM > To: Leo Li ; a.zummo@towertech.it; > alexandre.belloni@bootlin.com > Cc: linux-rtc@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: RE: rtc: pcf85363/pcf85263: fix error that failed to run hwclock= -w >=20 > > > Subject: rtc: pcf85363/pcf85263: fix error that failed to run > > > hwclock -w > > > > > > Issue: > > > # hwclock -w > > > hwclock: RTC_SET_TIME: Invalid argument > > > > > > The patch fixes error when run command hwclock -w with rtc > > > pcf85363/pcf85263 > > > > Can you explain a little bit more in the commit message on how the > changes fix > > the above issue? It is not that clear just from the code. > 1. Relative patch: https://lkml.org/lkml/2019/4/3/55 , this patch will al= ways > check for unwritable registers, it will compare reg with max_register in > regmap_writeable. >=20 > 2. 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 fal= se,so > regmap_writeable will return false. From you description, it looks like the problem is actually that the buf[] = was written to a wrong place. If that's the case, we should say that in th= e commit message. >=20 > > > > > > > > Signed-off-by: Biwen Li > > > --- > > > drivers/rtc/rtc-pcf85363.c | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c > > > index a075e77617dc..3450d615974d 100644 > > > --- a/drivers/rtc/rtc-pcf85363.c > > > +++ b/drivers/rtc/rtc-pcf85363.c > > > @@ -166,7 +166,12 @@ static int pcf85363_rtc_set_time(struct device > > > *dev, struct rtc_time *tm) > > > buf[DT_YEARS] =3D bin2bcd(tm->tm_year % 100); > > > > > > ret =3D regmap_bulk_write(pcf85363->regmap, CTRL_STOP_EN, > > > - tmp, sizeof(tmp)); > > > + tmp, 2); > > > + if (ret) > > > + return ret; > > > + > > > + ret =3D regmap_bulk_write(pcf85363->regmap, DT_100THS, > > > + buf, sizeof(tmp) - 2); > > > if (ret) > > > return ret; > > > > > > -- > > > 2.17.1