From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] at91 : group selfrefresh functions
Date: Wed, 11 Jan 2012 15:55:39 +0100 [thread overview]
Message-ID: <1326293740-15735-7-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1326293740-15735-1-git-send-email-daniel.lezcano@linaro.org>
Group in a single function the multiple functions declaration.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
arch/arm/mach-at91/pm.h | 105 ++++++++++++++++------------------------------
1 files changed, 37 insertions(+), 68 deletions(-)
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index b9de247..aaa8e14 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -18,7 +18,13 @@ struct ram_saved {
u32 lpr1;
};
-#ifdef CONFIG_ARCH_AT91RM9200
+#ifdef CONFIG_ARCH_AT91SAM9263
+/*
+ * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
+ * handle those cases both here and in the Suspend-To-RAM support.
+ */
+#warning Assuming EB1 SDRAM controller is *NOT* used
+#endif
/*
* The AT91RM9200 goes into self-refresh mode with this command, and will
@@ -32,56 +38,32 @@ struct ram_saved {
static inline void sdram_selfrefresh_enable(struct ram_saved *rs)
{
- rs->lpr0 = at91_sys_read(AT91_SDRAMC_LPR);
+ u32 lpr0;
+
+#ifdef CONFIG_ARCH_AT91RM9200
+
+ lpr0 = at91_sys_read(AT91_SDRAMC_LPR);
at91_sys_write(AT91_SDRAMC_LPR, 0);
at91_sys_write(AT91_SDRAMC_SRR, 1);
-}
-static inline void sdram_selfrefresh_disable(struct ram_saved *rs)
-{
- at91_sys_write(AT91_SDRAMC_LPR, rs->lpr0);
-}
-
-static inline void wait_for_interrupt_enable(void)
-{
- asm volatile ("mcr p15, 0, %0, c7, c0, 4" : : "r" (0));
-}
+ rs->lpr0 = lpr0;
#elif defined(CONFIG_ARCH_AT91CAP9)
-static inline void sdram_selfrefresh_enable(struct ram_saved *rs)
-{
- u32 lpr;
-
rs->lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
- lpr = rs->lpr0 & ~AT91_DDRSDRC_LPCB;
- at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr |
+ lpr0 = rs->lpr0 & ~AT91_DDRSDRC_LPCB;
+ at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0 |
AT91_DDRSDRC_LPCB_SELF_REFRESH);
-}
-
-static inline void sdram_selfrefresh_disable(struct ram_saved *rs)
-{
- at91_ramc_write(0, AT91_DDRSDRC_LPR, rs->lpr0);
-}
-
-static inline void wait_for_interrupt_enable(void)
-{
- cpu_do_idle();
-}
-
#elif defined(CONFIG_ARCH_AT91SAM9G45)
-/* We manage both DDRAM/SDRAM controllers, we need more than one value to
- * remember.
- */
-static inline void sdram_selfrefresh_enable(struct ram_saved *rs)
-{
- /* Those tow values allow us to delay self-refresh activation
- * to the maximum. */
- u32 lpr0, lpr1;
+ /* We manage both DDRAM/SDRAM controllers, we need more than one value
+ * to remember */
+ u32 lpr1;
+ /* Those two values allow us to delay self-refresh activation
+ * to the maximum. */
rs->lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
lpr1 = rs->lpr1 & ~AT91_DDRSDRC_LPCB;
lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
@@ -93,50 +75,37 @@ static inline void sdram_selfrefresh_enable(struct ram_saved *rs)
/* self-refresh mode now */
at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
+#else
+ rs->lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR);
+ lpr0 = rs->lpr0 & ~AT91_SDRAMC_LPCB;
+ at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0 |
+ AT91_SDRAMC_LPCB_SELF_REFRESH);
+
+#endif
}
static inline void sdram_selfrefresh_disable(struct ram_saved *rs)
{
+#ifdef CONFIG_ARCH_AT91RM9200
+ at91_sys_write(AT91_SDRAMC_LPR, rs->lpr0);
+#elif defined(CONFIG_ARCH_AT91CAP9)
+ at91_ramc_write(0, AT91_DDRSDRC_LPR, rs->lpr0);
+#elif defined(CONFIG_ARCH_AT91SAM9G45)
at91_ramc_write(0, AT91_DDRSDRC_LPR, rs->lpr0);
at91_ramc_write(1, AT91_DDRSDRC_LPR, rs->lpr1);
-}
-
-static inline void wait_for_interrupt_enable(void)
-{
- cpu_do_idle();
-}
-
#else
-
-#ifdef CONFIG_ARCH_AT91SAM9263
-/*
- * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
- * handle those cases both here and in the Suspend-To-RAM support.
- */
-#warning Assuming EB1 SDRAM controller is *NOT* used
+ at91_ramc_write(0, AT91_SDRAMC_LPR, rs->lpr0);
#endif
-static inline void sdram_selfrefresh_enable(struct ram_saved *rs)
-{
- u32 lpr;
-
- rs->lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR);
-
- lpr = rs->lpr0 & ~AT91_SDRAMC_LPCB;
- at91_ramc_write(0, AT91_SDRAMC_LPR, lpr |
- AT91_SDRAMC_LPCB_SELF_REFRESH);
-}
-
-static inline void sdram_selfrefresh_disable(struct ram_saved *rs)
-{
- at91_ramc_write(0, AT91_SDRAMC_LPR, rs->lpr0);
}
static inline void wait_for_interrupt_enable(void)
{
+#ifdef CONFIG_ARCH_AT91RM9200
+ asm volatile ("mcr p15, 0, %0, c7, c0, 4" : : "r" (0));
+#else
cpu_do_idle();
-}
-
#endif
+}
#endif
--
1.7.4.1
next prev parent reply other threads:[~2012-01-11 14:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 14:55 [PATCH 0/7] at91 : pm.h cleanups Daniel Lezcano
2012-01-11 14:55 ` [PATCH 1/7] at91 : coding style fixes Daniel Lezcano
2012-01-11 14:55 ` [PATCH 2/7] at91 : declare header name Daniel Lezcano
2012-01-11 14:55 ` [PATCH 3/7] at91 : group headers inclusion for the memory controller Daniel Lezcano
2012-01-11 14:55 ` [PATCH 4/7] at91 : convert pm.h macros to static inline functions Daniel Lezcano
2012-01-11 14:55 ` [PATCH 5/7] at91 : fix dirty hack for the selfrefresh function Daniel Lezcano
2012-01-11 15:10 ` Arnd Bergmann
2012-01-11 16:55 ` Russell King - ARM Linux
2012-01-11 18:27 ` Arnd Bergmann
2012-01-11 19:43 ` Russell King - ARM Linux
2012-01-12 14:41 ` Nicolas Ferre
2012-01-12 19:36 ` Russell King - ARM Linux
2012-01-13 0:38 ` Rob Lee
2012-01-13 9:29 ` Daniel Lezcano
2012-01-13 10:22 ` Russell King - ARM Linux
2012-01-13 15:48 ` Arnd Bergmann
2012-01-13 17:25 ` Rob Lee
2012-01-11 14:55 ` Daniel Lezcano [this message]
2012-01-11 16:56 ` [PATCH 6/7] at91 : group selfrefresh functions Russell King - ARM Linux
2012-01-11 14:55 ` [PATCH 7/7] at91 : fix compilation warning Daniel Lezcano
2012-01-11 15:23 ` [PATCH 0/7] at91 : pm.h cleanups Arnd Bergmann
2012-01-11 16:29 ` Daniel Lezcano
2012-01-23 6:29 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-11 16:57 ` Russell King - ARM Linux
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=1326293740-15735-7-git-send-email-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--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).