From: William Qiu <william.qiu@starfivetech.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-riscv@lists.infradead.org>, <linux-pwm@vger.kernel.org>
Cc: "Emil Renner Berthing" <kernel@esmil.dk>,
"Rob Herring" <robh+dt@kernel.org>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Hal Feng" <hal.feng@starfivetech.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v7 2/4] pwm: opencores: Add PWM driver support
Date: Mon, 13 Nov 2023 17:47:13 +0800 [thread overview]
Message-ID: <6610e454-2fda-4a2b-b088-88237685ea49@starfivetech.com> (raw)
In-Reply-To: <66173ccd-4478-4622-a386-557a8d35102f@linaro.org>
On 2023/11/10 20:27, Krzysztof Kozlowski wrote:
> On 10/11/2023 07:20, William Qiu wrote:
>> Add Pulse Width Modulation driver support for OpenCores.
>
> What is OpenCores? Why all your commit messages lack basic explanation
> of the hardware you are working on?
>
Will modify.
>>
>
>
>> +static const struct ocores_pwm_data jh7100_pwm_data = {
>> + .get_ch_base = starfive_jh71x0_get_ch_base,
>> +};
>> +
>> +static const struct ocores_pwm_data jh7110_pwm_data = {
>> + .get_ch_base = starfive_jh71x0_get_ch_base,
>> +};
>> +
>> +static const struct of_device_id ocores_pwm_of_match[] = {
>> + { .compatible = "opencores,pwm" },
>> + { .compatible = "starfive,jh7100-pwm", .data = &jh7100_pwm_data},
>> + { .compatible = "starfive,jh7110-pwm", .data = &jh7110_pwm_data},
>
> Your bindings say something entirely else.
>
> I don't understand what is happening with this patchset.
>
Will update.
>
>> + { /* sentinel */ }
>> +};
>
> ...
>
>> + ddata->regs = devm_platform_ioremap_resource(pdev, 0);
>> + if (IS_ERR(ddata->regs))
>> + return dev_err_probe(dev, PTR_ERR(ddata->regs),
>> + "Unable to map IO resources\n");
>> +
>> + ddata->clk = devm_clk_get(dev, NULL);
>> + if (IS_ERR(ddata->clk))
>> + return dev_err_probe(dev, PTR_ERR(ddata->clk),
>> + "Unable to get pwm's clock\n");
>> +
>> + ret = clk_prepare_enable(ddata->clk);
>> + if (ret)
>> + return dev_err_probe(dev, ret, "Clock enable failed\n");
>
> dev_clk_get_enabled() or whatever the API is called
>
You mean change devm_clk_get_enabled() instead of devm_clk_get()?
>> +
>> + ddata->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
>> + reset_control_deassert(ddata->rst);
>> +
>> + ddata->clk_rate = clk_get_rate(ddata->clk);
>> + if (ddata->clk_rate <= 0)
>> + return dev_err_probe(dev, ddata->clk_rate,
>> + "Unable to get clock's rate\n");
>> +
>> + ret = devm_pwmchip_add(dev, chip);
>> + if (ret < 0) {
>> + dev_err_probe(dev, ret, "Could not register PWM chip\n");
>> + clk_disable_unprepare(ddata->clk);
>> + reset_control_assert(ddata->rst);
>
> return dev_err_probe
>
Will update.
>> + }
>> +
>> + platform_set_drvdata(pdev, ddata);
>> +
>> + return ret;
>> +}
>> +
>> +static void ocores_pwm_remove(struct platform_device *dev)
>> +{
>> + struct ocores_pwm_device *ddata = platform_get_drvdata(dev);
>> +
>> + reset_control_assert(ddata->rst);
>> + clk_disable_unprepare(ddata->clk);
>
> You have confusing order of cleanups. It's like random, once clock then
> reset, in other place reset then clock.
>
Will change it into a reasonable order.
Thank you for spending time on this patchset.
Best Regards,
William
> Best regards,
> Krzysztof
>
next prev parent reply other threads:[~2023-11-13 9:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 6:20 [PATCH v7 0/4] StarFive's Pulse Width Modulation driver support William Qiu
2023-11-10 6:20 ` [PATCH v7 1/4] dt-bindings: pwm: Add OpenCores PWM module William Qiu
2023-11-10 12:24 ` Krzysztof Kozlowski
2023-11-13 9:42 ` William Qiu
2023-11-13 20:07 ` Krzysztof Kozlowski
2023-11-13 20:17 ` Conor Dooley
2023-11-22 7:03 ` William Qiu
2023-11-22 17:36 ` Conor Dooley
2023-11-24 7:38 ` William Qiu
2023-11-24 12:44 ` Conor Dooley
2023-11-10 12:24 ` Krzysztof Kozlowski
2023-11-13 9:43 ` William Qiu
2023-11-10 6:20 ` [PATCH v7 2/4] pwm: opencores: Add PWM driver support William Qiu
2023-11-10 12:27 ` Krzysztof Kozlowski
2023-11-13 9:47 ` William Qiu [this message]
2023-11-10 6:20 ` [PATCH v7 3/4] riscv: dts: starfive: jh7110: Add PWM node and pins configuration William Qiu
2023-11-10 6:20 ` [PATCH v7 4/4] riscv: dts: starfive: jh7100: " William Qiu
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=6610e454-2fda-4a2b-b088-88237685ea49@starfivetech.com \
--to=william.qiu@starfivetech.com \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hal.feng@starfivetech.com \
--cc=kernel@esmil.dk \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.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: 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).