linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/27] OMAP3: PM: GPIO context save/restore
Date: Wed, 14 Oct 2009 15:13:41 -0700	[thread overview]
Message-ID: <20091014221340.GM12700@atomide.com> (raw)
In-Reply-To: <1255557490-16787-3-git-send-email-khilman@deeprootsystems.com>

* Kevin Hilman <khilman@deeprootsystems.com> [091014 15:08]:
> From: Rajendra Nayak <rnayak@ti.com>

This one should have a description of the patch here.

Also one comment below.

> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/plat-omap/gpio.c              |   93 ++++++++++++++++++++++++++++++++
>  arch/arm/plat-omap/include/mach/gpio.h |    3 +-
>  2 files changed, 95 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index b1af0c2..48ce218 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -260,6 +260,23 @@ static struct gpio_bank gpio_bank_34xx[6] = {
>  	{ OMAP34XX_GPIO6_BASE, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_24XX },
>  };
>  
> +struct omap3_gpio_regs {
> +	u32 sysconfig;
> +	u32 irqenable1;
> +	u32 irqenable2;
> +	u32 wake_en;
> +	u32 ctrl;
> +	u32 oe;
> +	u32 leveldetect0;
> +	u32 leveldetect1;
> +	u32 risingdetect;
> +	u32 fallingdetect;
> +	u32 dataout;
> +	u32 setwkuena;
> +	u32 setdataout;
> +};
> +
> +static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
>  #endif
>  
>  #ifdef CONFIG_ARCH_OMAP4
> @@ -2002,6 +2019,82 @@ void omap2_gpio_resume_after_retention(void)
>  
>  #endif
>  
> +#ifdef CONFIG_ARCH_OMAP34XX
> +/* save the registers of bank 2-6 */
> +void omap3_gpio_save_context(void)
> +{
> +	int i;
> +
> +	/* saving banks from 2-6 only since GPIO1 is in WKUP */
> +	for (i = 1; i < gpio_bank_count; i++) {
> +		struct gpio_bank *bank = &gpio_bank[i];
> +		gpio_context[i].sysconfig =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_SYSCONFIG);
> +		gpio_context[i].irqenable1 =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1);
> +		gpio_context[i].irqenable2 =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE2);
> +		gpio_context[i].wake_en =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_WAKE_EN);
> +		gpio_context[i].ctrl =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_CTRL);
> +		gpio_context[i].oe =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_OE);
> +		gpio_context[i].leveldetect0 =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
> +		gpio_context[i].leveldetect1 =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> +		gpio_context[i].risingdetect =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT);
> +		gpio_context[i].fallingdetect =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT);
> +		gpio_context[i].dataout =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_DATAOUT);
> +		gpio_context[i].setwkuena =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_SETWKUENA);
> +		gpio_context[i].setdataout =
> +			__raw_readl(bank->base + OMAP24XX_GPIO_SETDATAOUT);
> +	}
> +}
> +EXPORT_SYMBOL(omap3_gpio_save_context);

This function looks like it should work on most omaps.
Maybe it should be named just omap_gpio_save_context()?

