]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
scsi: Enable FUA bit in WRITE10 commands
authorAswin Murugan <aswin.murugan@oss.qualcomm.com>
Thu, 16 Apr 2026 09:10:47 +0000 (14:40 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 27 Apr 2026 19:44:06 +0000 (13:44 -0600)
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 that prevents
data loss during board resets.

Reviewed-by: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>
Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/scsi/scsi.c

index 9a41779585150854dc6668e38cafa553709855c0..50e7d7499212a835c2f1882f322f776ff9a7a57e 100644 (file)
@@ -107,7 +107,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;