Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77319
b: refs/heads/master
c: 59d70df
h: refs/heads/master
i:
  77317: 782c5e6
  77315: f0a44cc
  77311: 543be86
v: v3
  • Loading branch information
eric miao authored and Jean Delvare committed Jan 27, 2008
1 parent cad8662 commit 0a50e12
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e8b99251be8b6f992baa88e3a6ba3c4ae01660b
refs/heads/master: 59d70df025473931c500d6d60510798e4bfa3279
58 changes: 29 additions & 29 deletions trunk/drivers/i2c/busses/i2c-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,32 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
.functionality = i2c_pxa_functionality,
};

static void i2c_pxa_enable(struct platform_device *dev)
{
if (cpu_is_pxa27x()) {
switch (dev->id) {
case 0:
pxa_gpio_mode(GPIO117_I2CSCL_MD);
pxa_gpio_mode(GPIO118_I2CSDA_MD);
break;
case 1:
local_irq_disable();
PCFR |= PCFR_PI2CEN;
local_irq_enable();
break;
}
}
}

static void i2c_pxa_disable(struct platform_device *dev)
{
if (cpu_is_pxa27x() && dev->id == 1) {
local_irq_disable();
PCFR &= ~PCFR_PI2CEN;
local_irq_enable();
}
}

#define res_len(r) ((r)->end - (r)->start + 1)
static int i2c_pxa_probe(struct platform_device *dev)
{
Expand Down Expand Up @@ -899,25 +925,13 @@ static int i2c_pxa_probe(struct platform_device *dev)
#endif

clk_enable(i2c->clk);
#ifdef CONFIG_PXA27x
switch (dev->id) {
case 0:
pxa_gpio_mode(GPIO117_I2CSCL_MD);
pxa_gpio_mode(GPIO118_I2CSDA_MD);
break;
case 1:
local_irq_disable();
PCFR |= PCFR_PI2CEN;
local_irq_enable();
}
#endif
i2c_pxa_enable(dev);

ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED,
i2c->adap.name, i2c);
if (ret)
goto ereqirq;


i2c_pxa_reset(i2c);

i2c->adap.algo_data = i2c;
Expand Down Expand Up @@ -955,14 +969,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
free_irq(irq, i2c);
ereqirq:
clk_disable(i2c->clk);

#ifdef CONFIG_PXA27x
if (dev->id == 1) {
local_irq_disable();
PCFR &= ~PCFR_PI2CEN;
local_irq_enable();
}
#endif
i2c_pxa_disable(dev);
eremap:
clk_put(i2c->clk);
eclk:
Expand All @@ -983,14 +990,7 @@ static int i2c_pxa_remove(struct platform_device *dev)

clk_disable(i2c->clk);
clk_put(i2c->clk);

#ifdef CONFIG_PXA27x
if (dev->id == 1) {
local_irq_disable();
PCFR &= ~PCFR_PI2CEN;
local_irq_enable();
}
#endif
i2c_pxa_disable(dev);

release_mem_region(i2c->iobase, i2c->iosize);
kfree(i2c);
Expand Down

0 comments on commit 0a50e12

Please sign in to comment.