public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: khilman@deeprootsystems•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v8 01/11] OMAP: GPIO: prepare for platform driver
Date: Thu, 09 Dec 2010 14:19:59 -0800	[thread overview]
Message-ID: <871v5q7fn4.fsf@deeprootsystems.com> (raw)
In-Reply-To: <4D014B3C.7040806@ti.com> (Benoit Cousson's message of "Thu, 9 Dec 2010 22:33:48 +0100")

"Cousson, Benoit" <b-cousson@ti•com> writes:

> Salut Kevin,
>
> On 12/9/2010 8:18 PM, Kevin Hilman wrote:
>> Hi Charu,
>>
>> "Varadarajan, Charulatha"<charu@ti•com>  writes:
>>
>>> Prepare for implementing GPIO as a platform driver.
>>>
>>> Modifies omap_gpio_init() to make use of omap_gpio_chip_init()
>>> and omap_gpio_mod_init(). omap_gpio_mod_init() does the module init
>>> by clearing the status register and initializing the GPIO control register.
>>> omap_gpio_chip_init() initializes the chip request, free, get, set and
>>> other function pointers and sets the gpio irq handler.
>>>
>>> This is only to reorganize the code so that the "omap gpio platform driver
>>> implementation patch" looks cleaner and better to review.
>>>
>>> Signed-off-by: Charulatha V<charu@ti•com>
>>
>> I just noticed while testing on 36xx/Zoom3 that GPIO wakeups are no
>> longer working after this series.
>>
>> The problem seems to be that for OMAP2+, this series removed manual
>> SYSCONFIG register setting in favor of using omap_hwmod (which is good),
>> however some of the SYSCONFIG values, specifically, in the current code,
>> the ENAWAKEUP bit was set in each bank, but this is no longer the
>> default with omap_hwmod.
>
> That part is strange, because Rajendra did a patch to enable the
> wakeup bit during _omap_hwmod_enable as soon as the idlemode is set to
> smartidle.
>
> /* If slave port is in SMARTIDLE, also enable wakeup */
> if ((sf & SYSC_HAS_SIDLEMODE) && (s_idlemode == HWMOD_IDLEMODE_SMART))
> 	_enable_wakeup(oh);
>
> The _disable_wakeup is never called, so in theory once it is set, it
> should remain enabled.
>
> Does that mean that this the GPIO is not in smartidle anymore in your case?

Looks like a bug in the patch that added automatic wakeup enables.
Basically, wakeups are enabled, but are promptly disabled if
SYSC_HAS_AUTOIDLE.  Here's the code:

	/*
	 * XXX The clock framework should handle this, by
	 * calling into this code.  But this must wait until the
	 * clock structures are tagged with omap_hwmod entries
	 */
	if ((oh->flags & HWMOD_SET_DEFAULT_CLOCKACT) &&
	    (sf & SYSC_HAS_CLOCKACTIVITY))
		_set_clockactivity(oh, oh->class->sysc->clockact, &v);

	_write_sysconfig(v, oh);

OK, so here, 'v' has wakeups disabled.

	/* If slave is in SMARTIDLE, also enable wakeup */
	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE))
		_enable_wakeup(oh);

Here we enabled them directly in SYSC (but 'v' is not updated)

	/*
	 * Set the autoidle bit only after setting the smartidle bit
	 * Setting this will not have any impact on the other modules.
	 */
	if (sf & SYSC_HAS_AUTOIDLE) {
		idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ?
			0 : 1;
		_set_module_autoidle(oh, idlemode, &v);
		_write_sysconfig(v, oh);
	}

And here, SYSCONFIG is updated again using 'v', which does not have
wakeups enabled.

A quick patch (below) shows that if I update 'v' after enabling wakeups, 
the problem is fixed.

I'll cook up a cleaner patch for this, but I think the solution is
probably to change _enable_wakeup() to take the 'v' argument and modify
it instead of directly writing SYSCONFIG.  That will make it more like
all the other helper functions.

Kevin



diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 12856eb..adcb1fc 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -791,8 +791,10 @@ static void _enable_sysc(struct omap_hwmod *oh)
 	_write_sysconfig(v, oh);
 
 	/* If slave is in SMARTIDLE, also enable wakeup */
-	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE))
+	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE)) {
 		_enable_wakeup(oh);
+		v = oh->_sysc_cache;
+	}
 
 	/*
 	 * Set the autoidle bit only after setting the smartidle bit

  reply	other threads:[~2010-12-09 22:19 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 12:48 [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 01/11] OMAP: GPIO: prepare for platform driver Varadarajan, Charulatha
2010-12-01 18:34   ` [PATCH v8 01-b/11] OMAP: GPIO: Make omap_gpio_show_rev bank specific Tony Lindgren
2010-12-09 19:18   ` [PATCH v8 01/11] OMAP: GPIO: prepare for platform driver Kevin Hilman
2010-12-09 21:33     ` Cousson, Benoit
2010-12-09 22:19       ` Kevin Hilman [this message]
2010-12-09 22:29         ` Cousson, Benoit
2010-12-09 23:19     ` Kevin Hilman
2010-11-25 12:48 ` [PATCH v8 02/11] OMAP15xx: GPIO: Introduce support for GPIO init Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 03/11] OMAP16xx: " Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 04/11] OMAP7xx: " Varadarajan, Charulatha
2010-12-07  5:20   ` Cory Maccarrone
2010-12-07  5:43     ` Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 05/11] OMAP2420: hwmod data: Add GPIO Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 06/11] OMAP2430: " Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 07/11] OMAP3: " Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 08/11] OMAP4: " Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 09/11] OMAP2+: GPIO: device registration Varadarajan, Charulatha
2010-11-25 12:48 ` [PATCH v8 10/11] OMAP: GPIO: Implement GPIO as a platform device Varadarajan, Charulatha
2010-12-07  5:19   ` Cory Maccarrone
2010-12-07  5:35     ` Varadarajan, Charulatha
2010-12-07  7:08       ` Varadarajan, Charulatha
2010-12-07 22:07         ` Tony Lindgren
2010-11-25 12:48 ` [PATCH v8 11/11] OMAP: GPIO: Remove omap_gpio_init() Varadarajan, Charulatha
2010-12-01 18:33 ` [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device Tony Lindgren
2010-12-02  9:58   ` Kevin Hilman
2010-12-02 14:18     ` Varadarajan, Charulatha
2010-12-04 21:25       ` Tony Lindgren
2010-12-07 23:23         ` [PATCH 12/11] omap1: Fix gpio mpuio bank to work for multi-omap for 7xx/15xx/16xx Tony Lindgren
2010-12-08  1:04           ` Tony Lindgren
2010-12-08  4:22           ` Varadarajan, Charulatha
2010-12-10 16:04           ` Janusz Krzysztofik
2010-12-10 17:41             ` Tony Lindgren
2010-12-08  0:54 ` [PATCH v8 00/11] OMAP: GPIO: Implement GPIO as platform device Tony Lindgren
2010-12-09 19:33 ` [PATCH 13/11] OMAP2+: GPIO: ensure bank wakeups are enabled by default Kevin Hilman
2010-12-10  0:07   ` Tony Lindgren
2010-12-10  0:14     ` Kevin Hilman

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=871v5q7fn4.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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