2013-04-19 00:01:10

by EUNBONG SONG

[permalink] [raw]
Subject: [PATCH] I2C: Change the value of octeon i2c adapter timeout value


I think HZ/50 is better than 2 for adapter timeout.

Signed-off-by: Eunbong Song <[email protected]>
---
drivers/i2c/busses/i2c-octeon.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index 935585e..ca489f3 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -440,7 +440,7 @@ static struct i2c_adapter octeon_i2c_ops = {
.owner = THIS_MODULE,
.name = "OCTEON adapter",
.algo = &octeon_i2c_algo,
- .timeout = 2,
+ .timeout = HZ/50,
};

/**
--
1.7.0.1
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?


2013-04-19 07:58:47

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value

On Fri, Apr 19, 2013 at 12:01:04AM +0000, EUNBONG SONG wrote:
>
> I think HZ/50 is better than 2 for adapter timeout.

Basically OK. But why HZ/50? Most drivers use HZ.

2013-04-19 09:13:59

by EUNBONG SONG

[permalink] [raw]
Subject: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value



On Fri, Apr 19, 2013 at 12:01:04AM +0000, EUNBONG SONG wrote:
>>
>> I think HZ/50 is better than 2 for adapter timeout.

> Basically OK. But why HZ/50? Most drivers use HZ.

Actually, I just translated 2 jiffies because HZ is 100 in default cavium config.
You can find that in "arch/mips/configs/cavium_octeon_defconfig".
And i have been using this value over 1 year in octeon board without problem.
Thanks. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-04-19 18:33:00

by Wolfram Sang

[permalink] [raw]
Subject: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value

On Fri, Apr 19, 2013 at 09:13:54AM +0000, EUNBONG SONG wrote:
>
>
> On Fri, Apr 19, 2013 at 12:01:04AM +0000, EUNBONG SONG wrote:
> >>
> >> I think HZ/50 is better than 2 for adapter timeout.
>
> > Basically OK. But why HZ/50? Most drivers use HZ.
>
> Actually, I just translated 2 jiffies because HZ is 100 in default cavium config.
> You can find that in "arch/mips/configs/cavium_octeon_defconfig".
> And i have been using this value over 1 year in octeon board without problem.

Have you been writing to EEPROMS? Their erase/write cycle might be
longer. But I am not forcing you to change the value, just giving some
suggestions.

2013-04-20 07:50:18

by EUNBONG SONG

[permalink] [raw]
Subject: Re: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value


>
> Have you been writing to EEPROMS? Their erase/write cycle might be
> longer. But I am not forcing you to change the value, just giving some
> suggestions.

My board has i2c mux, temp sensor, eeprom. And I added some debugging code for measuring i2c response time as below and
run i2c operation for each device.
The maximum respeonse time was 500usec(under 1msec). So 20 msec is enough for adapter timeout.
Thanks.
static int octeon_i2c_wait(struct octeon_i2c *i2c)
{
int result;
+ struct timeval start, end;

octeon_i2c_int_enable(i2c);

+ do_gettimeofday(&start);
result = wait_event_timeout(i2c->queue,
octeon_i2c_test_iflg(i2c),
i2c->adap.timeout);

+ do_gettimeofday(&end);

+ if(end.tv_usec < start.tv_usec){
+ end.tv_usec += 1000000;
+ end.tv_sec--;
+ }

+ if(result > 0)
+ printk("octeon_i2c_wait elapse time: %ld msecs\n", (end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
+ else
+ printk("octeon_i2c_wait fail!!\n");
}????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-04-23 16:27:56

by Wolfram Sang

[permalink] [raw]
Subject: Re: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value

Hi,

what mail client do you use? It seems to break message threading on my side :(


> > Have you been writing to EEPROMS? Their erase/write cycle might be
> > longer. But I am not forcing you to change the value, just giving some
> > suggestions.
>
> My board has i2c mux, temp sensor, eeprom. And I added some debugging code for measuring i2c response time as below and
> run i2c operation for each device.
> The maximum respeonse time was 500usec(under 1msec). So 20 msec is enough for adapter timeout.

Well, OK, I don't mind. We can increase it later if needed.

Applied to for-next, thanks! Please have a look later how I changed your
commit messages to see the preferred style.

2013-04-23 21:57:34

by EUNBONG SONG

[permalink] [raw]
Subject: Re: Re: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value



Sender : Wolfram Sang<[email protected]>
Date : 2013-04-24 01:27 (GMT+09:00)
Title : Re: Re: Re: [PATCH] I2C: Change the value of octeon i2c adapter timeout value

> Well, OK, I don't mind. We can increase it later if needed.

> Applied to for-next, thanks! Please have a look later how I changed your
> commit messages to see the preferred style.

Yes, i will check your commit message and use for reference for the next-time.
Thanks.????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?