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

bios: litespi: clear rx queue after write Beta #2101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions litex/soc/software/liblitespi/spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ static void spiflash_master_write(uint32_t val, size_t len, size_t width, uint32
spiflash_core_master_rxtx_write(val);
while (!spiflash_rx_ready());

/* Clear RX queue. */
spiflash_core_master_rxtx_read();

/* Clear CS. */
spiflash_core_master_cs_write(0);
}
Expand Down Expand Up @@ -153,7 +156,7 @@ static uint32_t spiflash_read_id_register(void)
transfer_cmd(w_buf, buf, 4);

#ifdef SPIFLASH_DEBUG
printf("[ID: %02x %02x %02x %02x]", buf[0], buf[1], buf[2], buf[3]);
printf("[ID: %02x %02x %02x %02x]\n", buf[0], buf[1], buf[2], buf[3]);
#endif

/* FIXME normally the status should be in buf[1],
Expand All @@ -170,7 +173,7 @@ static uint32_t spiflash_read_status_register(void)
transfer_cmd(w_buf, buf, 4);

#ifdef SPIFLASH_DEBUG
printf("[SR: %02x %02x %02x %02x]", buf[0], buf[1], buf[2], buf[3]);
printf("[SR: %02x %02x %02x %02x]\n", buf[0], buf[1], buf[2], buf[3]);
#endif

/* FIXME normally the status should be in buf[1],
Expand Down
3 changes: 3 additions & 0 deletions litex/soc/software/liblitespi/spiram.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ static void spiram_master_write(uint32_t val, size_t len, size_t width, uint32_t
spiram_core_master_rxtx_write(val);
while (!spiram_rx_ready());

/* Clear RX queue. */
spiflash_core_master_rxtx_read();

/* Clear CS. */
spiram_core_master_cs_write(0);
}
Expand Down
Loading