mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-14 00:24:16 +00:00
fix(nand): reset the SLC NAND
The reset command should be the first command sent to the SLC NAND. Resetting the SLC NAND should not be done only if NAND_ONFI_DETECT is enabled. Change-Id: If225a1b1a7e04181cc5839e282c435c5c8958bd7 Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
This commit is contained in:
parent
53092a7780
commit
f4d765a128
1 changed files with 19 additions and 17 deletions
|
@ -218,6 +218,18 @@ int nand_wait_ready(unsigned int delay_ms)
|
|||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
static int nand_reset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = nand_send_cmd(NAND_CMD_RESET, NAND_TWB_MAX);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return nand_send_wait(PSEC_TO_MSEC(NAND_TRST_MAX), 0U);
|
||||
}
|
||||
|
||||
#if NAND_ONFI_DETECT
|
||||
static uint16_t nand_check_crc(uint16_t crc, uint8_t *data_in,
|
||||
unsigned int data_len)
|
||||
|
@ -265,18 +277,6 @@ static int nand_read_id(uint8_t addr, uint8_t *id, unsigned int size)
|
|||
return nand_read_data(id, size, true);
|
||||
}
|
||||
|
||||
static int nand_reset(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = nand_send_cmd(NAND_CMD_RESET, NAND_TWB_MAX);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return nand_send_wait(PSEC_TO_MSEC(NAND_TRST_MAX), 0U);
|
||||
}
|
||||
|
||||
static int nand_read_param_page(void)
|
||||
{
|
||||
struct nand_param_page page;
|
||||
|
@ -346,11 +346,6 @@ static int detect_onfi(void)
|
|||
int ret;
|
||||
char id[4];
|
||||
|
||||
ret = nand_reset();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nand_read_id(ONFI_SIGNATURE_ADDR, (uint8_t *)id, sizeof(id));
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
@ -406,6 +401,8 @@ void nand_raw_ctrl_init(const struct nand_ctrl_ops *ops)
|
|||
|
||||
int nand_raw_init(unsigned long long *size, unsigned int *erase_size)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rawnand_dev.nand_dev = get_nand_device();
|
||||
if (rawnand_dev.nand_dev == NULL) {
|
||||
return -EINVAL;
|
||||
|
@ -420,6 +417,11 @@ int nand_raw_init(unsigned long long *size, unsigned int *erase_size)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = nand_reset();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if NAND_ONFI_DETECT
|
||||
if (detect_onfi() != 0) {
|
||||
WARN("Detect ONFI failed\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue