Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
To: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	b-cousson-l0cyMroinI0@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Subject: Re: [PATCHv3 8/8] i2c: omap: cleanup the sysc write
Date: Mon, 5 Nov 2012 16:14:42 +0200	[thread overview]
Message-ID: <20121105141442.GD4815@arwen.pp.htv.fi> (raw)
In-Reply-To: <1352118223-3796-9-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>

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

Hi,

On Mon, Nov 05, 2012 at 05:53:43PM +0530, Shubhrajyoti D wrote:
> Currently after the reset the sysc is written with hardcoded values.
> The patch reads the sysc register and writes back the same value
> after reset.
> 
> - Some unnecessary rev checks can be optimised.
> - Also due to whatever reason the hwmod flags are changed
> we will not reset the values.
> - In some of the cases the minor values of the 2430 register
> is different(0x37) in that case the autoidle setting may be missed.
> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-omap.c |   20 +++++---------------
>  1 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 25f1564..a09acdc 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -302,7 +302,11 @@ static void __omap_i2c_init(struct omap_i2c_dev *dev)
>  static int omap_i2c_reset(struct omap_i2c_dev *dev)
>  {
>  	unsigned long timeout;
> +	u16 sysc;
> +
>  	if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
> +		sysc = omap_i2c_read_reg(dev, OMAP_I2C_SYSC_REG);
> +
>  		/* Disable I2C controller before soft reset */
>  		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
>  			omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
> @@ -324,22 +328,8 @@ static int omap_i2c_reset(struct omap_i2c_dev *dev)
>  		}
>  
>  		/* SYSC register is cleared by the reset; rewrite it */
> -		if (dev->rev == OMAP_I2C_REV_ON_2430) {
> -
> -			omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
> -					   SYSC_AUTOIDLE_MASK);
> +		omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, sysc);
>  
> -		} else if (dev->rev >= OMAP_I2C_REV_ON_3430_3530) {
> -			dev->syscstate = SYSC_AUTOIDLE_MASK;
> -			dev->syscstate |= SYSC_ENAWAKEUP_MASK;
> -			dev->syscstate |= (SYSC_IDLEMODE_SMART <<
> -			      __ffs(SYSC_SIDLEMODE_MASK));
> -			dev->syscstate |= (SYSC_CLOCKACTIVITY_FCLK <<
> -			      __ffs(SYSC_CLOCKACTIVITY_MASK));
> -
> -			omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
> -							dev->syscstate);
> -		}

not sure if this will work. What about the first time you call reset() ?
won't SYSC just contain the reset values ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-11-05 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 12:23 [PATCHv3 0/7] i2c: omap: updates Shubhrajyoti D
2012-11-05 12:23 ` [PATCHv3 2/8] i2c: omap: use revision check for OMAP_I2C_FLAG_APPLY_ERRATA_I207 Shubhrajyoti D
2012-11-05 12:23 ` [PATCHv3 4/8] ARM: i2c: omap: Remove the i207 errata flag Shubhrajyoti D
2012-11-05 12:23 ` [PATCHv3 6/8] i2c: omap: make reset a seperate function Shubhrajyoti D
     [not found] ` <1352118223-3796-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-11-05 12:23   ` [PATCHv3 1/8] i2c: omap: Fix the revision register read Shubhrajyoti D
2012-11-05 14:11     ` Felipe Balbi
2012-11-05 12:23   ` [PATCHv3 3/8] i2c: omap: remove the dtrev Shubhrajyoti D
     [not found]     ` <1352118223-3796-4-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-11-05 14:11       ` Felipe Balbi
2012-11-05 12:23   ` [PATCHv3 5/8] i2c: omap: re-factor omap_i2c_init function Shubhrajyoti D
2012-11-05 12:23   ` [PATCHv3 7/8] i2c: omap: Restore i2c context always Shubhrajyoti D
2012-11-05 12:23   ` [PATCHv3 8/8] i2c: omap: cleanup the sysc write Shubhrajyoti D
     [not found]     ` <1352118223-3796-9-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-11-05 14:14       ` Felipe Balbi [this message]
2012-11-05 14:23         ` Shubhrajyoti
     [not found]           ` <5097CBF1.6060108-l0cyMroinI0@public.gmane.org>
2012-11-05 14:25             ` Felipe Balbi
2012-11-05 17:24               ` Cousson, Benoit
     [not found]                 ` <5097F642.9010803-l0cyMroinI0@public.gmane.org>
2012-11-05 18:29                   ` Shubhrajyoti Datta
2012-11-13 12:50   ` [PATCHv3 0/7] i2c: omap: updates Shubhrajyoti Datta
2012-11-14 12:04   ` Wolfram Sang
2012-11-14 13:09     ` Shubhrajyoti

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=20121105141442.GD4815@arwen.pp.htv.fi \
    --to=balbi-l0cymroini0@public.gmane.org \
    --cc=b-cousson-l0cyMroinI0@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shubhrajyoti-l0cyMroinI0@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@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