public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: linux-omap@vger.kernel.org, santosh.shilimkar@ti.com, tony@atomide.com
Subject: Re: [PATCH v2 08/18] GPIO: OMAP: Use wkup regs off/suspend support flag
Date: Thu, 16 Jun 2011 10:38:43 -0700	[thread overview]
Message-ID: <87pqmdn0bg.fsf@ti.com> (raw)
In-Reply-To: <1308111776-29130-7-git-send-email-tarun.kanti@ti.com> (Tarun Kanti DebBarma's message of "Wed, 15 Jun 2011 09:52:55 +0530")

Tarun Kanti DebBarma <tarun.kanti@ti.com> writes:

> Wakeup register offsets are initialized according to OMAP versions
> during device registration. These explicit checks are no longer needed.
>
> mpuio_init() function is defined under #ifdefs. It is required only in case
> of MPUIO bank type and only when PM operations are supported by it.
> This is applicable only in case of OMAP16xx SoC's MPUIO GPIO bank type.
> For all the other cases it is a dummy function. Hence clean up the same
> and remove all the OMAP SoC specific #ifdefs.
>
> bank_is_mpuio() is defined as a check to identify if the bank type is MPUIO.
> It is not required to define it separately as zero for OMAP2plus. Remove this.
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> Signed-off-by: Charulatha V <charu@ti.com>

[...]

> diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
> index cdbc728..ea1556b 100644
> --- a/arch/arm/mach-omap2/gpio.c
> +++ b/arch/arm/mach-omap2/gpio.c
> @@ -72,6 +72,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  
>  	dev_attr = (struct omap_gpio_dev_attr *)oh->dev_attr;
>  	pdata->bank_width = dev_attr->bank_width;
> +	pdata->suspend_support = true;
>  	pdata->dbck_flag = dev_attr->dbck_flag;
>  	pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1);
>  	pdata->get_context_loss_count = omap_gpio_get_context_loss;
> @@ -108,6 +109,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  		pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
>  		pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
>  		pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
> +		pdata->regs->wkup_status = OMAP24XX_GPIO_WAKE_EN;
> +		pdata->regs->wkup_clear = OMAP24XX_GPIO_CLEARWKUENA;
> +		pdata->regs->wkup_set = OMAP24XX_GPIO_SETWKUENA;
>  		break;
>  	case 2:
>  		pdata->bank_type = METHOD_GPIO_44XX;
> @@ -125,6 +129,9 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
>  		pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
>  		pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
>  		pdata->regs->ctrl = OMAP4_GPIO_CTRL;
> +		pdata->regs->wkup_status = OMAP4_GPIO_IRQWAKEN0;
> +		pdata->regs->wkup_clear = OMAP4_GPIO_IRQWAKEN0;
> +		pdata->regs->wkup_set = OMAP4_GPIO_IRQWAKEN0;
>  		break;

This is wrong for OMAP4.

The wkup_clear & wkup_set registers offsets are for the registers
*dedicated* to set and clear.    Any usage of these offets assumes that
a single write will either set or clear the register, which is clearly
not the case with IRQWAKEN, which requires a read/modify/write.

For example, in suspend this is done:

	__raw_writel(0xffffffff, wake_clear);
	__raw_writel(bank->suspend_wakeup, wake_set);

As both the set & clear are set to IRQWAKEN on OMAP4, this means that
wakeups are actually enabled for *all* GPIOs in every bank during
suspend.  This is clearly not what's intended.  Also, since resume does
something similar, wakeups for *all* GPIOs are left enabled after resume
as well.

Also, the 44xx TRMs recommend not using the set/clear registers at all
for OMAP4, so they should be left blank.

Instead, any usage of the wake set/clear registers in the code should
probably be converted to just use read/modify/writes on wake_status so
it's the same for all SoCs.

Kevin

  parent reply	other threads:[~2011-06-16 17:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  4:22 [PATCH v2 02/18] GPIO: OMAP2+: Use flag to identify wakeup domain Tarun Kanti DebBarma
2011-06-15  4:22 ` [PATCH v2 03/18] GPIO: OMAP: Make gpio_context part of gpio_bank structure Tarun Kanti DebBarma
2011-06-15  4:22 ` [PATCH v2 04/18] GPIO: OMAP: Fix pwrdm_post_transition call sequence Tarun Kanti DebBarma
2011-06-15  4:22 ` [PATCH v2 05/18] GPIO: OMAP: Handle save/restore ctx in GPIO driver Tarun Kanti DebBarma
2011-06-16 16:34   ` Kevin Hilman
2011-06-17  5:41     ` DebBarma, Tarun Kanti
2011-06-15  4:22 ` [PATCH v2 06/18] GPIO: OMAP2+: Make non-wakeup GPIO part of pdata Tarun Kanti DebBarma
2011-06-16 16:35   ` Kevin Hilman
2011-06-15  4:22 ` [PATCH 07/18] GPIO: OMAP: Avoid cpu checks during module ena/disable Tarun Kanti DebBarma
2011-06-15  4:22 ` [PATCH v2 08/18] GPIO: OMAP: Use wkup regs off/suspend support flag Tarun Kanti DebBarma
2011-06-16 16:54   ` Kevin Hilman
2011-06-17  5:34     ` DebBarma, Tarun Kanti
2011-06-17 15:52       ` Kevin Hilman
2011-06-17 15:53         ` DebBarma, Tarun Kanti
2011-06-30 13:35     ` DebBarma, Tarun Kanti
2011-06-30 22:57       ` Kevin Hilman
2011-06-16 17:38   ` Kevin Hilman [this message]
2011-06-17  5:24     ` DebBarma, Tarun Kanti
2011-06-15  4:22 ` [PATCH v2 09/18] GPIO: OMAP: Use level/edge detect reg offsets Tarun Kanti DebBarma
2011-06-16 17:00   ` Kevin Hilman
2011-06-17  5:26     ` DebBarma, Tarun Kanti

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=87pqmdn0bg.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=tarun.kanti@ti.com \
    --cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox