All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Hui <jason.hui@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4 V2] MX5: Add AHB clock reporting and fix IPG clock reporting
Date: Fri, 23 Sep 2011 10:09:38 +0800	[thread overview]
Message-ID: <CAFQ4atRwLRJ8JXNZ6zNO6B5JCqGmmb7Vto88kVwNjfQ+EbjDFA@mail.gmail.com> (raw)
In-Reply-To: <1316719237-31095-1-git-send-email-marek.vasut@gmail.com>

Hi, Marek,

On Fri, Sep 23, 2011 at 3:20 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Jason Hui <jason.hui@linaro.org>

Here is: Jason Liu <jason.hui@linaro.org>

> ---
> ?arch/arm/cpu/armv7/mx5/clock.c | ? 36 +++++++++++++++++++++++++++---------
> ?1 files changed, 27 insertions(+), 9 deletions(-)
>
> V2: Use get_periph_clock() as AHB clocksource.
>
> diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
> index 9f37f7f..b87b29e 100644
> --- a/arch/arm/cpu/armv7/mx5/clock.c
> +++ b/arch/arm/cpu/armv7/mx5/clock.c
> @@ -152,18 +152,35 @@ static u32 get_periph_clk(void)
> ?}
>
> ?/*
> + * Get the rate of ahb clock.
> + */
> +static u32 get_ahb_clk(void)
> +{
> + ? ? ? uint32_t freq, div, reg;
> +
> + ? ? ? freq = get_periph_clk();
> +
> + ? ? ? reg = __raw_readl(&mxc_ccm->cbcdr);
> + ? ? ? div = ((reg & MXC_CCM_CBCDR_AHB_PODF_MASK) >>
> + ? ? ? ? ? ? ? ? ? ? ? MXC_CCM_CBCDR_AHB_PODF_OFFSET) + 1;
> +
> + ? ? ? return freq / div;
> +}
> +
> +/*
> ?* Get the rate of ipg clock.
> ?*/
> ?static u32 get_ipg_clk(void)
> ?{
> - ? ? ? u32 ahb_podf, ipg_podf;
> -
> - ? ? ? ahb_podf = __raw_readl(&mxc_ccm->cbcdr);
> - ? ? ? ipg_podf = (ahb_podf & MXC_CCM_CBCDR_IPG_PODF_MASK) >>
> - ? ? ? ? ? ? ? ? ? ? ? MXC_CCM_CBCDR_IPG_PODF_OFFSET;
> - ? ? ? ahb_podf = (ahb_podf & MXC_CCM_CBCDR_AHB_PODF_MASK) >>
> - ? ? ? ? ? ? ? ? ? ? ? MXC_CCM_CBCDR_AHB_PODF_OFFSET;
> - ? ? ? return get_periph_clk() / ((ahb_podf + 1) * (ipg_podf + 1));
> + ? ? ? uint32_t freq, reg, div;
> +
> + ? ? ? freq = get_ahb_clk();
> +
> + ? ? ? reg = __raw_readl(&mxc_ccm->cbcdr);
> + ? ? ? div = ((reg & MXC_CCM_CBCDR_IPG_PODF_MASK) >>
> + ? ? ? ? ? ? ? ? ? ? ? MXC_CCM_CBCDR_IPG_PODF_OFFSET) + 1;
> +
> + ? ? ? return freq / div;
> ?}
>
> ?/*
> @@ -290,7 +307,7 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
> ? ? ? ?case MXC_ARM_CLK:
> ? ? ? ? ? ? ? ?return get_mcu_main_clk();
> ? ? ? ?case MXC_AHB_CLK:
> - ? ? ? ? ? ? ? break;
> + ? ? ? ? ? ? ? return get_ahb_clk();
> ? ? ? ?case MXC_IPG_CLK:
> ? ? ? ? ? ? ? ?return get_ipg_clk();
> ? ? ? ?case MXC_IPG_PERCLK:
> @@ -336,6 +353,7 @@ int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> ? ? ? ?freq = decode_pll(mxc_plls[PLL4_CLOCK], CONFIG_SYS_MX5_HCLK);
> ? ? ? ?printf("pll4: %dMHz\n", freq / 1000000);
> ?#endif
> + ? ? ? printf("ahb clock ? ? : %dHz\n", mxc_get_clock(MXC_AHB_CLK));
> ? ? ? ?printf("ipg clock ? ? : %dHz\n", mxc_get_clock(MXC_IPG_CLK));
> ? ? ? ?printf("ipg per clock : %dHz\n", mxc_get_clock(MXC_IPG_PERCLK));
>

Looks good to me.

Acked-by: Jason Liu <jason.hui@linaro.org>

BR
Jason Liu

> --
> 1.7.5.4
>
>

  reply	other threads:[~2011-09-23  2:09 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15  0:09 [U-Boot] [PATCH 0/4] Clock fix and MXC I2C rework series Marek Vasut
2011-09-15  0:09 ` [U-Boot] [PATCH 1/4] MX5: Modify the PLL decoding algorithm Marek Vasut
2011-09-22  3:20   ` Jason Hui
2011-09-23  9:15     ` Stefano Babic
2011-09-23  9:43   ` [U-Boot] [PATCH 1/4 V2] " Marek Vasut
2011-09-15  0:09 ` [U-Boot] [PATCH 2/4] MX5: Add AHB clock reporting and fix IPG clock reporting Marek Vasut
2011-09-22  3:05   ` Jason Hui
2011-09-22  3:41     ` Marek Vasut
2011-09-22  4:46       ` Jason Hui
2011-09-22 19:20   ` [U-Boot] [PATCH 2/4 V2] " Marek Vasut
2011-09-23  2:09     ` Jason Hui [this message]
2011-09-15  0:09 ` [U-Boot] [PATCH 3/4] MX5: Clean up the output of "clocks" command Marek Vasut
2011-09-19 10:03   ` Stefano Babic
2011-09-22  1:58   ` Jason Hui
2011-09-15  0:09 ` [U-Boot] [PATCH 4/4] I2C: mxc_i2c rework Marek Vasut
2011-09-15  4:16   ` [U-Boot] [PATCH 4/4 V2] " Marek Vasut
2011-09-19  6:13     ` Heiko Schocher
2011-09-20  2:30     ` [U-Boot] [PATCH 4/4 V3] " Marek Vasut
2011-09-20  2:35       ` [U-Boot] [PATCH 4/4 V4] " Marek Vasut
2011-09-22  2:45         ` Jason Hui
2011-09-22  3:43           ` Marek Vasut
2011-09-22  4:54             ` Jason Hui
2011-09-22  5:47               ` Marek Vasut
2011-09-22  6:49                 ` Jason Hui
2011-09-22 19:22         ` [U-Boot] [PATCH 4/4 V5] " Marek Vasut
2011-09-23  3:32           ` Jason Hui
2011-09-23  4:31             ` Fabio Estevam
2011-09-23  6:21             ` Marek Vasut
2011-09-23  7:46             ` Stefano Babic
2011-09-26  6:30               ` Heiko Schocher
2011-10-14 16:28           ` Anatolij Gustschin
2011-09-19 10:11   ` [U-Boot] [PATCH 4/4] " Stefano Babic
2011-09-19 10:24     ` Marek Vasut
2011-09-20 10:07     ` Jason Liu

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=CAFQ4atRwLRJ8JXNZ6zNO6B5JCqGmmb7Vto88kVwNjfQ+EbjDFA@mail.gmail.com \
    --to=jason.hui@linaro.org \
    --cc=u-boot@lists.denx.de \
    /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 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.