[U-Boot] [PATCH 1/8 V6] EXYNOS: CLK: Add i2c clock

Simon Glass sjg at chromium.org
Thu Jul 19 20:18:21 CEST 2012


On Thu, Jul 19, 2012 at 12:39 PM, Rajeshwari Shinde
<rajeshwari.s at samsung.com> wrote:
> This adds i2c clock information for EXYNOS5.
>
> Signed-off-by: Alim Akhtar <alim.akhtar at samsung.com>
> Signed-off-by: Doug Anderson <dianders at chromium.org>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
> Acked-by: Simon Glass <sjg at chromium.org>

Acked-by: Simon Glass <sjg at chromium.org>

> ---
> changes in V2:
>         - Incorporated comments from Simon Glass which are removed extra
>           braces around (readl(&clk->div_top1)) >> 24 and gave a tab space for
>           return statement.
> Changes in V3:
>         - None
> Changes in V4:
>         - None
> Changes in V5:
>         - None.
> Changes in V6:
>         - Incorporated review comments from Simon Glass.
>  arch/arm/cpu/armv7/exynos/clock.c      |   33 ++++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-exynos/clk.h |    1 +
>  2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
> index 672598f..de3db8e 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -605,6 +605,29 @@ void exynos4_set_mipi_clk(void)
>         writel(cfg, &clk->div_lcd0);
>  }
>
> +/*
> + * I2C
> + *
> + * exynos5: obtaining the I2C clock
> + */
> +static unsigned long exynos5_get_i2c_clk(void)
> +{
> +       struct exynos5_clock *clk =
> +               (struct exynos5_clock *)samsung_get_base_clock();
> +       unsigned long aclk_66, aclk_66_pre, sclk;
> +       unsigned int ratio;
> +
> +       sclk = get_pll_clk(MPLL);
> +
> +       ratio = (readl(&clk->div_top1)) >> 24;
> +       ratio &= 0x7;
> +       aclk_66_pre = sclk / (ratio + 1);
> +       ratio = readl(&clk->div_top0);
> +       ratio &= 0x7;
> +       aclk_66 = aclk_66_pre / (ratio + 1);
> +       return aclk_66;
> +}
> +
>  unsigned long get_pll_clk(int pllreg)
>  {
>         if (cpu_is_exynos5())
> @@ -621,6 +644,16 @@ unsigned long get_arm_clk(void)
>                 return exynos4_get_arm_clk();
>  }
>
> +unsigned long get_i2c_clk(void)
> +{
> +       if (cpu_is_exynos5()) {
> +               return exynos5_get_i2c_clk();
> +       } else {
> +               debug("I2C clock is not set for this CPU\n");
> +               return 0;
> +       }
> +}
> +
>  unsigned long get_pwm_clk(void)
>  {
>         if (cpu_is_exynos5())
> diff --git a/arch/arm/include/asm/arch-exynos/clk.h b/arch/arm/include/asm/arch-exynos/clk.h
> index e99339a..5529025 100644
> --- a/arch/arm/include/asm/arch-exynos/clk.h
> +++ b/arch/arm/include/asm/arch-exynos/clk.h
> @@ -31,6 +31,7 @@
>
>  unsigned long get_pll_clk(int pllreg);
>  unsigned long get_arm_clk(void);
> +unsigned long get_i2c_clk(void);
>  unsigned long get_pwm_clk(void);
>  unsigned long get_uart_clk(int dev_index);
>  void set_mmc_clk(int dev_index, unsigned int div);
> --
> 1.7.4.4
>


More information about the U-Boot mailing list