Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp260818ybn; Thu, 3 Oct 2019 04:49:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQRRfmvX8H8TJClifwyb58f1XgEB0z3dEVDJH2oTpQEZzUrAL66aJwYQRK7vxn1YfcWTBd X-Received: by 2002:a05:6402:1688:: with SMTP id a8mr8782608edv.225.1570103392247; Thu, 03 Oct 2019 04:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570103392; cv=none; d=google.com; s=arc-20160816; b=TMYxIe73Xlfi2Xt/0d+scLNMTO0IoQhK5EJ2rNnf80hsR3IG3Zcr/qsu/UeCQrSl6T ITFtYJ6cpNMCuzyZIff4gIlVIVDr0nU4QiZQGV9nW4dkkUdLQOGRGEidyQd9v0VtBWK1 w1FJWaQ8T5QyK6Dya9sUW9OULLRKfM3m+7eBf5DlELdj4CSYZqDsU72jG0b7sVCgep0E g4R5YvsLm9vLs9Q6zc5K4SiICeaA5BU3od0726M672cQcoz9KwnbhPUJz9tQYigzrQIM E/IzWRJ35rL1zzIKwNDAhEN3eM/y2m6LnSnS6yiBraLTfD6wB3RPLV9I/cex7VdX5iz1 7+sg== 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=7I14W6+uD3Ri/MiO4uJ+WvycmWbwSjZm7Fg4aCGr0Fg=; b=ROu8LNfw/9axi3E6Il6b4A5o5C62ueai01n0aEeRHhAHLLZHlXc99Osf+EWnsUjLAV FC7e4zr3IrvmXUErloX68mokXf6HuSO593iCwVwNzh24AyWqBTL/enTjDao0k3QoBqQB jrhICWLoDDOtah6kEfz4hTObYYzZetkPaDF0XiLkpwnZg58t2aWnrn3F18i4cLuWxKJQ 3trLe6tMbD+oLjXR2gekBKUn920qKV1NFGm4te90wEIuOeX41BBvhGeQBWJfHI0EtOtS lX2jQnRNmv2DeIBWadO6pRgoNdG2U2VhWjFe5IkfEia2T8/i7UkmXdsQnOln48MRaIHp TTWw== 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 gh2si1104507ejb.330.2019.10.03.04.49.27; Thu, 03 Oct 2019 04:49:52 -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 S1729557AbfJCLse (ORCPT + 99 others); Thu, 3 Oct 2019 07:48:34 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:35605 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbfJCLsd (ORCPT ); Thu, 3 Oct 2019 07:48:33 -0400 X-Originating-IP: 86.207.98.53 Received: from localhost (aclermont-ferrand-651-1-259-53.w86-207.abo.wanadoo.fr [86.207.98.53]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id F131824000C; Thu, 3 Oct 2019 11:48:31 +0000 (UTC) Date: Thu, 3 Oct 2019 13:48:31 +0200 From: Alexandre Belloni To: Lukasz Majewski Cc: Alessandro Zummo , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices Message-ID: <20191003114831.GR4106@piout.net> References: <20190911154803.15969-1-lukma@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911154803.15969-1-lukma@denx.de> 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 Hello, On 11/09/2019 17:48:03+0200, Lukasz Majewski wrote: > This change adds support for 'century bits' on 4162 family of RTC devices > (from ST or microcrystal), which allow storing time beyond year 2099. > > For rv4162 century bits - CB1[7]:CB0[6] are stored in reg6 - 0x6 (MONTH): > CB1 CB0 > 0 0 (year 2000 - 2099) > 0 1 (year 2100 - 2199) > 1 0 (year 2200 - 2299) > 1 1 (year 2300 - 2399) > > The driver has been also adjusted to allow setting time up to year 2399 > if the M41T80_FEATURE_CB is set in its DTS/I2C data. > > There shall be no functional changes for devices not supporting this > feature. However, other devices - like m41t80 - have different approaches > to handle century information. > This does not work because the RTC doesn't handle leap years on century properly. This means that if you do that, then there is no guarantee the date will be the correct after 2099. As far as the m41t62 and rv4162 are concerned, there is no way to make the century bits useful. See the datasheet: "During any year which is a multiple of 4, the RV-4162 RTC will automatically insert leap day, February 29. Therefore, the application software must correct for this during the exception years (2100, 2200, etc.) as noted above." -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com