[PATCH] i2c: add EFI i2c master driver

Tomas Marek tomas.marek at elrest.cz
Mon Mar 25 23:08:30 PDT 2024


Hi Sascha,

On Mon, Mar 25, 2024 at 11:39:46AM +0100, Sascha Hauer wrote:
> Hi Tomas,
> 
> Thanks for the patch. Looks mostly fine, but this needs fixing:
> 
> On Wed, Mar 20, 2024 at 01:55:38PM +0100, Tomas Marek wrote:
> > +static int efi_i2c_xfer(struct i2c_adapter *adapter,
> > +			struct i2c_msg *msg, int nmsgs)
> > +{
> > +	struct efi_i2c_priv *i2c_priv = adapter_to_efi_i2c_priv(adapter);
> > +	int i, ret;
> > +
> > +	for (i = nmsgs; i > 0; i--, msg++) {
> > +		ret = efi_i2c_message_xfer(i2c_priv, msg);
> > +		if (ret)
> > +			return ret;
> > +	}
> 
> Each of the messages should start with a (repeated) start bit and only
> the last message should be followed by a stop bit. By separating the
> full message into segments and pushing each segment into EFI separately
> you would instead send a stop bit after each segment, see the comment
> above EFI_I2C_REQUEST_PACKET:
> 
> ///
> /// I2C device request
> ///
> /// The EFI_I2C_REQUEST_PACKET describes a single I2C transaction.  The
> /// transaction starts with a start bit followed by the first operation
> /// in the operation array.  Subsequent operations are separated with
> /// repeated start bits and the last operation is followed by a stop bit
> /// which concludes the transaction.  Each operation is described by one
> /// of the elements in the Operation array.
> ///
> 
> Instead you have to compile all nmsgs into a single EFI_I2C_REQUEST_PACKET
> and push it into EFI as a single request.

I see. You are right. I will fix.

Best regards

Tomas

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list