Skip to content

Commit 6f13fd5

Browse files
avasquez01James Bottomley
authored andcommitted
[SCSI] qla2xxx: Wait for FLASH write-protection to complete after a write.
Some flash parts have a slow enable write-protection (WP) operation whereby subsequent FLASH accesses would fail if the WP operation had not completed. Software now polls the SPI's status-register for WP completion. Signed-off-by: Andrew Vasquez <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 3776541 commit 6f13fd5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/scsi/qla2xxx/qla_sup.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
550550
int ret;
551551
uint32_t liter, miter;
552552
uint32_t sec_mask, rest_addr, conf_addr;
553-
uint32_t fdata, findex ;
553+
uint32_t fdata, findex, cnt;
554554
uint8_t man_id, flash_id;
555555
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
556556
dma_addr_t optrom_dma;
@@ -690,8 +690,14 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
690690
0xff0000) | ((fdata >> 16) & 0xff));
691691
}
692692

693-
/* Enable flash write-protection. */
693+
/* Enable flash write-protection and wait for completion. */
694694
qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0x9c);
695+
for (cnt = 300; cnt &&
696+
qla24xx_read_flash_dword(ha,
697+
flash_conf_to_access_addr(0x005)) & BIT_0;
698+
cnt--) {
699+
udelay(10);
700+
}
695701

696702
/* Disable flash write. */
697703
WRT_REG_DWORD(&reg->ctrl_status,

0 commit comments

Comments
 (0)