Patchwork [U-Boot] exynos: i2c: Use generic api to get i2c clk freq

login
register
mail settings
Submitter Akshay Saraswat
Date March 25, 2013, 9:02 a.m.
Message ID <1364202173-13719-1-git-send-email-akshay.s@samsung.com>
Download mbox | patch
Permalink /patch/230589/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Akshay Saraswat - March 25, 2013, 9:02 a.m.
From: Padmavathi Venna <padma.v@samsung.com>

Use generic api to get the i2c clock frequency.
Tested on smdk5250 with the help of following commands.
run
i2c dev 1
i2c dev 2
i2c speed

This patch depends on:
http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/154930

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
---
 drivers/i2c/s3c24x0_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Minkyu Kang - June 4, 2013, 7:53 a.m.
On 25/03/13 18:02, Akshay Saraswat wrote:
> From: Padmavathi Venna <padma.v@samsung.com>
> 
> Use generic api to get the i2c clock frequency.

Please move following comments to under "---" line.

> Tested on smdk5250 with the help of following commands.
> run
> i2c dev 1
> i2c dev 2
> i2c speed
> 
> This patch depends on:
> http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/154930
> 
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---
>  drivers/i2c/s3c24x0_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index 769a2ba..a9f19e7 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -151,7 +151,7 @@ static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd)
>  {
>  	ulong freq, pres = 16, div;
>  #if (defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
> -	freq = get_i2c_clk();
> +	freq = clock_get_periph_rate(PERIPH_ID_I2C0);
>  #else
>  	freq = get_PCLK();
>  #endif
> 

Thanks,
Minkyu Kang.
Minkyu Kang - June 4, 2013, 8:01 a.m.
On 25/03/13 18:02, Akshay Saraswat wrote:
> From: Padmavathi Venna <padma.v@samsung.com>
> 
> Use generic api to get the i2c clock frequency.
> Tested on smdk5250 with the help of following commands.
> run
> i2c dev 1
> i2c dev 2
> i2c speed
> 
> This patch depends on:
> http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/154930
> 
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> ---
>  drivers/i2c/s3c24x0_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index 769a2ba..a9f19e7 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -151,7 +151,7 @@ static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd)
>  {
>  	ulong freq, pres = 16, div;
>  #if (defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
> -	freq = get_i2c_clk();
> +	freq = clock_get_periph_rate(PERIPH_ID_I2C0);

Since clock_get_periph_rate did not implemented on exynos4, exynos4 will get zero.
So, I'll not accept this patch.

>  #else
>  	freq = get_PCLK();
>  #endif
> 

Thanks,
Minkyu Kang.

Patch

diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index 769a2ba..a9f19e7 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -151,7 +151,7 @@  static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd)
 {
 	ulong freq, pres = 16, div;
 #if (defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
-	freq = get_i2c_clk();
+	freq = clock_get_periph_rate(PERIPH_ID_I2C0);
 #else
 	freq = get_PCLK();
 #endif