Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp293413pxb; Thu, 12 Nov 2020 04:08:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwEZsq27TDO9kA16TEAfFOHJQ29VgmhhmjpTqqqN0EnfNO+7/sJ+oHUC4FwmO7hsPfar/E X-Received: by 2002:a50:e041:: with SMTP id g1mr4835019edl.385.1605182904043; Thu, 12 Nov 2020 04:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605182904; cv=none; d=google.com; s=arc-20160816; b=chAA6e95St1XdUb5oB4Cj638NQZGUHBqe+Syrp3N4P4X0W36F4qbIDcXb47kBQ9l2p z+NhzmGMqgPoApoL9eNeBP3V510kxVYRPsQaJ8Jk7vb9U19Uy13O2TC/AJWWa9xsqZXq vbUaWlrDgcDRlWl77k29SsUA9q9S+PUW8jgwBiyYhlqNhJg0V5Cnmyut47azyAa12iL7 3MX9sfnUM8q0wRWM68CR7kMFD3xgrSS1B/BAH6MteHR8IQd9u65xvyYY4OX+ij0Wy5Wc W5iteIaHy2GI3eWiEniCJQY75a/MJD7ZNv3r4/ZgraAa0FT/BrvxdK4BchtzM4mesHpm 0BDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=EJLEigPOcrNr6Yq7gXmsArU8CiPn6iZFsyRo5lHW8i4=; b=fkLy8xzLT2MrGbQyQjxkT3gOEFZJtA2G2YhEgqxddZWqOsrOk9tQ/a+jcI8Zt88bEl Xloyifww8GtUw7BgXgBhzMnxqHnJ5h8MAKoa7E/HGRDLkT2L4uDf+Xf+FmqK5I0HfeDR nSfnYDpwC2JuPgRdYYjJqJWxMulUTCFgutHsu8t/tRmMJFmjprPYKAWN9cnZul6uO/uZ MqHhS5+EwngJn5s7sW5hpC0WERPDqE0QHTXeKHJYO/wq+D2NVjSaEBX1dr4c4MLaPR/7 H7yDt6Z2uH7+nv+h6w57CYrQUHnHkg+AviBLxKHjGku/vk3lz1f6P0yokeTDpS9HD0n/ sgRg== 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 go40si943603ejc.141.2020.11.12.04.08.00; Thu, 12 Nov 2020 04:08:24 -0800 (PST) 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 S1728185AbgKLMEL (ORCPT + 99 others); Thu, 12 Nov 2020 07:04:11 -0500 Received: from mail.loongson.cn ([114.242.206.163]:49358 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726969AbgKLMEI (ORCPT ); Thu, 12 Nov 2020 07:04:08 -0500 Received: from [10.130.0.80] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxmtCmJK1fl58MAA--.18841S3; Thu, 12 Nov 2020 20:03:50 +0800 (CST) Subject: Re: [PATCH] MIPS: Loongson64: Add read_persistent_clock64() To: Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen References: <1605169793-10481-1-git-send-email-yangtiezhu@loongson.cn> <8d6ebfe2-e300-3f38-6316-196cba947d36@flygoat.com> Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Yinglu Yang , WANG Xuerui From: Tiezhu Yang Message-ID: <6f0a7a43-4eac-65d8-61ff-778dc13f925c@loongson.cn> Date: Thu, 12 Nov 2020 20:03:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9AxmtCmJK1fl58MAA--.18841S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw4UWF18JFyfurW7AF13Jwb_yoW8Cw48pa 18Aan0kF4UXF1UCw4Iyrn8Cryjgw4rGF1qg34rt345ur1q93W3GFykC3yj9FyDur1fCw1v vrW5t3sxWa1j9FJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvm14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCYjI0SjxkI62AI1cAE67vI Y487MxkIecxEwVAFwVW5JwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2 z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnU UI43ZEXa7VUjfHUDUUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/12/2020 06:09 PM, Jiaxun Yang wrote: > > > 在 2020/11/12 18:04, Jiaxun Yang 写道: >> Hi Tiezhu, >> >> 在 2020/11/12 16:29, Tiezhu Yang 写道: >>> Add read_persistent_clock64() to read the time from the battery backed >>> persistent clock. With this patch, we can fix the wrong time issue due >>> to the system clock is not consistent with hardware clock after resume >>> from sleep state S3 (suspend to RAM), at the same time, the system time >>> can be right instead of "Thu Jan 1 08:00:00 CST 1970" without rtc >>> driver. >>> >>> start_kernel() >>> timekeeping_init() >>> read_persistent_wall_and_boot_offset() >>> read_persistent_clock64() >>> >>> timekeeping_resume() >>> read_persistent_clock64() >>> >>> timekeeping_suspend() >>> read_persistent_clock64() >> >> It is highly discoraged to do anything with bridgetype, which isn't >> probed via >> devicetree. >> >> Please check if you can deal with that inside RTC framework, or make >> it as >> a part of RTC driver (e.g. set up a callback). >> >> Also you should submit RTC driver at first if you intend to complete >> LS7A support. > > Oops, > Just dig it deeper, I guess simply select RTC_HCTOSYS would solve the > issue. > We're trying very hard to decouple all the drivers and conponents, > DeviceTree for all! +cc WANG Xuerui Hi Jiaxun, Thanks for your reply. Xuerui has already submitted the patch of LS7A rtc driver [1], but not yet been merged into the mainline kernel, I discussed with him early today. Do you mean that read_persistent_clock64() can call the function like rtc_read_time() defined in rtc driver? Thanks, Tiezhu [1] https://patchwork.kernel.org/project/linux-mips/patch/20200923075845.360974-2-git@xen0n.name/ > >> >> Thanks. >> >> - Jiaxun >> >>> >>> Signed-off-by: Yinglu Yang >>> Signed-off-by: Tiezhu Yang >>> --- >>>