From patchwork Tue Jul 30 19:49:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 13747841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1F636C3DA49 for ; Tue, 30 Jul 2024 19:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=80+fQm4YlesSMroy5N5cHYeUUxSPDbbk/O1f2Emc1R4=; b=wt3sQHOEcC805VFT6IT80NvEpU N2xIJrywDh0A9oB4X870GRFg9yklguXVyQsbelmIKRBFBkIxNAcL9E2N1I2K1Ml7ZdEN/hfJ/h0A3 SKl4cMD4o9Mr1ZATW7drAS7oUe4ApZVhN3wIRUe94IGTe3bDUhyJfx0bz58PafBd2+Ux6xPyCXi9z YDsJ63efctRSQj6oPgdaziebmiaQD8oPDmKRMw4se35fnZ+QeRAQN4mCwZCtJecxGnc6j9OC4SI4t 7rxY4aTO5Dx6QHhQmRoVCZX5zk9KvJrvoOtfz0N+RFfhOA36mCmFVj26dL5+juc4YfjPANitFp8QC WtNFWR/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYsqw-0000000GLWo-1LHI; Tue, 30 Jul 2024 19:49:46 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYsqT-0000000GLQ7-3dbv for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 19:49:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 17C39CE11EA; Tue, 30 Jul 2024 19:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56E8CC32782; Tue, 30 Jul 2024 19:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722368955; bh=ZRU/ils+M3BtFnjH9dt3Gff4powKMpDinTqwXofED/o=; h=From:To:Cc:Subject:Date:From; b=X64ADXox43umdsDRtMUpRKW31HQ1ZHNTX4onNoU0QNchkN4AhaVjUWfA07xu2aLC4 b9rEySAXMLu/tBW3zYfvpShp6p4Nx9QMdz6CcsoTWNZeNXIKVbExJ+nEdRyd/MAHTJ gtU2z5iBWHnU/F9XU3nKc78GBxyyDRRoOXgp57GwQsWnL0e+sQTT21mm5MetY0pk6D OonsdH0B0qzyonZ9PpZwRVp3ZPDELzoxXhOocWCk9VagG77Vy80usKCpGRVj/GjYA3 dt8I7zbc30I/IOyQ/0nd3FPce4fuPKvnP7B1r70YdQWd9q70iG7AkequpgsUIMAJlx brMr/Et78jltg== From: Michael Walle To: Alexandre Belloni , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH] rtc: sun6i: disable automatic clock input switching Date: Tue, 30 Jul 2024 21:49:05 +0200 Message-Id: <20240730194905.2587202-1-mwalle@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_124918_109252_7ED6B915 X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The V3(s) will detect a valid external low frequency clock and if it is not present will automatically switch to the internal one. This might hide bugs and (hardware) configuration errors. It's even worse because the internal RTC runs significantly slower (32.000Hz vs 32.768Hz). Fortunately for us, the V3(s) has an (undocumented) bypass of this switching and the driver already supports it by setting the .has_auto_swt flag. Signed-off-by: Michael Walle Acked-by: Chen-Yu Tsai --- This is not tagged as a Fixes commit, because it might break boards with an incorrect device tree. That is, if the device tree lists the external crystal but the board doesn't have it the RTC will stop running. I don't think this is likely though, because the user manual requires the external clock. --- drivers/rtc/rtc-sun6i.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 8e0c66906103..e681c1745866 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -402,6 +402,7 @@ CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc", static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { .rc_osc_rate = 32000, .has_out_clk = 1, + .has_auto_swt = 1, }; static void __init sun8i_v3_rtc_clk_init(struct device_node *node)