From patchwork Mon Dec 3 14:58:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95AAE16B1 for ; Mon, 3 Dec 2018 14:59:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 851842AFAA for ; Mon, 3 Dec 2018 14:59:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 783432AFC7; Mon, 3 Dec 2018 14:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29E162AFAA for ; Mon, 3 Dec 2018 14:59:29 +0000 (UTC) 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=9PNSB5jJBHyV/oegh/yzEls5nmUnXB8UQUVsmGWzMT4=; b=tw6QaCpRsZVveJ dJGg3YNd8JHkw3BMfGXDCLpFsjYE8iPps6w1rz5OV3IZ3vJGIjCC3MVB13NK+xe10zHl82pOcIYNy JT+N7Agxw9SGgt5TIpXBHIvRzNMH/c9HLv115Y424ZrsFhb+jCRPG6tOCFgrg3AKGlfTqcUo7X1A2 6OUfONnCQPjcuDiu/rKUUzptIIO4Ao4N1xwDE8uS31VP3c4UGIdW3/iHzlQRAWbBZPPa2NHvD56r6 +WdnKtfD/vKdQoYXbXsNlNVxvfF3W8br8Bu3olv9d6tWGN8Hi8CaSe+6jk1/zspWimbYXlcP0yMLC AI/PW+mXhOOqSPzrx2Og==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTph0-0006fo-L1; Mon, 03 Dec 2018 14:59:26 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgI-0005vW-LX for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:58:45 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 665B85FD5E; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 01/14] dt-bindings: rtc: sun6i-rtc: Rewrite clock outputs as a list Date: Mon, 3 Dec 2018 22:58:12 +0800 Message-Id: <20181203145825.20511-2-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065842_932773_6DC85E98 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The clock output section for this binding describes the two outputs in the descriptions for both the #clock-cells and clock-output-names properties. Instead of overlapping information that is hard to read, rewrite the clock outputs as a list of indices and descriptions. The properies can reference this list instead. This will also make it easier to add notes or conditions to the clocks, and also for adding new outputs. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- Documentation/devicetree/bindings/rtc/sun6i-rtc.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt index cf4177f61ace..fed0d58cbfec 100644 --- a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt +++ b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt @@ -10,10 +10,12 @@ Required properties: Required properties for new device trees - clocks : phandle to the 32kHz external oscillator -- clock-output-names : names of the LOSC and its external output clocks created -- #clock-cells : must be equals to 1. The RTC provides two clocks: the - LOSC and its external output, with index 0 and 1 - respectively. +- clock-output-names : names of the two clock outputs. See below. +- #clock-cells : must be equal to 1. + +The RTC provides the following clocks at the given indices: +- 0: LOSC +- 1: LOSC external output, known as X32KFOUT in the datasheet. Example: From patchwork Mon Dec 3 14:58:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE2EC14E2 for ; Mon, 3 Dec 2018 14:58:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD1BF2A5B7 for ; Mon, 3 Dec 2018 14:58:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C100F28585; Mon, 3 Dec 2018 14:58:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5750228585 for ; Mon, 3 Dec 2018 14:58:58 +0000 (UTC) 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=uiHQjISZK0X1hgg+cFJiWY4EkoVmSl4Gzq52XbO81p8=; b=cXSSefeK7I41IO ltAetgYbK12pU+qserzjRAlXJXH22XVgsJ95pqjw/zS9YCnjD9z01HKfRNx4JLvtSB1I03wfppKER wzJMdN1BD1MhzDJejYhWgRVvPE4m3QrQUOtkJzgSuVyNlQBn5THtIg9V0tpVoTxSZLISTO6V7NR6x p30aBOwgBw9Qf6VOHSjPDMQ090WTlfmiG46hnBlk8dkN8EhCOGXBhoxR5MnwV7Yv3Mu2MGo5OQc+Y 6eJisEzB+cSoAMJTiJ3zbGlynoO6TrnAYESeawhk4oLoSdUKPOxH61jiHhvHpgdQ6hIbf84BrEq7G BPlElL4nz7V4mBGRR4Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgU-00068P-O1; Mon, 03 Dec 2018 14:58:54 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgI-0005vV-EM for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:58:44 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 4E66A5FD80; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 02/14] dt-bindings: rtc: sun6i-rtc: Add compatible strings for pre-H6 variants Date: Mon, 3 Dec 2018 22:58:13 +0800 Message-Id: <20181203145825.20511-3-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065842_619580_B0628335 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP While doing Bluetooth enablement for various boards based on various Allwinner SoCs, minor differences in the RTC modules were found. These include a lack of an external clock output (A31), different internal oscillator frequencies (H3/H5/A64/V3/V3s), different regulator voltage settings (H5/H6), and the presence of miscellaneous registers unrelated to the RTC (A64/R40/H5/H6). The datasheet also describes different number of registers for non-volatile storage, though based on actual experiments the actual number is the same across the board. This patch adds a list of all pre-H6 variants, grouped by the internal oscillator's clock rate, regulator settings, and the presence of the external clock output. Combinations are introduced for the variants that have miscellaneous registers. The RTC block in the H6 also handles the 24 MHz DCXO. This will require more device tree binding changes and will be done later. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- .../devicetree/bindings/rtc/sun6i-rtc.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt index fed0d58cbfec..037ec475f412 100644 --- a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt +++ b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt @@ -3,7 +3,21 @@ RTC controller for the Allwinner A31 Required properties: -- compatible : Should be "allwinner,sun6i-a31-rtc" +- compatible : Should be one of the following combinations: + - "allwinner,sun6i-a31-rtc" + - "allwinner,sun8i-a23-rtc" + - "allwinner,sun8i-h3-rtc" + - "allwinner,sun8i-r40-rtc", "allwinner,sun8i-h3-rtc" + - "allwinner,sun8i-v3-rtc" + - "allwinner,sun50i-a64-rtc", "allwinner,sun8i-h3-rtc" + - "allwinner,sun50i-h5-rtc" + + Where there are two or more compatible strings, this + denotes the hardware covered by the most specific one + is backward-compatible with the latter ones, and the + implementation for the latter ones can be used, albeit + with reduced functionality. + - reg : physical base address of the controller and length of memory mapped region. - interrupts : IRQ lines for the RTC alarm 0 and alarm 1, in that order. From patchwork Mon Dec 3 14:58:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E30F14E2 for ; Mon, 3 Dec 2018 14:58:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C8E22A5B7 for ; Mon, 3 Dec 2018 14:58:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0DD22AD9A; Mon, 3 Dec 2018 14:58:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A2B072A5B7 for ; Mon, 3 Dec 2018 14:58:51 +0000 (UTC) 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=TXpUXFHrXvzZ72nPONKOG/Dh9mBv5yrE2dyD6OE2mSc=; b=nRDKW2501LMJTT 82gKFt7Z/TQY4i1lZnuL5OxLRttcIERqlwpRzpljdl0Pe2gyGrOmQyZSxLQdz38TWijpDOZ2iSny5 GBtPP0q98bhRCykaNt5KBH2a3URsxyWTiCrgZ/46X1pHnpSvSPSxryzxPHTy2TkuLxPmP3Vu0ZJho abWGgARkFoJ2+wXSZY4AVudohXdEcVIBDqlUkbnJIekzeaVI7TcuxKDusp4u/x1mOhIdoPqryZbK6 a2jg7lD2O4+mD6wfGyYvlsT0hzLFEahTXP0XNWjmwwBVCmwwcpB8XYLlOZMB7fXIvqaNKxON+I722 K9VTvZyVqyqwQhkmxgOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgL-0005yb-Lm; Mon, 03 Dec 2018 14:58:45 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgI-0005vU-FD for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:58:44 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 42DC55FB92; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 03/14] dt-bindings: rtc: sun6i-rtc: Deprecate external clock output for A31 Date: Mon, 3 Dec 2018 22:58:14 +0800 Message-Id: <20181203145825.20511-4-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065842_719458_AEA7E0FA X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The A31 does not have an external clock output directly from the RTC. Instead, it has four muxable clock outputs: three (A, B, C) are controlled from the CCU, and the last (D) is controlled from the PRCM. Deprecate the usage of the external clock output for the A31 compatible. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- Documentation/devicetree/bindings/rtc/sun6i-rtc.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt index 037ec475f412..c7aed31210bc 100644 --- a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt +++ b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt @@ -24,12 +24,14 @@ Required properties: Required properties for new device trees - clocks : phandle to the 32kHz external oscillator -- clock-output-names : names of the two clock outputs. See below. +- clock-output-names : names of up to two clock outputs. See below. - #clock-cells : must be equal to 1. The RTC provides the following clocks at the given indices: - 0: LOSC - 1: LOSC external output, known as X32KFOUT in the datasheet. + This clock is not available on the A31 and is deprecated for old + device trees still using the "allwinner,sun6i-a31-rtc" compatible. Example: @@ -37,7 +39,7 @@ rtc: rtc@1f00000 { compatible = "allwinner,sun6i-a31-rtc"; reg = <0x01f00000 0x400>; interrupts = <0 40 4>, <0 41 4>; - clock-output-names = "osc32k", "osc32k-out"; + clock-output-names = "osc32k"; clocks = <&ext_osc32k>; #clock-cells = <1>; }; From patchwork Mon Dec 3 14:58:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 842901731 for ; Mon, 3 Dec 2018 15:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 754CA2B0B7 for ; Mon, 3 Dec 2018 15:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733692B18B; Mon, 3 Dec 2018 15:10:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25FE12B0B7 for ; Mon, 3 Dec 2018 15:10:35 +0000 (UTC) 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=JRG9Ryg1SSjCh9oWfDH1B1b1hehrzbDiKRZapHWe0Ic=; b=qpNOGrvRkmaWyZ UsCTxvc+kdRLW6EpHJU3eiFm+OB0cKM4j/WGZwom9vfeT1knorU7NjZcUqc0fRjV1OIQ6i8tAq6xw qfnFtW0RFukgjAiJPBstDG+VOYMzde4iAI0472pAzebU2b1OaRbwzuWYqCLGULwGzD3YoAF+DOOwa uPTE8yZE71oSRB5ZsbSsk2TX8E0qYivt5WysinzDHYe/c/3G/9mXwhpoKQvbc8FlnbMbyYgYfc4vO d5DJ9emT3lwFn6ipuGyN9vF+7FpJzN1wwESjl2KZfRT7FcO6pLqpO1r32zp5ZFtCVDDVUfyUW6Z1X yrX5l6EF+/r0jhHMRoMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTprm-00078k-2l; Mon, 03 Dec 2018 15:10:34 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005ya-BG for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:09 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 6DD975FD95; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 04/14] dt-bindings: rtc: sun6i-rtc: Export internal RC oscillator Date: Mon, 3 Dec 2018 22:58:15 +0800 Message-Id: <20181203145825.20511-5-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_352140_8E7BA3CC X-CRM114-Status: GOOD ( 12.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Experiments showed that on at least the H3/H5/A64 the RTC's internal oscillator also feeds the CPUS mux in the PRCM. Export this clock through the device tree, instead of having to use a dummy fixed-clock device node, for the PRCM to consume. This will properly describe the relationship between the clocks. Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- Documentation/devicetree/bindings/rtc/sun6i-rtc.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt index c7aed31210bc..6b732c41392b 100644 --- a/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt +++ b/Documentation/devicetree/bindings/rtc/sun6i-rtc.txt @@ -24,7 +24,7 @@ Required properties: Required properties for new device trees - clocks : phandle to the 32kHz external oscillator -- clock-output-names : names of up to two clock outputs. See below. +- clock-output-names : names of up to three clock outputs. See below. - #clock-cells : must be equal to 1. The RTC provides the following clocks at the given indices: @@ -32,6 +32,7 @@ The RTC provides the following clocks at the given indices: - 1: LOSC external output, known as X32KFOUT in the datasheet. This clock is not available on the A31 and is deprecated for old device trees still using the "allwinner,sun6i-a31-rtc" compatible. +- 2: InternalOSC, or internal RC oscillator (A64/H3/H5 only) Example: From patchwork Mon Dec 3 14:58:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31BB414E2 for ; Mon, 3 Dec 2018 14:59:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E50C2AFB5 for ; Mon, 3 Dec 2018 14:59:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EF2F2AFCB; Mon, 3 Dec 2018 14:59:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B63552AFB5 for ; Mon, 3 Dec 2018 14:59:58 +0000 (UTC) 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=ddGlYNm/ZZsuovsxE/9n+lwEKEatpFJCj1HJnwi3zwE=; b=iV+C97qVUHSTXo WLp18cC8aAYUN5lE6z+WcYJSPrRlGlJEghKjtnxDH4wy5MZJ7fnAQNY6sCSFveqqle4Y+OkuFIyse JvZZoW2aJsFPQ4koh8GhuQzgqa/rFhxLwTvtGf31VooUpXo0s9gz6VlFVcN8CI59MZCL4sXMvxa98 T3L3DqR+hEffCJ0tyesd1h6/rENb4TX0IGdWZ0TBN0QvUEaNix+FwHaxy5GcD3FLfP+eJLAz7bmrm FpKiWuC/cX+NKH+b1jnUBMLtLZ/PY343bkkKoCSfanS70XPz8BaGAEzZJgQSutnb0TRqLeBVr8/iH JnXqK/oCXHEaeVl4CHrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTphG-0006wL-FM; Mon, 03 Dec 2018 14:59:42 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgI-0005vT-Px for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:58:45 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 6BFFB5FCE1; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 05/14] rtc: sun6i: Add default clock name for LOSC Date: Mon, 3 Dec 2018 22:58:16 +0800 Message-Id: <20181203145825.20511-6-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065842_982518_68DD4CD0 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RTC's main clock, used internally and exported to the rest of the SoC, is called "LOSC" (low speed oscillator) through the hardware documentation. This patch adds a default name for this clock, in case the device tree does not provide one. This shouldn't happen, but lets play it safe. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- 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 fe07310952df..8edd9e1ec007 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -191,6 +191,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) struct sun6i_rtc_dev *rtc; struct clk_init_data init = { .ops = &sun6i_rtc_osc_ops, + .name = "losc", }; const char *clkout_name = "osc32k-out"; const char *parents[2]; From patchwork Mon Dec 3 14:58:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5C5113BF for ; Mon, 3 Dec 2018 15:11:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900632B186 for ; Mon, 3 Dec 2018 15:11:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83BC42B050; Mon, 3 Dec 2018 15:11:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 154722B186 for ; Mon, 3 Dec 2018 15:11:10 +0000 (UTC) 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=zGulrYwkkRlKjCcGVoVij8vwYsLP5qYr376EwwMOz6Y=; b=Bc2rsVxRjslJ09 ru3d+iXDICgEOfUo+fBJMjQAg/bSyeKwW3gEbd6Z3wZvwMMhbhGSOOynQYXPE5huj1n8Gys513tNn aEnztur+LgvNl+tG640Dsjmz9VngoLphkb5PWVAo1khQhQ+83vJHnzIA3GTkLgMPMZzfkKGBwQJNk algc7XLAN7kOQvyqRuKHkT8CHxdszBmmv8d+KmMUQT69ZJWVmxux2ZopBHxkNCNokKRyU1gBNqxvC WrW79NhJiV6AUAWpK/0GZ0NGa+gopspG9X2AgZeDBSV2VrX7mnX+jV3uLdATaIOqhhfr7inJsBABm 2/41kn47vFbG8o64I3VA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpsK-0007ic-IP; Mon, 03 Dec 2018 15:11:08 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yT-B3 for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:13 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 728AE5FD90; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 06/14] rtc: sun6i: Add support for different variants Date: Mon, 3 Dec 2018 22:58:17 +0800 Message-Id: <20181203145825.20511-7-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_936220_FBFDC1F5 X-CRM114-Status: GOOD ( 19.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Amongst the Allwinner SoCs that have seen some kind of coverage by the linux-sunxi community, whether it be mainline Linux or U-boot support, or just available datasheets, most newer chips use the RTC design first seen in the A31 (sun6i). Overall there have been some minor differences. This patch covers the following: - average clock rate of the internal RC oscillator + presence of fixed and adjustable prescaler for this clock - availability of an external (to the SoC) clock output One major difference regarding the H6 is the 24 MHz crystal is now routed through the RTC, as a digitally compensated oscillator (DCXO). This is not covered in this patch and will be supported later. Other differences are either unrelated to RTC or clock functionality, such as boot or crypto related registers, or the driver simply doesn't use the feature in question. One example of the latter is the calibration function for the RC oscillator. We consider this clock to be very bad and avoid using it. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- drivers/rtc/rtc-sun6i.c | 58 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 8edd9e1ec007..d1866d90b9ef 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -118,9 +118,30 @@ #define SUN6I_YEAR_MAX 2033 #define SUN6I_YEAR_OFF (SUN6I_YEAR_MIN - 1900) +/* + * There are other differences between models, including: + * + * - number of GPIO pins that can be configured to hold a certain level + * - crypto-key related registers (H5, H6) + * - boot process related (super standby, secondary processor entry address) + * registers (R40, H6) + * - SYS power domain controls (R40) + * - DCXO controls (H6) + * - RC oscillator calibration (H6) + * + * These functions are not covered by this driver. + */ +struct sun6i_rtc_clk_data { + unsigned long rc_osc_rate; + unsigned int fixed_prescaler : 16; + unsigned int has_prescaler : 1; + unsigned int has_out_clk : 1; +}; + struct sun6i_rtc_dev { struct rtc_device *rtc; struct device *dev; + const struct sun6i_rtc_clk_data *data; void __iomem *base; int irq; unsigned long alarm; @@ -139,14 +160,19 @@ static unsigned long sun6i_rtc_osc_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct sun6i_rtc_dev *rtc = container_of(hw, struct sun6i_rtc_dev, hw); - u32 val; + u32 val = 0; val = readl(rtc->base + SUN6I_LOSC_CTRL); if (val & SUN6I_LOSC_CTRL_EXT_OSC) return parent_rate; - val = readl(rtc->base + SUN6I_LOSC_CLK_PRESCAL); - val &= GENMASK(4, 0); + if (rtc->data->fixed_prescaler) + parent_rate /= rtc->data->fixed_prescaler; + + if (rtc->data->has_prescaler) { + val = readl(rtc->base + SUN6I_LOSC_CLK_PRESCAL); + val &= GENMASK(4, 0); + } return parent_rate / (val + 1); } @@ -185,7 +211,8 @@ static const struct clk_ops sun6i_rtc_osc_ops = { .set_parent = sun6i_rtc_osc_set_parent, }; -static void __init sun6i_rtc_clk_init(struct device_node *node) +static void __init sun6i_rtc_clk_init(struct device_node *node, + const struct sun6i_rtc_clk_data *data) { struct clk_hw_onecell_data *clk_data; struct sun6i_rtc_dev *rtc; @@ -200,6 +227,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) if (!rtc) return; + rtc->data = data; clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); if (!clk_data) { kfree(rtc); @@ -228,7 +256,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) rtc->int_osc = clk_hw_register_fixed_rate_with_accuracy(NULL, "rtc-int-osc", NULL, 0, - 667000, + rtc->data->rc_osc_rate, 300000000); if (IS_ERR(rtc->int_osc)) { pr_crit("Couldn't register the internal oscillator\n"); @@ -271,8 +299,18 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) err: kfree(clk_data); } -CLK_OF_DECLARE_DRIVER(sun6i_rtc_clk, "allwinner,sun6i-a31-rtc", - sun6i_rtc_clk_init); + +static const struct sun6i_rtc_clk_data sun6i_a31_rtc_data = { + .rc_osc_rate = 667000, /* datasheet says 600 ~ 700 KHz */ + .has_prescaler = 1, +}; + +static void __init sun6i_a31_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun6i_a31_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun6i_a31_rtc_clk, "allwinner,sun6i-a31-rtc", + sun6i_a31_rtc_clk_init); static irqreturn_t sun6i_rtc_alarmirq(int irq, void *id) { @@ -579,6 +617,12 @@ static int sun6i_rtc_probe(struct platform_device *pdev) return 0; } +/* + * As far as RTC functionality goes, all models are the same. The + * datasheets claim that different models have different number of + * registers available for non-volatile storage, but experiments show + * that all SoCs have 16 registers available for this purpose. + */ static const struct of_device_id sun6i_rtc_dt_ids[] = { { .compatible = "allwinner,sun6i-a31-rtc" }, { /* sentinel */ }, From patchwork Mon Dec 3 14:58:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D47613BF for ; Mon, 3 Dec 2018 15:00:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C4352B08A for ; Mon, 3 Dec 2018 15:00:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 201122B0B7; Mon, 3 Dec 2018 15:00:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF8BB2B08A for ; Mon, 3 Dec 2018 15:00:47 +0000 (UTC) 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=rbED5pUN94eulq92fbtLJKwzm7ieWyPx1gQIRJ+6Gfc=; b=SeCh0uhXhApNcl Meglh+scAtEkBEgCy4ZrwOos85baupf2Fd6vqUCvMxFKRrmEK1+zDRg1S3CHCyAYg2Kqb5gp1pDgU Q7sM+IJaXKfMxCwuBTidrekLVp/j9Qw+Xcdlq5GcZhHZzY9KLP/JgU7t62xmfm4oFu0huaL1L1d6C kZ9gf2G5BHLjwFpoot+t/bDbk08k8FLyGvCsoOd7ocsMLTIzdzX2rEeQL/ldTNuYM2S1S42oT2WvK Wiyv1HvW41VwHYNd20cxiVJyUQw+kk1ZKuke/eEJXyv5Zb5r2vleL19TwfsvBAldtL3oWlidypV9Y iWRLgUtJelxmQvRcu1qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpiG-0000l7-1n; Mon, 03 Dec 2018 15:00:44 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yY-B8 for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:04 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 74C445FD96; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 07/14] rtc: sun6i: Add support for all known pre-H6 variants Date: Mon, 3 Dec 2018 22:58:18 +0800 Message-Id: <20181203145825.20511-8-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_178208_AEC386DC X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There are different variants to the RTC hardware first seen on sun6i (A31). The differences we care about in this driver are the clock rate for the internal oscillator, prescalers, and the presence of an external clock output. This patch adds support for all the known pre-H6 base compatibles using the variants data structure previously introduced. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- drivers/rtc/rtc-sun6i.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index d1866d90b9ef..46609ae56ffd 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -312,6 +312,48 @@ static void __init sun6i_a31_rtc_clk_init(struct device_node *node) CLK_OF_DECLARE_DRIVER(sun6i_a31_rtc_clk, "allwinner,sun6i-a31-rtc", sun6i_a31_rtc_clk_init); +static const struct sun6i_rtc_clk_data sun8i_a23_rtc_data = { + .rc_osc_rate = 667000, /* datasheet says 600 ~ 700 KHz */ + .has_prescaler = 1, + .has_out_clk = 1, +}; + +static void __init sun8i_a23_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_a23_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_a23_rtc_clk, "allwinner,sun8i-a23-rtc", + sun8i_a23_rtc_clk_init); + +static const struct sun6i_rtc_clk_data sun8i_h3_rtc_data = { + .rc_osc_rate = 16000000, + .fixed_prescaler = 32, + .has_prescaler = 1, + .has_out_clk = 1, +}; + +static void __init sun8i_h3_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_h3_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_h3_rtc_clk, "allwinner,sun8i-h3-rtc", + sun8i_h3_rtc_clk_init); +/* As far as we are concerned, clocks for H5 are the same as H3 */ +CLK_OF_DECLARE_DRIVER(sun50i_h5_rtc_clk, "allwinner,sun50i-h5-rtc", + sun8i_h3_rtc_clk_init); + +static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { + .rc_osc_rate = 32000, + .has_out_clk = 1, +}; + +static void __init sun8i_v3_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_v3_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_v3_rtc_clk, "allwinner,sun8i-v3-rtc", + sun8i_v3_rtc_clk_init); + static irqreturn_t sun6i_rtc_alarmirq(int irq, void *id) { struct sun6i_rtc_dev *chip = (struct sun6i_rtc_dev *) id; @@ -625,6 +667,10 @@ static int sun6i_rtc_probe(struct platform_device *pdev) */ static const struct of_device_id sun6i_rtc_dt_ids[] = { { .compatible = "allwinner,sun6i-a31-rtc" }, + { .compatible = "allwinner,sun8i-a23-rtc" }, + { .compatible = "allwinner,sun8i-h3-rtc" }, + { .compatible = "allwinner,sun8i-v3-rtc" }, + { .compatible = "allwinner,sun50i-h5-rtc" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids); From patchwork Mon Dec 3 14:58:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF8891731 for ; Mon, 3 Dec 2018 15:10:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF8722AC2E for ; Mon, 3 Dec 2018 15:10:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3BC72B170; Mon, 3 Dec 2018 15:10:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 407942AC2E for ; Mon, 3 Dec 2018 15:10:26 +0000 (UTC) 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=HgQm3jh+GPFZBpWxb8UIPiPUJHRmyqLtH8HfPT5HvzE=; b=XHNjIiXXTip7Pd o9soLjwUD+VZAmEuWMFyvj38lmZ6x/BzYdPvlYFqXMXIIHz4SVdIG8SbriflFddqdByCeNXpdk1yQ g6DzXSOseum0jrorPQKq88sFESvHlHdE9/C4QjLMmIWzqmIr/wZ4GS2ZH4vebxBr9Ir7GA6oqGuxc T7v0HGl5O26N1tc3GXmRmuk72BbJJv6LEPcCtBfV4yF23EiSejKWlXh/c5apH9Pbj/XLyn9DynTRu P0qFxc3PL0P60zEvIrrZkkO8Fx1VjPbdG+qE/ike0H27LH3AGsPrrTQnQV+UW6CNgPgnp1j83TqFb vJ7NyB8keRRlPQjzw/sg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTprc-0006y9-Us; Mon, 03 Dec 2018 15:10:24 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yZ-BA for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:00 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 7DDFC5FDB8; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 08/14] rtc: sun6i: Expose internal oscillator through device tree Date: Mon, 3 Dec 2018 22:58:19 +0800 Message-Id: <20181203145825.20511-9-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065855_994026_1C3B02B0 X-CRM114-Status: GOOD ( 15.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The bindings have been updated to expose the RTC's internal oscillator, for some SoCs that have it directly feeding the PRCM block. The changes include the index 2 for the clock outputs, as well as the clock output names. This patch adds the internal oscillator to the list of clocks exposed through of_clk_add_hw_provider(), and also have the driver optionally fetch the name of the clock from the device tree if it's available. Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/rtc/rtc-sun6i.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 46609ae56ffd..11f56de52179 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -136,6 +136,7 @@ struct sun6i_rtc_clk_data { unsigned int fixed_prescaler : 16; unsigned int has_prescaler : 1; unsigned int has_out_clk : 1; + unsigned int export_iosc : 1; }; struct sun6i_rtc_dev { @@ -220,6 +221,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, .ops = &sun6i_rtc_osc_ops, .name = "losc", }; + const char *iosc_name = "rtc-int-osc"; const char *clkout_name = "osc32k-out"; const char *parents[2]; @@ -228,7 +230,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, return; rtc->data = data; - clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); + clk_data = kzalloc(struct_size(clk_data, hws, 3), GFP_KERNEL); if (!clk_data) { kfree(rtc); return; @@ -253,8 +255,13 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, if (!of_get_property(node, "clocks", NULL)) goto err; + /* Only read IOSC name from device tree if it is exported */ + if (rtc->data->export_iosc) + of_property_read_string_index(node, "clock-output-names", 2, + &iosc_name); + rtc->int_osc = clk_hw_register_fixed_rate_with_accuracy(NULL, - "rtc-int-osc", + iosc_name, NULL, 0, rtc->data->rc_osc_rate, 300000000); @@ -293,6 +300,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, clk_data->num = 2; clk_data->hws[0] = &rtc->hw; clk_data->hws[1] = __clk_get_hw(rtc->ext_losc); + if (rtc->data->export_iosc) { + clk_data->hws[2] = rtc->int_osc; + clk_data->num = 3; + } of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); return; @@ -330,6 +341,7 @@ static const struct sun6i_rtc_clk_data sun8i_h3_rtc_data = { .fixed_prescaler = 32, .has_prescaler = 1, .has_out_clk = 1, + .export_iosc = 1, }; static void __init sun8i_h3_rtc_clk_init(struct device_node *node) From patchwork Mon Dec 3 14:58:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC1FA13BF for ; Mon, 3 Dec 2018 15:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB82C2AFE8 for ; Mon, 3 Dec 2018 15:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF2812B0A3; Mon, 3 Dec 2018 15:01:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B20B2AFE8 for ; Mon, 3 Dec 2018 15:01:05 +0000 (UTC) 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=Iby7fBw2kjziPYfA8gTJKLmazLn/KK4x4/h8hcfHJHI=; b=E+bjxd9ZEZ1/hW UaDhBw4fe07ZkDbAWgxRC9Lzad+O9I5FviaVYWgqN1EksLyIm9d29tOIU378vt7GfyXSbHTiMYL8l ViKJ73OW5buZkYR5L5t/LDHh+DFLYNliah0IM4mmWz87fTfbBFOQmgZ8ABrG9uYYFMdxrkIzA+La6 6S/D2NeQvwigmnMiHMnUjKjI+Wl0bYzqXa/TzdSLZ2skrdD+XNkvHvx9eWRe3SvNtkWQDCtXv1hw1 L3NhuTHncLl1kLRID5bBQqVUnXBUOYF0oA77OjWs+uB9Z0MyrYpWhciDn0F4KdrWk6zuVtjz8WGuB D5dwxpegRFenO33p7U+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpiZ-00015p-Af; Mon, 03 Dec 2018 15:01:03 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yw-BF for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:06 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 83A115FDC1; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 09/14] ARM: dts: sun8i: a23/a33: Fix up RTC device node Date: Mon, 3 Dec 2018 22:58:20 +0800 Message-Id: <20181203145825.20511-10-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_358274_6093BC57 X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RTC module on the A23 was claimed to be the same as on the A31, when in fact it is not. The A31 does not have an RTC external clock output, and its internal RC oscillator's average clock rate is not in the same range. The A33's RTC is the same as the A23. This patch fixes the compatible string and clock properties to conform to the updated bindings. The register range is also fixed. Acked-by: Maxime Ripard Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi index c2ff8975ac60..a9c123de5d2c 100644 --- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi +++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi @@ -573,11 +573,11 @@ }; rtc: rtc@1f00000 { - compatible = "allwinner,sun6i-a31-rtc"; - reg = <0x01f00000 0x54>; + compatible = "allwinner,sun8i-a23-rtc"; + reg = <0x01f00000 0x400>; interrupts = , ; - clock-output-names = "osc32k"; + clock-output-names = "osc32k", "osc32k-out"; clocks = <&ext_osc32k>; #clock-cells = <1>; }; From patchwork Mon Dec 3 14:58:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39D0F16B1 for ; Mon, 3 Dec 2018 15:00:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28CA52AFE8 for ; Mon, 3 Dec 2018 15:00:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D0AC2B0AD; Mon, 3 Dec 2018 15:00:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 123EA2B0A9 for ; Mon, 3 Dec 2018 15:00:43 +0000 (UTC) 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=AjXG/egVRJ21xEtggTmKljnJzg8Y0VydZLzxd7A0YcE=; b=dNpFV823xwkJ4J f+ouEI79+tKRXDAq9JkN76ZBR5b9XRFEo0rgvXwnyzbJXPHHlH0JLKzvoWiTes2IpQ8Cp+q3+UGE9 Se2zMYTMDyKjPZBo5p6OTW+Av4yfgf1tOnnfB+3JBlYmzk0r57FGeJ56vqVwAWObYGau99VARgO8e YP232yjQ9gqi/guDE5upbwySFjXc7BaceD+NYaxxBkqEKjjQ+mnQnmdkYgMnwjO0MY7NUhe3MDULY 46FaISl96bDz7s6SigbLPlhR55iiiLFLw4uNw/ElVkPGj4HjWrkLfiZpY/zlxlV6WMvVEzFILxvJg hJNv+Nr2EEJys4Ie2Cag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpi2-0000UF-Ly; Mon, 03 Dec 2018 15:00:30 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yx-BD for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:03 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 8ECB25FD9E; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 10/14] ARM: dts: sunxi: h3/h5: Add clock accuracy for external oscillators Date: Mon, 3 Dec 2018 22:58:21 +0800 Message-Id: <20181203145825.20511-11-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_628040_DEBCE8C4 X-CRM114-Status: GOOD ( 11.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The H3 datasheet specifies a tolerance range for the external oscillators used. Add them to the device tree as the clock accuracy. The internal oscillator is left unchanged, as it will be removed later. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sunxi-h3-h5.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index 0d9e9eac518c..bce3bf1d6ae5 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -86,6 +86,7 @@ #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <24000000>; + clock-accuracy = <50000>; clock-output-names = "osc24M"; }; @@ -93,6 +94,7 @@ #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <32768>; + clock-accuracy = <50000>; clock-output-names = "osc32k"; }; From patchwork Mon Dec 3 14:58:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9C4F16B1 for ; Mon, 3 Dec 2018 15:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99BAB2B0E8 for ; Mon, 3 Dec 2018 15:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2CF2B12A; Mon, 3 Dec 2018 15:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A78E2B12D for ; Mon, 3 Dec 2018 15:01:22 +0000 (UTC) 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=eRNLzFLGgIGP5rVFZWZ9PJArjpn8ysZ7xNQuVN8+pLw=; b=l3F00AeUYSTBfZ 4CiyqXslVyt12rw8DFC3jnaFyDeYdFI0PpnWW8Fc/1OQr7yllRgVPws9vlV7ut5fCk6CrEf3IDJwV CV2Y0onWg/tmrDqpC1dnpavtGT9/ffJwMzbBFtWN1jZQssSk407KGh0P4emB4rM3YkdWSlBo8LvFA 8ieY2/071WXiHzjBC5wAA7yoBKxW+MfoA2MQucLp3Q5fb7rkyt4EiiCtiwJvtzV3KO2nAk+Xej0wA zPI7I/2wJHwApHejLZyVfzKMWmA4LRQXyEMXtCh8/YRA5lV0EGpBtXDJ1Yg11Z3GESJ9n8EKBV5qd 6cO92M1fNCY2N17xZYUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpin-0001KU-6O; Mon, 03 Dec 2018 15:01:17 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005z3-BH for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:05 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 9491F5FDD0; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 11/14] ARM: dts: sunxi: h3/h5: Fix up RTC device node and clock references Date: Mon, 3 Dec 2018 22:58:22 +0800 Message-Id: <20181203145825.20511-12-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_656590_33663E52 X-CRM114-Status: GOOD ( 16.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RTC module on the H3 was claimed to be the same as on the A31, when in fact it is not. The A31 does not have an RTC external clock output, and its internal RC oscillator's average clock rate is not in the same range. The H5's RTC has some extra crypto-related registers compared to the H3. Their exact functions are not clear. Also the RTC-VIO regulator has different settings. This patch fixes the compatible string and clock properties to conform to the updated bindings. The device node for the internal oscillator is removed, as it is internalized into the RTC device. Clock references to the IOSC and LOSC are also fixed. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-h3.dtsi | 4 +++ arch/arm/boot/dts/sunxi-h3-h5.dtsi | 26 ++++++++------------ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 +++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index c2da3a3d373a..743c1dbaf147 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -241,3 +241,7 @@ &pio { compatible = "allwinner,sun8i-h3-pinctrl"; }; + +&rtc { + compatible = "allwinner,sun8i-h3-rtc"; +}; diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index bce3bf1d6ae5..3cc4366c07fd 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -95,15 +95,7 @@ compatible = "fixed-clock"; clock-frequency = <32768>; clock-accuracy = <50000>; - clock-output-names = "osc32k"; - }; - - iosc: internal-osc-clk { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <16000000>; - clock-accuracy = <300000000>; - clock-output-names = "iosc"; + clock-output-names = "ext_osc32k"; }; }; @@ -377,7 +369,7 @@ ccu: clock@1c20000 { /* compatible is in per SoC .dtsi file */ reg = <0x01c20000 0x400>; - clocks = <&osc24M>, <&osc32k>; + clocks = <&osc24M>, <&rtc 0>; clock-names = "hosc", "losc"; #clock-cells = <1>; #reset-cells = <1>; @@ -388,7 +380,7 @@ reg = <0x01c20800 0x400>; interrupts = , ; - clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>; + clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&rtc 0>; clock-names = "apb", "hosc", "losc"; gpio-controller; #gpio-cells = <3>; @@ -813,17 +805,19 @@ }; rtc: rtc@1f00000 { - compatible = "allwinner,sun6i-a31-rtc"; - reg = <0x01f00000 0x54>; + /* compatible is in per SoC .dtsi file */ + reg = <0x01f00000 0x400>; interrupts = , ; + clock-output-names = "osc32k", "osc32k-out", "iosc"; + clocks = <&osc32k>; + #clock-cells = <1>; }; r_ccu: clock@1f01400 { compatible = "allwinner,sun8i-h3-r-ccu"; reg = <0x01f01400 0x100>; - clocks = <&osc24M>, <&osc32k>, <&iosc>, - <&ccu 9>; + clocks = <&osc24M>, <&rtc 0>, <&rtc 2>, <&ccu 9>; clock-names = "hosc", "losc", "iosc", "pll-periph"; #clock-cells = <1>; #reset-cells = <1>; @@ -861,7 +855,7 @@ compatible = "allwinner,sun8i-h3-r-pinctrl"; reg = <0x01f02c00 0x400>; interrupts = ; - clocks = <&r_ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>; + clocks = <&r_ccu CLK_APB0_PIO>, <&osc24M>, <&rtc 0>; clock-names = "apb", "hosc", "losc"; gpio-controller; #gpio-cells = <3>; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi index b41dc1aab67d..fe731b35f761 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi @@ -172,3 +172,7 @@ ; compatible = "allwinner,sun50i-h5-pinctrl"; }; + +&rtc { + compatible = "allwinner,sun50i-h5-rtc"; +}; From patchwork Mon Dec 3 14:58:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75EE813BF for ; Mon, 3 Dec 2018 15:10:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6422228591 for ; Mon, 3 Dec 2018 15:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 573A42B19F; Mon, 3 Dec 2018 15:10:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E69E628591 for ; Mon, 3 Dec 2018 15:10:50 +0000 (UTC) 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=PqT8Lbw7Bh+5FIXlPEobcuzEwSgb8go+dAuyz7FPvn8=; b=pv8rDa7slrOgcQ FXf8uZeZO/DFKfLx0j7QUe/+TkvZtIj6mUM8ZxXuUNEKOXiHuxiV8Q/E/vJ3Gm+iM3QBHsUiDyP7k VKR2zIW09Z+32iyZN/TJumi+78fNIp9dlDphOlzb7JsiS3cFb9Tp4TljQ9atzJsYnSUpNzmrhNBi+ TucfZhoSKCG3vFojDCiX3UY/UZakS8rLqssOq4l3DB/KK1nVm12chjJp21AP15ArICk3nH35m/7yJ Q24klsmvfdfufLKOCWv9MvdumGXHaURNE0o8NPSimsIMt+MaCGGjIxnuL5wso+ho1cLISgcDvjXCL GapqqUXgBqAW99x/csOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTps0-0007Mf-0o; Mon, 03 Dec 2018 15:10:48 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005yz-BC for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:07 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 9A2F95FDD5; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 12/14] ARM: dts: sun8i: r40: Add clock accuracy for external oscillators Date: Mon, 3 Dec 2018 22:58:23 +0800 Message-Id: <20181203145825.20511-13-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_559243_BC030EB9 X-CRM114-Status: GOOD ( 11.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The R40 datasheet specifies a tolerance range for the external oscillators used. Add them to the device tree as the clock accuracy. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-r40.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 6f4c9ca5a3ee..a8917f8b1c80 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -61,6 +61,7 @@ #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <24000000>; + clock-accuracy = <50000>; clock-output-names = "osc24M"; }; @@ -68,6 +69,7 @@ #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <32768>; + clock-accuracy = <20000>; clock-output-names = "osc32k"; }; }; From patchwork Mon Dec 3 14:58:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40AD41731 for ; Mon, 3 Dec 2018 15:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D24A2B042 for ; Mon, 3 Dec 2018 15:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A6272B18B; Mon, 3 Dec 2018 15:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3DE72B0A7 for ; Mon, 3 Dec 2018 15:10:33 +0000 (UTC) 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=m6DIaEAFSGzePF7ry/6CpnJnDf+l7xi84xO6ty4Yrj4=; b=nsR318/PGosoFj RiwpkL/9DHCS5HTsgeq7DghtpqTefcbK7knjUR10ebug+bqJy9LGgw3RBs9AaXw86voNq3LaDOAHD MIUfwIvhylPm5vuYEy05tkzBGDDj6lb0iYPHFkjK6xQol+9UMK2CRcT1mXt+fZLMnMhkWzWb1aJt4 4qwrwq170q6MDZ5fW0Au9igD36DnnEDBoj79Ozvm6TL5h45fmpQnUg66wIbMJ1JO5soBceckgZOaP w31nx3yxuLmmMqlFt88NPHDEvtTj8hQNfe7YaecPRPSsbktgy0r6DoZdZJH3Rl3mYow2hpzncCrmn 0t6Ozj77dx3YGZfQq0YQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTprd-0006yf-9H; Mon, 03 Dec 2018 15:10:25 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005z1-BB for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:10 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 9FBC95FDD7; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 13/14] ARM: dts: sun8i: r40: Add RTC device node Date: Mon, 3 Dec 2018 22:58:24 +0800 Message-Id: <20181203145825.20511-14-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_326247_7213221A X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Corentin Labbe , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The R40 has an RTC hardware block, which has additional registers that are not related to RTC or clock functions, and is otherwise compatible with the H3's RTC. Add a device node for it, and fix up any references to the LOSC. Acked-by: Maxime Ripard Tested-by: Corentin Labbe Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-r40.dtsi | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index a8917f8b1c80..89762dbefe42 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -70,7 +70,7 @@ compatible = "fixed-clock"; clock-frequency = <32768>; clock-accuracy = <20000>; - clock-output-names = "osc32k"; + clock-output-names = "ext-osc32k"; }; }; @@ -315,17 +315,27 @@ ccu: clock@1c20000 { compatible = "allwinner,sun8i-r40-ccu"; reg = <0x01c20000 0x400>; - clocks = <&osc24M>, <&osc32k>; + clocks = <&osc24M>, <&rtc 0>; clock-names = "hosc", "losc"; #clock-cells = <1>; #reset-cells = <1>; }; + rtc: rtc@1c20400 { + compatible = "allwinner,sun8i-r40-rtc", + "allwinner,sun8i-h3-rtc"; + reg = <0x01c20400 0x400>; + interrupts = ; + clock-output-names = "osc32k", "osc32k-out"; + clocks = <&osc32k>; + #clock-cells = <1>; + }; + pio: pinctrl@1c20800 { compatible = "allwinner,sun8i-r40-pinctrl"; reg = <0x01c20800 0x400>; interrupts = ; - clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>; + clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&rtc 0>; clock-names = "apb", "hosc", "losc"; gpio-controller; interrupt-controller; From patchwork Mon Dec 3 14:58:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10709759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62D2F13BF for ; Mon, 3 Dec 2018 15:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51DAE2B08A for ; Mon, 3 Dec 2018 15:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 451F02B082; Mon, 3 Dec 2018 15:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 442B12B08A for ; Mon, 3 Dec 2018 15:00:18 +0000 (UTC) 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=zzapKNOM8eXwlSnVwz2NpJrcFkHZA0Lq9w+eF38tr/w=; b=VLLQOEuR0YqSF0 QkM4i5Aya+WYNB3sKbucnGoVqOENt2bu7jLhjsVWKpVJFWt0D7LZxhxIU+T8dD8+dugWheoJ7E3Ou Kh+asHwuGUWnVl+2afvAtLgb3eR76yyCx7rMLiSmbWsKaCLnA06Kx7vnYtIAtojZ91EUgHmMgr4gj Ufl+woHzpch+VWVnRZ5BNQWJveqzcNYh56CMfyvC6sTQ2lC+4j3VyBCQi62uj8CkhtdIG0jpWQlZb KL3vauynGRV0ShwmFkfmofolDgHkrkYK5dndJRyo6sh4ZAbaFfL3TW9Wt9e6ORHxbik9nwVsM5wP1 E+5svztzVpPbWdvibT3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTphm-0007yn-Li; Mon, 03 Dec 2018 15:00:14 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpgV-0005z2-BE for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:59:03 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id A73B75FDD9; Mon, 3 Dec 2018 22:58:27 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Subject: [PATCH v2 14/14] arm64: dts: allwinner: a64: Fix up RTC device node and clock references Date: Mon, 3 Dec 2018 22:58:25 +0800 Message-Id: <20181203145825.20511-15-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181203145825.20511-1-wens@csie.org> References: <20181203145825.20511-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065856_231781_48F2B558 X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RTC module on the A64 was claimed to be the same as on the A31, when in fact it is not. It is actually compatible to the H3's RTC. The A64's RTC has some extra crypto-related registers which the H3's does not, but the exact function of these is not clear. This patch fixes the compatible string and clock properties to conform to the updated bindings. The device node for the internal oscillator is removed, as it is internalized into the RTC device. Clock references to the IOSC and LOSC are also fixed. Acked-by: Maxime Ripard Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 384c417cb7a2..a729dcc63038 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -139,15 +139,7 @@ #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <32768>; - clock-output-names = "osc32k"; - }; - - iosc: internal-osc-clk { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <16000000>; - clock-accuracy = <300000000>; - clock-output-names = "iosc"; + clock-output-names = "ext-osc32k"; }; psci { @@ -514,7 +506,7 @@ ccu: clock@1c20000 { compatible = "allwinner,sun50i-a64-ccu"; reg = <0x01c20000 0x400>; - clocks = <&osc24M>, <&osc32k>; + clocks = <&osc24M>, <&rtc 0>; clock-names = "hosc", "losc"; #clock-cells = <1>; #reset-cells = <1>; @@ -944,11 +936,12 @@ }; rtc: rtc@1f00000 { - compatible = "allwinner,sun6i-a31-rtc"; - reg = <0x01f00000 0x54>; + compatible = "allwinner,sun50i-a64-rtc", + "allwinner,sun8i-h3-rtc"; + reg = <0x01f00000 0x400>; interrupts = , ; - clock-output-names = "rtc-osc32k", "rtc-osc32k-out"; + clock-output-names = "osc32k", "osc32k-out", "iosc"; clocks = <&osc32k>; #clock-cells = <1>; }; @@ -965,8 +958,7 @@ r_ccu: clock@1f01400 { compatible = "allwinner,sun50i-a64-r-ccu"; reg = <0x01f01400 0x100>; - clocks = <&osc24M>, <&osc32k>, <&iosc>, - <&ccu 11>; + clocks = <&osc24M>, <&rtc 0>, <&rtc 2>, <&ccu 11>; clock-names = "hosc", "losc", "iosc", "pll-periph"; #clock-cells = <1>; #reset-cells = <1>;