Re: [PATCH] i2c: xiic: Add max_read_len quirk

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

 



On 2019-06-04 12:22 a.m., Michal Simek wrote:
> +Shubhrajyoti,
> 
> On 04. 06. 19 1:33, Robert Hancock wrote:
>> This driver does not support reading more than 255 bytes at once because
>> the register for storing the number of bytes to read is only 8 bits. Add
>> a max_read_len quirk to enforce this.
> 
> How did you find it out?
> Any particular issue you have had that you were looking for a solution?
> 
> I think there is more things behind which should be described in commit
> message.

We ran into this issue with the SFP driver which attempted to read 256
bytes at once from the I2C device. It seems like this caused the driver
and/or logic to get into an invalid state because it treated the number
of bytes to read as 0. Rejecting the unsupported transfer at least makes
it easier to debug what is going on.

I can respin with that in the commit message if it seems relevant.

> 
> Thanks,
> Michal
> 
>>
>> Signed-off-by: Robert Hancock <hancock@xxxxxxxxxxxxx>
>> ---
>>  drivers/i2c/busses/i2c-xiic.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
>> index 0fea7c5..37b3b93 100644
>> --- a/drivers/i2c/busses/i2c-xiic.c
>> +++ b/drivers/i2c/busses/i2c-xiic.c
>> @@ -709,11 +709,16 @@ static u32 xiic_func(struct i2c_adapter *adap)
>>  	.functionality = xiic_func,
>>  };
>>  
>> +static const struct i2c_adapter_quirks xiic_quirks = {
>> +	.max_read_len = 255,
>> +};
>> +
>>  static const struct i2c_adapter xiic_adapter = {
>>  	.owner = THIS_MODULE,
>>  	.name = DRIVER_NAME,
>>  	.class = I2C_CLASS_DEPRECATED,
>>  	.algo = &xiic_algorithm,
>> +	.quirks = &xiic_quirks,
>>  };
>>  
>>  
>>

-- 
Robert Hancock
Senior Software Developer
SED Systems, a division of Calian Ltd.
Email: hancock@xxxxxxxxxxxxx



[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