Re: [RFC 2/5] clk: shmobile: cpg-mssr: add generic support for read-only DIV6 clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wolfram,

On Mon, Mar 21, 2016 at 8:19 PM, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
> From: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
>
> Gen3 has two clocks (OSC and R) which look like a DIV6 clock but their
> divider value is read-only and depends on MD pins at bootup. Add support
> for such clocks by reading the value and adding a fixed clock.

I may be blind, but I couldn't find the register to read the OSC divider from?

> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/clk/shmobile/renesas-cpg-mssr.c | 18 ++++++++++++------
>  drivers/clk/shmobile/renesas-cpg-mssr.h |  3 +++
>  2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clk/shmobile/renesas-cpg-mssr.c b/drivers/clk/shmobile/renesas-cpg-mssr.c
> index 58e24b326a48bb..3e4d2609cc0292 100644
> --- a/drivers/clk/shmobile/renesas-cpg-mssr.c
> +++ b/drivers/clk/shmobile/renesas-cpg-mssr.c

> @@ -274,13 +275,18 @@ static void __init cpg_mssr_register_core_clk(const struct cpg_core_clk *core,
>                 }
>
>                 parent_name = __clk_get_name(parent);
> -               if (core->type == CLK_TYPE_FF) {
> -                       clk = clk_register_fixed_factor(NULL, core->name,
> -                                                       parent_name, 0,
> -                                                       core->mult, core->div);
> -               } else {
> +
> +               if (core->type == CLK_TYPE_DIV6_RO)
> +                       /* Multiply with the DIV6 register value */
> +                       div *= (readl(priv->base + core->offset) & 0x3f) + 1;
> +
> +               if (core->type == CLK_TYPE_DIV6P1) {
>                         clk = cpg_div6_register(core->name, 1, &parent_name,
>                                                 priv->base + core->offset);
> +               } else {
> +                       clk = clk_register_fixed_factor(NULL, core->name,
> +                                                       parent_name, 0,
> +                                                       core->mult, div);
>                 }

Please use a switch() instead of if / else. It avoids people wondering where
the "core->type == CLK_TYPE_FF" case went to, until they realize it's covered
by the else.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux