aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/onenand/onenand_base.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index b2c40f67db83..f633941011a5 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1904,7 +1904,12 @@ static int onenand_do_lock_cmd(struct mtd_info *mtd, loff_t ofs, size_t len, int
1904 */ 1904 */
1905static int onenand_lock(struct mtd_info *mtd, loff_t ofs, size_t len) 1905static int onenand_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
1906{ 1906{
1907 return onenand_do_lock_cmd(mtd, ofs, len, ONENAND_CMD_LOCK); 1907 int ret;
1908
1909 onenand_get_device(mtd, FL_LOCKING);
1910 ret = onenand_do_lock_cmd(mtd, ofs, len, ONENAND_CMD_LOCK);
1911 onenand_release_device(mtd);
1912 return ret;
1908} 1913}
1909 1914
1910/** 1915/**
@@ -1917,7 +1922,12 @@ static int onenand_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
1917 */ 1922 */
1918static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) 1923static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
1919{ 1924{
1920 return onenand_do_lock_cmd(mtd, ofs, len, ONENAND_CMD_UNLOCK); 1925 int ret;
1926
1927 onenand_get_device(mtd, FL_LOCKING);
1928 ret = onenand_do_lock_cmd(mtd, ofs, len, ONENAND_CMD_UNLOCK);
1929 onenand_release_device(mtd);
1930 return ret;
1921} 1931}
1922 1932
1923/** 1933/**
@@ -1979,7 +1989,7 @@ static int onenand_unlock_all(struct mtd_info *mtd)
1979 loff_t ofs = this->chipsize >> 1; 1989 loff_t ofs = this->chipsize >> 1;
1980 size_t len = mtd->erasesize; 1990 size_t len = mtd->erasesize;
1981 1991
1982 onenand_unlock(mtd, ofs, len); 1992 onenand_do_lock_cmd(mtd, ofs, len, ONENAND_CMD_UNLOCK);
1983 } 1993 }
1984 1994
1985 onenand_check_lock_status(this); 1995 onenand_check_lock_status(this);
@@ -1987,7 +1997,7 @@ static int onenand_unlock_all(struct mtd_info *mtd)
1987 return 0; 1997 return 0;
1988 } 1998 }
1989 1999
1990 onenand_unlock(mtd, 0x0, this->chipsize); 2000 onenand_do_lock_cmd(mtd, 0x0, this->chipsize, ONENAND_CMD_UNLOCK);
1991 2001
1992 return 0; 2002 return 0;
1993} 2003}