From: Stephen Boyd <sboyd@kernel.org>
To: conor.dooley@microchip.com
Cc: conor.dooley@microchip.com, cyril.jean@microchip.com,
daire.mcnamara@microchip.com, david.abdurachmanov@gmail.com,
devicetree@vger.kernel.org, geert@linux-m68k.org,
krzysztof.kozlowski@canonical.com, linux-clk@vger.kernel.org,
mturquette@baylibre.com, padmarao.begari@microchip.com,
palmer@dabbelt.com, robh+dt@kernel.org
Subject: Re: [PATCH v9 2/2] clk: microchip: Add driver for Microchip PolarFire SoC
Date: Tue, 25 Jan 2022 12:23:08 -0800 [thread overview]
Message-ID: <20220125202310.5E5CBC340E0@smtp.kernel.org> (raw)
In-Reply-To: <20220125134010.2528785-1-conor.dooley@microchip.com>
Quoting conor.dooley@microchip.com (2022-01-25 05:40:11)
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Quoting conor.dooley@microchip.com (2021-12-16 06:00:22)
> > > diff --git a/drivers/clk/microchip/Makefile b/drivers/clk/microchip/Makefile
> > > index f34b247e870f..0dce0b12eac4 100644
> > > --- a/drivers/clk/microchip/Makefile
> > > +++ b/drivers/clk/microchip/Makefile
>
> Snipping the rest, will/have addressed them.
>
> > > +static int mpfs_clk_register_cfgs(struct device *dev, struct mpfs_cfg_hw_clock *cfg_hws,
> > > + unsigned int num_clks, struct mpfs_clock_data *data,
> > > + struct clk *clk_parent)
> > > +{
> > > + struct clk_hw *hw;
> > > + void __iomem *sys_base = data->base;
> > > + unsigned int i, id;
> > > +
> > > + for (i = 0; i < num_clks; i++) {
> > > + struct mpfs_cfg_hw_clock *cfg_hw = &cfg_hws[i];
> > > +
> > > + cfg_hw->cfg.parent = __clk_get_hw(clk_parent);
> > > + cfg_hw->hw.init = CLK_HW_INIT_HW(cfg_hw->cfg.name, cfg_hw->cfg.parent,
> > > + &mpfs_clk_cfg_ops, cfg_hw->cfg.flags);
> > > + hw = mpfs_clk_register_cfg(dev, cfg_hw, sys_base);
> > > + if (IS_ERR(hw)) {
> > > + dev_err(dev, "failed to register clock %s\n", cfg_hw->cfg.name);
> > > + goto err_clk;
> > > + }
> > > +
> > > + id = cfg_hws[i].cfg.id;
> > > + data->hw_data.hws[id] = hw;
> > > + }
> > > +
> > > + return 0;
> > > +
> > > +err_clk:
> > > + while (i--)
> > > + devm_clk_hw_unregister(dev, data->hw_data.hws[cfg_hws[i].cfg.id]);
> >
> > > + clk_parent = devm_clk_get(dev, NULL);
> >
> > Use clk_parent_data instead please.
> >
> > > + if (IS_ERR(clk_parent))
> > > + return PTR_ERR(clk_parent);
>
>
> Please correct me if I am misinterpreting:
> I had the devm_clk_get() in there to pickup the refclk from the device
> tree as a result of previous feedback. I have replaced this with the
> following, which I have found in several other drivers - does it achieve
> the same thing?
> If it does, all of the args to CLK_HW_INIT_PARENTS_DATA are now set at
> compile time & I will take CLK_HW_INIT_PARENTS_DATA back out of this
> function.
>
> static struct clk_parent_data mpfs_cfg_parent[] = {
> { .index = 0 },
> };
Yes this should be sufficient. Make it const though.
>
> static int mpfs_clk_register_cfgs(struct device *dev, struct mpfs_cfg_hw_clock *cfg_hws,
> unsigned int num_clks, struct mpfs_clock_data *data)
> {
> void __iomem *sys_base = data->base;
> unsigned int i, id;
> int ret;
>
> for (i = 0; i < num_clks; i++) {
> struct mpfs_cfg_hw_clock *cfg_hw = &cfg_hws[i];
>
> cfg_hw->hw.init = CLK_HW_INIT_PARENTS_DATA(cfg_hw->cfg.name, mpfs_cfg_parent,
> &mpfs_clk_cfg_ops, cfg_hw->cfg.flags);
>
> ret = mpfs_clk_register_cfg(dev, cfg_hw, sys_base);
> if (ret) {
> dev_err_probe(dev, ret, "failed to register clock %s\n",
> cfg_hw->cfg.name);
> return ret;
> }
>
> id = cfg_hws[i].cfg.id;
> data->hw_data.hws[id] = &cfg_hw->hw;
> }
>
> return 0;
> }
Looks good. Thanks.
next prev parent reply other threads:[~2022-01-25 20:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 14:00 [PATCH v9 0/2] Add clkcfg driver for Microchip PolarFire SoC conor.dooley
2021-12-16 14:00 ` [PATCH v9 1/2] dt-bindings: clk: microchip: Add Microchip PolarFire host binding conor.dooley
2022-01-25 0:26 ` Stephen Boyd
2021-12-16 14:00 ` [PATCH v9 2/2] clk: microchip: Add driver for Microchip PolarFire SoC conor.dooley
2022-01-25 0:48 ` Stephen Boyd
2022-01-25 13:40 ` conor.dooley
2022-01-25 20:23 ` Stephen Boyd [this message]
2022-01-10 10:24 ` [PATCH v9 0/2] Add clkcfg " Conor.Dooley
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=20220125202310.5E5CBC340E0@smtp.kernel.org \
--to=sboyd@kernel.org \
--cc=conor.dooley@microchip.com \
--cc=cyril.jean@microchip.com \
--cc=daire.mcnamara@microchip.com \
--cc=david.abdurachmanov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=padmarao.begari@microchip.com \
--cc=palmer@dabbelt.com \
--cc=robh+dt@kernel.org \
/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).