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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32904C433FF for ; Thu, 8 Aug 2019 12:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09401214C6 for ; Thu, 8 Aug 2019 12:12:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=megous.com header.i=@megous.com header.b="Qd9gwkz+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730962AbfHHMMl (ORCPT ); Thu, 8 Aug 2019 08:12:41 -0400 Received: from vps.xff.cz ([195.181.215.36]:58886 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbfHHMMk (ORCPT ); Thu, 8 Aug 2019 08:12:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1565266358; bh=YR0FHwwc4tmQEDY6+l7XAQ5vaMUXhvN625ICx9pNwyg=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=Qd9gwkz+IAUYkFnbm+yGA4MfQAQoeVQH6V5rTGkoD1vjvyoxsK/PxapaGvkli+pa6 e/Ni/kZ6HqBP2FbyuQo7jCxVGCdj+3Kex7Wlz2/Omly0lPYtMqc6t7LhW95+WB4WWJ 8+3lHLRBfQ201XEZ+VhRuEostHFx1INt+bzJ70eI= Date: Thu, 8 Aug 2019 14:12:37 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Alexandre Belloni Cc: Chen-Yu Tsai , Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-kernel , linux-sunxi , Rob Herring , linux-arm-kernel , linux-rtc@vger.kernel.org Subject: Re: [linux-sunxi] [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> Mail-Followup-To: Alexandre Belloni , Chen-Yu Tsai , Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-kernel , linux-sunxi , Rob Herring , linux-arm-kernel , linux-rtc@vger.kernel.org References: <20190412120730.473-1-megous@megous.com> <20190806183045.edhm3qzpegscf2z7@core.my.home> <20190807105502.GK3600@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190807105502.GK3600@piout.net> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote: > Hi, > > On 06/08/2019 20:30:45+0200, Ondřej Jirman wrote: > > Maybe whether XO or DCXO is used also matters if you want to do some fine > > tunning of DCXO (control register has pletny of options), but that's probably > > better done in u-boot. And there's still no need to read HOSC source from DT. > > The driver can just check compatible, and if it is H6 and OSC_CLK_SRC_SEL is 1, > > it can do it's DCXO tunning, or whatever. But neither OS nor bootloader will > > be using this info to gate/disable the osciallator. > > > > It is actually useful to be able to tweak the crystal tuning at > runtime to be able to reduce clock drift and compare with a reliable > source (e.g. NTP). I don't think there's a Linux kernel API that you can use to achieve that, so that's a rather theoretical concern at the moment. Also there are multiple clocks, that can drive the RTC, and you usually don't drive it from 24MHz DCXO oscillator. The reason is that you'd have to deal with the fact that the clock for RTC then becomes 24000000/750 (750 is fixed divider), which is 32000. So if you want to get 32768Hz for RTC by tuning the DCXO, it would have to have 24 576 000 Hz. And even if you could achieve that (doubtful), it would throw off timings in the rest of the system (say UART, USB, CPU, display ctl) in a major way. I guess you can try tuning 24MHz oscillator so that it's closer to the real-world 24MHz via NTP reference for other reasons. But it would be complicated, and require precise interaction with other components, like using HW timers sourced from 24MHz HOSC clock, because you can't use CPU's timers, because of inaccuracies introduced during DVFS, for example. regards, o. > I'm curious, what kind of options does this RTC have? > > -- > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ond=C5=99ej?= Jirman Subject: Re: [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC Date: Thu, 8 Aug 2019 14:12:37 +0200 Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> References: <20190412120730.473-1-megous@megous.com> <20190806183045.edhm3qzpegscf2z7@core.my.home> <20190807105502.GK3600@piout.net> Reply-To: megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <20190807105502.GK3600-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Alexandre Belloni Cc: Chen-Yu Tsai , Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-kernel , linux-sunxi , Rob Herring , linux-arm-kernel , linux-rtc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote: > Hi, >=20 > On 06/08/2019 20:30:45+0200, Ond=C5=99ej Jirman wrote: > > Maybe whether XO or DCXO is used also matters if you want to do some fi= ne > > tunning of DCXO (control register has pletny of options), but that's pr= obably > > better done in u-boot. And there's still no need to read HOSC source fr= om DT. > > The driver can just check compatible, and if it is H6 and OSC_CLK_SRC_S= EL is 1, > > it can do it's DCXO tunning, or whatever. But neither OS nor bootloader= will > > be using this info to gate/disable the osciallator. > >=20 >=20 > It is actually useful to be able to tweak the crystal tuning at > runtime to be able to reduce clock drift and compare with a reliable > source (e.g. NTP). I don't think there's a Linux kernel API that you can use to achieve that, = so that's a rather theoretical concern at the moment. Also there are multiple clocks, that can drive the RTC, and you usually don= 't drive it from 24MHz DCXO oscillator. The reason is that you'd have to deal = with the fact that the clock for RTC then becomes 24000000/750 (750 is fixed divider), which is 32000. So if you want to get 32768Hz for RTC by tuning the DCXO, it would have to = have 24 576 000 Hz. And even if you could achieve that (doubtful), it would thro= w off timings in the rest of the system (say UART, USB, CPU, display ctl) in a ma= jor way. I guess you can try tuning 24MHz oscillator so that it's closer to the real-world 24MHz via NTP reference for other reasons. But it would be complicated, and require precise interaction with other components, like us= ing HW timers sourced from 24MHz HOSC clock, because you can't use CPU's timers= , because of inaccuracies introduced during DVFS, for example. regards, o. > I'm curious, what kind of options does this RTC have? >=20 > --=20 > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >=20 > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --=20 You received this message because you are subscribed to the Google Groups "= linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web, visit https://groups.google.com/d/msgid= /linux-sunxi/20190808121237.g6twq2nh3sayu3vx%40core.my.home. 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 X-Spam-Level: X-Spam-Status: No, score=0.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07744C0650F for ; Thu, 8 Aug 2019 12:12:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CC681214C6 for ; Thu, 8 Aug 2019 12:12:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DRi2kzFQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="Qd9gwkz+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC681214C6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0r4v8i7XO0QNPo8fhX7vysBHF46pyZrku/tyik01AjM=; b=DRi2kzFQMfUDBM kVDslII0e9w+fDW1uDJrBgl25GwZKTBrrr3HZlnBiIXsMqg3mu9FbKmTg7jO8LMPZrbNUAB0BjRZF RHzv7fOuTGxjSWlA21bA1RRo0WF064AQqtChbCYVREYN8VagEmnt+lvgBKb2XIiUZ1tW0z1i2zMnC wMutR0gLheD2Bk4DnBMJ+hYbDH4/LO+XywFWFdHXlulrSd86MXWZaz/2Wpnxj8Y25CnT+VYyjYgYa g5/1YWB7cXNTqapWWZQaMKAG+/Wi3mA5RGainK0CrZC16py+XE3kMChulwHHd4SEtSw6GK6TyUKvu CxxfQ2DKf/yEF7xwwD5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvhHj-0004nC-AU; Thu, 08 Aug 2019 12:12:47 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hvhHf-0004lg-7y for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2019 12:12:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1565266358; bh=YR0FHwwc4tmQEDY6+l7XAQ5vaMUXhvN625ICx9pNwyg=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=Qd9gwkz+IAUYkFnbm+yGA4MfQAQoeVQH6V5rTGkoD1vjvyoxsK/PxapaGvkli+pa6 e/Ni/kZ6HqBP2FbyuQo7jCxVGCdj+3Kex7Wlz2/Omly0lPYtMqc6t7LhW95+WB4WWJ 8+3lHLRBfQ201XEZ+VhRuEostHFx1INt+bzJ70eI= Date: Thu, 8 Aug 2019 14:12:37 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Alexandre Belloni Subject: Re: [linux-sunxi] [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> Mail-Followup-To: Alexandre Belloni , Chen-Yu Tsai , Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-kernel , linux-sunxi , Rob Herring , linux-arm-kernel , linux-rtc@vger.kernel.org References: <20190412120730.473-1-megous@megous.com> <20190806183045.edhm3qzpegscf2z7@core.my.home> <20190807105502.GK3600@piout.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190807105502.GK3600@piout.net> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190808_051243_665241_71ACAD2D X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-sunxi , linux-kernel , Chen-Yu Tsai , Rob Herring , linux-arm-kernel , linux-rtc@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gV2VkLCBBdWcgMDcsIDIwMTkgYXQgMTI6NTU6MDJQTSArMDIwMCwgQWxleGFuZHJlIEJlbGxv bmkgd3JvdGU6Cj4gSGksCj4gCj4gT24gMDYvMDgvMjAxOSAyMDozMDo0NSswMjAwLCBPbmTFmWVq IEppcm1hbiB3cm90ZToKPiA+IE1heWJlIHdoZXRoZXIgWE8gb3IgRENYTyBpcyB1c2VkIGFsc28g bWF0dGVycyBpZiB5b3Ugd2FudCB0byBkbyBzb21lIGZpbmUKPiA+IHR1bm5pbmcgb2YgRENYTyAo Y29udHJvbCByZWdpc3RlciBoYXMgcGxldG55IG9mIG9wdGlvbnMpLCBidXQgdGhhdCdzIHByb2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