[ivtv-devel] cx18: Set of i2c related patches

Andy Walls awalls at radix.net
Sat Apr 26 05:36:27 CEST 2008


On Fri, 2008-04-25 at 23:01 -0400, Andy Walls wrote:
> Ryan Watts wrote:
> 
> > Andy,
> > 
> > Thanks for all your work on these patches.  I have been trying to get around
> > to
> > work on this, but I have been way too busy lately.  You may remember my
> > previous post:
> > http://ivtvdriver.org/pipermail/ivtv-devel/2008-February/005310.html
> 
> Yes.  That was a day or two before I received my HVR-1600 in the
> mail. :)
> 
> > Anyhow, I applied the 4 patches in order and still no luck.
> 
> Bummer.  You're the third to report no luck.  Zero users have reported
> improvement.
> 
> The patches still fixed some things that were wrong (but maybe not
> noticeable), but there is something else going on, masking any effects
> that those errors would have had.
> 
> 
> >   I have attached
> > the
> > debug output from dmesg since it is too lengthy to put in an e-mail.  I am
> > using
> > a 2.6.22.9 kernel with i2c debug.  The output is after using "modprobe
> > i2c_algo_bit
> > i2c_debug=3" and "modprobe cx18 debug=511".
> > 
> > I have also attached the output from "lspci -tv", "lspci -vvvnnxxx", and
> > "lsmod".
> > 
> > If you need anything else, let me know.  I have a logic analyzer that I can
> > hook up.
> 
> On my card, the two test points at the top right corner of the card,
> TP10 and TP11, are SDA and SCL respectively for the I2C bus that the
> EEPROM is on.  All the pins on one side of the ATMEL 24C02 EEPROM chip,
> at the very top corner of the board, are wired to ground, if you need a
> known ground reference
> 
> 
> > I haven't tested it on the patches, but when I hooked it up using the driver
> > a few
> > months ago, the SCL and SDA lines were stuck high.
> 
> Well, with an open collector or open drain bus like I2C, things can't be
> "stuck" high, as that is the free state of the bus.  Things can be stuck
> low.  See section 3.1 of:
> 
> http://www.nxp.com/acrobat/usermanuals/UM10204_3.pdf
> 
> So what you observed was the cx23418 failing to drive the bus.  That in
> itself is valuable to know.  It would also be nice to know if this is
> still the case with the patches in place or with the latest driver.
> 
> 
> >   I was going to try and
> > make
> > a PCI breakout card (i thought the problem might be with the PCI bus) but I
> > don't
> > have enough time and my logic analyzer only has 12 channels.
> 
> That's probably overkill for right now.  There are software indications
> of PCI bus errors that supposedly the kernel can notify the driver
> about.  I'm going to write a callback routine to try and catch any of
> these.  
> 
> 
> > I will see if I can stay on top of things, but it may be this weekend before
> > I can get
> > back to you.
> 
> OK.  If you do some testing on your own, don't be afraid to hit me with
> the details.  I've got an EE background.  If you see funny rise times,
> odd clock or data stretches, spurious transitions, etc. let me know.
> 
> 
> >   Hopefully I can study your patches a little more thoroughly
> > and see
> > if I can understand them and maybe provide some help.
> 
> 1/4: Added better driver book-keeping on which of the 2 I2C busses
> should be manipulated and eliminated duplicate functions.  This should
> have no effect on operation.
> 
> 2/4: Force PCI memory mapped IO writes to complete by performing a
> readback, before returning control to i2c-algo-bit.  This is so
> i2c-algo-bit won't start it's timing loop before the cx23418 has
> actually gotten the command to toggle the line.
> 
> 3/4:  Bang on the slaves when we initialize each I2C bus, in the hopes
> of making sure no slave is hanging I2C (keeping it stuck low) and that
> they'll all be ready to listen.
> 
> 4/4: Fix the SCL clock period timing for i2c-algo-bit, to actually use
> the maximum 100 kHz clock rate for Normal/Standard Mode I2C.  Make the
> stuck SCL timeout 2 seconds, no matter what rate the kernel runs the PIT
> at.
> 
> 
> Versions of patch 1, 2, and 4 are already in the latest cx18 driver.
> 
> 
> > Thanks,
> > Ryan
> 
> I'll look over you log outputs, 


