File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,6 +391,11 @@ int ospi_flash_xip_restore(ospi_flash_t *self) {
391391/******************************************************************************/
392392// Top-level read/erase/write functions.
393393
394+ void ospi_flash_sleep (void ) {
395+ ospi_flash_t * self = & global_flash ;
396+ ospi_flash_write_cmd (self , self -> set -> power_down_command );
397+ }
398+
394399int ospi_flash_erase_sector (uint32_t addr ) {
395400 ospi_flash_t * self = & global_flash ;
396401
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ typedef struct _ospi_flash_settings_t {
7373 uint8_t read_dummy_cycles ;
7474 uint16_t write_command ;
7575 uint16_t erase_command ;
76+ uint16_t power_down_command ;
7677} ospi_flash_settings_t ;
7778
7879// Provided by the board when it enables OSPI.
@@ -97,6 +98,7 @@ int ospi_flash_xip_exit(struct _ospi_flash_t *self);
9798// SPI flash interface.
9899int ospi_flash_init (void );
99100uintptr_t ospi_flash_get_xip_base (void );
101+ void ospi_flash_sleep (void );
100102int ospi_flash_erase_sector (uint32_t addr );
101103int ospi_flash_read (uint32_t addr , uint32_t len , uint8_t * dest );
102104int ospi_flash_write (uint32_t addr , uint32_t len , const uint8_t * src );
Original file line number Diff line number Diff line change 4444 .read_id_dummy_cycles = 4, \
4545 .read_command = 0xee11, \
4646 .write_command = 0x12ed, \
47- .erase_command = 0x21de
47+ .erase_command = 0x21de, \
48+ .power_down_command = 0xb946
4849
4950// Everspin EM.
5051#define OSPI_FLASH_SETTINGS_EM \
6162 .read_id_dummy_cycles = 8, \
6263 .read_command = 0xfd, \
6364 .write_command = 0xc2, \
64- .erase_command = 0x21
65+ .erase_command = 0x21, \
66+ .power_down_command = 0xb9
6567
6668// ISSI IS25.
6769#define OSPI_FLASH_SETTINGS_IS25 \
7880 .read_id_dummy_cycles = 8, \
7981 .read_command = 0xfd, \
8082 .write_command = 0xc2, \
81- .erase_command = 0x21
83+ .erase_command = 0x21, \
84+ .power_down_command = 0xb9
85+
8286#endif // __OSPI_FLASH_SETTINGS_H__
You can’t perform that action at this time.
0 commit comments