Patchwork i2c-pxa: prepare clock before use

login
register
mail settings
Submitter Daniel Drake
Date June 13, 2013, 7:24 p.m.
Message ID <20130613192457.51006FAACE@dev.laptop.org>
Download mbox | patch
Permalink /patch/251153/
State Changes Requested
Headers show

Comments

Daniel Drake - June 13, 2013, 7:24 p.m.
On OLPC XO-1.75 (MMP2), a WARN_ON() was occurring during boot
since the clock being enabled by i2c-pxa had not been prepared.

Use clk_prepare_enable() to ensure that the prepare operation
has taken place.

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/i2c/busses/i2c-pxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Wolfram Sang - June 15, 2013, 2:23 p.m.
On Thu, Jun 13, 2013 at 03:24:57PM -0400, Daniel Drake wrote:
> On OLPC XO-1.75 (MMP2), a WARN_ON() was occurring during boot
> since the clock being enabled by i2c-pxa had not been prepared.
> 
> Use clk_prepare_enable() to ensure that the prepare operation
> has taken place.
> 
> Signed-off-by: Daniel Drake <dsd@laptop.org>

The other half of the pair is missing.

> ---
>  drivers/i2c/busses/i2c-pxa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index ea6d45d..ef307ea 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1160,7 +1160,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		i2c->adap.class = plat->class;
>  	}
>  
> -	clk_enable(i2c->clk);
> +	clk_prepare_enable(i2c->clk);
>  
>  	if (i2c->use_pio) {
>  		i2c->adap.algo = &i2c_pxa_pio_algorithm;
> -- 
> 1.8.1.4
>

Patch

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index ea6d45d..ef307ea 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1160,7 +1160,7 @@  static int i2c_pxa_probe(struct platform_device *dev)
 		i2c->adap.class = plat->class;
 	}
 
-	clk_enable(i2c->clk);
+	clk_prepare_enable(i2c->clk);
 
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;