soc/mediatek/mt8192: Add SPI flash controller dual read function

Support SPI flash dual read funciton which change spi mode (1-1-1)
to dual mode (1-1-2).

Signed-off-by: CK Hu <ck.hu@mediatek.com>
Change-Id: Iabd3668fc4bc42137b7743144fc1cced4fe72737
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44852
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
CK Hu 2020-08-25 14:46:23 +08:00 committed by Patrick Georgi
parent 60296aec76
commit af0b00fa4d
2 changed files with 7 additions and 1 deletions

View File

@ -132,6 +132,9 @@ static int nor_read(const struct spi_flash *flash, u32 addr, size_t len,
u32 done, read_len, copy_len; u32 done, read_len, copy_len;
uint8_t *dest = (uint8_t *)buf; uint8_t *dest = (uint8_t *)buf;
setbits8(&mt8192_nor->read_dual, SFLASH_READ_DUAL_EN);
write8(&mt8192_nor->prgdata[3], SFLASH_1_1_2_READ);
/* DMA: start [ skip | len | drop ] = total end */ /* DMA: start [ skip | len | drop ] = total end */
for (done = 0; done < total; dest += copy_len) { for (done = 0; done < total; dest += copy_len) {
read_len = MIN(dma_buf_len, total - done); read_len = MIN(dma_buf_len, total - done);

View File

@ -29,7 +29,10 @@ enum {
/* DMA commands */ /* DMA commands */
SFLASH_DMA_TRIGGER = 1 << 0, SFLASH_DMA_TRIGGER = 1 << 0,
SFLASH_DMA_SW_RESET = 1 << 1, SFLASH_DMA_SW_RESET = 1 << 1,
SFLASH_DMA_WDLE_EN = 1 << 2 SFLASH_DMA_WDLE_EN = 1 << 2,
/* Dual mode */
SFLASH_READ_DUAL_EN = 0x1,
SFLASH_1_1_2_READ = 0x3b
}; };
/* register Offset */ /* register Offset */