Skip to contentSkip to conversation

i2c-pxa: prepare clock before use

PATCH Applied Daniel Drake 2 participants 2 messages Jun 17, 2013 – Jun 18, 2013 1 message not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c-pxa: prepare clock before use

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, and use clk_disable_unprepare() in the matching shutdown paths.

---
 drivers/i2c/busses/i2c-pxa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

v2: add the "other half" - thanks Wolfram!

drivers/i2c/busses/i2c-pxa.c +3 -3
index ea6d45d..fbafed2 100644
@@ -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;
@@ -1202,7 +1202,7 @@ eadapt:
 	if (!i2c->use_pio)
 		free_irq(irq, i2c);
 ereqirq:
-	clk_disable(i2c->clk);
+	clk_disable_unprepare(i2c->clk);
 	iounmap(i2c->reg_base);
 eremap:
 	clk_put(i2c->clk);
@@ -1221,7 +1221,7 @@ static int i2c_pxa_remove(struct platform_device *dev)
 	if (!i2c->use_pio)
 		free_irq(i2c->irq, i2c);
 
-	clk_disable(i2c->clk);
+	clk_disable_unprepare(i2c->clk);
 	clk_put(i2c->clk);
 
 	iounmap(i2c->reg_base);
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 20130617153036.67CC84375-2+9YHz4BXxlLDiiyqF6/[email protected]

Applied
#2 lore raw
Quoted 8 lines · Daniel Drake

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, and use clk_disable_unprepare() in the matching shutdown paths.

Applied to for-next, thanks!