* [PATCH] i2c-pxa: fastmode support
@ 2008-07-31 15:56 Jonathan Cameron
[not found] ` <4891E0C5.7020009-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-01 9:42 ` Ben Dooks
0 siblings, 2 replies; 11+ messages in thread
From: Jonathan Cameron @ 2008-07-31 15:56 UTC (permalink / raw)
To: linux-arm-kernel, i2c; +Cc: linux, Ben Dooks
From: Jonathan Cameron <jic23@cam.ac.uk>
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>
--
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(-)
diff -uprN -X a/Documentation/dontdiff a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
--- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
+++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
@@ -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
--- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
+++ b/include/asm-arm/arch-pxa/i2c.h 2008-07-31 16:01:28.000000000 +0100
@@ -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
--- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
+++ b/drivers/i2c/busses/i2c-pxa.c 2008-07-31 16:10:43.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
[not found] ` <4891E0C5.7020009-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-08-01 1:29 ` Eric Miao
2008-08-01 9:49 ` Jonathan Cameron
0 siblings, 1 reply; 11+ messages in thread
From: Eric Miao @ 2008-08-01 1:29 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW, Ben Dooks,
i2c-GZX6beZjE8VD60Wz+7aTrA
> 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.
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
2008-07-31 15:56 [PATCH] i2c-pxa: fastmode support Jonathan Cameron
[not found] ` <4891E0C5.7020009-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-08-01 9:42 ` Ben Dooks
[not found] ` <20080801094257.GK26938-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
1 sibling, 1 reply; 11+ messages in thread
From: Ben Dooks @ 2008-08-01 9:42 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux, linux-arm-kernel, Ben Dooks, i2c
On Thu, Jul 31, 2008 at 04:56:53PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <jic23@cam.ac.uk>
>
> 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>
> --
> 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.
> 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
> --- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
> @@ -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
> --- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/i2c.h 2008-07-31 16:01:28.000000000 +0100
> @@ -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
> --- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
> +++ b/drivers/i2c/busses/i2c-pxa.c 2008-07-31 16:10:43.000000000 +0100
> @@ -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.
> #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) {
--
--
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
2008-08-01 1:29 ` Eric Miao
@ 2008-08-01 9:49 ` Jonathan Cameron
0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2008-08-01 9:49 UTC (permalink / raw)
To: Eric Miao; +Cc: linux, linux-arm-kernel, Ben Dooks, i2c
Eric Miao wrote:
>> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
[not found] ` <20080801094257.GK26938-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
@ 2008-08-01 10:06 ` Jonathan Cameron
2008-08-01 10:09 ` Russell King - ARM Linux
2008-08-01 10:08 ` [PATCH] i2c-pxa: fastmode support (with suggested fixes) Jonathan Cameron
1 sibling, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2008-08-01 10:06 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
i2c-GZX6beZjE8VD60Wz+7aTrA
Ben Dooks wrote:
> On Thu, Jul 31, 2008 at 04:56:53PM +0100, Jonathan Cameron wrote:
>> From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>>
>> 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-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>> --
>> 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.
>> 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
>> --- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
>> +++ b/drivers/i2c/busses/i2c-pxa.c 2008-07-31 16:10:43.000000000 +0100
>> @@ -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.
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,
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] i2c-pxa: fastmode support (with suggested fixes)
[not found] ` <20080801094257.GK26938-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2008-08-01 10:06 ` Jonathan Cameron
@ 2008-08-01 10:08 ` Jonathan Cameron
[not found] ` <4892E08F.4000907-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
1 sibling, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2008-08-01 10:08 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
i2c-GZX6beZjE8VD60Wz+7aTrA
From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
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-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
--
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(-)
--- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
+++ b/drivers/i2c/busses/i2c-pxa.c 2008-08-01 10:50:38.000000000 +0100
@@ -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) {
--- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
+++ b/include/asm-arm/arch-pxa/i2c.h 2008-08-01 10:51:40.000000000 +0100
@@ -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);
--- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
+++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
@@ -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
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
2008-08-01 10:06 ` Jonathan Cameron
@ 2008-08-01 10:09 ` Russell King - ARM Linux
2008-08-01 10:12 ` Jonathan Cameron
0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2008-08-01 10:09 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-arm-kernel, Ben Dooks, i2c
On Fri, Aug 01, 2008 at 11:06:12AM +0100, Jonathan Cameron wrote:
> Ben Dooks wrote:
> > On Thu, Jul 31, 2008 at 04:56:53PM +0100, Jonathan Cameron wrote:
> >> From: Jonathan Cameron <jic23@cam.ac.uk>
> >>
> >> 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>
> >> --
> >> 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.
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support
2008-08-01 10:09 ` Russell King - ARM Linux
@ 2008-08-01 10:12 ` Jonathan Cameron
[not found] ` <4892E183.7090601-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2008-08-01 10:12 UTC (permalink / raw)
To: Russell King - ARM Linux; +Cc: linux-arm-kernel, Ben Dooks, i2c
Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2008 at 11:06:12AM +0100, Jonathan Cameron wrote:
>> Ben Dooks wrote:
>>> On Thu, Jul 31, 2008 at 04:56:53PM +0100, Jonathan Cameron wrote:
>>>> From: Jonathan Cameron <jic23@cam.ac.uk>
>>>>
>>>> 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>
>>>> --
>>>> 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.
Doh, emails crossed. I'll repost with 72 character limit in a sec!
>
>> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] i2c-pxa: fastmode support (format cleanups)
[not found] ` <4892E183.7090601-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-08-01 10:16 ` Jonathan Cameron
[not found] ` <4892E28E.40202-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2008-08-01 10:16 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Russell King - ARM Linux,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW, Ben Dooks,
i2c-GZX6beZjE8VD60Wz+7aTrA
From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
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-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
--
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(-)
--- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
+++ b/drivers/i2c/busses/i2c-pxa.c 2008-08-01 10:50:38.000000000 +0100
@@ -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) {
--- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
+++ b/include/asm-arm/arch-pxa/i2c.h 2008-08-01 10:51:40.000000000 +0100
@@ -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);
--- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
+++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
@@ -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
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support (format cleanups)
[not found] ` <4892E28E.40202-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-08-01 10:37 ` Eric Miao
0 siblings, 0 replies; 11+ messages in thread
From: Eric Miao @ 2008-08-01 10:37 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Russell King - ARM Linux,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW, Ben Dooks,
i2c-GZX6beZjE8VD60Wz+7aTrA
On Fri, Aug 1, 2008 at 6:16 PM, Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org> wrote:
> From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>
> 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-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Acked-by: Eric Miao <eric.miao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
>
> --
> 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(-)
>
> --- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
> +++ b/drivers/i2c/busses/i2c-pxa.c 2008-08-01 10:50:38.000000000 +0100
> @@ -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) {
> --- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/i2c.h 2008-08-01 10:51:40.000000000 +0100
> @@ -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);
> --- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
> @@ -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
> i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
> http://lists.lm-sensors.org/mailman/listinfo/i2c
>
--
Cheers
- eric
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] i2c-pxa: fastmode support (with suggested fixes)
[not found] ` <4892E08F.4000907-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
@ 2008-08-06 22:40 ` Ben Dooks
0 siblings, 0 replies; 11+ messages in thread
From: Ben Dooks @ 2008-08-06 22:40 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW, Ben Dooks,
i2c-GZX6beZjE8VD60Wz+7aTrA
On Fri, Aug 01, 2008 at 11:08:15AM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>
> 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...
> Signed-off-by: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>
> --
> 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(-)
>
> --- a/drivers/i2c/busses/i2c-pxa.c 2008-07-31 12:02:42.000000000 +0100
> +++ b/drivers/i2c/busses/i2c-pxa.c 2008-08-01 10:50:38.000000000 +0100
> @@ -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) {
> --- a/include/asm-arm/arch-pxa/i2c.h 2008-07-31 12:00:05.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/i2c.h 2008-08-01 10:51:40.000000000 +0100
> @@ -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);
> --- a/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:02:51.000000000 +0100
> +++ b/include/asm-arm/arch-pxa/pxa-regs.h 2008-07-31 12:34:44.000000000 +0100
> @@ -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
> i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
> http://lists.lm-sensors.org/mailman/listinfo/i2c
--
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-08-06 22:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-31 15:56 [PATCH] i2c-pxa: fastmode support Jonathan Cameron
[not found] ` <4891E0C5.7020009-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-01 1:29 ` Eric Miao
2008-08-01 9:49 ` Jonathan Cameron
2008-08-01 9:42 ` Ben Dooks
[not found] ` <20080801094257.GK26938-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2008-08-01 10:06 ` Jonathan Cameron
2008-08-01 10:09 ` Russell King - ARM Linux
2008-08-01 10:12 ` Jonathan Cameron
[not found] ` <4892E183.7090601-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-01 10:16 ` [PATCH] i2c-pxa: fastmode support (format cleanups) Jonathan Cameron
[not found] ` <4892E28E.40202-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-01 10:37 ` Eric Miao
2008-08-01 10:08 ` [PATCH] i2c-pxa: fastmode support (with suggested fixes) Jonathan Cameron
[not found] ` <4892E08F.4000907-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-08-06 22:40 ` Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox