devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org>
To: Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ariel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org
Subject: Re: [PATCH v2 1/2] i2c: add i2c-lpc2k driver
Date: Mon, 17 Aug 2015 17:18:30 -0300	[thread overview]
Message-ID: <20150817201830.GA11033@laptop> (raw)
In-Reply-To: <1439748617-7683-2-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 16 Aug 08:10 PM, Joachim Eastwood wrote:
[..]
> +
> +static int i2c_lpc2k_clear_arb(struct lpc2k_i2c *i2c)
> +{
> +	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
> +
> +	/*
> +	 * If the transfer needs to abort for some reason, we'll try to
> +	 * force a stop condition to clear any pending bus conditions
> +	 */
> +	writel(LPC24XX_STO, i2c->base + LPC24XX_I2CONSET);
> +
> +	/* Wait for status change */
> +	while (readl(i2c->base + LPC24XX_I2STAT) != M_I2C_IDLE) {
> +		if (time_after(jiffies, timeout)) {
> +			/* Bus was not idle, try to reset adapter */
> +			i2c_lpc2k_reset(i2c);
> +			return -EBUSY;
> +		}
> +
> +		cpu_relax();
> +	}

I believe you can use readl_{relaxed}_poll_timeout_{atomic} here.

Ccing Ariel, maybe he can help with a test.

-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

  parent reply	other threads:[~2015-08-17 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-16 18:10 [PATCH v2 0/2] I2C support for NXP LPC18xx family Joachim Eastwood
     [not found] ` <1439748617-7683-1-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-16 18:10   ` [PATCH v2 1/2] i2c: add i2c-lpc2k driver Joachim Eastwood
     [not found]     ` <1439748617-7683-2-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-17 20:18       ` Ezequiel Garcia [this message]
2015-08-17 20:37         ` Joachim Eastwood
2015-08-16 18:10   ` [PATCH v2 2/2] doc: dt: add documentation for nxp,lpc1788-i2c Joachim Eastwood
2015-08-19 15:18   ` [PATCH v2 0/2] I2C support for NXP LPC18xx family Wolfram Sang
2015-08-19 15:30     ` Joachim Eastwood

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=20150817201830.GA11033@laptop \
    --to=ezequiel-30ulvvutt6g51wmpkgsgjgyuob5fgqpz@public.gmane.org \
    --cc=ariel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).