Skip to contentSkip to conversation

i2c-pxa: fastmode support

PATCH In review Jonathan Cameron 6 participants 11 messages Jul 31, 2008 – Aug 6, 2008 5 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-pxa: fastmode support

From: Jonathan Cameron <[email protected]>

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.

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

Patch is against 2.6.27-rc1

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
include/asm-arm/arch-pxa/pxa-regs.h +1 -0
diff -uprN -X a/Documentation/dontdiff a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -448,6 +448,7 @@
 #define ICR_ALDIE	(1 << 12)	   /* enable arbitration interrupt */
 #define ICR_SADIE	(1 << 13)	   /* slave address detected int enable */
 #define ICR_UR		(1 << 14)	   /* unit reset */
+#define ICR_FM		(1 << 15)	   /* fast mode */
 
 #define ISR_RWM		(1 << 0)	   /* read/write mode */
 #define ISR_ACKNAK	(1 << 1)	   /* ack/nak status */
include/asm-arm/arch-pxa/i2c.h +2 -1
diff -uprN -X a/Documentation/dontdiff a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		slave_addr;
 	struct i2c_slave_client	*slave;
 	unsigned int		class;
-	int			use_pio;
+	int			use_pio:1;
+	int			fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
drivers/i2c/busses/i2c-pxa.c +4 -2
diff -uprN -X a/Documentation/dontdiff a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
 	int			irq;
-	int			use_pio;
+	int			use_pio:1;
+	int			fast_mode:1;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
 	writel(i2c->slave_addr, _ISAR(i2c));
 
 	/* set control register values */
-	writel(I2C_ICR_INIT, _ICR(i2c));
+	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
 	if (plat) {
 		i2c->adap.class = plat->class;
 		i2c->use_pio = plat->use_pio;
+		i2c->fast_mode = plat->fast_mode;
 	}
 
 	if (i2c->use_pio) {

-------------------------------------------------------------------

List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

A message that is not in the archive (sent off-list or not yet received): 4891E0C5.7020009-KWPb1pKIrIJaa/[email protected]

#3 lore raw
Quoted 5 lines · Eric Miao
Quoted 3 lines

This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

It's generally better to use "unsigned int" for bit field please. Otherwise OK.

Good point! Concept of a 1 bit signed integer is a bit odd to say the least ;)

Patch repost with that (and Ben's point about description length) fixed shortly.

Cheers,
--
Jonathan Cameron

-------------------------------------------------------------------

List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
#4 lore raw
In reply to Jonathan Cameron
Quoted 11 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

please ensure your descriptions are wrapped to less than 77 characters per line.

Quoted 35 lines

Patch is against 2.6.27-rc1

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff -uprN -X a/Documentation/dontdiff a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h

include/asm-arm/arch-pxa/pxa-regs.h +1 -0
@@ -448,6 +448,7 @@
 #define ICR_ALDIE	(1 << 12)	   /* enable arbitration interrupt */
 #define ICR_SADIE	(1 << 13)	   /* slave address detected int enable */
 #define ICR_UR		(1 << 14)	   /* unit reset */
+#define ICR_FM		(1 << 15)	   /* fast mode */
 
 #define ISR_RWM		(1 << 0)	   /* read/write mode */
 #define ISR_ACKNAK	(1 << 1)	   /* ack/nak status */

diff -uprN -X a/Documentation/dontdiff a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h

include/asm-arm/arch-pxa/i2c.h +2 -1
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		slave_addr;
 	struct i2c_slave_client	*slave;
 	unsigned int		class;
-	int			use_pio;
+	int			use_pio:1;
+	int			fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);

diff -uprN -X a/Documentation/dontdiff a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c

drivers/i2c/busses/i2c-pxa.c struct pxa_i2c { · line 70

Quoted 7 lines
drivers/i2c/busses/i2c-pxa.c +2 -1
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
 	int			irq;
-	int			use_pio;
+	int			use_pio:1;
+	int			fast_mode:1;
 };

Please use unsigned int for bitfields, and a space between the name and the :1 would be nice.

Quoted 18 lines
drivers/i2c/busses/i2c-pxa.c +2 -1
 #define _IBMR(i2c)	((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
 	writel(i2c->slave_addr, _ISAR(i2c));
 
 	/* set control register values */
