From: Stephen Boyd <sboyd@kernel.org>
To: Huacai Chen <chenhuacai@kernel.org>,
Jianmin Lv <lvjianmin@loongson.cn>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh+dt@kernel.org>, WANG Xuerui <kernel@xen0n.name>,
Yang Li <yang.lee@linux.alibaba.com>,
devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, liupeibao@loongson.cn,
loongarch@lists.linux.dev, wanghongliang@loongson.cn,
zhuyinbo@loongson.cn
Subject: Re: [PATCH v10 2/4] clk: clk-loongson2: add clock controller driver support
Date: Fri, 17 Feb 2023 14:15:42 -0800 [thread overview]
Message-ID: <8332a1cf44b01f06bdd5db9dc5d7f387.sboyd@kernel.org> (raw)
In-Reply-To: <4b5fd886-57ce-01ef-8224-432898b7fb1c@loongson.cn>
Quoting zhuyinbo (2023-02-14 23:35:22)
>
> 在 2023/2/11 上午7:42, Stephen Boyd 写道:
> > Quoting Yinbo Zhu (2022-11-28 19:41:55)
> >
> >> +
> >> + mult = (val >> LOONGSON2_USB_FREQSCALE_SHIFT) &
> >> + clk_div_mask(LOONGSON2_USB_FREQSCALE_WIDTH);
> >> +
> >> + rate = parent_rate * (mult + 1);
> >> + do_div(rate, 8);
> > Why is do_div() being used?
> no expecial reason, I only want to get a result that rate divide 8.
Ok, you can use div_u64() here and simplify.
> >
>
> you meaning is to use clk_parent_data to rework
> loongson2_clk_pll_register and drop
>
> loongson2_obtain_fixed_clk_hw ?
Yes
>
> >
> >> +}
> >> +
> >> +static void __init loongson2_clocks_init(struct device_node *np)
> >> +{
> >> + struct clk_hw **hws;
> >> + struct clk_hw_onecell_data *clk_hw_data;
> >> + spinlock_t loongson2_clk_lock;
> >> +
> >> + loongson2_pll_base = of_iomap(np, 0);
> >> +
> >> + if (!loongson2_pll_base) {
> >> + pr_err("clk: unable to map loongson2 clk registers\n");
> >> + goto err;
> > return?
> sorry, I don't get it. you meaning is that remove "goto err". Instead,
> add a "return".
Yes.
> >
> >> + }
> >> +
> >> + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, LOONGSON2_CLK_END),
> >> + GFP_KERNEL);
> >> + if (WARN_ON(!clk_hw_data))
> >> + goto err;
[...]
> >> +
> >> +err:
> >> + iounmap(loongson2_pll_base);
> >> +}
> >> +
> >> +CLK_OF_DECLARE(loongson2_clk, "loongson,ls2k-clk", loongson2_clocks_init);
> > Any reason this can't be a platform driver?
>
> For the compatible consideration of other clock controllers of
> Loongson-2 series in the future, the way of using dts can be
>
> better compatible.
>
Sorry that sentence doesn't make sense to me. The use of dts doesn't
require the use of CLK_OF_DECLARE.
next prev parent reply other threads:[~2023-02-17 22:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 3:41 [PATCH v10 1/4] dt-bindings: clock: add loongson-2 clock include file Yinbo Zhu
2022-11-29 3:41 ` [PATCH v10 2/4] clk: clk-loongson2: add clock controller driver support Yinbo Zhu
2022-11-30 3:32 ` XiaochuanMao
[not found] ` <dfc61f0b-0051-4146-f534-6436e3076b65@loongson.cn>
2022-11-30 10:16 ` Yinbo Zhu
2022-11-30 13:14 ` XiaochuanMao
2022-11-30 22:49 ` Yinbo Zhu
2022-12-07 2:15 ` Yinbo Zhu
2023-02-01 4:37 ` zhuyinbo
2023-02-10 23:42 ` Stephen Boyd
2023-02-15 7:35 ` zhuyinbo
2023-02-17 22:15 ` Stephen Boyd [this message]
2023-02-20 5:44 ` zhuyinbo
2023-02-21 23:07 ` Stephen Boyd
2023-02-22 2:02 ` zhuyinbo
2023-02-22 5:10 ` zhuyinbo
2023-02-22 21:00 ` Stephen Boyd
2023-02-23 2:16 ` zhuyinbo
2023-02-24 19:10 ` Stephen Boyd
2023-02-27 1:54 ` zhuyinbo
2022-11-29 3:41 ` [PATCH v10 3/4] LoongArch: time: add of_clk_init in time_init Yinbo Zhu
2023-02-10 23:33 ` Stephen Boyd
2022-11-29 3:41 ` [PATCH v10 4/4] dt-bindings: clock: add loongson-2 clock Yinbo Zhu
2023-02-10 23:43 ` Stephen Boyd
2023-02-10 23:42 ` [PATCH v10 1/4] dt-bindings: clock: add loongson-2 clock include file Stephen Boyd
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=8332a1cf44b01f06bdd5db9dc5d7f387.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liupeibao@loongson.cn \
--cc=loongarch@lists.linux.dev \
--cc=lvjianmin@loongson.cn \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=wanghongliang@loongson.cn \
--cc=yang.lee@linux.alibaba.com \
--cc=zhuyinbo@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