aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Wallner <wolfgang.wallner@br-automation.com>2020-01-14 14:05:48 +0100
committerBin Meng <bmeng.cn@gmail.com>2020-02-04 01:19:28 +0800
commit5e579cc0044b8660fff7fbc043982ff80ff7be7a (patch)
tree391b8604d769927d584d1fa0bd5b291a2e73edcb
parentb58d85363ff5bcd4293387e9e18e12e1add69e4a (diff)
downloadu-boot-5e579cc0044b8660fff7fbc043982ff80ff7be7a.zip
u-boot-5e579cc0044b8660fff7fbc043982ff80ff7be7a.tar.gz
u-boot-5e579cc0044b8660fff7fbc043982ff80ff7be7a.tar.bz2
spi: ich: Drop while loop in hardware sequencing erase case
When ich_spi_exec_op_hwseq() is called to erase a 4k block (opcode = SPINOR_OP_BE_4K), it expects to find a length value in op->data.nbytes, but that value is always 0. As a result, the while loop is never executed and no erase is carried out. Fix this by dropping the loop code entirely, only keeping the relevant parts of the loop body. See http://patchwork.ozlabs.org/patch/1222779/ for more detailed background information and discussion. Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r--drivers/spi/ich.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 133b25b..a9d7715 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -562,16 +562,8 @@ static int ich_spi_exec_op_hwseq(struct spi_slave *slave,
return 0; /* ignore */
case SPINOR_OP_BE_4K:
cycle = HSFSTS_CYCLE_4K_ERASE;
- while (len) {
- uint xfer_len = 0x1000;
-
- ret = exec_sync_hwseq_xfer(regs, cycle, offset, 0);
- if (ret)
- return ret;
- offset += xfer_len;
- len -= xfer_len;
- }
- return 0;
+ ret = exec_sync_hwseq_xfer(regs, cycle, offset, 0);
+ return ret;
default:
debug("Unknown cycle %x\n", op->cmd.opcode);
return -EINVAL;