Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liblitespi: add 4k erase function #2129

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions litex/soc/software/liblitespi/spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ void spiflash_erase_range(uint32_t addr, uint32_t len)
}
}

void spiflash_erase_4k_sector(uint32_t addr)
{
w_buf[0] = 0x20;
w_buf[1] = addr>>16;
w_buf[2] = addr>>8;
w_buf[3] = addr>>0;
transfer_cmd(w_buf, r_buf, 4);
}

int spiflash_write_stream(uint32_t addr, uint8_t *stream, uint32_t len)
{
int res = 0;
Expand Down
1 change: 1 addition & 0 deletions litex/soc/software/liblitespi/spiflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void spiflash_memspeed(void);
void spiflash_init(void);
int spiflash_write_stream(uint32_t addr, uint8_t *stream, uint32_t len);
void spiflash_erase_range(uint32_t addr, uint32_t len);
void spiflash_erase_4k_sector(uint32_t addr);

#ifdef __cplusplus
}
Expand Down