aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
commit65a6ec0d72a07f16719e9b7a96e1c4bae044b591 (patch)
tree344e03a5039a44982c1b78d6113633b21b434820 /drivers/i2c
parent541010e4b8921cd781ff02ae68028501457045b6 (diff)
parent0181b61a988424b5cc44fe09e6968142359c815e (diff)
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 ...
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-pxa.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index bb5466b27b59..00fad11733ad 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -31,6 +31,8 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/i2c-pxa.h> 32#include <linux/i2c-pxa.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/err.h>
35#include <linux/clk.h>
34 36
35#include <asm/hardware.h> 37#include <asm/hardware.h>
36#include <asm/irq.h> 38#include <asm/irq.h>
@@ -48,6 +50,7 @@ struct pxa_i2c {
48 unsigned int slave_addr; 50 unsigned int slave_addr;
49 51
50 struct i2c_adapter adap; 52 struct i2c_adapter adap;
53 struct clk *clk;
51#ifdef CONFIG_I2C_PXA_SLAVE 54#ifdef CONFIG_I2C_PXA_SLAVE
52 struct i2c_slave_client *slave; 55 struct i2c_slave_client *slave;
53#endif 56#endif
@@ -869,6 +872,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
869 872
870 sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); 873 sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id);
871 874
875 i2c->clk = clk_get(&dev->dev, "I2CCLK");
876 if (IS_ERR(i2c->clk)) {
877 ret = PTR_ERR(i2c->clk);
878 goto eclk;
879 }
880
872 i2c->reg_base = ioremap(res->start, res_len(res)); 881 i2c->reg_base = ioremap(res->start, res_len(res));
873 if (!i2c->reg_base) { 882 if (!i2c->reg_base) {
874 ret = -EIO; 883 ret = -EIO;
@@ -889,22 +898,19 @@ static int i2c_pxa_probe(struct platform_device *dev)
889 } 898 }
890#endif 899#endif
891 900
901 clk_enable(i2c->clk);
902#ifdef CONFIG_PXA27x
892 switch (dev->id) { 903 switch (dev->id) {
893 case 0: 904 case 0:
894#ifdef CONFIG_PXA27x
895 pxa_gpio_mode(GPIO117_I2CSCL_MD); 905 pxa_gpio_mode(GPIO117_I2CSCL_MD);
896 pxa_gpio_mode(GPIO118_I2CSDA_MD); 906 pxa_gpio_mode(GPIO118_I2CSDA_MD);
897#endif
898 pxa_set_cken(CKEN_I2C, 1);
899 break; 907 break;
900#ifdef CONFIG_PXA27x
901 case 1: 908 case 1:
902 local_irq_disable(); 909 local_irq_disable();
903 PCFR |= PCFR_PI2CEN; 910 PCFR |= PCFR_PI2CEN;
904 local_irq_enable(); 911 local_irq_enable();
905 pxa_set_cken(CKEN_PWRI2C, 1);
906#endif
907 } 912 }
913#endif
908 914
909 ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, 915 ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED,
910 i2c->adap.name, i2c); 916 i2c->adap.name, i2c);
@@ -948,19 +954,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
948eadapt: 954eadapt:
949 free_irq(irq, i2c); 955 free_irq(irq, i2c);
950ereqirq: 956ereqirq:
951 switch (dev->id) { 957 clk_disable(i2c->clk);
952 case 0: 958
953 pxa_set_cken(CKEN_I2C, 0);
954 break;
955#ifdef CONFIG_PXA27x 959#ifdef CONFIG_PXA27x
956 case 1: 960 if (dev->id == 1) {
957 pxa_set_cken(CKEN_PWRI2C, 0);
958 local_irq_disable(); 961 local_irq_disable();
959 PCFR &= ~PCFR_PI2CEN; 962 PCFR &= ~PCFR_PI2CEN;
960 local_irq_enable(); 963 local_irq_enable();
961#endif
962 } 964 }
965#endif
963eremap: 966eremap:
967 clk_put(i2c->clk);
968eclk:
964 kfree(i2c); 969 kfree(i2c);
965emalloc: 970emalloc:
966 release_mem_region(res->start, res_len(res)); 971 release_mem_region(res->start, res_len(res));
@@ -975,18 +980,18 @@ static int i2c_pxa_remove(struct platform_device *dev)
975 980
976 i2c_del_adapter(&i2c->adap); 981 i2c_del_adapter(&i2c->adap);
977 free_irq(i2c->irq, i2c); 982 free_irq(i2c->irq, i2c);
978 switch (dev->id) { 983
979 case 0: 984 clk_disable(i2c->clk);
980 pxa_set_cken(CKEN_I2C, 0); 985 clk_put(i2c->clk);
981 break; 986
982#ifdef CONFIG_PXA27x 987#ifdef CONFIG_PXA27x
983 case 1: 988 if (dev->id == 1) {
984 pxa_set_cken(CKEN_PWRI2C, 0);
985 local_irq_disable(); 989 local_irq_disable();
986 PCFR &= ~PCFR_PI2CEN; 990 PCFR &= ~PCFR_PI2CEN;
987 local_irq_enable(); 991 local_irq_enable();
988#endif
989 } 992 }
993#endif
994
990 release_mem_region(i2c->iobase, i2c->iosize); 995 release_mem_region(i2c->iobase, i2c->iosize);
991 kfree(i2c); 996 kfree(i2c);
992 997