From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Qing Zhang <zhangqing@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thomas Gleixner <tglx@linutronix.de>,
Marc Zyngier <maz@kernel.org>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Ming Wang <wangming01@loongson.cn>
Subject: Re: [PATCH v4 3/7] MIPS: Loongson64: Add support for the Loongson-2K1000 to get cpu_clock_freq
Date: Wed, 10 Mar 2021 11:50:20 +0300 [thread overview]
Message-ID: <cb549804-4ee1-79ab-d872-3e95bf0cbe55@gmail.com> (raw)
In-Reply-To: <20210310075639.20372-4-zhangqing@loongson.cn>
Hello!
On 10.03.2021 10:56, Qing Zhang wrote:
> Get the fixed-clock from the CPU0 node of the device tree.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
> Tested-by: Ming Wang <wangming01@loongson.cn>
> ---
>
> v3-v4: Standard submission of information
> Add return after error
>
> arch/mips/loongson64/time.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/arch/mips/loongson64/time.c b/arch/mips/loongson64/time.c
> index 91e842b58365..2d84f9b20a9b 100644
> --- a/arch/mips/loongson64/time.c
> +++ b/arch/mips/loongson64/time.c
> @@ -11,9 +11,33 @@
> #include <asm/hpet.h>
>
> #include <loongson.h>
> +#include <linux/clk.h>
> +#include <linux/of_clk.h>
>
> void __init plat_time_init(void)
> {
> + struct clk *clk = NULL;
You don't seem to need this initializer.
> + struct device_node *np;
> +
> + if (loongson_sysconf.fw_interface == LOONGSON_DTB) {
> + of_clk_init(NULL);
> +
> + np = of_get_cpu_node(0, NULL);
> + if (!np) {
> + pr_err("Failed to get CPU node\n");
> + return;
> + }
> +
> + clk = of_clk_get(np, 0);
> + if (IS_ERR(clk)) {
> + pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk));
> + return;
> + }
> +
> + cpu_clock_freq = clk_get_rate(clk);
> + clk_put(clk);
> + }
> +
> /* setup mips r4k timer */
> mips_hpt_frequency = cpu_clock_freq / 2;
>
>
next prev parent reply other threads:[~2021-03-10 8:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 7:56 [PATCH v4 0/7] Add basic support for Loongson-2K1000 Qing Zhang
2021-03-10 7:56 ` [PATCH v4 1/7] MIPS: Loongson64: DeviceTree " Qing Zhang
2021-03-10 7:56 ` [PATCH v4 2/7] MIPS: Loongson64: Distinguish firmware dependencies DTB/LEFI Qing Zhang
2021-03-10 10:57 ` Oleksij Rempel
2021-03-10 12:12 ` Jiaxun Yang
2021-03-10 13:26 ` Oleksij Rempel
[not found] ` <a2b1ad18-8f4b-8e43-e175-c372580a7168@flygoat.com>
2021-03-10 16:03 ` Oleksij Rempel
2021-03-10 7:56 ` [PATCH v4 3/7] MIPS: Loongson64: Add support for the Loongson-2K1000 to get cpu_clock_freq Qing Zhang
2021-03-10 8:50 ` Sergei Shtylyov [this message]
2021-03-10 9:37 ` zhangqing
2021-03-10 12:06 ` Jiaxun Yang
2021-03-10 7:56 ` [PATCH v4 4/7] MIPS: Loongson64: Add Loongson-2K1000 early_printk_port Qing Zhang
2021-03-10 7:56 ` [PATCH v4 5/7] irqchip/loongson-liointc: irqchip add 2.0 version Qing Zhang
2021-03-10 7:56 ` [PATCH v4 6/7] dt-bindings: interrupt-controller: Add Loongson-2K1000 LIOINTC Qing Zhang
2021-03-10 12:04 ` Jiaxun Yang
2021-03-11 1:43 ` zhangqing
2021-03-10 7:56 ` [PATCH v4 7/7] MIPS: Loongson64: Add a Loongson-2K1000 default config file Qing Zhang
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=cb549804-4ee1-79ab-d872-3e95bf0cbe55@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=chenhuacai@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=wangming01@loongson.cn \
--cc=zhangqing@loongson.cn \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).