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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 8B93EC2BA83 for ; Fri, 14 Feb 2020 17:01:21 +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 3F47D20656 for ; Fri, 14 Feb 2020 17:01:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GH2M5kWw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F47D20656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=siol.net 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c3CMmBMSTdORPJee/v8Jnp2UUoJpWO4CgGYB+a8fJnM=; b=GH2M5kWw7qI763 5EehCoxV3iwcO24OWG+gpnVBrEpawbKzLmGVm8unK0jdYRKkiVmoHNswhADBf0emXbrpqMk5ZmaiS 5eVNXdIckl+yDLfY3k6ZugOQ+srtgqecbQGzjtK1+HFSeqMGixfHoyJ7S7ZVN+bpJTUxbYh0HnvBB vZgdWkkYTdHJaN7W50zluACFdRKeK7iSvCJEZq2QKrJDo7w+bXiEomePGe8C9l2JeRQ22QN+CitID aYIXDaNk8LeCVWDH/0FkSw9qMY2xiWTjQD1qHLU6SumJhYy3B/wEZK2EEqVc5JZ8qCQr7SCpyvOsd E9xTYjS4SD9Yw0KvF3SA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j2eL9-0002ke-VO; Fri, 14 Feb 2020 17:01:20 +0000 Received: from mailoutvs40.siol.net ([185.57.226.231] helo=mail.siol.net) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j2e2q-0003sR-Cw for linux-arm-kernel@lists.infradead.org; Fri, 14 Feb 2020 16:42:31 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 3F1E752389C; Fri, 14 Feb 2020 17:42:16 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta09.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta09.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id gPTKP3VPISxT; Fri, 14 Feb 2020 17:42:15 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id D26BF52389B; Fri, 14 Feb 2020 17:42:15 +0100 (CET) Received: from jernej-laptop.localnet (cpe-194-152-20-232.static.triera.net [194.152.20.232]) (Authenticated sender: jernej.skrabec@siol.net) by mail.siol.net (Postfix) with ESMTPA id 8286452389D; Fri, 14 Feb 2020 17:42:14 +0100 (CET) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard Subject: Re: [PATCH 1/2] rtc: sun6i: Make external 32k oscillator optional Date: Fri, 14 Feb 2020 17:42:13 +0100 Message-ID: <5326350.DvuYhMxLoT@jernej-laptop> In-Reply-To: <20200214081443.ajz2sxh5ztk6qb2i@gilmour.lan> References: <20200213211427.33004-1-jernej.skrabec@siol.net> <20200213211427.33004-2-jernej.skrabec@siol.net> <20200214081443.ajz2sxh5ztk6qb2i@gilmour.lan> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200214_084224_603963_F1E905C0 X-CRM114-Status: GOOD ( 21.53 ) 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@arm.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, wens@csie.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Maxime, Dne petek, 14. februar 2020 ob 09:14:43 CET je Maxime Ripard napisal(a): > Hi Jernej, > > Thanks for taking care of this > > On Thu, Feb 13, 2020 at 10:14:26PM +0100, Jernej Skrabec wrote: > > Some boards, like OrangePi PC2 (H5), OrangePi Plus 2E (H3) and Tanix TX6 > > (H6) don't have external 32kHz oscillator. Till H6, it didn't really > > matter if external oscillator was enabled because HW detected error and > > fall back to internal one. H6 has same functionality but it's the first > > SoC which have "auto switch bypass" bit documented and always enabled in > > driver. This prevents RTC to work correctly if external crystal is not > > present on board. There are other side effects - all peripherals which > > depends on this clock also don't work (HDMI CEC for example). > > > > Make clocks property optional. If it is present, select external > > oscillator. If not, stay on internal. > > > > Signed-off-by: Jernej Skrabec > > --- > > > > drivers/rtc/rtc-sun6i.c | 14 ++++++-------- > > 1 file changed, 6 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c > > index 852f5f3b3592..538cf7e19034 100644 > > --- a/drivers/rtc/rtc-sun6i.c > > +++ b/drivers/rtc/rtc-sun6i.c > > @@ -250,19 +250,17 @@ static void __init sun6i_rtc_clk_init(struct > > device_node *node,> > > writel(reg, rtc->base + SUN6I_LOSC_CTRL); > > > > } > > > > - /* Switch to the external, more precise, oscillator */ > > - reg |= SUN6I_LOSC_CTRL_EXT_OSC; > > - if (rtc->data->has_losc_en) > > - reg |= SUN6I_LOSC_CTRL_EXT_LOSC_EN; > > + /* Switch to the external, more precise, oscillator, if present */ > > + if (of_get_property(node, "clocks", NULL)) { > > + reg |= SUN6I_LOSC_CTRL_EXT_OSC; > > + if (rtc->data->has_losc_en) > > + reg |= SUN6I_LOSC_CTRL_EXT_LOSC_EN; > > + } > > > > writel(reg, rtc->base + SUN6I_LOSC_CTRL); > > > > /* Yes, I know, this is ugly. */ > > sun6i_rtc = rtc; > > > > - /* Deal with old DTs */ > > - if (!of_get_property(node, "clocks", NULL)) > > - goto err; > > - > > Doesn't that prevent the parents to be properly set if there's an > external crystal? No, why? Check these two clk_summary: http://ix.io/2bHY Tanix TX6 (no external crystal) http://ix.io/2bI2 OrangePi 3 (external crystal present) Please disregard ac200_clk in first case, it's part of another work. Best regards, Jernej _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel