[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1560936971.2158.17.camel@mtksdaap41>
Date: Wed, 19 Jun 2019 17:36:11 +0800
From: Weiyi Lu <weiyi.lu@...iatek.com>
To: Nicolas Boichat <drinkcat@...omium.org>
CC: Matthias Brugger <matthias.bgg@...il.com>,
Rob Herring <robh@...nel.org>,
James Liao <jamesjj.liao@...iatek.com>,
Fan Chen <fan.chen@...iatek.com>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
lkml <linux-kernel@...r.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
srv_heupstream <srv_heupstream@...iatek.com>
Subject: Re: [PATCH v5 09/14] soc: mediatek: Add basic_clk_name to
scp_power_data
On Thu, 2019-03-21 at 14:02 +0800, Nicolas Boichat wrote:
> On Tue, Mar 19, 2019 at 4:02 PM Weiyi Lu <weiyi.lu@...iatek.com> wrote:
> >
> > Try to stop extending the clk_id or clk_names if there are
> > more and more new BASIC clocks. To get its own clocks by the
> > basic_clk_name of each power domain.
> >
> > Signed-off-by: Weiyi Lu <weiyi.lu@...iatek.com>
> > ---
> > drivers/soc/mediatek/mtk-scpsys.c | 27 +++++++++++++++++++--------
> > 1 file changed, 19 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> > index 6bf846cb1893..c6360de4e41e 100644
> > --- a/drivers/soc/mediatek/mtk-scpsys.c
> > +++ b/drivers/soc/mediatek/mtk-scpsys.c
> > @@ -118,6 +118,8 @@ static const char * const clk_names[] = {
> > * @bus_prot_mask: The mask for single step bus protection.
> > * @clk_id: The basic clock needs to be enabled before enabling certain
> > * power domains.
> > + * @basic_clk_name: provide the same purpose with field "clk_id"
> > + * by declaring basic clock prefix name rather than clk_id.
> > * @caps: The flag for active wake-up action.
> > */
> > struct scp_domain_data {
> > @@ -128,6 +130,7 @@ struct scp_domain_data {
> > u32 sram_pdn_ack_bits;
> > u32 bus_prot_mask;
> > enum clk_id clk_id[MAX_CLKS];
> > + const char *basic_clk_name[MAX_CLKS];
>
> Either call them basic_clk_id/basic_clk_name, or clk_id/clk_name.
>
OK.
> > u8 caps;
> > };
> >
> > @@ -499,16 +502,24 @@ static struct scp *init_scp(struct platform_device *pdev,
> >
> > scpd->data = data;
> >
> > - for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) {
> > - struct clk *c = clk[data->clk_id[j]];
> > + if (data->clk_id[0]) {
>
> Since it's either clk_id or basic_clk_name, I wonder if it'd be good
> to add a WARN_ON here, e.g.
>
> WARN_ON(data->basic_clk_name[0]);
>
Thanks for the advise. I'll add it.
> > + for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) {
> > + struct clk *c = clk[data->clk_id[j]];
> >
> > - if (IS_ERR(c)) {
> > - dev_err(&pdev->dev, "%s: clk unavailable\n",
> > - data->name);
> > - return ERR_CAST(c);
> > - }
> > + if (IS_ERR(c)) {
> > + dev_err(&pdev->dev,
> > + "%s: clk unavailable\n",
> > + data->name);
> > + return ERR_CAST(c);
> > + }
> >
> > - scpd->clk[j] = c;
> > + scpd->clk[j] = c;
> > + }
> > + } else if (data->basic_clk_name[0]) {
> > + for (j = 0; j < MAX_CLKS &&
> > + data->basic_clk_name[j]; j++)
> > + scpd->clk[j] = devm_clk_get(&pdev->dev,
> > + data->basic_clk_name[j]);
> > }
> >
> > genpd->name = data->name;
> > --
> > 2.18.0
> >
Powered by blists - more mailing lists