From patchwork Sun Jun 23 12:38:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 11011699 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 96EE1112C for ; Sun, 23 Jun 2019 12:37:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79EEB28B08 for ; Sun, 23 Jun 2019 12:37:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 658BE28AF3; Sun, 23 Jun 2019 12:37:12 +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 DE70B28AF3 for ; Sun, 23 Jun 2019 12:37:11 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=j5xjoq6QCuu/53Rh9FkPRWrrr16E+8GwYHw9nNgytyc=; b=aWV gw8SEXXQihKup3mq/LRigTAXR2a0rB5AEIAScmxQJpSDjOw6WzEDn8FtwKgZ5vGRn/8JiGy1Ct7p8 IYcEI7VGgqXYdW6h0DfFYisuT0ex+wWdJlfdzJuJasj45KOlrWUpvV7ssWuvLYMSvSKEQk2I6Ggwy JlGEoW/qF6x5ptjm3V4vMoFVIzUn2x99D7cIB7FoQz8taPDUzpU3aPuXMjq6cAp6el9oMeWLQkIDd YKfnVhXBfytIlsNXeQBSusGIU+geSfWriksT7fzawYo6Lhzvm3C7orNB2pRzZS9s9tAHOSC7h2moh dAsmoF/B7490SLbUt8SdEjuymYscDXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hf1k6-0007QC-6t; Sun, 23 Jun 2019 12:37:10 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hf1k2-0007P7-Tc for linux-arm-kernel@lists.infradead.org; Sun, 23 Jun 2019 12:37:08 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1D0242003D1; Sun, 23 Jun 2019 14:37:05 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2D7CC20012B; Sun, 23 Jun 2019 14:36:56 +0200 (CEST) Received: from mega.ap.freescale.net (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 3EA8C4030C; Sun, 23 Jun 2019 20:36:45 +0800 (SGT) From: Anson.Huang@nxp.com To: daniel.lezcano@linaro.org, tglx@linutronix.de, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, l.stach@pengutronix.de, abel.vesa@nxp.com, ccaione@baylibre.com, angus@akkea.ca, andrew.smirnov@gmail.com, agx@sigxcpu.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RESEND V2 1/3] clocksource/drivers/sysctr: Add optional clock-frequency property Date: Sun, 23 Jun 2019 20:38:48 +0800 Message-Id: <20190623123850.22584-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190623_053707_095384_EC7D7E77 X-CRM114-Status: UNSURE ( 7.55 ) X-CRM114-Notice: Please train this message. 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: Linux-imx@nxp.com MIME-Version: 1.0 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 From: Anson Huang Systems which use platform driver model for clock driver require the clock frequency to be supplied via device tree when system counter driver is enabled. This is necessary as in the platform driver model the of_clk operations do not work correctly because system counter driver is initialized in early phase of system boot up, and clock driver using platform driver model is NOT ready at that time, it will cause system counter driver initialization failed. Add the optinal clock-frequency to the device tree bindings of the NXP system counter, so the frequency can be handed in and the of_clk operations can be skipped. Signed-off-by: Anson Huang --- Changes since V1: - improve commit log, no content change. --- Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt index d576599..c9907a0 100644 --- a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt +++ b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.txt @@ -14,6 +14,11 @@ Required properties: - clocks : Specifies the counter clock. - clock-names: Specifies the clock's name of this module +Optional properties: + +- clock-frequency : Specifies system counter clock frequency and indicates system + counter driver to skip clock operations. + Example: system_counter: timer@306a0000 { @@ -22,4 +27,5 @@ Example: clocks = <&clk_8m>; clock-names = "per"; interrupts = ; + clock-frequency = <8333333>; }; From patchwork Sun Jun 23 12:38:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 11011701 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 3D99E1580 for ; Sun, 23 Jun 2019 12:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 289BC28AF3 for ; Sun, 23 Jun 2019 12:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1914A28AF8; Sun, 23 Jun 2019 12:37: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 AF7BC28AF3 for ; Sun, 23 Jun 2019 12:37: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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=ToDN701eMDTH9eSj5tgb0lGpXGVomMWKOdSbZm9WbyA=; b=Mw6AvaRHsDdZ3Pb9lE2lcz7+7q aDBL4o5mYP+B2d2h9CHDL1WzmiZ8o0OYmYqdRqWxBEALdSGvjR1kQykIcsCdqjQs42lIexwiDPSyr korCP3RAOnG7GtY8a1nhv1vmOA6xl0QeJlCsxrZQU1AcbM0TI6X5BumTGTohbpkZD1rD3PO7kPu+0 R5xRLfoxA43w7f/UFyJ8MdTiitjQa/AHGv9oVQs7zEtW7P2/0B2Htu3kKgYqWx96TaybEHo0ZauB2 kI+EuqoNgXI+UFDccUDx0xtFhPHbmpUUwk+cOy2e3aHQjgAg4XSrk0PY1+xhPBSs6iV858rNPDX/k 8WArnieQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hf1kO-0007cT-3g; Sun, 23 Jun 2019 12:37:28 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hf1k3-0007PR-WC for linux-arm-kernel@lists.infradead.org; Sun, 23 Jun 2019 12:37:09 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BE51A2003D6; Sun, 23 Jun 2019 14:37:06 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CB38F2003CF; Sun, 23 Jun 2019 14:36:57 +0200 (CEST) Received: from mega.ap.freescale.net (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id DBC6B40313; Sun, 23 Jun 2019 20:36:46 +0800 (SGT) From: Anson.Huang@nxp.com To: daniel.lezcano@linaro.org, tglx@linutronix.de, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, l.stach@pengutronix.de, abel.vesa@nxp.com, ccaione@baylibre.com, angus@akkea.ca, andrew.smirnov@gmail.com, agx@sigxcpu.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RESEND V2 2/3] clocksource: imx-sysctr: Make timer work with clock driver using platform driver model Date: Sun, 23 Jun 2019 20:38:49 +0800 Message-Id: <20190623123850.22584-2-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190623123850.22584-1-Anson.Huang@nxp.com> References: <20190623123850.22584-1-Anson.Huang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190623_053708_169765_DFA645E3 X-CRM114-Status: UNSURE ( 9.19 ) X-CRM114-Notice: Please train this message. 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: Linux-imx@nxp.com MIME-Version: 1.0 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 From: Anson Huang On some i.MX8M platforms, clock driver uses platform driver model and it is NOT ready during timer initialization phase, the clock operations will fail and system counter driver will fail too. As all the i.MX8M platforms' system counter clock are from OSC which is always enabled, so it is no need to enable clock for system counter driver, the ONLY thing is to pass clock frequence to driver. To make system counter driver work for upper scenario, add an option of skipping of_clk operation for system counter driver, an optional property "clock-frequency" is introduced to pass the frequency value to system counter driver and indicate driver to skip of_clk operations. Signed-off-by: Anson Huang --- Changes since V1: - improve commit log, no content change. --- drivers/clocksource/timer-imx-sysctr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index fd7d680..8ff3d7e 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -129,6 +129,14 @@ static void __init sysctr_clockevent_init(void) static int __init sysctr_timer_init(struct device_node *np) { int ret = 0; + u32 rate; + + if (!of_property_read_u32(np, "clock-frequency", + &rate)) { + to_sysctr.of_clk.rate = rate; + to_sysctr.of_clk.period = DIV_ROUND_UP(rate, HZ); + to_sysctr.flags &= ~TIMER_OF_CLOCK; + } ret = timer_of_init(np, &to_sysctr); if (ret) From patchwork Sun Jun 23 12:38:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 11011703 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 F3FE0186E for ; Sun, 23 Jun 2019 12:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E452C28AF3 for ; Sun, 23 Jun 2019 12:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7E5628B08; Sun, 23 Jun 2019 12:37:53 +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 93FBC28AF3 for ; Sun, 23 Jun 2019 12:37:53 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=bEHIKF7Jq8oRXdf1oI2HF3GnivvWe74j2jp2orMNdqE=; b=GhPnonDt+2yrD55QXOEEBPOwgD LnFJtpfAZlMmiNpyp+ZWq/jd7e8evXBVobIRrJYinnO6cKQhLAWhOOCZ4ChGshwooZBBrT75upDKl IZnZfXIJMd/wlI5jK3HHXYPnOOHrXXpkFEAQ9IJlrOkDmClF4o7t18JvorfVu7yoteH43iAD8feOa nOmFrahLGNPT88JEP0BbAj3UR92+X0fbRBz6JGiMQ4O2GojejFOz/Qw2WaE2vQ7P/qagiW84c0e5A gpGKuoOeSXK8jG6LJTraTUTu8NE+qLOBNRY+sts7EUV+BOKH5L/BWY6qciAJINx8l7qKDfJoqrtOA SEf83ovA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hf1kh-00084T-S2; Sun, 23 Jun 2019 12:37:48 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hf1k5-0007Pk-7g for linux-arm-kernel@lists.infradead.org; Sun, 23 Jun 2019 12:37:10 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F0DD220012B; Sun, 23 Jun 2019 14:37:07 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0DEAA2003D0; Sun, 23 Jun 2019 14:36:59 +0200 (CEST) Received: from mega.ap.freescale.net (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 8473F40318; Sun, 23 Jun 2019 20:36:48 +0800 (SGT) From: Anson.Huang@nxp.com To: daniel.lezcano@linaro.org, tglx@linutronix.de, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, l.stach@pengutronix.de, abel.vesa@nxp.com, ccaione@baylibre.com, angus@akkea.ca, andrew.smirnov@gmail.com, agx@sigxcpu.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RESEND V2 3/3] arm64: dts: imx8mq: Add system counter node Date: Sun, 23 Jun 2019 20:38:50 +0800 Message-Id: <20190623123850.22584-3-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190623123850.22584-1-Anson.Huang@nxp.com> References: <20190623123850.22584-1-Anson.Huang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190623_053709_409886_7A88719B X-CRM114-Status: UNSURE ( 6.23 ) X-CRM114-Notice: Please train this message. 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: Linux-imx@nxp.com MIME-Version: 1.0 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 From: Anson Huang Add i.MX8MQ system counter node to enable timer-imx-sysctr broadcast timer driver. Signed-off-by: Anson Huang --- No change. --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index d09b808..9d99191 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -635,6 +635,14 @@ #pwm-cells = <2>; status = "disabled"; }; + + system_counter: timer@306a0000 { + compatible = "nxp,sysctr-timer"; + reg = <0x306a0000 0x30000>; + interrupts = , + ; + clock-frequency = <8333333>; + }; }; bus@30800000 { /* AIPS3 */