All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Jouni Hogander <jouni.hogander@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/4] PM: Workaround for taking care of gpio clocks
Date: Wed, 20 Aug 2008 14:37:16 +0300	[thread overview]
Message-ID: <20080820113715.GC29374@atomide.com> (raw)
In-Reply-To: <1218786439-28070-1-git-send-email-jouni.hogander@nokia.com>

* Jouni Hogander <jouni.hogander@nokia.com> [080815 10:47]:
> In omap3 gpios 2-6 are in per domain. Functional clocks for these
> should be disabled. This patch is needed until gpio driver disables
> gpio clocks.
> 
> GPIO modules in PER domain are not able to act as a wake up source if
> PER domain is in retention. PER domain sleep transition before MPU is
> prevented by leaving icks active. PER domain still enters retention
> together with MPU. When this happens IOPAD wake up mechanism is used
> for gpios.

As we talked offline.. Should we pass the GPIO wake-up configuration
from board-*.c files? Or can we always automatically do this safely
on 34xx?

Tony


> Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
> ---
>  arch/arm/mach-omap2/pm34xx.c |   54 +++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 53 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index f30fa9e..7d5d461 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -53,6 +53,36 @@ static void (*saved_idle)(void);
>  
>  static struct powerdomain *mpu_pwrdm;
>  
> +/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> + * handles fcks correctly */
> +#define NUM_OF_PERGPIOS 5
> +static struct clk *gpio_fcks[NUM_OF_PERGPIOS];
> +
> +/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> + * handles fcks correctly */
> +static void per_gpio_clk_enable(void)
> +{
> +	int i;
> +	for (i = 1; i < NUM_OF_PERGPIOS + 1; i++)
> +		clk_enable(gpio_fcks[i-1]);
> +}
> +
> +/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> + * handles fcks correctly */
> +static void per_gpio_clk_disable(void)
> +{
> +	int i;
> +	for (i = 1; i < NUM_OF_PERGPIOS + 1; i++)
> +		clk_disable(gpio_fcks[i-1]);
> +}
> +
> +/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> + * handles fcks correctly */
> +static void gpio_fclk_mask(u32 *fclk)
> +{
> +	*fclk &= ~(0x1f << 13);
> +}
> +
>  /* PRCM Interrupt Handler for wakeups */
>  static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
>  {
> @@ -169,8 +199,18 @@ static void omap_sram_idle(void)
>  
>  	omap2_gpio_prepare_for_retention();
>  
> +	/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> +	 * handles fcks correctly */
> +	if (clocks_off_while_idle)
> +		per_gpio_clk_disable();
> +
>  	_omap_sram_idle(NULL, save_state);
>  
> +	/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> +	 * handles fcks correctly */
> +	if (clocks_off_while_idle)
> +		per_gpio_clk_enable();
> +
>  	omap2_gpio_resume_after_retention();
>  }
>  
> @@ -200,6 +240,10 @@ static int omap3_fclks_active(void)
>  				  CM_FCLKEN);
>  	fck_per = cm_read_mod_reg(OMAP3430_PER_MOD,
>  				  CM_FCLKEN);
> +
> +	if (clocks_off_while_idle)
> +		gpio_fclk_mask(&fck_per);
> +
>  	if (fck_core1 | fck_core3 | fck_sgx | fck_dss |
>  	    fck_cam | fck_per | fck_usbhost)
>  		return 1;
> @@ -418,7 +462,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm)
>  int __init omap3_pm_init(void)
>  {
>  	struct power_state *pwrst;
> -	int ret;
> +	char clk_name[11];
> +	int ret, i;
>  
>  	printk(KERN_ERR "Power Management for TI OMAP3.\n");
>  
> @@ -454,6 +499,13 @@ int __init omap3_pm_init(void)
>  
>  	pm_idle = omap3_pm_idle;
>  
> +	/* XXX This is for gpio fclk hack. Will be removed as gpio driver
> +	 * handles fcks correctly */
> +	for (i = 1; i < NUM_OF_PERGPIOS + 1; i++) {
> +		sprintf(clk_name, "gpio%d_fck", i + 1);
> +		gpio_fcks[i-1] = clk_get(NULL, clk_name);
> +	}
> +
>  err1:
>  	return ret;
>  err2:
> -- 
> 1.5.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-08-20 11:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15  7:44 [PATCH 0/4] Refreshed PM workaround patches 2 Högander Jouni
2008-08-15  7:47 ` [PATCH 1/4] 34XX: PM: Workaround to check wether any fck is active before entering sleep Jouni Hogander
2008-08-20 11:35   ` Tony Lindgren
2008-08-22  5:45     ` Högander Jouni
2008-08-22 18:07       ` Tony Lindgren
2008-08-21  8:17   ` Rajendra Nayak
2008-08-21  9:41     ` Rajendra Nayak
2008-08-15  7:47 ` [PATCH 2/4] PM: Workaround for taking care of gpio clocks Jouni Hogander
2008-08-20 11:37   ` Tony Lindgren [this message]
2008-08-21 11:07     ` Tero.Kristo
2008-08-22 18:06       ` Tony Lindgren
2008-08-15  7:47 ` [PATCH 3/4] Added sleep support to UART Jouni Hogander
2008-08-20 11:40   ` Tony Lindgren
2008-08-20 12:26     ` Tero.Kristo
2008-08-15  7:47 ` [PATCH 4/4] 34XX: PM: Workaround to enable autoidle for clocks and plls Jouni Hogander
2008-08-20 11:51   ` Tony Lindgren
2008-08-15  7:49 ` [PATCH 0/4] Refreshed PM workaround patches 2 Felipe Balbi
2008-08-18 13:23   ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2008-06-30  8:50 [PATCH 0/6] 34XX: PM: Workarounds to get omap3 to retention 4th Högander Jouni
2008-08-15  6:18 ` [PATCH 2/4] PM: Workaround for taking care of gpio clocks Jouni Hogander

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=20080820113715.GC29374@atomide.com \
    --to=tony@atomide.com \
    --cc=jouni.hogander@nokia.com \
    --cc=linux-omap@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.