-	writel(I2C_ICR_INIT, _ICR(i2c));
+	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
 	if (plat) {
 		i2c->adap.class = plat->class;
 		i2c->use_pio = plat->use_pio;
+		i2c->fast_mode = plat->fast_mode;
 	}
 
 	if (i2c->use_pio) {
Signature · 11 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

A message that is not in the archive (sent off-list or not yet received): 20080801094257.GK26938-SMNkleLxa3Z6Wcw2j4pizdi2O/[email protected]

#6 lore raw
Quoted 8 lines · Ben Dooks
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>

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.

Quoted 7 lines
Quoted 4 lines

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

please ensure your descriptions are wrapped to less than 77 characters per line.

Will do, sorry about that bit of carelessness.

Quoted 7 lines
Quoted 7 lines

extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
diff -uprN -X a/Documentation/dontdiff a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c

drivers/i2c/busses/i2c-pxa.c +0 -0
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
Quoted 8 lines

drivers/i2c/busses/i2c-pxa.c struct pxa_i2c { · line 70

Quoted 5 lines
drivers/i2c/busses/i2c-pxa.c +2 -1
 	int			irq;
-	int			use_pio;
+	int			use_pio:1;
+	int			fast_mode:1;
 };

Please use unsigned int for bitfields, and a space between the name and the :1 would be nice.

On this point, which is the standard way of doing this?
I'd normally go for a space before the colon, but it appears to be an open issue from point of view of coding standards(and checkpatch throws a wobbly)

Not something I care about that much either way and I'm guessing by the would be nice that you don't either. I'll repost the patch without.

Thanks for the comments,

#7 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · Ben Dooks
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

please ensure your descriptions are wrapped to less than 77 characters per line.

Will do, sorry about that bit of carelessness.

Less than 72 is preferable - because tools (eg, git log) commonly prefix the comments with one tab.

Quoted 2 lines

Not something I care about that much either way and I'm guessing by the would be nice that you don't either. I'll repost the patch without.

Preferred without the space.

-------------------------------------------------------------------

List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
#8 lore raw
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Jonathan Cameron
Quoted 12 lines · Ben Dooks
Quoted 11 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

please ensure your descriptions are wrapped to less than 77 characters per line.

Will do, sorry about that bit of carelessness.

Less than 72 is preferable - because tools (eg, git log) commonly prefix the comments with one tab.

Doh, emails crossed. I'll repost with 72 character limit in a sec!

Quoted 5 lines
Quoted 3 lines

Not something I care about that much either way and I'm guessing by the would be nice that you don't either. I'll repost the patch without.

Preferred without the space.

Thanks for clearing that up.
--
Jonathan

-------------------------------------------------------------------

List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

A message that is not in the archive (sent off-list or not yet received): 4892E183.7090601-KWPb1pKIrIJaa/[email protected]

#10 lore raw

PATCH 1/1 i2c-pxa: fastmode support (format cleanups)

From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>

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.

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-pxa.c +4 -2
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
 	int			irq;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
 	writel(i2c->slave_addr, _ISAR(i2c));
 
 	/* set control register values */
-	writel(I2C_ICR_INIT, _ICR(i2c));
+	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
 	if (plat) {
 		i2c->adap.class = plat->class;
 		i2c->use_pio = plat->use_pio;
+		i2c->fast_mode = plat->fast_mode;
 	}
 
 	if (i2c->use_pio) {
include/asm-arm/arch-pxa/i2c.h +2 -1
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		slave_addr;
 	struct i2c_slave_client	*slave;
 	unsigned int		class;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
include/asm-arm/arch-pxa/pxa-regs.h +1 -0
@@ -448,6 +448,7 @@
 #define ICR_ALDIE	(1 << 12)	   /* enable arbitration interrupt */
 #define ICR_SADIE	(1 << 13)	   /* slave address detected int enable */
 #define ICR_UR		(1 << 14)	   /* unit reset */
+#define ICR_FM		(1 << 15)	   /* fast mode */
 
 #define ISR_RWM		(1 << 0)	   /* read/write mode */
 #define ISR_ACKNAK	(1 << 1)	   /* ack/nak status */

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 4892E28E.40202-KWPb1pKIrIJaa/[email protected]

Acked-by
#12 lore raw

Re: [PATCH] i2c-pxa: fastmode support (format cleanups)

Quoted 8 lines · Jonathan Cameron

From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>

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.

Quoted 68 lines

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-pxa.c 2008-08-01 10:50:38.000000000 +0100 renamed from drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100 +4 -2
@@ -65,7 +65,8 @@ struct pxa_i2c {
       unsigned long           iosize;
 
       int                     irq;
-       int                     use_pio;
+       unsigned int            use_pio:1;
+       unsigned int            fast_mode:1;
 };
 
 #define _IBMR(i2c)     ((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
       writel(i2c->slave_addr, _ISAR(i2c));
 
       /* set control register values */
-       writel(I2C_ICR_INIT, _ICR(i2c));
+       writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
       dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
       if (plat) {
               i2c->adap.class = plat->class;
               i2c->use_pio = plat->use_pio;
+               i2c->fast_mode = plat->fast_mode;
       }
 
       if (i2c->use_pio) {
include/asm-arm/arch-pxa/i2c.h 2008-08-01 10:51:40.000000000 +0100 renamed from include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100 +2 -1
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
       unsigned int            slave_addr;
       struct i2c_slave_client *slave;
       unsigned int            class;
-       int                     use_pio;
+       unsigned int            use_pio:1;
+       unsigned int            fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100 renamed from include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100 +1 -0
@@ -448,6 +448,7 @@
 #define ICR_ALDIE      (1 << 12)          /* enable arbitration interrupt */
 #define ICR_SADIE      (1 << 13)          /* slave address detected int enable */
 #define ICR_UR         (1 << 14)          /* unit reset */
+#define ICR_FM         (1 << 15)          /* fast mode */
 
 #define ISR_RWM                (1 << 0)           /* read/write mode */
 #define ISR_ACKNAK     (1 << 1)           /* ack/nak status */

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Signature · 7 lines
Cheers
- eric

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
#13 lore raw

PATCH 1/1 i2c-pxa: fastmode support (with suggested fixes)

In reply to a message not in the archive

From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>

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.

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-pxa.c +4 -2
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
 	int			irq;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
 	writel(i2c->slave_addr, _ISAR(i2c));
 
 	/* set control register values */
-	writel(I2C_ICR_INIT, _ICR(i2c));
+	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
 	if (plat) {
 		i2c->adap.class = plat->class;
 		i2c->use_pio = plat->use_pio;
+		i2c->fast_mode = plat->fast_mode;
 	}
 
 	if (i2c->use_pio) {
include/asm-arm/arch-pxa/i2c.h +2 -1
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		slave_addr;
 	struct i2c_slave_client	*slave;
 	unsigned int		class;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
include/asm-arm/arch-pxa/pxa-regs.h +1 -0
@@ -448,6 +448,7 @@
 #define ICR_ALDIE	(1 << 12)	   /* enable arbitration interrupt */
 #define ICR_SADIE	(1 << 13)	   /* slave address detected int enable */
 #define ICR_UR		(1 << 14)	   /* unit reset */
+#define ICR_FM		(1 << 15)	   /* fast mode */
 
 #define ISR_RWM		(1 << 0)	   /* read/write mode */
 #define ISR_ACKNAK	(1 << 1)	   /* ack/nak status */

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): 4892E08F.4000907-KWPb1pKIrIJaa/[email protected]

#15 lore raw

Re: [PATCH] i2c-pxa: fastmode support (with suggested fixes)

Quoted 6 lines · Jonathan Cameron

From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>

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.

this looks fine, the only problem is that we're still going through some reorganisation of the ARM headers... given this is really a new feature, I'm not going to apply it until closer to the next release.

I may even have a look to see what the state of splitting pxa-regs up further into something that might be more maintainable...

Quoted 68 lines

--
This is basically a repost of the original patch with use_pio and fast_mode converted to bit fields as suggested / agreed by Eric Miao and Ben Dooks.

 drivers/i2c/busses/i2c-pxa.c        |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h      |    3 ++-
 include/asm-arm/arch-pxa/pxa-regs.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-pxa.c +4 -2
@@ -65,7 +65,8 @@ struct pxa_i2c {
 	unsigned long		iosize;
 
 	int			irq;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_base + 0)
@@ -364,7 +365,7 @@ static void i2c_pxa_reset(struct pxa_i2c
 	writel(i2c->slave_addr, _ISAR(i2c));
 
 	/* set control register values */
-	writel(I2C_ICR_INIT, _ICR(i2c));
+	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
@@ -1013,6 +1014,7 @@ static int i2c_pxa_probe(struct platform
 	if (plat) {
 		i2c->adap.class = plat->class;
 		i2c->use_pio = plat->use_pio;
+		i2c->fast_mode = plat->fast_mode;
 	}
 
 	if (i2c->use_pio) {
include/asm-arm/arch-pxa/i2c.h +2 -1
@@ -65,7 +65,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		slave_addr;
 	struct i2c_slave_client	*slave;
 	unsigned int		class;
-	int			use_pio;
+	unsigned int		use_pio:1;
+	unsigned int		fast_mode:1;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
include/asm-arm/arch-pxa/pxa-regs.h +1 -0
@@ -448,6 +448,7 @@
 #define ICR_ALDIE	(1 << 12)	   /* enable arbitration interrupt */
 #define ICR_SADIE	(1 << 13)	   /* slave address detected int enable */
 #define ICR_UR		(1 << 14)	   /* unit reset */
+#define ICR_FM		(1 << 15)	   /* fast mode */
 
 #define ISR_RWM		(1 << 0)	   /* read/write mode */
 #define ISR_ACKNAK	(1 << 1)	   /* ack/nak status */

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Signature · 8 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c