All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Varadarajan, Charulatha" <charu@ti.com>
To: tony@atomide.com, linux-omap@vger.kernel.org
Cc: khilman@deeprootsystems.com, paul@pwsan.com, b-cousson@ti.com,
	rnayak@ti.com, p-basak2@ti.com, "Varadarajan,
	Charulatha" <charu@ti.com>
Subject: [PATCH v6 11/13] OMAP: GPIO: Make gpio_context as part of gpio_bank structure
Date: Sat, 18 Sep 2010 19:45:51 +0530	[thread overview]
Message-ID: <1284819353-8512-12-git-send-email-charu@ti.com> (raw)
In-Reply-To: <1284819353-8512-1-git-send-email-charu@ti.com>

gpio_context array, which is used to save gpio bank's context,
is used only for OMAP3 architecture.

This patch moves gpio_context as part of gpio_bank structure
so that it can be specific to each gpio bank and can be
used for any OMAP architecture

Signed-off-by: Charulatha V <charu@ti.com>
---
 arch/arm/plat-omap/gpio.c |   73 ++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index fa324bb..aa0d510 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -133,6 +133,19 @@ static struct powerdomain *per_pwrdm;
 #define OMAP4_GPIO_CLEARDATAOUT		0x0190
 #define OMAP4_GPIO_SETDATAOUT		0x0194
 
