From: Charulatha V <charu@ti.com>
To: linux-omap@vger.kernel.org
Cc: paul@pwsan.com, khilman@deeprootsystems.com, b-cousson@ti.com,
rnayak@ti.com, Charulatha V <charu@ti.com>,
"Basak, Partha" <p-basak2@ti.com>
Subject: [PATCH 11/13 v5] OMAP: GPIO: Make gpio_context as part of gpio_bank structure
Date: Fri, 6 Aug 2010 18:04:23 +0530 [thread overview]
Message-ID: <1281098065-24177-12-git-send-email-charu@ti.com> (raw)
In-Reply-To: <1281098065-24177-11-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>
Signed-off-by: Basak, Partha <p-basak2@ti.com>
---
arch/arm/plat-omap/gpio.c | 70 ++++++++++++++++++++++-----------------------
1 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index a377d40..6a5cf43 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -132,6 +132,19 @@
#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;
@@ -156,27 +169,11 @@ struct gpio_bank {
u32 mod_usage;
u32 dbck_enable_mask;
struct device *dev;
+ struct omap_gpio_regs gpio_context;
bool dbck_flag;
bool off_mode_support;
};
-#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
@@ -2032,25 +2029,25 @@ void omap_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);
}
}
@@ -2063,24 +2060,25 @@ void omap_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.6.3.3
next prev parent reply other threads:[~2010-08-06 12:31 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 12:34 [PATCH 00/13 v5] OMAP: GPIO: Implement GPIO in HWMOD way Charulatha V
2010-08-06 12:34 ` [PATCH 01/13 v5] OMAP: GPIO: Modify init() in preparation for platform device implementation Charulatha V
2010-08-06 12:34 ` [PATCH 02/13 v5] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init Charulatha V
2010-08-06 12:34 ` [PATCH 03/13 v5] OMAP: GPIO: Introduce support for OMAP16xx " Charulatha V
2010-08-06 12:34 ` [PATCH 04/13 v5] OMAP: GPIO: Introduce support for OMAP7xx " Charulatha V
2010-08-06 12:34 ` [PATCH 05/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP3 Charulatha V
2010-08-06 12:34 ` [PATCH 06/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP242X Charulatha V
2010-08-06 12:34 ` [PATCH 07/13 v5] OMAP: GPIO: add GPIO hwmods structures for OMAP243X Charulatha V
2010-08-06 12:34 ` [PATCH 08/13 v5] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct Charulatha V
2010-08-06 12:34 ` [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init Charulatha V
2010-08-06 12:34 ` [PATCH 10/13 v5] OMAP: GPIO: Implement GPIO as a platform device Charulatha V
2010-08-06 12:34 ` Charulatha V [this message]
2010-08-06 12:34 ` [PATCH 12/13 v5] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class Charulatha V
2010-08-06 12:34 ` [PATCH 13/13 v5] OMAP: GPIO: Remove omap_gpio_init() Charulatha V
2010-08-09 23:00 ` Kevin Hilman
2010-08-10 5:22 ` Varadarajan, Charulatha
2010-08-09 21:45 ` [PATCH 12/13 v5] OMAP: GPIO: Use dev_pm_ops instead of sys_dev_class Kevin Hilman
2010-08-10 0:21 ` Kevin Hilman
2010-08-10 12:37 ` Basak, Partha
2010-08-10 18:10 ` Kevin Hilman
2010-08-12 7:49 ` Basak, Partha
2010-08-12 14:07 ` Kevin Hilman
2010-08-12 12:43 ` Basak, Partha
2010-08-09 23:06 ` [PATCH 10/13 v5] OMAP: GPIO: Implement GPIO as a platform device Kevin Hilman
2010-08-10 11:53 ` Basak, Partha
2010-08-10 17:59 ` Kevin Hilman
2010-08-11 5:47 ` Paul Walmsley
2010-08-12 12:10 ` Basak, Partha
2010-08-23 15:46 ` Basak, Partha
2010-08-09 23:58 ` [PATCH 09/13 v5] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init Kevin Hilman
2010-08-10 5:56 ` Varadarajan, Charulatha
2010-08-10 0:21 ` Kevin Hilman
2010-08-09 3:51 ` [PATCH 03/13 v5] OMAP: GPIO: Introduce support for OMAP16xx " DebBarma, Tarun Kanti
2010-08-09 22:20 ` [PATCH 01/13 v5] OMAP: GPIO: Modify init() in preparation for platform device implementation Kevin Hilman
2010-08-10 5:18 ` Varadarajan, Charulatha
2010-08-10 7:20 ` Basak, Partha
2010-08-10 10:44 ` Cousson, Benoit
2010-08-10 11:31 ` Basak, Partha
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=1281098065-24177-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 \
/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).