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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2DABDC3DA59 for ; Tue, 16 Jul 2024 08:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZwXOm3tNwMkuI9eyvNzwE9pC9TYEz1S59+t6GuH8NIc=; b=4VBs1612MGEyEPZezZcqQAvN+w R5p2dXwvpwQFrAWyVeO8AOOtgq8SGbLTjSjSMzunAmEhgsUlYm0FrVC+hZ9qAkru8ZkqFaRUCHEwD VapJmg6etjyilhKAfqrCYEDelL/X2if/BVYfVzRZspx2GE8qCxXacvuk8oxaZGdiMEVoXfDLNK9Tp 044CTJa+BVh/XpBkXUtUrWg6x2nuL2qN/oOX494Dh7gK6XbJr5KVplaPfYIGVBkDNXr1pKgTWMVHa zYT7wPkO1ozGcQwS174SD/4NlScjM6otN2O4oe0SX1pSkpGMyEdao+s3PaEHj/HXxT4d6jv2cBhni 1+tqEM7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTd8L-00000009g1L-0y4q; Tue, 16 Jul 2024 08:02:01 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTd82-00000009fyA-1lkn for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 08:01:43 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so34768245e9.2 for ; Tue, 16 Jul 2024 01:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1721116901; x=1721721701; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZwXOm3tNwMkuI9eyvNzwE9pC9TYEz1S59+t6GuH8NIc=; b=ra2yxeBP5mP5Hy2/359qgKvfucpW2APqwdMMdTBW2/kspI0q9ew4Q1FyZCbpMcTocz I1swHAiuP+vGaHNsXtKimbUOAq/gvWxEYUhJNJJEgRCsTsFPFjrx/CzGvyuUZrLwcXBG u5t8T1fC03FLKxP4VGyY3ngKp6u+34YseLgKV+1MQp0Gt8Dai+ENBU0T9q2m00FOaCgJ 1RveJ4cvwn+ozJSUjcLpRgSRAyehdjMh3S0/qarRqzton9Wf2nHAY8NroJDVUk4kQE64 WqM0GYIBdUkcThlDY8zOG0JQfZIFU6L2ckahHMUB4T+8UsMsLsFfQ0uIv6i8/liZepWR o0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721116901; x=1721721701; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZwXOm3tNwMkuI9eyvNzwE9pC9TYEz1S59+t6GuH8NIc=; b=gSWZMdsnrTy2TYUE0Ap4DqsodMNM+zOviqPgWSq9w+m3GNIl9O0LQaiqYWgRmCb7qi pE06aCIj4eOOgc4tlvyRv9eFw12cne71JTE5y6gGs6nMnn5M4i/4aZKX69n5J6tgTzDe UYGk1H+l9B0B38iQ8+0qaSjY2ucCWd6/kU0hpRuB1rJ5mYL+wcRjaEky5fQySdHGv2s0 NwD0Nv/1M5aEijgj+GJPtqvX4/i5kRfN9wB2e0u565V93yMUriUBfL0EEV2dLfLSWMEk ZyUDmhUeQM+vsXGaq2mm4PLU8RP4EfQ5p4GMGq2P6uu8CrMQfyOn+V/3ufdpNatHuxY4 2+AA== X-Forwarded-Encrypted: i=1; AJvYcCUs/2/446E4YsehiNWaRwO+bM8q72EdIilFPECPiTKx/yMciuGA+LnQQbo93B4AiB2s0Y6+KDqShqhfQ/PhuR1XcMgOUejZW7+X/lGlQ5fvOWMknsE= X-Gm-Message-State: AOJu0YxUysBTOPdhjlnGMZf6iLDbCp0N/Jsf4sDW4COxxd12YCcpjC+9 7KC5eWPsdBR8FWqcmhuX0ocfaz/b9jAYrznuUnf6ICltELir64jA4v/D2xFHmNY= X-Google-Smtp-Source: AGHT+IG6fQN6WXJ0Gc2jk8xr2vMncZMDw69SpzYeioPOmKKhucyeLpDyckAH5Kp4szbtrRfRKHSMyA== X-Received: by 2002:a05:6000:188c:b0:367:9614:fb99 with SMTP id ffacd0b85a97d-36825f66e6cmr1061751f8f.10.1721116900778; Tue, 16 Jul 2024 01:01:40 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dab3cb0sm8206693f8f.10.2024.07.16.01.01.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jul 2024 01:01:40 -0700 (PDT) Message-ID: <41981721-b90e-4eed-9258-9aa96ea9cc07@tuxon.dev> Date: Tue, 16 Jul 2024 11:01:38 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 06/12] rtc: renesas-rtca3: Add driver for RTCA-3 available on Renesas RZ/G3S SoC Content-Language: en-US From: claudiu beznea To: Alexandre Belloni Cc: geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, lee@kernel.org, magnus.damm@gmail.com, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea References: <20240614071932.1014067-1-claudiu.beznea.uj@bp.renesas.com> <20240614071932.1014067-7-claudiu.beznea.uj@bp.renesas.com> <2024061409215756e6a10c@mail.local> <4a477079-b4a6-4861-ae24-b3b87adb8ecd@tuxon.dev> <20240617072551acf731aa@mail.local> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_010142_499133_61785960 X-CRM114-Status: GOOD ( 20.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Alexandre, On 17.06.2024 10:31, claudiu beznea wrote: > On 17.06.2024 10:25, Alexandre Belloni wrote: >> On 14/06/2024 14:06:38+0300, claudiu beznea wrote: >>>>> + /* >>>>> + * Stop the RTC and set to 12 hours mode and calendar count mode. >>>>> + * RCR2.START initial value is undefined so we need to stop here >>>>> + * all the time. >>>>> + */ >>>> Certainly not, if you stop the RTC on probe, you lose the time >>>> information, this must only be done when the RTC has never been >>>> initialised. The whole goal of the RTC is the keep time across reboots, >>>> its lifecycle is longer than the system. >>> This was also my first thought when I read the HW manual. >>> >>> It has been done like this to follow the HW manual. According to HW manual >>> [1], chapter 22.3.19 RTC Control Register 2 (RCR2), initial value of START >>> bit is undefined. >>> >>> If it's 1 while probing but it has never been initialized, we can falsely >>> detect that RTC is started and skip the rest of the initialization steps. >>> W/o initialization configuration, the RTC will not be able to work. >>> >>> Even with this implementation we don't loose the time b/w reboots. Here is >>> the output on my board [2]. The steps I did were the following: >>> 1/ remove the power to the board (I don't have a battery for RTC installed >>> at the moment) >>> 2/ boot the board and issue hwclock -w >>> 3/ reboot >>> 4/ check the systime and rtc time >>> 5/ poweroff >>> 6/ poweron >>> 7/ boot and check systime and RTC time >>> >>> As you can see the time is not lost but continue to increment. I presume >>> the hardware takes into account that time needs to increment when initial >>> configuration is executed. >> I don't think so, I guess it stops ticking but the registers are not >> reset so when ts starts ticking again, you are not too far from the time >> that it should report. > I'll double check with hardware team on this and return with an answer. It has been confirmed me that the HW manual has a mistake and we can avoid stopping the RTC here every time. I'll adjust it in the next version. Thank you, Claudiu Beznea