summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_util.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-10-04 22:20:25 +0200
committerWolfgang Denk <wd@denx.de>2011-10-04 22:20:25 +0200
commit4f7549d2dc00023c5f33d1adc7fee0a77575fcb2 (patch)
treef87d6f02fe74f832d18ab8c11feb0978da53014a /drivers/mtd/nand/nand_util.c
parent1fed668b3fb9c35932f58af00ff5539239fa4e1d (diff)
parent169de9059f24f50c4c7ac794ded060b2c133a29c (diff)
downloadu-boot-imx-4f7549d2dc00023c5f33d1adc7fee0a77575fcb2.zip
u-boot-imx-4f7549d2dc00023c5f33d1adc7fee0a77575fcb2.tar.gz
u-boot-imx-4f7549d2dc00023c5f33d1adc7fee0a77575fcb2.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
* 'master' of git://git.denx.de/u-boot-nand-flash: PPC: Fix socrates NAND problem PPC: Fix fsl_upm.c by renaming nand handling functions NAND: Make page, erase, oob size available via cmd_nand mtd: eLBC NAND: remove elbc_fcm_ctrl->oob_poi NAND: Add -y option to nand scrub command NAND: Add nand read.raw and write.raw commands NAND: Really ignore bad blocks when scrubbing spl, nand: add 4bit HW ecc oob first nand_read_page function mxc_nand: fix a problem writing more than 32MB mxc_nand: fixed some typos (cosmetic) nand: increase chip_delay in mv kirkwood nand driver
Diffstat (limited to 'drivers/mtd/nand/nand_util.c')
-rw-r--r--drivers/mtd/nand/nand_util.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 81bf366..60c778e 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -57,12 +57,6 @@ typedef struct mtd_info mtd_info_t;
#define cpu_to_je16(x) (x)
#define cpu_to_je32(x) (x)
-/*****************************************************************************/
-static int nand_block_bad_scrub(struct mtd_info *mtd, loff_t ofs, int getchip)
-{
- return 0;
-}
-
/**
* nand_erase_opts: - erase NAND flash with support for various options
* (jffs2 formating)
@@ -82,7 +76,6 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
int bbtest = 1;
int result;
int percent_complete = -1;
- int (*nand_block_bad_old)(struct mtd_info *, loff_t, int) = NULL;
const char *mtd_device = meminfo->name;
struct mtd_oob_ops oob_opts;
struct nand_chip *chip = meminfo->priv;
@@ -110,17 +103,15 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
* and disable bad block table while erasing.
*/
if (opts->scrub) {
- struct nand_chip *priv_nand = meminfo->priv;
-
- nand_block_bad_old = priv_nand->block_bad;
- priv_nand->block_bad = nand_block_bad_scrub;
- /* we don't need the bad block table anymore...
+ erase.scrub = opts->scrub;
+ /*
+ * We don't need the bad block table anymore...
* after scrub, there are no bad blocks left!
*/
- if (priv_nand->bbt) {
- kfree(priv_nand->bbt);
+ if (chip->bbt) {
+ kfree(chip->bbt);
}
- priv_nand->bbt = NULL;
+ chip->bbt = NULL;
}
for (erased_length = 0;
@@ -204,12 +195,8 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
if (!opts->quiet)
printf("\n");
- if (nand_block_bad_old) {
- struct nand_chip *priv_nand = meminfo->priv;
-
- priv_nand->block_bad = nand_block_bad_old;
- priv_nand->scan_bbt(meminfo);
- }
+ if (opts->scrub)
+ chip->scan_bbt(meminfo);
return 0;
}