From e3799aa1bffbe5e278531dec4cc9453ec7b0bc7e Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 3 Mar 2022 22:44:32 -0800 Subject: [PATCH] Add missing dummy reads --- utils/flash_spi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/flash_spi.c b/utils/flash_spi.c index bb8748d2a..bc4a7f46a 100644 --- a/utils/flash_spi.c +++ b/utils/flash_spi.c @@ -147,6 +147,7 @@ uint8_t spi_flash_read_byte(struct flash_device *fdev, int protocol) for (int i = 7; i >= 0; i--) { reg_write32(fdev->ctrl_reg, 0); + reg_read32(fdev->ctrl_reg); // dummy read val |= ((reg_read32(fdev->ctrl_reg) & FLASH_D_1) != 0) << i; reg_write32(fdev->ctrl_reg, FLASH_CLK); reg_read32(fdev->ctrl_reg); // dummy read @@ -158,6 +159,7 @@ uint8_t spi_flash_read_byte(struct flash_device *fdev, int protocol) for (int i = 6; i >= 0; i -= 2) { reg_write32(fdev->ctrl_reg, 0); + reg_read32(fdev->ctrl_reg); // dummy read val |= (reg_read32(fdev->ctrl_reg) & FLASH_D_01) << i; reg_write32(fdev->ctrl_reg, FLASH_CLK); reg_read32(fdev->ctrl_reg); // dummy read @@ -169,6 +171,7 @@ uint8_t spi_flash_read_byte(struct flash_device *fdev, int protocol) for (int i = 4; i >= 0; i -= 4) { reg_write32(fdev->ctrl_reg, 0); + reg_read32(fdev->ctrl_reg); // dummy read val |= (reg_read32(fdev->ctrl_reg) & FLASH_D_0123) << i; reg_write32(fdev->ctrl_reg, FLASH_CLK); reg_read32(fdev->ctrl_reg); // dummy read