Woo hoo!  One more level of causality uncovered:

[ 1788.534047] Linux video capture interface: v2.00
[ 1788.561795] cx18:  Start initialization, version 0.1.0
[ 1788.562080] cx18-0: Initializing card #0
[ 1788.562089] cx18-0: Autodetected Hauppauge card
[ 1788.562096] cx18-0 info: base addr: 0xdc000000
[ 1788.562098] cx18-0 info: Enabling pci device
[ 1788.562117] cx18-0 info: cx23418 (rev 0) at 00:0d.0, irq: 17, latency: 64, memory: 0xdc000000
[ 1788.562122] cx18-0 info: attempting ioremap at 0xdc000000 len 0x04000000
[ 1788.563025] cx18-0: cx23418 revision 01010000 (B)
[ 1788.636892] cx18-0 info: GPIO initial dir: 0000ffff out: 00000000
[ 1788.636921] cx18-0 info: activating i2c...
[ 1788.636924] cx18-0 i2c: i2c init
[ 1788.659560] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.659906] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.660246] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.660587] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.660928] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.661271] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.661617] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.661957] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.662298] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.662638] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.662979] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.663152] cx18-0 warning: setsda failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SDA line to 0
[ 1788.663668] cx18-0 warning: setsda failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SDA line to 0
[ 1788.663843] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.664351] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.664693] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.665034] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.665384] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.665725] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.666067] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.666408] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.666749] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.667091] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.667264] cx18-0 warning: setsda failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SDA line to 0
[ 1788.667778] cx18-0 warning: setsda failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SDA line to 0
[ 1788.667953] cx18-0 warning: setscl failed to write to CX18_REG_I2C_1_WR register to drive bus 1 SCL line to 0
[ 1788.669950] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.670950] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.671945] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.672940] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.673943] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.674938] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.675933] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.676928] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.677931] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.678926] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.679921] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.680421] cx18-0 warning: setsda failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SDA line to 0
[ 1788.682244] cx18-0 warning: setsda failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SDA line to 0
[ 1788.682747] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.684238] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.685237] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.686238] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.687234] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.688230] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.689229] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.690230] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.691226] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.692222] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[ 1788.692723] cx18-0 warning: setsda failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SDA line to 0
[ 1788.694221] cx18-0 warning: setsda failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SDA line to 0
[ 1788.694723] cx18-0 warning: setscl failed to write to CX18_REG_I2C_2_WR register to drive bus 2 SCL line to 0
[...]

The CPU is writing out, over the PCI bus, a value to a cx23418 control
register for the I2C bus lines.  The readback doesn't match what was
written!

Patch 2/4 is generating this error message.  This corner case error
message will not be generated by the subset of that patch that was
incorporated into the latest cx18 driver, so don't convert to the latest
driver yet.

The messages above show failure for times (maybe not all) your CPU tries
to have the CX23418 pull an I2C line low.

There are three high level reasons why this could be:
1. Bona-fide PCI bus problems, such that the writes don't complete or
actual bus errors.
2. Setup of the I2C hardware block in the cx23418 failed and it's not
accepting commands in those registers
3. The command is actually going to the CX23418, but host bridge is
sending us back an old/cached value on readback.


I'll have to think about tests to run still.  I'll get back to you
tomorrow.


Regards,
Andy








> then send a lists of tests you can try,
> along with what I'm trying to eliminate/discover with each.
> 
> 
> Regards,
> Andy
> 
> 
> _______________________________________________
> ivtv-devel mailing list
> ivtv-devel at ivtvdriver.org
> http://ivtvdriver.org/mailman/listinfo/ivtv-devel
> 




More information about the ivtv-devel mailing list