stm32/sdram: Add function to enable SDRAM power-down mode.

Add power-down mode for maximum power saving while in standby mode, to be
used by a board if needed.  Also fix a typo in a comment.
This commit is contained in:
iabdalkader 2022-04-07 16:29:44 +02:00 committed by Damien George
parent cb0372b5bf
commit 2a19c3cfe1
2 changed files with 10 additions and 1 deletions

View File

@ -259,7 +259,7 @@ static void sdram_init_seq(SDRAM_HandleTypeDef
void sdram_enter_low_power(void) {
// Enter self-refresh mode.
// In self-refresh mode the SDRAM retains data with external clocking.
// In self-refresh mode the SDRAM retains data without external clocking.
FMC_SDRAM_DEVICE->SDCMR |= (FMC_SDRAM_CMD_SELFREFRESH_MODE | // Command Mode
FMC_SDRAM_CMD_TARGET_BANK | // Command Target
(0 << 5U) | // Auto Refresh Number -1
@ -276,6 +276,14 @@ void sdram_leave_low_power(void) {
(0 << 9U)); // Mode Register Definition
}
void sdram_enter_power_down(void) {
// Enter power-down mode.
FMC_SDRAM_DEVICE->SDCMR |= (FMC_SDRAM_CMD_POWERDOWN_MODE | // Command Mode
FMC_SDRAM_CMD_TARGET_BANK | // Command Target
(0 << 5U) | // Auto Refresh Number -1
(0 << 9U)); // Mode Register Definition
}
#if __GNUC__ >= 11
// Prevent array bounds warnings when accessing SDRAM_START_ADDRESS as a memory pointer.
#pragma GCC diagnostic push

View File

@ -13,5 +13,6 @@ void *sdram_start(void);
void *sdram_end(void);
void sdram_enter_low_power(void);
void sdram_leave_low_power(void);
void sdram_enter_power_down(void);
bool sdram_test(bool exhaustive);
#endif // __SDRAM_H__