w25qxxxjv: fix missing QSPI locking
There was a missing QSPI locking for w25qxxxjv_get_die_from_addr function. We can't have the lock directly in w25qxxxjv_get_die_from_addr because the function is called from already locked function w25qxxxjv_erase_sector. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
parent
f53afd174e
commit
cde21ae8bf
1 changed files with 6 additions and 2 deletions
|
|
@ -1409,12 +1409,16 @@ static ssize_t w25qxxxjv_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||
* read
|
||||
*/
|
||||
|
||||
w25qxxxjv_lock(priv->qspi);
|
||||
|
||||
if (priv->numofdies != 0)
|
||||
{
|
||||
priv->currentdie = w25qxxxjv_get_die_from_addr(priv, startblock <<
|
||||
priv->pageshift);
|
||||
}
|
||||
|
||||
w25qxxxjv_unlock(priv->qspi);
|
||||
|
||||
#ifdef CONFIG_W25QXXXJV_SECTOR512
|
||||
nbytes = w25qxxxjv_read(dev, startblock << W25QXXXJV_SECTOR512_SHIFT,
|
||||
nblocks << W25QXXXJV_SECTOR512_SHIFT, buffer);
|
||||
|
|
@ -1447,6 +1451,8 @@ static ssize_t w25qxxxjv_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||
finfo("startblock: %08" PRIxOFF " nblocks: %d\n",
|
||||
startblock, (int)nblocks);
|
||||
|
||||
w25qxxxjv_lock(priv->qspi);
|
||||
|
||||
if (priv->numofdies != 0)
|
||||
{
|
||||
priv->currentdie = w25qxxxjv_get_die_from_addr(priv, startblock <<
|
||||
|
|
@ -1455,8 +1461,6 @@ static ssize_t w25qxxxjv_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||
|
||||
/* Lock the QuadSPI bus and write all of the pages to FLASH */
|
||||
|
||||
w25qxxxjv_lock(priv->qspi);
|
||||
|
||||
#if defined(CONFIG_W25QXXXJV_SECTOR512)
|
||||
ret = w25qxxxjv_write_cache(priv, buffer, startblock, nblocks);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue