Re: [PATCH] i2c: mxs: Rework the PIO mode operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

> 
> Thinking about this, did you correctly configure the EEPROM write sector
> size? I think it's 32 bytes for this device.
> 

The EEPROM is correctly configured, i.e. page size is set to 32.

I made a test by writing one byte (0x01) to the address 0x0100 of the EEPROM. 
The EEPROM's I2C bus address is 0x54.
The test has only one transfer with a message length of 3 bytes.

I figured out that the value written to the MXS_I2C_DATA register should be 
0x010001a8. But instead of that a value of 0x00000000 is written to the 
register.

I think that the reason for that can be found in the following code section:

if (i + 1 == msg->len) {
	/* This is the last transfer. */
	start |= flags;
	start &= ~MXS_I2C_CTRL0_RETAIN_CLOCK;
	xlen = (i + 2) % 4;
	data >>= (4 - xlen) * 8;
} else if ((i & 3) == 2) {
	/* Regular transfer. */
	xlen = 4;
} else {
	/* Just stuff data. */
	continue;
}

After the last byte is stuffed into the variable data (i = 2) xlen is 
calculated (with xlen = (i + 2) % 4) to zero. Thus the following shift 
operation (data >>= (4 - xlen) * 8) shifts all the bits out of data that 
already contains 0x010001a8.


Best regards
Torsten Fleischer
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux