Commit ea306945 authored by Lionel Debieve's avatar Lionel Debieve Committed by Yann Gautier
Browse files

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: default avatarLionel Debieve <lionel.debieve@st.com>
Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
parent 6751b836
/* /*
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved * Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -190,7 +190,7 @@ static int nand_status(uint8_t *status) ...@@ -190,7 +190,7 @@ static int nand_status(uint8_t *status)
return ret; return ret;
} }
int nand_wait_ready(unsigned long delay) int nand_wait_ready(unsigned int delay_ms)
{ {
uint8_t status; uint8_t status;
int ret; int ret;
...@@ -204,7 +204,7 @@ int nand_wait_ready(unsigned long delay) ...@@ -204,7 +204,7 @@ int nand_wait_ready(unsigned long delay)
return ret; return ret;
} }
timeout = timeout_init_us(delay); timeout = timeout_init_us(delay_ms * 1000U);
while (!timeout_elapsed(timeout)) { while (!timeout_elapsed(timeout)) {
ret = nand_read_data(&status, 1U, true); ret = nand_read_data(&status, 1U, true);
if (ret != 0) { if (ret != 0) {
......
...@@ -169,7 +169,7 @@ struct rawnand_device { ...@@ -169,7 +169,7 @@ struct rawnand_device {
}; };
int nand_raw_init(unsigned long long *size, unsigned int *erase_size); 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, int nand_read_page_cmd(unsigned int page, unsigned int offset,
uintptr_t buffer, unsigned int len); uintptr_t buffer, unsigned int len);
int nand_change_read_column_cmd(unsigned int offset, uintptr_t buffer, int nand_change_read_column_cmd(unsigned int offset, uintptr_t buffer,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment