On 1/5/26 06:25, Balaji Selvanathan wrote:
Enable the Force Unit Access (FUA) bit in SCSI WRITE10 commands to
ensure writes bypass the device's volatile cache and go directly to
non-volatile storage. This provides write-through behavior without
requiring explicit cache flushes after each write operation.
Remove the SYNC_CACHE command that was being issued after every
scsi_write() call, as it is redundant when FUA is enabled and was
causing system hangs during large sparse image flashing operations.
Signed-off-by: Aswin Murugan <[email protected]>
Signed-off-by: Balaji Selvanathan <[email protected]>
---
drivers/scsi/scsi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 8fe6b38a8c7..b755616bf3f 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -124,7 +124,7 @@ static void scsi_setup_write_ext(struct scsi_cmd *pccb,
lbaint_t start,
lbaint_t blocks)
{
pccb->cmd[0] = SCSI_WRITE10;
- pccb->cmd[1] = 0;
+ pccb->cmd[1] = 0x08; /* Set FUA bit to bypass write cache */
pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff;
pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff;
pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff;
@@ -301,11 +301,6 @@ static ulong scsi_write(struct udevice *dev, lbaint_t
blknr, lbaint_t blkcnt,
buf_addr += pccb->datalen;
} while (blks != 0);
- /* Flush the SCSI cache so we don't lose data on board reset. */
- scsi_setup_sync_cache(pccb, 0, 0);
- if (scsi_exec(bdev, pccb))
- scsi_print_error(pccb);
-
debug("%s: end startblk " LBAF ", blccnt " LBAF " buffer %lX\n",
__func__, start, blocks, buf_addr);
return blkcnt;
Reviewed-by: Neil Armstrong <[email protected]>