Re: [PATCH v2 1/3] i2c: s3c24xx: fix read transfers in polling mode

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

 



Hi Inki,

On 02.11.2023 02:31, 대인기/Tizen Platform Lab(SR)/삼성전자 wrote:
>
>> -----Original Message-----
>> From: Marek Szyprowski<m.szyprowski@xxxxxxxxxxx>
>> Sent: Wednesday, October 25, 2023 9:17 PM
>> To:linux-samsung-soc@xxxxxxxxxxxxxxx;linux-i2c@xxxxxxxxxxxxxxx
>> Cc: Marek Szyprowski<m.szyprowski@xxxxxxxxxxx>; Krzysztof Kozlowski
>> <krzysztof.kozlowski@xxxxxxxxxx>; Alim Akhtar<alim.akhtar@xxxxxxxxxxx>;
>> Andi Shyti<andi.shyti@xxxxxxxxxx>; Wolfram Sang<wsa@xxxxxxxxxx>
>> Subject: [PATCH v2 1/3] i2c: s3c24xx: fix read transfers in polling mode
>>
>> To properly handle read transfers in polling mode, no waiting for the ACK
>> state is needed as it will never come. Just wait a bit to ensure start
>> state is on the bus and continue processing next bytes.
>>
>> Fixes: 117053f77a5a ("i2c: s3c2410: Add polling mode support")
>> Signed-off-by: Marek Szyprowski<m.szyprowski@xxxxxxxxxxx>
>> ---
>>   drivers/i2c/busses/i2c-s3c2410.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-
>> s3c2410.c
>> index 127eb3805fac..f9dcb1112a61 100644
>> --- a/drivers/i2c/busses/i2c-s3c2410.c
>> +++ b/drivers/i2c/busses/i2c-s3c2410.c
>> @@ -216,8 +216,13 @@ static bool is_ack(struct s3c24xx_i2c *i2c)
>>   	int tries;
>>
>>   	for (tries = 50; tries; --tries) {
>> -		if (readl(i2c->regs + S3C2410_IICCON)
>> -			& S3C2410_IICCON_IRQPEND) {
>> +		unsigned long tmp = readl(i2c->regs + S3C2410_IICCON);
>> +
>> +		if (!(tmp & S3C2410_IICCON_ACKEN)) {
>> +			usleep_range(100, 200);
> Trivial question, but is there any hardware specification related to sleeping for 100-200 microseconds? If any then it would be nice to use const variable instead and add some description about why sleeping here is needed.


Well, this is a bit magic value I got from my experiments. There is some 
delay needed there to let hardware to clear that bit and the values I 
proposed worked. If You don't like that, I can reuse the delay value 
that is already present in that loop: usleep_range(1000, 2000).


Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux