Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp292476pxb; Mon, 16 Aug 2021 05:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxebsoEVhlGHs8Dcw6gU9vP6EHRH8uRANHxCBluDM5csKJlm6+ZzWw1CWzfHoT3Pq+C5GU X-Received: by 2002:a17:906:32cf:: with SMTP id k15mr16180478ejk.68.1629117677463; Mon, 16 Aug 2021 05:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629117677; cv=none; d=google.com; s=arc-20160816; b=E3NJsqGoyDe7jEYGhhmZYepoAk1hIp5hf/QRh7xQbgY8iIxJ43+3xLreZWQtEzbe0K xWsQLwlNeJyQphPw+xexNuOhQAdK9HjBk0oqx5V1hYSpUjyaaOgbCtcZH8gKxdDYzQJU P0njDjahl9zhhggzQzB8eZrcJexG1MlzwpfuQSs65xjX9LOUSrEpV/GRC1DWYpVmR8jo 7SU9c1yA2TDJjOjafuR8/XoLbrHop8n87EqO0wSPms4ypzEL8/sPz6zMixLRHI9ZcEKq zAYKHe2Y/XYCbm279AOoTywhxYH1uZT+x1bQicFoVbAGWY7f8u0GVe8zKIGW5b39gvVS g3Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=gr6iZgbc66okhvilvlSQvuH2aY7qEuZVsAJe7tJaL0k=; b=Qv2OFklmOntXwAzuh7ecTCDKXp8F7I0smdGU1n8ZhFl8tr+v301TU8iE36NV8s1K3U 4UB1YX47bgbCUUAR+k04smUu46hHNQNlMkyqAeS9SJgWikAXNtiR/xkkHg0hvTLq3aKb r9Nw+jYYab9mQfGAFfza6F7XEYGr7PPZ+2WzEZaPLvjc1/HgjjJoCMlX9qbppMR5Xi0V EpNEjMY+wSgXZTZQAHktNAhzKDNO6RIcSbABoPoJk5zyxCzpzKlH25pneY797+u21UEq u7B0JMTs5ZIZuFO4AnyqyVjsh23V6n1TobJoZIb2EHExyNJ44bMxMhOAzCHYroXgwVde trJw== 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 b2si10357490ejc.314.2021.08.16.05.40.54; Mon, 16 Aug 2021 05:41:17 -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 S229886AbhHPMhW (ORCPT + 99 others); Mon, 16 Aug 2021 08:37:22 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:43023 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbhHPMhV (ORCPT ); Mon, 16 Aug 2021 08:37:21 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id AC3BE1C0009; Mon, 16 Aug 2021 12:36:48 +0000 (UTC) Date: Mon, 16 Aug 2021 14:36:48 +0200 From: Alexandre Belloni To: Tony W Wang-oc Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, TimGuo-oc@zhaoxin.com, CooperYan@zhaoxin.com, QiyuanWang@zhaoxin.com, HerryYang@zhaoxin.com, CobeChen@zhaoxin.com, YanchenSun@zhaoxin.com Subject: Re: [PATCH] rtc: Fix set RTC time delay 500ms on some Zhaoxin SOCs Message-ID: References: <1629121638-3246-1-git-send-email-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com