linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	Tawfik Bayouk <tawfik@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Lior Amsalem <alior@marvell.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: Re: [PATCHv2 10/15] clk: mvebu: extend common code to allow an optional refclk
Date: Fri, 20 Feb 2015 10:21:34 -0800	[thread overview]
Message-ID: <20150220182134.421.95366@quantum> (raw)
In-Reply-To: <1424451874-25375-11-git-send-email-thomas.petazzoni@free-electrons.com>

Quoting Thomas Petazzoni (2015-02-20 09:04:29)
> The Armada 39x, contrary to its predecessor, has a configurable
> reference clock frequency, of either 25 Mhz, or 40 Mhz. For the
> previous SoCs, it was fixed to 25 Mhz and described directly as such
> in the Device Tree.
> 
> For Armada 39x, we need to read certain registers to know whether the
> frequency is 25 or 40 Mhz. Therefore, this commit extends the common
> mvebu clock code to allow the SoC-specific code to say it wants to
> register a reference clock, by giving a non-NULL ->get_refclk_freq()
> function pointer in its coreclk_soc_desc structure.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Looks fine to me. I'll apply after -rc1 drops.

Regards,
Mike

> ---
>  drivers/clk/mvebu/common.c | 17 +++++++++++++++++
>  drivers/clk/mvebu/common.h |  1 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
> index 0d4d121..15b370f 100644
> --- a/drivers/clk/mvebu/common.c
> +++ b/drivers/clk/mvebu/common.c
> @@ -121,6 +121,11 @@ void __init mvebu_coreclk_setup(struct device_node *np,
>  
>         /* Allocate struct for TCLK, cpu clk, and core ratio clocks */
>         clk_data.clk_num = 2 + desc->num_ratios;
> +
> +       /* One more clock for the optional refclk */
> +       if (desc->get_refclk_freq)
> +               clk_data.clk_num += 1;
> +
>         clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *),
>                                 GFP_KERNEL);
>         if (WARN_ON(!clk_data.clks)) {
> @@ -162,6 +167,18 @@ void __init mvebu_coreclk_setup(struct device_node *np,
>                 WARN_ON(IS_ERR(clk_data.clks[2+n]));
>         };
>  
> +       /* Register optional refclk */
> +       if (desc->get_refclk_freq) {
> +               const char *name = "refclk";
> +               of_property_read_string_index(np, "clock-output-names",
> +                                             2 + desc->num_ratios, &name);
> +               rate = desc->get_refclk_freq(base);
> +               clk_data.clks[2 + desc->num_ratios] =
> +                       clk_register_fixed_rate(NULL, name, NULL,
> +                                               CLK_IS_ROOT, rate);
> +               WARN_ON(IS_ERR(clk_data.clks[2 + desc->num_ratios]));
> +       }
> +
>         /* SAR register isn't needed anymore */
>         iounmap(base);
>  
> diff --git a/drivers/clk/mvebu/common.h b/drivers/clk/mvebu/common.h
> index 783b563..f0de6c8 100644
> --- a/drivers/clk/mvebu/common.h
> +++ b/drivers/clk/mvebu/common.h
> @@ -30,6 +30,7 @@ struct coreclk_soc_desc {
>         u32 (*get_tclk_freq)(void __iomem *sar);
>         u32 (*get_cpu_freq)(void __iomem *sar);
>         void (*get_clk_ratio)(void __iomem *sar, int id, int *mult, int *div);
> +       u32 (*get_refclk_freq)(void __iomem *sar);
>         bool (*is_sscg_enabled)(void __iomem *sar);
>         u32 (*fix_sscg_deviation)(u32 system_clk);
>         const struct coreclk_ratio *ratios;
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-02-20 18:21 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 17:04 [PATCHv2 00/15] ARM: mvebu: Armada 39x basic support, and preparatory cleanups Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 02/15] ARM: mvebu: fix usb@ unit address on Armada 38x to match register address Thomas Petazzoni
2015-02-23 15:14   ` Gregory CLEMENT
2015-02-20 17:04 ` [PATCHv2 03/15] ARM: mvebu: add missing UART alias on Armada 38x Thomas Petazzoni
2015-02-23 15:16   ` Gregory CLEMENT
2015-02-20 17:04 ` [PATCHv2 04/15] ARM: mvebu: use IRQ macros to define the SDHCI interrupt " Thomas Petazzoni
2015-02-23 15:27   ` Gregory CLEMENT
2015-02-27 14:48     ` Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 05/15] ARM: mvebu: add stdout-path to all armada-*.dts Thomas Petazzoni
2015-02-23 16:00   ` Gregory CLEMENT
     [not found]     ` <54EB4E9B.6010001-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-02-23 16:50       ` Rob Herring
2015-02-23 16:56         ` Thomas Petazzoni
2015-02-27 16:48         ` Thomas Petazzoni
     [not found]           ` <20150227174851.390d9f58-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-02-27 17:42             ` Rob Herring
2015-02-28  9:55               ` Thomas Petazzoni
2015-03-03  9:45               ` Thomas Petazzoni
2015-02-23 17:13   ` Mark Rutland
     [not found] ` <1424451874-25375-1-git-send-email-thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-02-20 17:04   ` [PATCHv2 01/15] ARM: mvebu: add __initconst specifiers on DT_MACHINE_START dt_compat tables Thomas Petazzoni
2015-02-23 15:12     ` Gregory CLEMENT
2015-02-20 17:04   ` [PATCHv2 06/15] devicetree: bindings: add DT binding for the Marvell Armada 39x SoC family Thomas Petazzoni
2015-02-23 16:07     ` Gregory CLEMENT
2015-02-20 17:04   ` [PATCHv2 11/15] clk: mvebu: add Marvell Armada 39x driver Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 07/15] devicetree: bindings: update DT bindings for Marvell EBU clock support Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 08/15] devicetree: bindings: add Device Tree bindings for Armada 39x pin-muxing controller Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 09/15] devicetree: bindings: add new SMP enable method for Marvell Armada 39x Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 10/15] clk: mvebu: extend common code to allow an optional refclk Thomas Petazzoni
2015-02-20 18:21   ` Mike Turquette [this message]
2015-02-23 18:06     ` Gregory CLEMENT
2015-02-27  0:05       ` Mike Turquette
2015-02-20 17:04 ` [PATCHv2 12/15] pinctrl: mvebu: add pinctrl driver for Marvell Armada 39x Thomas Petazzoni
2015-02-20 17:04 ` [PATCHv2 13/15] ARM: mvebu: add core support for " Thomas Petazzoni
2015-02-23 18:16   ` Gregory CLEMENT
2015-02-20 17:04 ` [PATCHv2 14/15] ARM: mvebu: add Device Tree files for Armada 39x SoC and board Thomas Petazzoni
2015-02-26 16:19   ` Gregory CLEMENT
2015-02-20 17:04 ` [PATCHv2 15/15] Documentation: arm: update supported Marvell EBU processors Thomas Petazzoni

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=20150220182134.421.95366@quantum \
    --to=mturquette@linaro.org \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=galak@codeaurora.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=nadavh@marvell.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.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).