linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
To: Sudhakar Rajashekhara <sudhakar.raj-l0cyMroinI0@public.gmane.org>
Cc: 'Alexander Vasiliev'
	<alexvasiljev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org,
	'Dirk Behme' <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	'Ben Dooks' <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/6] i2c: davinci: Fix smbus Oops with AIC33 usage
Date: Thu, 28 Jan 2010 06:45:07 -0800	[thread overview]
Message-ID: <878wbithjg.fsf@deeprootsystems.com> (raw)
In-Reply-To: <02ee01ca9ff6$53cf0d90$fb6d28b0$@raj-l0cyMroinI0@public.gmane.org> (Sudhakar Rajashekhara's message of "Thu\, 28 Jan 2010 14\:16\:05 +0530")

"Sudhakar Rajashekhara" <sudhakar.raj-l0cyMroinI0@public.gmane.org> writes:

> Kevin,
>
> On Wed, Jan 27, 2010 at 20:20:08, Kevin Hilman wrote:
>> "Sudhakar Rajashekhara" <sudhakar.raj-l0cyMroinI0@public.gmane.org> writes:
>> 
>> > Hi,
>> >
>> > On Wed, Jan 27, 2010 at 05:11:28, Kevin Hilman wrote:
>> >> From: Dirk Behme <dirk.behme-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
>> >> 
>> >> This fixes Oops at kernel startup while "scanning" for TLV320AIC23IDx
>> >> addresses.
>> >> 
>> >> Signed-off-by: Alexander Vasiliev <alexvasiljev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >> Signed-off-by: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
>> >> Signed-off-by: Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >> Acked-by: Kevin Hilman <khilman-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
>> >> ---
>> >>  drivers/i2c/busses/i2c-davinci.c |   29 +++++++++++++++++++++++++----
>> >>  1 files changed, 25 insertions(+), 4 deletions(-)
>> >> 
>> >> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
>> >> index c89687a..444a9f2 100644
>> >> --- a/drivers/i2c/busses/i2c-davinci.c
>> >> +++ b/drivers/i2c/busses/i2c-davinci.c
>> >
>> > [...]
>> >
>> >> @@ -290,6 +293,16 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>> >>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, w);
>> >>  
>> >>  	dev->terminate = 0;
>> >> +
>> >> +	/* First byte should be set here, not after interrupt,
>> >> +	 * because transmit-data-ready interrupt can come before
>> >> +	 * NACK-interrupt during sending of previous message and
>> >> +	 * ICDXR may have wrong data */
>> >> +	if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) {
>> >> +		davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++);
>> >> +		dev->buf_len--;
>> >> +	}
>> >> +
>> >
>> > I found an issue on DA850 while using this patch. 
>> 
>> ok, I'll drop this one for 2.6.34 until we figure this out.
>> 
>> > I think the above code should come after the
>> > below lines because an I2C transaction is being carried out before configuring the I2C mode
>> > register (which has bits to configure Master, Start condition etc), which causes undefined
>> > behavior.
>> 
>> hmm, are you seeing this behavior on davinci git too?  This is the same
>> patch that has been in davinci git for some time?
>> 
>
> The following patch fixes the issue I reported. I have tested it extensively on DA850/OMAP-L138.
> You can roll-in these changes into the current patch.

Thanks, I rolled it into the original, and updated the 'davinci-upstream-submitted'
branch.

Kevin

> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-davinci.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 35f9daa..8526bce 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -308,6 +308,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>  
>  	dev->terminate = 0;
>  
> +	/* write the data into mode register */
> +	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
> +
>  	/* First byte should be set here, not after interrupt,
>  	 * because transmit-data-ready interrupt can come before
>  	 * NACK-interrupt during sending of previous message and
> @@ -317,9 +320,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
>  		dev->buf_len--;
>  	}
>  
> -	/* write the data into mode register */
> -	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
> -
>  	r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
>  						      dev->adapter.timeout);
>  	if (r == 0) {
> --
>
> Regards,
> Sudhakar

  parent reply	other threads:[~2010-01-28 14:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 23:41 [PATCH 0/6] davinci i2c updates for 2.6.34 Kevin Hilman
     [not found] ` <1264549293-25556-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-01-26 23:41   ` [PATCH 1/6] i2c: davinci: Fix smbus Oops with AIC33 usage Kevin Hilman
     [not found]     ` <026601ca9f54$17a18110$46e48330$@raj@ti.com>
     [not found]       ` <026601ca9f54$17a18110$46e48330$@raj-l0cyMroinI0@public.gmane.org>
2010-01-27 14:50         ` Kevin Hilman
     [not found]           ` <87k4v3y53z.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-01-28  4:05             ` Sudhakar Rajashekhara
2010-01-28  8:46             ` Sudhakar Rajashekhara
     [not found]           ` <02ee01ca9ff6$53cf0d90$fb6d28b0$@raj@ti.com>
     [not found]             ` <02ee01ca9ff6$53cf0d90$fb6d28b0$@raj-l0cyMroinI0@public.gmane.org>
2010-01-28 14:45               ` Kevin Hilman [this message]
     [not found]     ` <1264549293-25556-2-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-01-27 13:24       ` Sudhakar Rajashekhara
2010-01-27 15:03       ` Ben Dooks
2010-01-26 23:41   ` [PATCH 2/6] i2c: davinci: Remove MOD_REG_BIT and IO_ADDRESS usage Kevin Hilman
     [not found]     ` <1264549293-25556-3-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-01-27 15:05       ` Ben Dooks
     [not found]         ` <20100127150518.GB6090-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2010-01-29 19:46           ` Kevin Hilman
2010-01-26 23:41   ` [PATCH 3/6] i2c: davinci: Add helper functions Kevin Hilman
2010-01-26 23:41   ` [PATCH 4/6] i2c: davinci: Add suspend/resume support Kevin Hilman
2010-01-26 23:41   ` [PATCH 5/6] i2c: davinci: Add cpufreq support Kevin Hilman
2010-01-26 23:41   ` [PATCH 6/6] i2c: davinci: bus recovery procedure to clear the bus Kevin Hilman
     [not found]     ` <1264549293-25556-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-02-01  5:57       ` Nori, Sekhar
     [not found]         ` <B85A65D85D7EB246BE421B3FB0FBB59301E235A3C2-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-02-01 19:40           ` Kevin Hilman
2010-02-05 13:53           ` Philby John
     [not found]             ` <225d086e1002050553tc1a696avce827cc115f56b1c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-08 10:35               ` Nori, Sekhar
     [not found]                 ` <B85A65D85D7EB246BE421B3FB0FBB59301E2639AD8-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-02-08 10:50                   ` Philby John
2010-02-08 15:13                   ` Philby John
     [not found]                     ` <4B702A17.3070104-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2010-02-08 16:03                       ` Nori, Sekhar
     [not found]                         ` <B85A65D85D7EB246BE421B3FB0FBB59301E2639D67-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-02-09 10:15                           ` Philby John
     [not found]                             ` <4B7135B3.9080104-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2010-02-09 10:52                               ` Nori, Sekhar
     [not found]                                 ` <B85A65D85D7EB246BE421B3FB0FBB59301E263A447-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-03-05 15:20                                   ` Griffis, Brad
     [not found]                                     ` <F8C55F6A02E92D48BDDFC6048552C6F14E6D9F3F-lTKHBJngVwKIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-03-08 13:37                                       ` Philby John
     [not found]                                         ` <4B94FD84.3060100-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2010-03-11 16:28                                           ` Griffis, Brad
2010-03-08 13:36                   ` Philby John
     [not found]                     ` <4B94FD6F.7050603-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2010-03-16 20:50                       ` Kevin Hilman
     [not found]                         ` <87d3z4xa7m.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-03-17 11:28                           ` Philby John
     [not found]                             ` <4BA0BCEC.8040209-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2010-03-17 13:18                               ` Nori, Sekhar
     [not found]                                 ` <B85A65D85D7EB246BE421B3FB0FBB59301E6328944-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-03-17 13:46                                   ` Philby John
2010-09-13 14:23       ` Pablo Bitton
     [not found]         ` <AANLkTimqT=xgoxycjFAwEr6LPTeK21-FB1F-7kP5baPE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-27 12:40           ` Philby John
  -- strict thread matches above, loose matches on Subject: below --
2010-04-06 17:42 [PATCH 0/6] i2c: davinci updates for 2.6.35 Kevin Hilman
     [not found] ` <1270575738-22388-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-04-06 17:42   ` [PATCH 1/6] i2c: davinci: Fix smbus Oops with AIC33 usage Kevin Hilman
     [not found]     ` <1270575738-22388-2-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-04-20  0:05       ` Ben Dooks

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=878wbithjg.fsf@deeprootsystems.com \
    --to=khilman-1d3hcaltpluheniveurvkkeocmrvltnr@public.gmane.org \
    --cc=alexvasiljev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sudhakar.raj-l0cyMroinI0@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).