soc/intel/cmn/blk/fast_spi: Cancel DMA transfer before locking
This commit addresses a potential low power state over-consumption issue. This issue could arise if SPI DMA has been locked down while a transfer was still marked as active, typically if a SPI DMA transfer failed and hung. The fast_spi_dma_lock() function now checks if a DMA transfer is ongoing and ensures that it is marked as complete before locking the DMA control register. Change-Id: I5e08991b2160a43013b129d302c46fc229f2286d Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88913 Reviewed-by: Zhixing Ma <zhixing.ma@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Bora Guvendik <bora.guvendik@intel.com>
This commit is contained in:
parent
b3ad2aa3e7
commit
ef0c650edf
1 changed files with 13 additions and 0 deletions
|
|
@ -516,6 +516,19 @@ static void fast_spi_dma_lock(void *unused)
|
|||
if (control.fields.lock)
|
||||
return;
|
||||
|
||||
/* Ensure that any ongoing DMA transfer is marked as complete before locking. */
|
||||
if (control.fields.start) {
|
||||
union fast_spi_dma_status status = {fast_spi_read(FAST_SPI_DMA_STATUS)};
|
||||
if (!status.fields.complete) {
|
||||
status.data = 0;
|
||||
status.fields.complete = 1;
|
||||
fast_spi_write(FAST_SPI_DMA_STATUS, status.data);
|
||||
}
|
||||
|
||||
control.fields.start = 0;
|
||||
fast_spi_write(FAST_SPI_DMA_CONTROL, control.data);
|
||||
}
|
||||
|
||||
control.fields.lock = 1;
|
||||
fast_spi_write(FAST_SPI_DMA_CONTROL, control.data);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue