devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-devel@linux.nxdi.nxp.com" <linux-devel@linux.nxdi.nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Wen He <wen.he_1@nxp.com>
Cc: Leo Li <leoyang.li@nxp.com>, "liviu.dudau@arm.com" <liviu.dudau@arm.com>
Subject: RE: [EXT] Re: [v4 2/2] clk: ls1028a: Add clock driver for Display output interface
Date: Wed, 18 Sep 2019 10:00:50 -0700	[thread overview]
Message-ID: <20190918170051.2AEAF21848@mail.kernel.org> (raw)
In-Reply-To: <DB7PR04MB51953099D6331F4F844A45EFE28E0@DB7PR04MB5195.eurprd04.prod.outlook.com>

Quoting Wen He (2019-09-18 02:20:26)
> > -----Original Message-----
> > From: Stephen Boyd <sboyd@kernel.org>
> > Quoting Wen He (2019-08-29 03:59:19)
> > > diff --git a/drivers/clk/clk-plldig.c b/drivers/clk/clk-plldig.c new
> > > file mode 100644 index 000000000000..d3239bcf59de
> > > --- /dev/null
> > > +++ b/drivers/clk/clk-plldig.c
> > > @@ -0,0 +1,298 @@
[...]
> 
> > 
> > > +
> > > +/* Maximum of the divider */
> > > +#define MAX_RFDPHI1          63
> > > +
> > > +/* Best value of multiplication factor divider */
> > > +#define PLLDIG_DEFAULE_MULT         44
> > > +
> > > +/*
> > > + * Clock configuration relationship between the PHI1
> > > +frequency(fpll_phi) and
> > > + * the output frequency of the PLL is determined by the PLLDV,
> > > +according to
> > > + * the following equation:
> > > + * fpll_phi = (pll_ref * mfd) / div_rfdphi1  */ struct
> > > +plldig_phi1_param {
> > > +       unsigned long rate;
> > > +       unsigned int rfdphi1;
> > > +       unsigned int mfd;
> > > +};
> > > +
> > > +enum plldig_phi1_freq_range {
> > > +       PHI1_MIN        = 27000000U,
> > > +       PHI1_MAX        = 600000000U
> > > +};
> > 
> > Please just inline these values in the one place they're used.
> > 
> > > +
> > > +struct clk_plldig {
> > > +       struct clk_hw hw;
> > > +       void __iomem *regs;
> > > +       struct device *dev;
> > 
> > Please remove this, it is unused.
> 
> It is used for probe.

Use a local variable and don't store it away forever in the struct.

> > 
> > > +
> > > +       val = readl(data->regs + PLLDIG_REG_PLLDV);
> > > +       val = phi1_param.mfd;
> > > +       rfdphi1 = phi1_param.rfdphi1;
> > > +       val |= rfdphi1;
> > > +
> > > +       writel(val, data->regs + PLLDIG_REG_PLLDV);
> > > +
> > > +       /* delay 200us make sure that old lock state is cleared */
> > > +       udelay(200);
> > > +
> > > +       /* Wait until PLL is locked or timeout (maximum 1000 usecs) */
> > > +       ret = readl_poll_timeout_atomic(data->regs + PLLDIG_REG_PLLSR,
> > cond,
> > > +                                       cond & PLLDIG_LOCK_MASK,
> > 0,
> > > +                                       USEC_PER_MSEC);
> > > +
> > > +       return ret;
> > 
> > Just return readl_poll_timeout_atomic(...) here.
> 
> Maybe use below code will to best describes.
> 
> If (ret)
>         return -ETIMEOUT;
> 
> return 0;

No, just return readl_poll_timeout_atomic().

  reply	other threads:[~2019-09-18 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 10:59 [v4 1/2] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings Wen He
2019-08-29 10:59 ` [v4 2/2] clk: ls1028a: Add clock driver for Display output interface Wen He
2019-09-16 20:26   ` Stephen Boyd
2019-09-18  9:20     ` [EXT] " Wen He
2019-09-18 17:00       ` Stephen Boyd [this message]
2019-09-19  3:53         ` Wen He

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=20190918170051.2AEAF21848@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-devel@linux.nxdi.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=wen.he_1@nxp.com \
    /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).