All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: Andi Shyti <andi.shyti@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	"open list:I2C SUBSYSTEM" <linux-i2c@vger.kernel.org>,
	"moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES"
	<linux-samsung-soc@vger.kernel.org>
Subject: Re: [2/3] i2c: exynos5: implement bus recovery functionality
Date: Thu, 18 Jan 2018 00:30:39 +0100	[thread overview]
Message-ID: <20180117233038.t4jz7k3456siu7ef@ninjato> (raw)
In-Reply-To: <8d4c93bf-c27d-7a64-fb4e-3957760ff9b7@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]


> > Really? READ_DATA looks like 8 clock pulses, but you need 9.
> 
> This is why I have used word 'similar' :) Unfortunately chip does not
> provide method to send exactly 9 pulses.

Pity :(

> But according to [1] it is the worst case scenario, usually less than 9
> pulses is enough.

The I2C specification says "should send nine clock pulses". A recovery
mechanism which "usually works" doesn't sound very attractive.

> Another solution I see is to READ_DATA twice, this way we will have 16
> pulses.

Can't you clock a single pulse when requesting an ACK? Or does READ_DATE
clock an ACK so we might end up with 9 pulses after all?

> > Bus recovery is only defined for stalled busses, i.e. when SDA is stuck
> > low. It is not a suitable method to deal with general timeouts.
> 
> You are right, I though I do not have precise info that SDA is stuck
> low, but I guess status HSI2C_MASTER_ST_LOSE indicates is, I will check it.

Thank you!

> >> +	i2c_lock_adapter(adap);
> >> +	clk_enable(i2c->clk);
> >> +	exynos5_i2c_recovery(i2c);
> >> +	clk_disable(i2c->clk);
> >> +	i2c_unlock_adapter(adap);
> > Why do you need to lock? Aren't you protected by the call to master_xfer
> > which then detected a problem?
> 
> If the problem is detected in master_xfer driver uses internal function
> exynos5_i2c_recovery,
> but function exynos5_i2c_recover_bus is called by i2c_recover_bus, and
> the latter can be called from any context,
> this is why I have added locking.

But the wrong one? The adapter lock is for serializing access to the
adapter using the I2C API. If you need to protect register access within
your driver, then you need the lock within struct exynos5_i2c.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-01-17 23:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171130143017eucas1p172b94622814eff172a27176c82f6e6fe@eucas1p1.samsung.com>
2017-11-30 14:30 ` [PATCH 0/3] i2c: exynos5: bus recovery implementation Andrzej Hajda
     [not found]   ` <CGME20171130143017eucas1p2f68094c72e4559e1a16cf334c3200950@eucas1p2.samsung.com>
2017-11-30 14:30     ` [PATCH 1/3] i2c: exynos5: change internal transmission timeout to 100ms Andrzej Hajda
2018-01-15 20:54       ` [1/3] " Wolfram Sang
     [not found]   ` <CGME20171130143018eucas1p13bd2ce9263f9ac016ab3b779920b512e@eucas1p1.samsung.com>
2017-11-30 14:30     ` [PATCH 2/3] i2c: exynos5: implement bus recovery functionality Andrzej Hajda
2018-01-15 20:52       ` [2/3] " Wolfram Sang
2018-01-16  8:35         ` Andrzej Hajda
2018-01-17 23:30           ` Wolfram Sang [this message]
     [not found]   ` <CGME20171130143018eucas1p1eba2c4f3361e0752cc53a25d217ce616@eucas1p1.samsung.com>
2017-11-30 14:30     ` [PATCH 3/3] i2c: exynos5: do not check TRANS_STATUS in case of Exynos7 variant Andrzej Hajda
2018-01-15 20:53       ` [3/3] " Wolfram Sang
2018-01-16  9:40         ` Andrzej Hajda
2018-01-17 23:23           ` Wolfram Sang
2018-01-26  7:17             ` Andrzej Hajda
2018-01-26  9:30               ` Wolfram Sang
2017-12-07  7:36   ` [PATCH 0/3] i2c: exynos5: bus recovery implementation Andi Shyti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180117233038.t4jz7k3456siu7ef@ninjato \
    --to=wsa@the-dreams.de \
    --cc=a.hajda@samsung.com \
    --cc=andi.shyti@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.