Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1110416pxb; Tue, 17 Aug 2021 04:11:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySCXDPhkdtsK4m+2V4RrTwLUkBSbsMa9N6dnXtFNTkwWXs3q3NGCkNnwneIurJSNPKQAsc X-Received: by 2002:a1c:e912:: with SMTP id q18mr2816127wmc.21.1629198697472; Tue, 17 Aug 2021 04:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629198697; cv=none; d=google.com; s=arc-20160816; b=FQ9eAZqkqBMeh+XZsSusbnSxBgHTDYQh/hHyNHPNFmXqt4w6OV+jfTQkre1OIIFILm cKYAxPJoXJmIK2yLDYFlKexM+7yFT4l94DYr4scsl5f9/w2R4dMpPKDCjX05vGu2LFfA H02LcKHrQJh2f0u8ypi0iehALnLjHRBrBVw7AdRSJM2Xv50rxOilYp+IoqDm+Pq83jz4 /1dWHCQ9TopHAKJGcTl9FRG47SLsC3BXWkKdIFXcXDzDLQ35VNn/OxhCmiD/XgB1Bzvk LWzHZNTARGyenn3tehMxN5yh0cEgiw9NrWiM0OLeDIn3J27MEpSA22MQfO6fJcM1hbCH 4tpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date; bh=6K1P4NtF2IgGn+dVOKyO4zg05dnpZX+7iW82miDDX60=; b=W7vBgVLoSaom88Vb29xtoASwDqSqWtwqp7Ghg/gcHUGgBaxdtwun1n+DLr6Lgu3/a2 Yzu+tXK4PUWQuQ1zd9aK0q5Zm7pH3mloI7wKo251LSDv1xtCrcZBWRuZxQA0cDgxp4u1 /Rlea9ujkMJmote2PN5dhqdyED2sMpfQy+7wEI/9tSz21goxOtsI+YlB+HKgJvUpMAQQ lSbYq8jwFyXHVksUNrFvI9sXhMDigCgOiTxZJ3taQ6nUFb4dluKdWoWnynKZ/FQmbPfl 5Q43NYwWBiO+I+UUodqvNjD3DWkR5TYqwzP35IPJ2K4deaq5E/TVLbHbUqkPNeCG7nwT I2jA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si1912335edx.139.2021.08.17.04.11.11; Tue, 17 Aug 2021 04:11:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236465AbhHQLKM (ORCPT + 99 others); Tue, 17 Aug 2021 07:10:12 -0400 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:10243 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231515AbhHQLKL (ORCPT ); Tue, 17 Aug 2021 07:10:11 -0400 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Tue, 17 Aug 2021 19:09:35 +0800 Received: from [10.122.79.217] (221.11.61.182) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Tue, 17 Aug 2021 19:09:33 +0800 Date: Tue, 17 Aug 2021 19:09:28 +0800 From: To: Alexandre Belloni CC: , , , , , , , , Subject: Re: [PATCH] rtc: Fix set RTC time delay 500ms on some Zhaoxin SOCs User-Agent: K-9 Mail for Android In-Reply-To: References: <1629121638-3246-1-git-send-email-TonyWWang-oc@zhaoxin.com> Message-ID: <7EA395FF-EB66-4274-9EDE-EC28450A0259@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [221.11.61.182] X-ClientProxiedBy: ZXSHCAS2.zhaoxin.com (10.28.252.162) To zxbjmbx1.zhaoxin.com (10.29.252.163) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On August 16, 2021 8:36:48 PM GMT+08:00, Alexandre Belloni wrote: >On 16/08/2021 18:03:13+0800, Tony W Wang-oc wrote: >> >> On 16/08/2021 16:24, Alexandre Belloni wrote: >> > Hello, >> > >> > On 16/08/2021 21:47:18+0800, Tony W Wang-oc wrote: >> >> When the RTC divider is changed from reset to an operating time >base, >> >> the first update cycle should be 500ms later. But on some Zhaoxin >SOCs, >> >> this first update cycle is one second later. >> >> >> >> So set RTC time on these Zhaoxin SOCs will causing 500ms delay. >> >> >> > >> > Can you explain what is the relationship between writing the >divider and >> > the 500ms delay? >> >> Isn't the issue that you are using systohc and set_offset_nsec is >set to >> > NSEC_PER_SEC / 2 ? >> > >> No. >> When using #hwclock -s to set RTC time and set_offset_nsec is >> NSEC_PER_SEC / 2, the function mc146818_set_time() requires the first >> update cycle after RTC divider be changed from reset to an operating >> mode is 500ms as the MC146818A spec specified. But on some Zhaoxin >SOCs, >> the first update cycle of RTC is one second later after RTC divider >be >> changed from reset to an operating mode. So the first update cycle >after >> RTC divider be changed from reset to an operation mode on These SOCs >> will causing 500ms delay with current mc146818_set_time() >implementation. >> > >What happens with hwclock --delay=0 -s ? With "hwclock --delay=0 -s" still have this problem. Actually, this 500ms delay caused by writing the RTC time on these Zhaoxin SOCs. As I've tested, with hwclock --delay=0 -w can fix it too. Sincerely TonyWWang-oc