diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2008-10-03 10:07:36 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-03 10:57:06 -0400 |
commit | c46c948260f41af18b277c1eb1895d788d3605dc (patch) | |
tree | f073823d5b3dab9cb02d231dcce591343759fa8d | |
parent | 73b610affe0b24ecb808ef68a1b0a436a4cf7bd5 (diff) |
[ARM] 5278/1: i2c-pxa fast mode support
Add fast_mode option to i2c_pxa_platform_data and use it to set the
ICR_FM bit appropriately when i2c_pxa_reset is called. Parameter
called fast_mode rather than frequency as this driver is also used
for the i2c_pxa_pwr bus which has different normal and fast frequencies.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/include/mach/i2c.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/pxa-regs.h | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/include/mach/i2c.h b/arch/arm/mach-pxa/include/mach/i2c.h index 897e71752177..1a9f65e6ec0f 100644 --- a/arch/arm/mach-pxa/include/mach/i2c.h +++ b/arch/arm/mach-pxa/include/mach/i2c.h | |||
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data { | |||
65 | unsigned int slave_addr; | 65 | unsigned int slave_addr; |
66 | struct i2c_slave_client *slave; | 66 | struct i2c_slave_client *slave; |
67 | unsigned int class; | 67 | unsigned int class; |
68 | int use_pio; | 68 | unsigned int use_pio :1; |
69 | unsigned int fast_mode :1; | ||
69 | }; | 70 | }; |
70 | 71 | ||
71 | extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); | 72 | extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); |
diff --git a/arch/arm/mach-pxa/include/mach/pxa-regs.h b/arch/arm/mach-pxa/include/mach/pxa-regs.h index 12288ca3cbb2..772c67635e23 100644 --- a/arch/arm/mach-pxa/include/mach/pxa-regs.h +++ b/arch/arm/mach-pxa/include/mach/pxa-regs.h | |||
@@ -448,6 +448,7 @@ | |||
448 | #define ICR_ALDIE (1 << 12) /* enable arbitration interrupt */ | 448 | #define ICR_ALDIE (1 << 12) /* enable arbitration interrupt */ |
449 | #define ICR_SADIE (1 << 13) /* slave address detected int enable */ | 449 | #define ICR_SADIE (1 << 13) /* slave address detected int enable */ |
450 | #define ICR_UR (1 << 14) /* unit reset */ | 450 | #define ICR_UR (1 << 14) /* unit reset */ |
451 | #define ICR_FM (1 << 15) /* fast mode */ | ||
451 | 452 | ||
452 | #define ISR_RWM (1 << 0) /* read/write mode */ | 453 | #define ISR_RWM (1 << 0) /* read/write mode */ |
453 | #define ISR_ACKNAK (1 << 1) /* ack/nak status */ | 454 | #define ISR_ACKNAK (1 << 1) /* ack/nak status */ |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 518b57c795c8..8b38ed0379d5 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -66,7 +66,8 @@ struct pxa_i2c { | |||
66 | unsigned long iosize; | 66 | unsigned long iosize; |
67 | 67 | ||
68 | int irq; | 68 | int irq; |
69 | int use_pio; | 69 | unsigned int use_pio :1; |
70 | unsigned int fast_mode :1; | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | #define _IBMR(i2c) ((i2c)->reg_base + (0x0 << (i2c)->reg_shift)) | 73 | #define _IBMR(i2c) ((i2c)->reg_base + (0x0 << (i2c)->reg_shift)) |
@@ -366,7 +367,7 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c) | |||
366 | writel(i2c->slave_addr, _ISAR(i2c)); | 367 | writel(i2c->slave_addr, _ISAR(i2c)); |
367 | 368 | ||
368 | /* set control register values */ | 369 | /* set control register values */ |
369 | writel(I2C_ICR_INIT, _ICR(i2c)); | 370 | writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c)); |
370 | 371 | ||
371 | #ifdef CONFIG_I2C_PXA_SLAVE | 372 | #ifdef CONFIG_I2C_PXA_SLAVE |
372 | dev_info(&i2c->adap.dev, "Enabling slave mode\n"); | 373 | dev_info(&i2c->adap.dev, "Enabling slave mode\n"); |
@@ -1010,6 +1011,7 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
1010 | if (plat) { | 1011 | if (plat) { |
1011 | i2c->adap.class = plat->class; | 1012 | i2c->adap.class = plat->class; |
1012 | i2c->use_pio = plat->use_pio; | 1013 | i2c->use_pio = plat->use_pio; |
1014 | i2c->fast_mode = plat->fast_mode; | ||
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | if (i2c->use_pio) { | 1017 | if (i2c->use_pio) { |