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 Cc: Linux-imx@nxp.com Subject: [PATCH 2/3] clocksource: imx-sysctr: Add of_clk skip option Date: Fri, 21 Jun 2019 16:28:37 +0800 [thread overview] Message-ID: <20190621082838.12630-2-Anson.Huang@nxp.com> (raw) In-Reply-To: <20190621082838.12630-1-Anson.Huang@nxp.com> From: Anson Huang <Anson.Huang@nxp.com> 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. This patch adds 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 <Anson.Huang@nxp.com> --- 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) -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
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 Cc: Linux-imx@nxp.com Subject: [PATCH 2/3] clocksource: imx-sysctr: Add of_clk skip option Date: Fri, 21 Jun 2019 16:28:37 +0800 [thread overview] Message-ID: <20190621082838.12630-2-Anson.Huang@nxp.com> (raw) In-Reply-To: <20190621082838.12630-1-Anson.Huang@nxp.com> From: Anson Huang <Anson.Huang@nxp.com> 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. This patch adds 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 <Anson.Huang@nxp.com> --- 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) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-21 8:27 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-21 8:28 [PATCH 1/3] clocksource/drivers/sysctr: Add an optional property Anson.Huang 2019-06-21 8:28 ` Anson.Huang 2019-06-21 8:28 ` Anson.Huang [this message] 2019-06-21 8:28 ` [PATCH 2/3] clocksource: imx-sysctr: Add of_clk skip option Anson.Huang 2019-06-21 8:28 ` [PATCH 3/3] arm64: dts: imx8mq: Add system counter node Anson.Huang 2019-06-21 8:28 ` Anson.Huang 2019-06-22 14:16 ` Martin Kepplinger 2019-06-22 14:16 ` Martin Kepplinger 2019-06-23 11:20 ` Martin Kepplinger 2019-06-23 11:20 ` Martin Kepplinger 2019-06-23 11:30 ` Anson Huang 2019-06-23 11:30 ` Anson Huang 2019-06-23 11:30 ` Anson Huang 2019-06-23 11:24 ` Anson Huang 2019-06-23 11:24 ` Anson Huang 2019-06-23 11:24 ` Anson Huang 2019-06-23 10:46 ` [PATCH 1/3] clocksource/drivers/sysctr: Add an optional property Thomas Gleixner 2019-06-23 10:46 ` Thomas Gleixner 2019-06-23 10:46 ` Thomas Gleixner 2019-06-23 11:31 ` Anson Huang 2019-06-23 11:31 ` Anson Huang 2019-06-23 11:31 ` Anson Huang 2019-06-23 11:34 ` Thomas Gleixner 2019-06-23 11:34 ` Thomas Gleixner 2019-06-23 11:34 ` Thomas Gleixner 2019-06-23 12:05 ` Anson Huang 2019-06-23 12:05 ` Anson Huang 2019-06-23 12:05 ` Anson Huang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190621082838.12630-2-Anson.Huang@nxp.com \ --to=anson.huang@nxp.com \ --cc=Linux-imx@nxp.com \ --cc=abel.vesa@nxp.com \ --cc=agx@sigxcpu.org \ --cc=andrew.smirnov@gmail.com \ --cc=angus@akkea.ca \ --cc=ccaione@baylibre.com \ --cc=daniel.lezcano@linaro.org \ --cc=devicetree@vger.kernel.org \ --cc=festevam@gmail.com \ --cc=kernel@pengutronix.de \ --cc=l.stach@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=robh+dt@kernel.org \ --cc=s.hauer@pengutronix.de \ --cc=shawnguo@kernel.org \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.