From: Geert Uytterhoeven <geert@linux-m68k.org> To: Simon Horman <horms+renesas@verge.net.au> Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, Magnus Damm <magnus.damm@gmail.com> Subject: Re: [PATCH v3 2/6] clk: renesas: rcar-gen3: Add Z2 clock divider support Date: Tue, 10 Oct 2017 08:56:35 +0200 [thread overview] Message-ID: <CAMuHMdVg4sFkZvqfv0SZkefSy1UN=eBtwQrii7OtbYqyjfmC=Q@mail.gmail.com> (raw) In-Reply-To: <CAMuHMdWpbZ5r5s2+29rLBcPABUaN0BBXEZreryoCSriDcqqdkQ@mail.gmail.com> Hi Simon, On Mon, Oct 9, 2017 at 10:02 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Thu, Oct 5, 2017 at 3:23 PM, Simon Horman <horms+renesas@verge.net.au> wrote: >> From: Takeshi Kihara <takeshi.kihara.df@renesas.com> >> >> This patch adds Z2 clock divider support for R-Car Gen3 SoC. >> >> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> >> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> >> --- >> v2 [Simon Horman] >> * Consolidate Z and Z2 clock ops >> * Allow setting of Z2 clock > > Thanks for the update! > >> --- a/drivers/clk/renesas/rcar-gen3-cpg.c >> +++ b/drivers/clk/renesas/rcar-gen3-cpg.c > >> @@ -88,8 +90,8 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, >> if (clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK) >> return -EBUSY; >> >> - val = clk_readl(zclk->reg) & ~CPG_FRQCRC_ZFC_MASK; >> - val |= FIELD_PREP(CPG_FRQCRC_ZFC_MASK, 32 - mult); >> + val = clk_readl(zclk->reg) & ~zclk->mask; >> + val |= ((32 - mult) << __bf_shf(zclk->mask)) & zclk->mask; > > Any special reason you're now open coding FIELD_PREP()? Now I know: to circumvent the BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), ...) in __BF_FIELD_CHECK(), called from FIELD_PREP(). Given <linux/bitfield.h> is intended to work with constant masks only, I think it's best to not use it, and replace __bf_shf() by __ffs(). > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Oops, looks like you forgot to replace CPG_FRQCRC_ZFC_MASK in cpg_z_clk_recalc_rate() by zclk->mask. Sorry for missing that. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
WARNING: multiple messages have this Message-ID (diff)
From: geert@linux-m68k.org (Geert Uytterhoeven) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/6] clk: renesas: rcar-gen3: Add Z2 clock divider support Date: Tue, 10 Oct 2017 08:56:35 +0200 [thread overview] Message-ID: <CAMuHMdVg4sFkZvqfv0SZkefSy1UN=eBtwQrii7OtbYqyjfmC=Q@mail.gmail.com> (raw) In-Reply-To: <CAMuHMdWpbZ5r5s2+29rLBcPABUaN0BBXEZreryoCSriDcqqdkQ@mail.gmail.com> Hi Simon, On Mon, Oct 9, 2017 at 10:02 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Thu, Oct 5, 2017 at 3:23 PM, Simon Horman <horms+renesas@verge.net.au> wrote: >> From: Takeshi Kihara <takeshi.kihara.df@renesas.com> >> >> This patch adds Z2 clock divider support for R-Car Gen3 SoC. >> >> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> >> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> >> --- >> v2 [Simon Horman] >> * Consolidate Z and Z2 clock ops >> * Allow setting of Z2 clock > > Thanks for the update! > >> --- a/drivers/clk/renesas/rcar-gen3-cpg.c >> +++ b/drivers/clk/renesas/rcar-gen3-cpg.c > >> @@ -88,8 +90,8 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, >> if (clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK) >> return -EBUSY; >> >> - val = clk_readl(zclk->reg) & ~CPG_FRQCRC_ZFC_MASK; >> - val |= FIELD_PREP(CPG_FRQCRC_ZFC_MASK, 32 - mult); >> + val = clk_readl(zclk->reg) & ~zclk->mask; >> + val |= ((32 - mult) << __bf_shf(zclk->mask)) & zclk->mask; > > Any special reason you're now open coding FIELD_PREP()? Now I know: to circumvent the BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), ...) in __BF_FIELD_CHECK(), called from FIELD_PREP(). Given <linux/bitfield.h> is intended to work with constant masks only, I think it's best to not use it, and replace __bf_shf() by __ffs(). > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Oops, looks like you forgot to replace CPG_FRQCRC_ZFC_MASK in cpg_z_clk_recalc_rate() by zclk->mask. Sorry for missing that. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
next prev parent reply other threads:[~2017-10-10 6:56 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-10-05 13:23 [PATCH v3 0/6] clk: renesas: r8a779[56]: Add Z and Z2 clock support Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 1/6] clk: renesas: rcar-gen3: Add Z clock divider support Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-09 8:02 ` Geert Uytterhoeven 2017-10-09 8:02 ` Geert Uytterhoeven 2017-10-10 7:23 ` Simon Horman 2017-10-10 7:23 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 2/6] clk: renesas: rcar-gen3: Add Z2 " Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-09 8:02 ` Geert Uytterhoeven 2017-10-09 8:02 ` Geert Uytterhoeven 2017-10-10 6:56 ` Geert Uytterhoeven [this message] 2017-10-10 6:56 ` Geert Uytterhoeven 2017-10-10 7:22 ` Simon Horman 2017-10-10 7:22 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 3/6] clk: renesas: r8a7795: Add Z clock Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 4/6] clk: renesas: r8a7795: Add Z2 clock Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 5/6] clk: renesas: r8a7796: Add Z clock Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-05 13:23 ` [PATCH v3 6/6] clk: renesas: r8a7796: Add Z2 clock Simon Horman 2017-10-05 13:23 ` Simon Horman 2017-10-09 13:05 ` [PATCH v3 0/6] clk: renesas: r8a779[56]: Add Z and Z2 clock support Geert Uytterhoeven 2017-10-09 13:05 ` Geert Uytterhoeven
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='CAMuHMdVg4sFkZvqfv0SZkefSy1UN=eBtwQrii7OtbYqyjfmC=Q@mail.gmail.com' \ --to=geert@linux-m68k.org \ --cc=horms+renesas@verge.net.au \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=magnus.damm@gmail.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.