aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Debieve <lionel.debieve@st.com>2020-08-26 16:17:02 +0200
committerYann Gautier <yann.gautier@st.com>2020-09-24 09:32:23 +0200
commitea306945614b88f993947e6fbd77e2cd5f575879 (patch)
tree7d96c53dedfd887cc386df156264d449814bec17
parent6751b83652c1604a77aee9348a240656658d0102 (diff)
downloadtrusted-firmware-a-ea306945614b88f993947e6fbd77e2cd5f575879.tar.gz
nand: raw_nand: fix timeout issue in nand_wait_ready
nand_wait_ready is called with a millisecond delay but the timeout used a micro second. Fixing the conversion in the timeout call. The prototype of the function is also changed to use an unsigned int parameter. Change-Id: Ia3281be7980477dfbfdb842308d35ecd8b926fb8 Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Signed-off-by: Yann Gautier <yann.gautier@st.com>
-rw-r--r--drivers/mtd/nand/raw_nand.c6
-rw-r--r--include/drivers/raw_nand.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw_nand.c b/drivers/mtd/nand/raw_nand.c
index 48131fcb25..1fb5facaff 100644
--- a/drivers/mtd/nand/raw_nand.c
+++ b/drivers/mtd/nand/raw_nand.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, STMicroelectronics - All Rights Reserved
+ * Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -190,7 +190,7 @@ static int nand_status(uint8_t *status)
return ret;
}
-int nand_wait_ready(unsigned long delay)
+int nand_wait_ready(unsigned int delay_ms)
{
uint8_t status;
int ret;
@@ -204,7 +204,7 @@ int nand_wait_ready(unsigned long delay)
return ret;
}
- timeout = timeout_init_us(delay);
+ timeout = timeout_init_us(delay_ms * 1000U);
while (!timeout_elapsed(timeout)) {
ret = nand_read_data(&status, 1U, true);
if (ret != 0) {
diff --git a/include/drivers/raw_nand.h b/include/drivers/raw_nand.h
index 9018f02428..7152300945 100644
--- a/include/drivers/raw_nand.h
+++ b/include/drivers/raw_nand.h
@@ -169,7 +169,7 @@ struct rawnand_device {
};
int nand_raw_init(unsigned long long *size, unsigned int *erase_size);
-int nand_wait_ready(unsigned long delay);
+int nand_wait_ready(unsigned int delay_ms);
int nand_read_page_cmd(unsigned int page, unsigned int offset,
uintptr_t buffer, unsigned int len);
int nand_change_read_column_cmd(unsigned int offset, uintptr_t buffer,