Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (95 commits) [ARM] 4578/1: CM-x270: PCMCIA support [ARM] 4577/1: ITE 8152 PCI bridge support [ARM] 4576/1: CM-X270 machine support [ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put() [ARM] pxa: move pxa_set_mode() from pxa2xx_mainstone.c to mainstone.c [ARM] pxa: move pxa_set_mode() from pxa2xx_lubbock.c to lubbock.c [ARM] pxa: Make cpu_is_pxaXXX dependent on configuration symbols [ARM] pxa: PXA3xx base support [NET] smc91x: fix PXA DMA support code [SERIAL] Fix console initialisation ordering [ARM] pxa: tidy up arch/arm/mach-pxa/Makefile [ARM] Update arch/arm/Kconfig for drivers/Kconfig changes [ARM] 4600/1: fix kernel build failure with build-id-supporting binutils [ARM] 4599/1: Preserve ATAG list for use with kexec (2.6.23) [ARM] Rename consistent_sync() as dma_cache_maint() [ARM] 4572/1: ep93xx: add cirrus logic edb9307 support [ARM] 4596/1: S3C2412: Correct IRQs for SDI+CF and add decoding support [ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32 [ARM] 4594/1: ns9xxx: use the new gpio functions [ARM] 4593/1: ns9xxx: implement generic clockevents ...
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/i2c-pxa.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/irq.h>
|
||||
@@ -48,6 +50,7 @@ struct pxa_i2c {
|
||||
unsigned int slave_addr;
|
||||
|
||||
struct i2c_adapter adap;
|
||||
struct clk *clk;
|
||||
#ifdef CONFIG_I2C_PXA_SLAVE
|
||||
struct i2c_slave_client *slave;
|
||||
#endif
|
||||
@@ -869,6 +872,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
||||
|
||||
sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id);
|
||||
|
||||
i2c->clk = clk_get(&dev->dev, "I2CCLK");
|
||||
if (IS_ERR(i2c->clk)) {
|
||||
ret = PTR_ERR(i2c->clk);
|
||||
goto eclk;
|
||||
}
|
||||
|
||||
i2c->reg_base = ioremap(res->start, res_len(res));
|
||||
if (!i2c->reg_base) {
|
||||
ret = -EIO;
|
||||
@@ -889,22 +898,19 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
clk_enable(i2c->clk);
|
||||
#ifdef CONFIG_PXA27x
|
||||
switch (dev->id) {
|
||||
case 0:
|
||||
#ifdef CONFIG_PXA27x
|
||||
pxa_gpio_mode(GPIO117_I2CSCL_MD);
|
||||
pxa_gpio_mode(GPIO118_I2CSDA_MD);
|
||||
#endif
|
||||
pxa_set_cken(CKEN_I2C, 1);
|
||||
break;
|
||||
#ifdef CONFIG_PXA27x
|
||||
case 1:
|
||||
local_irq_disable();
|
||||
PCFR |= PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
pxa_set_cken(CKEN_PWRI2C, 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED,
|
||||
i2c->adap.name, i2c);
|
||||
@@ -948,19 +954,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
|
||||
eadapt:
|
||||
free_irq(irq, i2c);
|
||||
ereqirq:
|
||||
switch (dev->id) {
|
||||
case 0:
|
||||
pxa_set_cken(CKEN_I2C, 0);
|
||||
break;
|
||||
clk_disable(i2c->clk);
|
||||
|
||||
#ifdef CONFIG_PXA27x
|
||||
case 1:
|
||||
pxa_set_cken(CKEN_PWRI2C, 0);
|
||||
if (dev->id == 1) {
|
||||
local_irq_disable();
|
||||
PCFR &= ~PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
eremap:
|
||||
clk_put(i2c->clk);
|
||||
eclk:
|
||||
kfree(i2c);
|
||||
emalloc:
|
||||
release_mem_region(res->start, res_len(res));
|
||||
@@ -975,18 +980,18 @@ static int i2c_pxa_remove(struct platform_device *dev)
|
||||
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
free_irq(i2c->irq, i2c);
|
||||
switch (dev->id) {
|
||||
case 0:
|
||||
pxa_set_cken(CKEN_I2C, 0);
|
||||
break;
|
||||
|
||||
clk_disable(i2c->clk);
|
||||
clk_put(i2c->clk);
|
||||
|
||||
#ifdef CONFIG_PXA27x
|
||||
case 1:
|
||||
pxa_set_cken(CKEN_PWRI2C, 0);
|
||||
if (dev->id == 1) {
|
||||
local_irq_disable();
|
||||
PCFR &= ~PCFR_PI2CEN;
|
||||
local_irq_enable();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
release_mem_region(i2c->iobase, i2c->iosize);
|
||||
kfree(i2c);
|
||||
|
||||
|
Reference in New Issue
Block a user