> +
> +/* restore the required registers of bank 2-6 */
> +void omap3_gpio_restore_context(void)
> +{
> +	int i;
> +	for (i = 1; i < gpio_bank_count; i++) {
> +		struct gpio_bank *bank = &gpio_bank[i];
> +		__raw_writel(gpio_context[i].sysconfig,
> +				bank->base + OMAP24XX_GPIO_SYSCONFIG);
> +		__raw_writel(gpio_context[i].irqenable1,
> +				bank->base + OMAP24XX_GPIO_IRQENABLE1);
> +		__raw_writel(gpio_context[i].irqenable2,
> +				bank->base + OMAP24XX_GPIO_IRQENABLE2);
> +		__raw_writel(gpio_context[i].wake_en,
> +				bank->base + OMAP24XX_GPIO_WAKE_EN);
> +		__raw_writel(gpio_context[i].ctrl,
> +				bank->base + OMAP24XX_GPIO_CTRL);
> +		__raw_writel(gpio_context[i].oe,
> +				bank->base + OMAP24XX_GPIO_OE);
> +		__raw_writel(gpio_context[i].leveldetect0,
> +				bank->base + OMAP24XX_GPIO_LEVELDETECT0);
> +		__raw_writel(gpio_context[i].leveldetect1,
> +				bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> +		__raw_writel(gpio_context[i].risingdetect,
> +				bank->base + OMAP24XX_GPIO_RISINGDETECT);
> +		__raw_writel(gpio_context[i].fallingdetect,
> +				bank->base + OMAP24XX_GPIO_FALLINGDETECT);
> +		__raw_writel(gpio_context[i].dataout,
> +				bank->base + OMAP24XX_GPIO_DATAOUT);
> +		__raw_writel(gpio_context[i].setwkuena,
> +				bank->base + OMAP24XX_GPIO_SETWKUENA);
> +		__raw_writel(gpio_context[i].setdataout,
> +				bank->base + OMAP24XX_GPIO_SETDATAOUT);
> +	}
> +}
> +EXPORT_SYMBOL(omap3_gpio_restore_context);

This too?


> +#endif
> +
>  /*
>   * This may get called early from board specific init
>   * for boards that have interrupts routed via FPGA.
> diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
> index 633ff68..7310414 100644
> --- a/arch/arm/plat-omap/include/mach/gpio.h
> +++ b/arch/arm/plat-omap/include/mach/gpio.h
> @@ -76,7 +76,8 @@ extern void omap2_gpio_prepare_for_retention(void);
>  extern void omap2_gpio_resume_after_retention(void);
>  extern void omap_set_gpio_debounce(int gpio, int enable);
>  extern void omap_set_gpio_debounce_time(int gpio, int enable);
> -
> +extern void omap3_gpio_save_context(void);
> +extern void omap3_gpio_restore_context(void);
>  /*-------------------------------------------------------------------------*/
>  
>  /* Wrappers for "new style" GPIO calls, using the new infrastructure
> -- 
> 1.6.4.3
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2009-10-14 22:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14 21:57 [PATCH 00/27] OMAP3: PM: base off-mode support Kevin Hilman
2009-10-14 21:57 ` [PATCH 01/27] OMAP3: PM: GPMC context save/restore Kevin Hilman
2009-10-14 21:57   ` [PATCH 02/27] OMAP3: PM: GPIO " Kevin Hilman
2009-10-14 21:57     ` [PATCH 03/27] OMAP3: PM: INTC " Kevin Hilman
2009-10-14 21:57       ` [PATCH 04/27] OMAP3: PM: PRCM " Kevin Hilman
2009-10-14 21:57         ` [PATCH 05/27] OMAP3: PM: Populate scratchpad contents Kevin Hilman
2009-10-14 21:57           ` [PATCH 06/27] OMAP3: PM: SCM context save/restore Kevin Hilman
2009-10-14 21:57             ` [PATCH 07/27] OMAP3: PM: SRAM restore function Kevin Hilman
2009-10-14 21:57               ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Kevin Hilman
2009-10-14 21:57                 ` [PATCH 09/27] OMAP3: PM: Restore MMU table entry Kevin Hilman
2009-10-14 21:57                   ` [PATCH 10/27] OMAP3: PM: MPU off-mode support Kevin Hilman
2009-10-14 21:57                     ` [PATCH 11/27] OMAP3: PM: CORE domain " Kevin Hilman
2009-10-14 21:57                       ` [PATCH 12/27] OMAP: PM: DMA context save/restore for " Kevin Hilman
2009-10-14 21:57                         ` [PATCH 13/27] OMAP3 PM: off-mode support for HS/EMU devices Kevin Hilman
2009-10-14 21:57                           ` [PATCH 14/27] OMAP3: PM: save secure RAM only during init Kevin Hilman
2009-10-14 21:57                             ` [PATCH 15/27] OMAP3: PM: Enable SDRAM auto-refresh during sleep Kevin Hilman
2009-10-14 21:57                               ` [PATCH 16/27] OMAP3: PM: Save and restore also CM_CLKSEL1_PLL_IVA2 Kevin Hilman
2009-10-14 21:58                                 ` [PATCH 17/27] OMAP3: PM: Fix secure SRAM context save/restore Kevin Hilman
2009-10-14 21:58                                   ` [PATCH 18/27] ARM: OMAP: Add missing SMS_SYSCONFIG save/restore Kevin Hilman
2009-10-14 21:58                                     ` [PATCH 19/27] OMAP3: PM: Fix PLL_MOD CLKEN offset in scratchpad Kevin Hilman
2009-10-14 21:58                                       ` [PATCH 20/27] OMAP: PM: Clear DMA channel state after a wakeup Kevin Hilman
2009-10-14 21:58                                         ` [PATCH 21/27] OMAP: Store reboot mode in scratchpad on OMAP34xx Kevin Hilman
2009-10-14 21:58                                           ` [PATCH 22/27] OMAP3: PM: SDRC auto-refresh workaround for off-mode Kevin Hilman
2009-10-14 21:58                                             ` [PATCH 23/27] OMAP3: PM: Fix INTC context save/restore Kevin Hilman
2009-10-14 21:58                                               ` [PATCH 24/27] PM: Disable usb host HW save and restore Kevin Hilman
2009-10-14 21:58                                                 ` [PATCH 25/27] OMAP3: PM: Wait for SDRC ready iso a blind delay Kevin Hilman
2009-10-14 21:58                                                   ` [PATCH 26/27] OMAP3: PM debug: allow runtime toggle of PM features Kevin Hilman
2009-10-14 21:58                                                     ` [PATCH 27/27] PM debug: allow configurable wakeup from suspend on OMAP GPtimer Kevin Hilman
2009-10-14 22:18                 ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Tony Lindgren
2009-10-14 22:17               ` [PATCH 07/27] OMAP3: PM: SRAM restore function Tony Lindgren
2009-10-14 22:15       ` [PATCH 03/27] OMAP3: PM: INTC context save/restore Tony Lindgren
2009-10-14 22:13     ` Tony Lindgren [this message]

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=20091014221340.GM12700@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.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).