mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
stm32: stm32_flash: add memory barrier during flash write
After writing data to flash space, next instruction is checking if flash controller is busy writing to the flash memory. Memory barrier is required here to avoid transaction re-ordering for data write and busy status check. Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
This commit is contained in:
parent
3ba1352b97
commit
9082517a85
1 changed files with 4 additions and 0 deletions
|
@ -137,6 +137,10 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
|||
/* To make things simple use byte writes only */
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*(uchar *)(addr + i) = src[i];
|
||||
/* avoid re-ordering flash data write and busy status
|
||||
* check as flash memory space attributes are generally Normal
|
||||
*/
|
||||
mb();
|
||||
while (readl(&STM32_FLASH->sr) & STM32_FLASH_SR_BSY)
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue