All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/6] Exynos5: Fix compiler warnings due to clock_get_periph_rate
Date: Fri, 16 Jan 2015 11:49:29 +0900	[thread overview]
Message-ID: <54B87C39.6090005@samsung.com> (raw)
In-Reply-To: <1421328674-15233-2-git-send-email-akshay.s@samsung.com>

Hi,

On 01/15/2015 10:31 PM, Akshay Saraswat wrote:
> Apparently, members of clk_bit_info array do not map correctly
> to the members of enum periph_id. This mapping got broken after
> we changed periph_id(s) to reflect interrupt number instead of
> their position in a sequence. This patch intends to fix above
> mentioned issue.
> 
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---
> Changes since v1:
> 	- Removed exynos5_bit_info array name.
> 
>  arch/arm/cpu/armv7/exynos/clock.c | 81 ++++++++++++++++++++++++---------------
>  1 file changed, 50 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c
> index b31c13b..519928c 100644
> --- a/arch/arm/cpu/armv7/exynos/clock.c
> +++ b/arch/arm/cpu/armv7/exynos/clock.c
> @@ -20,42 +20,49 @@
>   * positions of the peripheral clocks of the src and div registers
>   */
>  struct clk_bit_info {
> +	enum periph_id id;
>  	int8_t src_bit;
>  	int8_t div_bit;
>  	int8_t prediv_bit;
>  };
>  
> -/* src_bit div_bit prediv_bit */
> +/* periph_id src_bit div_bit prediv_bit */
>  static struct clk_bit_info clk_bit_info[] = {
> -	{0,	0,	-1},
> -	{4,	4,	-1},
> -	{8,	8,	-1},
> -	{12,	12,	-1},
> -	{0,	0,	8},
> -	{4,	16,	24},
> -	{8,	0,	8},
> -	{12,	16,	24},
> -	{-1,	-1,	-1},
> -	{16,	0,	8},
> -	{20,	16,	24},
> -	{24,	0,	8},
> -	{0,	0,	4},
> -	{4,	12,	16},
> -	{-1,	-1,	-1},
> -	{-1,	-1,	-1},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{-1,	24,	0},
> -	{24,	0,	-1},
> -	{24,	0,	-1},
> -	{24,	0,	-1},
> -	{24,	0,	-1},
> -	{24,	0,	-1},
> +	{PERIPH_ID_UART0,	0,	0,	-1},
> +	{PERIPH_ID_UART1,	4,	4,	-1},
> +	{PERIPH_ID_UART2,	8,	8,	-1},
> +	{PERIPH_ID_UART3,	12,	12,	-1},
> +	{PERIPH_ID_I2C0,	-1,	24,	0},
> +	{PERIPH_ID_I2C1,	-1,	24,	0},
> +	{PERIPH_ID_I2C2,	-1,	24,	0},
> +	{PERIPH_ID_I2C3,	-1,	24,	0},
> +	{PERIPH_ID_I2C4,	-1,	24,	0},
> +	{PERIPH_ID_I2C5,	-1,	24,	0},
> +	{PERIPH_ID_I2C6,	-1,	24,	0},
> +	{PERIPH_ID_I2C7,	-1,	24,	0},
> +	{PERIPH_ID_SPI0,	16,	0,	8},
> +	{PERIPH_ID_SPI1,	20,	16,	24},
> +	{PERIPH_ID_SPI2,	24,	0,	8},
> +	{PERIPH_ID_SDMMC0,	0,	0,	8},
> +	{PERIPH_ID_SDMMC1,	4,	16,	24},
> +	{PERIPH_ID_SDMMC2,	8,	0,	8},
> +	{PERIPH_ID_SDMMC3,	12,	16,	24},
> +	{PERIPH_ID_I2C8,	-1,	-1,	-1},
> +	{PERIPH_ID_I2C9,	-1,	-1,	-1},
> +	{PERIPH_ID_I2S0,	0,	0,	4},
> +	{PERIPH_ID_I2S1,	4,	12,	16},
> +	{PERIPH_ID_SROMC,	-1,	-1,	-1},
> +	{PERIPH_ID_SPI3,	0,	0,	4},
> +	{PERIPH_ID_SPI4,	4,	12,	16},
> +	{PERIPH_ID_SDMMC4,	16,	0,	8},
> +	{PERIPH_ID_PWM0,	24,	0,	-1},
> +	{PERIPH_ID_PWM1,	24,	0,	-1},
> +	{PERIPH_ID_PWM2,	24,	0,	-1},
> +	{PERIPH_ID_PWM3,	24,	0,	-1},
> +	{PERIPH_ID_PWM4,	24,	0,	-1},
> +	{PERIPH_ID_I2C10,	-1,	-1,	-1},
> +
> +	{PERIPH_ID_NONE,	-1,	-1,	-1},
>  };
>  
>  /* Epll Clock division values to achive different frequency output */
> @@ -260,9 +267,21 @@ static unsigned long exynos5_get_pll_clk(int pllreg)
>  	return fout;
>  }
>  
> +static struct clk_bit_info *get_clk_bit_info(int peripheral)
> +{
> +	int i;
> +
> +	for (i = 0; clk_bit_info[i].id != PERIPH_ID_NONE; i++) {
> +		if (clk_bit_info[i].id == peripheral)
> +			break;
> +	}

If don't match anything, it gets wrong bit_info.
I think good that print the warning message or other.

Best Regards,
Jaehoon Chung

> +
> +	return &clk_bit_info[i];
> +}
> +
>  static unsigned long exynos5_get_periph_rate(int peripheral)
>  {
> -	struct clk_bit_info *bit_info = &clk_bit_info[peripheral];
> +	struct clk_bit_info *bit_info = get_clk_bit_info(peripheral);
>  	unsigned long sclk, sub_clk;
>  	unsigned int src, div, sub_div;
>  	struct exynos5_clock *clk =
> 

  reply	other threads:[~2015-01-16  2:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 13:31 [U-Boot] [PATCH v2 0/4] Exynos5: Fix warnings and enrich clock_get_periph_rate Akshay Saraswat
2015-01-15 13:31 ` [U-Boot] [PATCH v2 1/6] Exynos5: Fix compiler warnings due to clock_get_periph_rate Akshay Saraswat
2015-01-16  2:49   ` Jaehoon Chung [this message]
2015-01-15 13:31 ` [U-Boot] [PATCH v2 2/6] Exynos542x: Move exynos5420_get_pll_clk up and rename Akshay Saraswat
2015-01-16  2:47   ` Joonyoung Shim
2015-01-15 13:31 ` [U-Boot] [PATCH v2 3/6] Exynos542x: Add and enable get_periph_rate support Akshay Saraswat
2015-01-16  4:58   ` Joonyoung Shim
2015-01-16  5:10     ` Joonyoung Shim
2015-01-15 13:31 ` [U-Boot] [PATCH v2 4/6] Exynos5: Fix exynos5_get_periph_rate calculations Akshay Saraswat
2015-01-15 13:31 ` [U-Boot] [PATCH v2 5/6] Exynos5: Use clock_get_periph_rate generic API Akshay Saraswat
2015-01-15 13:31 ` [U-Boot] [PATCH v2 6/6] Exynos5: Remove dead code for fetching clocks Akshay Saraswat

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=54B87C39.6090005@samsung.com \
    --to=jh80.chung@samsung.com \
    --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.