+struct omap_gpio_regs {
+	u32 irqenable1;
+	u32 irqenable2;
+	u32 wake_en;
+	u32 ctrl;
+	u32 oe;
+	u32 leveldetect0;
+	u32 leveldetect1;
+	u32 risingdetect;
+	u32 fallingdetect;
+	u32 dataout;
+};
+
 struct gpio_bank {
 	unsigned long pbase;
 	void __iomem *base;
@@ -157,29 +170,13 @@ struct gpio_bank {
 	u32 mod_usage;
 	u32 dbck_enable_mask;
 	struct device *dev;
+	struct omap_gpio_regs gpio_context;
 	bool dbck_flag;
 };
 
 static void omap3_gpio_restore_context(void);
 static void omap3_gpio_save_context(void);
 
-#ifdef CONFIG_ARCH_OMAP3
-struct omap3_gpio_regs {
-	u32 irqenable1;
-	u32 irqenable2;
-	u32 wake_en;
-	u32 ctrl;
-	u32 oe;
-	u32 leveldetect0;
-	u32 leveldetect1;
-	u32 risingdetect;
-	u32 fallingdetect;
-	u32 dataout;
-};
-
-static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
-#endif
-
 /*
  * TODO: Cleanup gpio_bank usage as it is having information
  * related to all instances of the device
@@ -2053,25 +2050,26 @@ static void omap3_gpio_save_context(void)
 	/* 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].irqenable1 =
+
+		bank->gpio_context.irqenable1 =
 			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1);
-		gpio_context[i].irqenable2 =
+		bank->gpio_context.irqenable2 =
 			__raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE2);
-		gpio_context[i].wake_en =
+		bank->gpio_context.wake_en =
 			__raw_readl(bank->base + OMAP24XX_GPIO_WAKE_EN);
-		gpio_context[i].ctrl =
+		bank->gpio_context.ctrl =
 			__raw_readl(bank->base + OMAP24XX_GPIO_CTRL);
-		gpio_context[i].oe =
+		bank->gpio_context.oe =
 			__raw_readl(bank->base + OMAP24XX_GPIO_OE);
-		gpio_context[i].leveldetect0 =
+		bank->gpio_context.leveldetect0 =
 			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
-		gpio_context[i].leveldetect1 =
+		bank->gpio_context.leveldetect1 =
 			__raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
-		gpio_context[i].risingdetect =
+		bank->gpio_context.risingdetect =
 			__raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT);
-		gpio_context[i].fallingdetect =
+		bank->gpio_context.fallingdetect =
 			__raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT);
-		gpio_context[i].dataout =
+		bank->gpio_context.dataout =
 			__raw_readl(bank->base + OMAP24XX_GPIO_DATAOUT);
 	}
 }
@@ -2083,25 +2081,26 @@ static void omap3_gpio_restore_context(void)
 
 	for (i = 1; i < gpio_bank_count; i++) {
 		struct gpio_bank *bank = &gpio_bank[i];
-		__raw_writel(gpio_context[i].irqenable1,
+
+		__raw_writel(bank->gpio_context.irqenable1,
 				bank->base + OMAP24XX_GPIO_IRQENABLE1);
-		__raw_writel(gpio_context[i].irqenable2,
+		__raw_writel(bank->gpio_context.irqenable2,
 				bank->base + OMAP24XX_GPIO_IRQENABLE2);
-		__raw_writel(gpio_context[i].wake_en,
+		__raw_writel(bank->gpio_context.wake_en,
 				bank->base + OMAP24XX_GPIO_WAKE_EN);
-		__raw_writel(gpio_context[i].ctrl,
+		__raw_writel(bank->gpio_context.ctrl,
 				bank->base + OMAP24XX_GPIO_CTRL);
-		__raw_writel(gpio_context[i].oe,
+		__raw_writel(bank->gpio_context.oe,
 				bank->base + OMAP24XX_GPIO_OE);
-		__raw_writel(gpio_context[i].leveldetect0,
+		__raw_writel(bank->gpio_context.leveldetect0,
 				bank->base + OMAP24XX_GPIO_LEVELDETECT0);
-		__raw_writel(gpio_context[i].leveldetect1,
+		__raw_writel(bank->gpio_context.leveldetect1,
 				bank->base + OMAP24XX_GPIO_LEVELDETECT1);
-		__raw_writel(gpio_context[i].risingdetect,
+		__raw_writel(bank->gpio_context.risingdetect,
 				bank->base + OMAP24XX_GPIO_RISINGDETECT);
-		__raw_writel(gpio_context[i].fallingdetect,
+		__raw_writel(bank->gpio_context.fallingdetect,
 				bank->base + OMAP24XX_GPIO_FALLINGDETECT);
-		__raw_writel(gpio_context[i].dataout,
+		__raw_writel(bank->gpio_context.dataout,
 				bank->base + OMAP24XX_GPIO_DATAOUT);
 	}
 }
-- 
1.7.0.4


  parent reply	other threads:[~2010-09-18 14:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18 14:15 [PATCH v6 00/13] OMAP: GPIO: Implement GPIO in hwmod way Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 01/13] OMAP: GPIO: Modify init() in preparation for platform device implementation Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 02/13] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 03/13] OMAP: GPIO: Introduce support for OMAP16xx " Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 04/13] OMAP: GPIO: Introduce support for OMAP7xx " Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 05/13] OMAP2420: hwmod data: Add GPIO Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 06/13] OMAP2430: " Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 07/13] OMAP3: " Varadarajan, Charulatha
2010-09-21 23:22   ` Kevin Hilman
2010-09-18 14:15 ` [PATCH v6 08/13] OMAP4: " Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 09/13] OMAP2PLUS: GPIO: use omap_device_build for device registration Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 10/13] OMAP: GPIO: Implement GPIO as a platform device Varadarajan, Charulatha
2010-09-18 14:15 ` Varadarajan, Charulatha [this message]
2010-09-18 14:15 ` [PATCH v6 12/13] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class Varadarajan, Charulatha
2010-09-18 14:15 ` [PATCH v6 13/13] OMAP: GPIO: Remove omap_gpio_init() Varadarajan, Charulatha
2010-09-21  0:07 ` [PATCH v6 00/13] OMAP: GPIO: Implement GPIO in hwmod way Kevin Hilman
2010-09-21 14:06   ` Varadarajan, Charulatha
2010-09-21 17:57     ` Kevin Hilman
2010-09-21 23:34       ` Kevin Hilman
2010-09-22  0:18         ` Kevin Hilman
2010-09-22 14:27           ` Varadarajan, Charulatha
2010-09-22 14:33             ` Kevin Hilman
2010-09-22 23:11           ` Kevin Hilman
2010-09-24 15:12           ` Varadarajan, Charulatha
2010-09-24 18:37             ` Kevin Hilman
2010-09-25 11:59               ` Varadarajan, Charulatha

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=1284819353-8512-12-git-send-email-charu@ti.com \
    --to=charu@ti.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=p-basak2@ti.com \
    --cc=paul@pwsan.com \
    --cc=rnayak@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 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.