Commit 31bb999e authored by Kyungmin Park's avatar Kyungmin Park Committed by David Woodhouse

mtd: onenand: add bbt_wait & unlock_all as replaceable for some platform

Add bbt_wait & unlock_all as replaceable for some platform such as
  s3c64xx s3c64xx has its own OneNAND controller and another interface
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 5988af23
...@@ -1506,7 +1506,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1506,7 +1506,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
onenand_update_bufferram(mtd, from, 0); onenand_update_bufferram(mtd, from, 0);
ret = onenand_bbt_wait(mtd, FL_READING); ret = this->bbt_wait(mtd, FL_READING);
if (unlikely(ret)) if (unlikely(ret))
ret = onenand_recover_lsb(mtd, from, ret); ret = onenand_recover_lsb(mtd, from, ret);
...@@ -2527,6 +2527,10 @@ static void onenand_unlock_all(struct mtd_info *mtd) ...@@ -2527,6 +2527,10 @@ static void onenand_unlock_all(struct mtd_info *mtd)
& ONENAND_CTRL_ONGO) & ONENAND_CTRL_ONGO)
continue; continue;
/* Don't check lock status */
if (this->options & ONENAND_SKIP_UNLOCK_CHECK)
return;
/* Check lock status */ /* Check lock status */
if (onenand_check_lock_status(this)) if (onenand_check_lock_status(this))
return; return;
...@@ -3442,6 +3446,10 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) ...@@ -3442,6 +3446,10 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
this->command = onenand_command; this->command = onenand_command;
if (!this->wait) if (!this->wait)
onenand_setup_wait(mtd); onenand_setup_wait(mtd);
if (!this->bbt_wait)
this->bbt_wait = onenand_bbt_wait;
if (!this->unlock_all)
this->unlock_all = onenand_unlock_all;
if (!this->read_bufferram) if (!this->read_bufferram)
this->read_bufferram = onenand_read_bufferram; this->read_bufferram = onenand_read_bufferram;
...@@ -3559,7 +3567,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) ...@@ -3559,7 +3567,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
mtd->owner = THIS_MODULE; mtd->owner = THIS_MODULE;
/* Unlock whole block */ /* Unlock whole block */
onenand_unlock_all(mtd); this->unlock_all(mtd);
ret = this->scan_bbt(mtd); ret = this->scan_bbt(mtd);
if ((!FLEXONENAND(this)) || ret) if ((!FLEXONENAND(this)) || ret)
......
...@@ -74,6 +74,8 @@ struct onenand_bufferram { ...@@ -74,6 +74,8 @@ struct onenand_bufferram {
* @command: [REPLACEABLE] hardware specific function for writing * @command: [REPLACEABLE] hardware specific function for writing
* commands to the chip * commands to the chip
* @wait: [REPLACEABLE] hardware specific function for wait on ready * @wait: [REPLACEABLE] hardware specific function for wait on ready
* @bbt_wait: [REPLACEABLE] hardware specific function for bbt wait on ready
* @unlock_all: [REPLACEABLE] hardware specific function for unlock all
* @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
* @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
* @read_word: [REPLACEABLE] hardware specific function for read * @read_word: [REPLACEABLE] hardware specific function for read
...@@ -118,6 +120,8 @@ struct onenand_chip { ...@@ -118,6 +120,8 @@ struct onenand_chip {
int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len);
int (*wait)(struct mtd_info *mtd, int state); int (*wait)(struct mtd_info *mtd, int state);
int (*bbt_wait)(struct mtd_info *mtd, int state);
void (*unlock_all)(struct mtd_info *mtd);
int (*read_bufferram)(struct mtd_info *mtd, int area, int (*read_bufferram)(struct mtd_info *mtd, int area,
unsigned char *buffer, int offset, size_t count); unsigned char *buffer, int offset, size_t count);
int (*write_bufferram)(struct mtd_info *mtd, int area, int (*write_bufferram)(struct mtd_info *mtd, int area,
...@@ -184,6 +188,7 @@ struct onenand_chip { ...@@ -184,6 +188,7 @@ struct onenand_chip {
#define ONENAND_HAS_CONT_LOCK (0x0001) #define ONENAND_HAS_CONT_LOCK (0x0001)
#define ONENAND_HAS_UNLOCK_ALL (0x0002) #define ONENAND_HAS_UNLOCK_ALL (0x0002)
#define ONENAND_HAS_2PLANE (0x0004) #define ONENAND_HAS_2PLANE (0x0004)
#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
#define ONENAND_PAGEBUF_ALLOC (0x1000) #define ONENAND_PAGEBUF_ALLOC (0x1000)
#define ONENAND_OOBBUF_ALLOC (0x2000) #define ONENAND_OOBBUF_ALLOC (0x2000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment