diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2010-06-21 09:59:27 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-07-09 07:31:50 -0400 |
commit | 7dca3343fc5ae5af2fa9248057cd65077a5576e1 (patch) | |
tree | 973030fa645ffe756cde695dd069768a42e52486 /arch/arm/mach-at91/pm.h | |
parent | 5f9f0a412f16b2b849624f1b760477fb35ceff4a (diff) |
ARM: 6185/1: AT91: PM: dual ram controller support
This rework allows to address tow memory controllers. AT91SAM9263 and
AT91SAM9G45 family have tow SDRAM or DDR/SDRAM controllers. Power management
should take care of this.
This patch modify the way RAM IP header files are implemented to allow
access to registers of both controllers ; it also adds some macros.
We also modify the power management files to use those modified header files.
Slow clock (assembly) and regular power management functions are synchronized
for setting of RAM self-refresh procedure:
(lpr & ~AT91_DDRSDRC_LPCB) | AT91_DDRSDRC_LPCB_SELF_REFRESH
Note that AT91RM9200 is not impacted by this modification.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/pm.h')
-rw-r--r-- | arch/arm/mach-at91/pm.h | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 08322c44df1a..8c87d0c1b8f8 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -30,14 +30,50 @@ static inline u32 sdram_selfrefresh_enable(void) | |||
30 | { | 30 | { |
31 | u32 saved_lpr, lpr; | 31 | u32 saved_lpr, lpr; |
32 | 32 | ||
33 | saved_lpr = at91_sys_read(AT91_DDRSDRC_LPR); | 33 | saved_lpr = at91_ramc_read(0, AT91_DDRSDRC_LPR); |
34 | 34 | ||
35 | lpr = saved_lpr & ~AT91_DDRSDRC_LPCB; | 35 | lpr = saved_lpr & ~AT91_DDRSDRC_LPCB; |
36 | at91_sys_write(AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH); | 36 | at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH); |
37 | return saved_lpr; | 37 | return saved_lpr; |
38 | } | 38 | } |
39 | 39 | ||
40 | #define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr) | 40 | #define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr) |
41 | |||
42 | #elif defined(CONFIG_ARCH_AT91SAM9G45) | ||
43 | #include <mach/at91sam9_ddrsdr.h> | ||
44 | |||
45 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to | ||
46 | * remember. | ||
47 | */ | ||
48 | static u32 saved_lpr1; | ||
49 | |||
50 | static inline u32 sdram_selfrefresh_enable(void) | ||
51 | { | ||
52 | /* Those tow values allow us to delay self-refresh activation | ||
53 | * to the maximum. */ | ||
54 | u32 lpr0, lpr1; | ||
55 | u32 saved_lpr0; | ||
56 | |||
57 | saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); | ||
58 | lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; | ||
59 | lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
60 | |||
61 | saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR); | ||
62 | lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB; | ||
63 | lpr0 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; | ||
64 | |||
65 | /* self-refresh mode now */ | ||
66 | at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); | ||
67 | at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); | ||
68 | |||
69 | return saved_lpr0; | ||
70 | } | ||
71 | |||
72 | #define sdram_selfrefresh_disable(saved_lpr0) \ | ||
73 | do { \ | ||
74 | at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); \ | ||
75 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); \ | ||
76 | } while (0) | ||
41 | 77 | ||
42 | #else | 78 | #else |
43 | #include <mach/at91sam9_sdramc.h> | 79 | #include <mach/at91sam9_sdramc.h> |
@@ -47,7 +83,6 @@ static inline u32 sdram_selfrefresh_enable(void) | |||
47 | * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; | 83 | * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; |
48 | * handle those cases both here and in the Suspend-To-RAM support. | 84 | * handle those cases both here and in the Suspend-To-RAM support. |
49 | */ | 85 | */ |
50 | #define AT91_SDRAMC AT91_SDRAMC0 | ||
51 | #warning Assuming EB1 SDRAM controller is *NOT* used | 86 | #warning Assuming EB1 SDRAM controller is *NOT* used |
52 | #endif | 87 | #endif |
53 | 88 | ||
@@ -55,13 +90,13 @@ static inline u32 sdram_selfrefresh_enable(void) | |||
55 | { | 90 | { |
56 | u32 saved_lpr, lpr; | 91 | u32 saved_lpr, lpr; |
57 | 92 | ||
58 | saved_lpr = at91_sys_read(AT91_SDRAMC_LPR); | 93 | saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR); |
59 | 94 | ||
60 | lpr = saved_lpr & ~AT91_SDRAMC_LPCB; | 95 | lpr = saved_lpr & ~AT91_SDRAMC_LPCB; |
61 | at91_sys_write(AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH); | 96 | at91_ramc_write(0, AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH); |
62 | return saved_lpr; | 97 | return saved_lpr; |
63 | } | 98 | } |
64 | 99 | ||
65 | #define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_SDRAMC_LPR, saved_lpr) | 100 | #define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr) |
66 | 101 | ||
67 | #endif | 102 | #endif |