aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyungmin Park <kmpark@infradead.org>2009-05-12 16:46:57 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-05 13:59:34 -0400
commit31bb999ee73748068ddc271dd99b22dcc418efe3 (patch)
treefba1d50c0ba56936f6fe5a6b9748a08af2e9e455
parent5988af2319781bc8e0ce418affec4e09cfa77907 (diff)
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: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/onenand/onenand_base.c12
-rw-r--r--include/linux/mtd/onenand.h5
2 files changed, 15 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 8d4c9c253732..864327ed7fb3 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1506,7 +1506,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
1506 1506
1507 onenand_update_bufferram(mtd, from, 0); 1507 onenand_update_bufferram(mtd, from, 0);
1508 1508
1509 ret = onenand_bbt_wait(mtd, FL_READING); 1509 ret = this->bbt_wait(mtd, FL_READING);
1510 if (unlikely(ret)) 1510 if (unlikely(ret))
1511 ret = onenand_recover_lsb(mtd, from, ret); 1511 ret = onenand_recover_lsb(mtd, from, ret);
1512 1512
@@ -2527,6 +2527,10 @@ static void onenand_unlock_all(struct mtd_info *mtd)
2527 & ONENAND_CTRL_ONGO) 2527 & ONENAND_CTRL_ONGO)
2528 continue; 2528 continue;
2529 2529
2530 /* Don't check lock status */
2531 if (this->options & ONENAND_SKIP_UNLOCK_CHECK)
2532 return;
2533
2530 /* Check lock status */ 2534 /* Check lock status */
2531 if (onenand_check_lock_status(this)) 2535 if (onenand_check_lock_status(this))
2532 return; 2536 return;
@@ -3442,6 +3446,10 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
3442 this->command = onenand_command; 3446 this->command = onenand_command;
3443 if (!this->wait) 3447 if (!this->wait)
3444 onenand_setup_wait(mtd); 3448 onenand_setup_wait(mtd);
3449 if (!this->bbt_wait)
3450 this->bbt_wait = onenand_bbt_wait;
3451 if (!this->unlock_all)
3452 this->unlock_all = onenand_unlock_all;
3445 3453
3446 if (!this->read_bufferram) 3454 if (!this->read_bufferram)
3447 this->read_bufferram = onenand_read_bufferram; 3455 this->read_bufferram = onenand_read_bufferram;
@@ -3559,7 +3567,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
3559 mtd->owner = THIS_MODULE; 3567 mtd->owner = THIS_MODULE;
3560 3568
3561 /* Unlock whole block */ 3569 /* Unlock whole block */
3562 onenand_unlock_all(mtd); 3570 this->unlock_all(mtd);
3563 3571
3564 ret = this->scan_bbt(mtd); 3572 ret = this->scan_bbt(mtd);
3565 if ((!FLEXONENAND(this)) || ret) 3573 if ((!FLEXONENAND(this)) || ret)
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9aab82c1c743..8ed873374381 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -74,6 +74,8 @@ struct onenand_bufferram {
74 * @command: [REPLACEABLE] hardware specific function for writing 74 * @command: [REPLACEABLE] hardware specific function for writing
75 * commands to the chip 75 * commands to the chip
76 * @wait: [REPLACEABLE] hardware specific function for wait on ready 76 * @wait: [REPLACEABLE] hardware specific function for wait on ready
77 * @bbt_wait: [REPLACEABLE] hardware specific function for bbt wait on ready
78 * @unlock_all: [REPLACEABLE] hardware specific function for unlock all
77 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 79 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
78 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 80 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
79 * @read_word: [REPLACEABLE] hardware specific function for read 81 * @read_word: [REPLACEABLE] hardware specific function for read
@@ -118,6 +120,8 @@ struct onenand_chip {
118 120
119 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); 121 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len);
120 int (*wait)(struct mtd_info *mtd, int state); 122 int (*wait)(struct mtd_info *mtd, int state);
123 int (*bbt_wait)(struct mtd_info *mtd, int state);
124 void (*unlock_all)(struct mtd_info *mtd);
121 int (*read_bufferram)(struct mtd_info *mtd, int area, 125 int (*read_bufferram)(struct mtd_info *mtd, int area,
122 unsigned char *buffer, int offset, size_t count); 126 unsigned char *buffer, int offset, size_t count);
123 int (*write_bufferram)(struct mtd_info *mtd, int area, 127 int (*write_bufferram)(struct mtd_info *mtd, int area,
@@ -184,6 +188,7 @@ struct onenand_chip {
184#define ONENAND_HAS_CONT_LOCK (0x0001) 188#define ONENAND_HAS_CONT_LOCK (0x0001)
185#define ONENAND_HAS_UNLOCK_ALL (0x0002) 189#define ONENAND_HAS_UNLOCK_ALL (0x0002)
186#define ONENAND_HAS_2PLANE (0x0004) 190#define ONENAND_HAS_2PLANE (0x0004)
191#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
187#define ONENAND_PAGEBUF_ALLOC (0x1000) 192#define ONENAND_PAGEBUF_ALLOC (0x1000)
188#define ONENAND_OOBBUF_ALLOC (0x2000) 193#define ONENAND_OOBBUF_ALLOC (0x2000)
189 194