Thread (1 message) 1 message, 1 author, 2008-02-14

Re: [PATCH/RFC] [POWERPC] Add i2c pins to dts and board setup on 01-31-08

From: Jochen Friedrich <jochen@scram.de>
Date: 2008-02-14 11:40:08

Hi Nima,
I've got a couple of comments about the above patch - I'm not quite sure
how to add my comments to the ozlab.org site.
simply replying to the original mail will add your comments.
1 -
-- a/arch/powerpc/boot/dts/mpc8272ads.dts
[snip]
+                       i2c@11860 {
+                               compatible = "fsl,mpc8248-i2c",  
[NIMA] Are you sure it should be mpc8248, or do you want 8272. I know
they are essentially the same chip, but just to avoid confusion, it
maybe better as 8272.
Good catch, thanks! As i don't have a CPM2 chip myself, i had a tester with
a MPC8248. I just took his dts parts.
quoted hunk
2-
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -96,6 +96,11 @@  static struct cpm_pin mpc8272_ads_pins[] = {
        {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
        {2, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
        {2, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+
+       /* I2C */
+       {3, 26, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN},
+       {3, 27, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN},
[NIMA] The MPC8272 manual states that it should be pins 14/15 and not
26/27.
Ah thanks. 
However, in all my accesses,
- 1st write is successful
- 1st read fails (times out)
- 2nd read succeeds

Here is the debug log:
i2c-adapter i2c-0: ioctl, cmd=0x703, arg=0x40
i2c-dev: i2c-0 writing 2 bytes.
i2c-adapter i2c-0: master_xfer[0] W, addr=0x40, len=2
i2c-adapter i2c-0: i2c-algo-cpm.o: R: 0 T: 0
i2c-adapter i2c-0: cpm_iic_write(abyte=0x80)
i2c-adapter i2c-0: tx sc 0 bc00
i2c-adapter i2c-0: test ready.
i2c-adapter i2c-0: not ready.
i2c-adapter i2c-0: Interrupt: 2
i2c-adapter i2c-0: Interrupt: 1
i2c-adapter i2c-0: test ready.
i2c-adapter i2c-0: ready.
i2c-adapter i2c-0: tx sc 0 3c00
i2c-dev: i2c-0 reading 1 bytes.
i2c-adapter i2c-0: master_xfer[0] R, addr=0x40, len=1
i2c-adapter i2c-0: i2c-algo-cpm.o: R: 0 T: 0
i2c-adapter i2c-0: cpm_i2c_read(abyte=0x81)
i2c-adapter i2c-0: test ready.
i2c-adapter i2c-0: not ready.
i2c-adapter i2c-0: I2C read: timeout!
i2c-adapter i2c-0: cpm_i2c_force_close()
i2c-dev: i2c-0 reading 1 bytes.
i2c-adapter i2c-0: master_xfer[0] R, addr=0x40, len=1
i2c-adapter i2c-0: i2c-algo-cpm.o: R: 0 T: 0
i2c-adapter i2c-0: cpm_i2c_read(abyte=0x81)
i2c-adapter i2c-0: test ready.
i2c-adapter i2c-0: not ready.
i2c-adapter i2c-0: Interrupt: 1
i2c-adapter i2c-0: test ready.
i2c-adapter i2c-0: ready.
i2c-adapter i2c-0: rx sc 2c00, rx sc 1800

Any ideas?
What does you chip expect? Start-Write-Start-Read-Stop or Start-Write-Stop, Start-Read-Stop? 
Did you try chaining the write and read request (put them into the same msg)?

Thanks,
Jochen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help