I2C pxa fast mode (400khz) support
PATCH 1/1 I2C pxa fast mode (400khz) 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.
--- drivers/i2c/busses/i2c-pxa.c | 4 +++- include/asm-arm/arch-pxa/i2c.h | 1 + include/asm-arm/arch-pxa/pxa-regs.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
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 */
include/asm-arm/arch-pxa/i2c.h +1 -0
@@ -66,6 +66,7 @@ struct i2c_pxa_platform_data {struct i2c_slave_client *slave;unsigned int class;int use_pio; +int fast_mode; };extern void pxa_set_i2c_info (struct i2c_pxa_platform_data *info);
drivers/i2c/busses/i2c-pxa.c +3 -1
@@ -67,6 +67,7 @@ struct pxa_i2c {int irq;int use_pio; +int fast_mode; };#define _IBMR (i2c) ((i2c)->reg_base + 0)
@@ -365,7 +366,7 @@ static void i2c_pxa_reset(struct pxa_i2cwritel (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" );
@@ -1041,6 +1042,7 @@ static int i2c_pxa_probe(struct platformif (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): 486B9E30.80806-KWPb1pKIrIJaa/[email protected]
Quoted 4 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.
Maybe we should convert that (as well as 'use_pio') to a bit field to save another byte.
Otherwise looks OK to me.
Quoted 58 lines
Signed-off-by Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>--- drivers/i2c/busses/i2c-pxa.c | 4 +++- include/asm-arm/arch-pxa/i2c.h | 1 + include/asm-arm/arch-pxa/pxa-regs.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)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 */ include/asm-arm/arch-pxa/i2c.h +1
-0@@ -66,6 +66,7 @@ struct i2c_pxa_platform_data {struct i2c_slave_client *slave;unsigned int class;int use_pio; +int fast_mode; };extern void pxa_set_i2c_info (struct i2c_pxa_platform_data *info);drivers/i2c/busses/i2c-pxa.c +3
-1@@ -67,6 +67,7 @@ struct pxa_i2c {int irq;int use_pio; +int fast_mode; };#define _IBMR (i2c) ((i2c)->reg_base + 0)@@ -365,7 +366,7 @@ static void i2c_pxa_reset(struct pxa_i2cwritel (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" );@@ -1041,6 +1042,7 @@ static int i2c_pxa_probe(struct platformif (plat) { i2c->adap.class = plat->class; i2c->use_pio = plat->use_pio; + i2c->fast_mode = plat->fast_mode; }if (i2c->use_pio) {
Quoted 4 lines
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 8 lines · Eric Miao
Quoted 4 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Maybe we should convert that (as well as '
use_pio') to a bit field to save another byte.
I think use_pio and fast_mode could both be bits.
Quoted 70 lines
Otherwise looks OK to me.
Quoted 58 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/i2c/busses/i2c-pxa.c | 4 +++- include/asm-arm/arch-pxa/i2c.h | 1 + include/asm-arm/arch-pxa/pxa-regs.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)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 */ include/asm-arm/arch-pxa/i2c.h +1
-0@@ -66,6 +66,7 @@ struct i2c_pxa_platform_data {struct i2c_slave_client *slave;unsigned int class;int use_pio; +int fast_mode; };extern void pxa_set_i2c_info (struct i2c_pxa_platform_data *info);drivers/i2c/busses/i2c-pxa.c +3
-1@@ -67,6 +67,7 @@ struct pxa_i2c {int irq;int use_pio; +int fast_mode; };#define _IBMR (i2c) ((i2c)->reg_base + 0)@@ -365,7 +366,7 @@ static void i2c_pxa_reset(struct pxa_i2cwritel (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" );@@ -1041,6 +1042,7 @@ static int i2c_pxa_probe(struct platformif (plat) { i2c->adap.class = plat->class; i2c->use_pio = plat->use_pio; + i2c->fast_mode = plat->fast_mode; }if (i2c->use_pio) {Quoted 4 lines
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c_______________________________________________
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' ------------------------------------------------------------------- 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): [email protected]
Quoted 11 lines · Ben Dooks
Quoted 8 lines · Eric Miao
Quoted 4 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Maybe we should convert that (as well as '
use_pio') to a bit field to save another byte.I think
use_pioandfast_modecould both be bits.
Or alternatively, "bool" ... which is usually a byte, and on ARM will let GCC eliminate a comparision instruction. Just load byte and branch on zero/nonzero, vs needing one more instruction. (In odd cases, it can be more important to conserve the extra seven bits.)
_______________________________________________
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): 200807111920.29739.david-b-yBeKhBN/[email protected]
Quoted 7 lines · David Brownell
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Eric Miao
Quoted 4 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Maybe we should convert that (as well as '
use_pio') to a bit field to save another byte.I think
use_pioandfast_modecould both be bits.Or alternatively, "bool" ... which is usually a byte, and on ARM will let GCC eliminate a comparision instruction. Just load byte and branch on zero/nonzero, vs needing one more instruction.
Unfortunately, on ARM the LDR/LDRB instructions can not update the condition codes.
_______________________________________________
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): 48791BF8.8080500-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
I think
use_pioandfast_modecould both be bits.Or alternatively, "bool" ... which is usually a byte, and on ARM will let GCC eliminate a comparision instruction. Just load byte and branch on zero/nonzero, vs needing one more instruction.
Unfortunately, on ARM the LDR/LDRB instructions can not update the condition codes.
Right, sorry -- I was looking at MOV not LDRB.
I don't use assembler often enough to remember that little asymmetry: data movement involving memory uses different notations and instructions.
If only the instruction set were as regular as a PDP-11 ... ;)
_______________________________________________
i2c mailing list [email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 52 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Signed-off-by Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>--- drivers/i2c/busses/i2c-pxa.c | 4 +++- include/asm-arm/arch-pxa/i2c.h | 1 + include/asm-arm/arch-pxa/pxa-regs.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)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 */ include/asm-arm/arch-pxa/i2c.h +1
-0@@ -66,6 +66,7 @@ struct i2c_pxa_platform_data {struct i2c_slave_client *slave;unsigned int class;int use_pio; +int fast_mode; };extern void pxa_set_i2c_info (struct i2c_pxa_platform_data *info);drivers/i2c/busses/i2c-pxa.c +2
-1@@ -67,6 +67,7 @@ struct pxa_i2c {int irq;int use_pio; +int fast_mode; };#define _IBMR (i2c) ((i2c)->reg_base + 0)@@ -365,7 +366,7 @@ static void i2c_pxa_reset(struct pxa_i2cwritel (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" );
drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform · line 1048
Quoted 7 lines
drivers/i2c/busses/i2c-pxa.c +1
-0@@ -1041,6 +1042,7 @@ static int i2c_pxa_probe(struct platformif (plat) { i2c->adap.class = plat->class; i2c->use_pio = plat->use_pio; + i2c->fast_mode = plat->fast_mode; }if (i2c->use_pio) {
Patch looks OK to me. Ben, i2c-pxa is embedded so this is something for you.
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 6 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Signed-off-by Jonathan Cameron <[email protected]>
Unfortuantely due to the problem of all the registers in one place, this really will need to be applied by RMK. However due to the current amount of work in the PXA tree, and the number of patches he is carrying for merging this is going to be too late for this kernel merge.
I would like to see the pxa-regs.h split up further so that subsystems can issue patches to it without causing problems for Russell... I will bring this up for the next round of development.
Signature · 8 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes' ------------------------------------------------------------------- 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): [email protected]
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>Unfortuantely due to the problem of all the registers in one place, this really will need to be applied by RMK. However due to the current amount of work in the PXA tree, and the number of patches he is carrying for merging this is going to be too late for this kernel merge.
Actually, this round of separation work of the pxa-regs.h has been done several weeks ago, so I don't see this patch is likely to cause any merge conflict.
But Russell is going to freeze the pxa branch, I see little chance this be fixed quickly and get into :(
Signature · 7 lines
Cheers - eric _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 15 lines · eric miao
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Quoted 7 lines
Quoted 1 line
Signed-off-by Jonathan Cameron <[email protected]>Unfortuantely due to the problem of all the registers in one place, this really will need to be applied by RMK. However due to the current amount of work in the PXA tree, and the number of patches he is carrying for merging this is going to be too late for this kernel merge.
Quoted 7 lines
Actually, this round of separation work of the
pxa-regs.hhas been done several weeks ago, so I don't see this patch is likely to cause any merge conflict.But Russell is going to freeze the pxa branch, I see little chance this be fixed quickly and get into :(
Dear all, thanks for the comments.
I'll switch the use_pio and fast_mode flags to bit fields and resend when next kernel merge begins.
As I'm maintaining rather a lot of platform specific stuff anyway for my use, one more won't do any harm for a few weeks!
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
Quoted 23 lines · Jonathan Cameron
Quoted 15 lines · eric miao
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Jonathan Cameron
Add
fast_modeoption toi2c_pxa_platform_dataand use it to set theICR_FMbit appropriately wheni2c_pxa_resetis called. Parameter calledfast_moderather than frequency as this driver is also used for thei2c_pxa_pwrbus which has different normal and fast frequencies.Quoted 7 lines
Quoted 1 line
Signed-off-by Jonathan Cameron <[email protected]>Unfortuantely due to the problem of all the registers in one place, this really will need to be applied by RMK. However due to the current amount of work in the PXA tree, and the number of patches he is carrying for merging this is going to be too late for this kernel merge.
Quoted 7 lines
Actually, this round of separation work of the
pxa-regs.hhas been done several weeks ago, so I don't see this patch is likely to cause any merge conflict.But Russell is going to freeze the pxa branch, I see little chance this be fixed quickly and get into :(
Quoted 7 lines
Dear all, thanks for the comments.
I'll switch the
use_pioandfast_modeflags to bit fields and resend when next kernel merge begins.As I'm maintaining rather a lot of platform specific stuff anyway for my use, one more won't do any harm for a few weeks!
I think most of RMK's pxa tree has been merged, so a diff against a current -git release should give you a better starting point.
Signature · 8 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes' ------------------------------------------------------------------- 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
Quoted 3 lines · Ben Dooks
I think most of RMK's pxa tree has been merged, so a diff against a current -git release should give you a better starting point.
There's still around 300K of PXA stuff outstanding - but unfortunately I can't update the 'nightly' snapshots with the outstanding commits because I can't get a reasonable patch out of git:
$ git-diff -u master...pxa |less diff --cc MAINTAINERS index 1528e58,8f0ec46,c68a118..20aef95 --- a/MAINTAINERS +++ b/MAINTAINERS @@@@ -481,11 -475,11 -475,11 +475,28 @@@@ M: [email protected] L: [email protected] (subscribers-only) S: Maintained
+++ARM/COMPULAB CM-X270/EM-X270 MACHINE SUPPORT
+++P: Mike Rapoport +++M: [email protected] +++L: [email protected] (subscribers-only) +++S: Maintained
+++
This is basically because 'master...pxa' has multiple common ancestors.
You can get a diff from 'master..pxa' but that will be a patch which removes changes in master but not pxa, and applies changes in pxa but not master, which isn't useful.
Of course, those with git can get the full tree and there isn't a problem moving through the history... those using the patches, however, are going to be facing a problem for the time being.
-------------------------------------------------------------------
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
Hi Russell,
Quoted 25 lines · Russell King - ARM Linux
Quoted 3 lines · Ben Dooks
I think most of RMK's pxa tree has been merged, so a diff against a current -git release should give you a better starting point.
There's still around 300K of PXA stuff outstanding - but unfortunately I can't update the 'nightly' snapshots with the outstanding commits because I can't get a reasonable patch out of git:
$ git-diff -u master...pxa |lessMAINTAINERS +6
-0@@@@ -481,11 -475,11 -475,11 +475,28 @@@@ M: [email protected] L: [email protected] (subscribers-only) S: Maintained +++ARM/COMPULAB CM-X270/EM-X270 MACHINE SUPPORT +++P: Mike Rapoport +++M: [email protected] +++L: [email protected] (subscribers-only) +++S: Maintained +++
Quoted 1 line
This is basically because 'master...pxa' has multiple common ancestors.
Hm, I don't see that with your current tree:
ukleinek@zentaur:~/gsrc/linux-2.6$ git merge-base --all rmk/pxa rmk/master 543cf4cb3fe6f6cae3651ba918b9c56200b257d0
and so git-diff -u rmk/master...rmk/pxa looks good here, too.
Anyway, IIRC you can apply the above patch with git-apply, didn't test it though. And if you don't want the people having to rely on git, you still can merge master and pxa and provide a diff between some fixed base and the merge result. (Or provide two patches and let the others do the merge.)
Best regards
Uwe
Signature · 8 lines
Uwe Kleine-König, Software Engineer Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962 ------------------------------------------------------------------- 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
Quoted 4 lines · Uwe Kleine-König
Hm, I don't see that with your current tree:
ukleinek@zentaur:~/gsrc/linux-2.6$ git merge-base --all rmk/pxa rmk/master 543cf4cb3fe6f6cae3651ba918b9c56200b257d0
That's because you're not looking at the right master. My master branch is now Linus' tip, but I'm not pushing that update out because my scripts will also push out the patch and mbox files (which, because of this, for PXA and devel will be empty.)
I fully understand why this happens, it's just annoying when it does that we lose the ability to have a nice clean patch.
It'll all resolve itself in the fullness of time (iow, after the SPI tree has been merged followed by the remainder of the PXA tree.)
-------------------------------------------------------------------
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