mirror of
https://github.com/CTCaer/switch-l4t-atf.git
synced 2025-02-07 19:06:52 +00:00
norflash: Clear status register before sending commands
The status register bits remain until explicitly cleared, which means that a command can be incorrectly considered to have generated an error - for example, after reset the status register contents may be unknown or if a previous command had failed. This patch clears the status register before beginning any command to be sure that the status register only represents information about the current operation. Change-Id: I9e98110ee24179937215461c00b6543a3467b350 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
This commit is contained in:
parent
9753cb5b51
commit
b4b09ca567
@ -68,6 +68,8 @@ int nor_word_program(uintptr_t base_addr, unsigned long data)
|
||||
uint32_t status;
|
||||
int ret;
|
||||
|
||||
nor_send_cmd(base_addr, NOR_CMD_CLEAR_STATUS_REG);
|
||||
|
||||
/* Set the device in write word mode */
|
||||
nor_send_cmd(base_addr, NOR_CMD_WORD_PROGRAM);
|
||||
mmio_write_32(base_addr, data);
|
||||
@ -98,8 +100,10 @@ int nor_lock(uintptr_t base_addr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
nor_send_cmd(base_addr, NOR_CMD_CLEAR_STATUS_REG);
|
||||
|
||||
nor_send_cmd(base_addr, NOR_CMD_LOCK_UNLOCK);
|
||||
mmio_write_32(base_addr, NOR_2X16(NOR_LOCK_BLOCK));
|
||||
nor_send_cmd(base_addr, NOR_LOCK_BLOCK);
|
||||
|
||||
ret = nor_poll_dws(base_addr, DWS_WORD_LOCK_RETRIES);
|
||||
nor_send_cmd(base_addr, NOR_CMD_READ_ARRAY);
|
||||
@ -117,8 +121,10 @@ int nor_unlock(uintptr_t base_addr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
nor_send_cmd(base_addr, NOR_CMD_CLEAR_STATUS_REG);
|
||||
|
||||
nor_send_cmd(base_addr, NOR_CMD_LOCK_UNLOCK);
|
||||
mmio_write_32(base_addr, NOR_2X16(NOR_UNLOCK_BLOCK));
|
||||
nor_send_cmd(base_addr, NOR_UNLOCK_BLOCK);
|
||||
|
||||
ret = nor_poll_dws(base_addr, DWS_WORD_LOCK_RETRIES);
|
||||
nor_send_cmd(base_addr, NOR_CMD_READ_ARRAY);
|
||||
|
Loading…
x
Reference in New Issue
Block a user