projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge with git://www.denx.de/git/u-boot.git
[platform/kernel/u-boot.git]
/
drivers
/
nand
/
nand_base.c
diff --git
a/drivers/nand/nand_base.c
b/drivers/nand/nand_base.c
index
b003085
..
151f535
100644
(file)
--- a/
drivers/nand/nand_base.c
+++ b/
drivers/nand/nand_base.c
@@
-72,7
+72,7
@@
#include <common.h>
#include <common.h>
-#if
(CONFIG_COMMANDS & CF
G_CMD_NAND) && !defined(CFG_NAND_LEGACY)
+#if
defined(CONFI
G_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include <malloc.h>
#include <watchdog.h>
#include <malloc.h>
#include <watchdog.h>
@@
-427,8
+427,9
@@
static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
struct nand_chip *this = mtd->priv;
u16 bad;
struct nand_chip *this = mtd->priv;
u16 bad;
+ page = (int)(ofs >> this->page_shift) & this->pagemask;
+
if (getchip) {
if (getchip) {
- page = (int)(ofs >> this->page_shift);
chipnr = (int)(ofs >> this->chip_shift);
/* Grab the lock and see if the device is available */
chipnr = (int)(ofs >> this->chip_shift);
/* Grab the lock and see if the device is available */
@@
-436,18
+437,17
@@
static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
/* Select the NAND device */
this->select_chip(mtd, chipnr);
/* Select the NAND device */
this->select_chip(mtd, chipnr);
- } else
- page = (int) ofs;
+ }
if (this->options & NAND_BUSWIDTH_16) {
if (this->options & NAND_BUSWIDTH_16) {
- this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page
& this->pagemask
);
+ this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page);
bad = cpu_to_le16(this->read_word(mtd));
if (this->badblockpos & 0x1)
bad >>= 1;
if ((bad & 0xFF) != 0xff)
res = 1;
} else {
bad = cpu_to_le16(this->read_word(mtd));
if (this->badblockpos & 0x1)
bad >>= 1;
if ((bad & 0xFF) != 0xff)
res = 1;
} else {
- this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos, page
& this->pagemask
);
+ this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos, page);
if (this->read_byte(mtd) != 0xff)
res = 1;
}
if (this->read_byte(mtd) != 0xff)
res = 1;
}
@@
-838,9
+838,9
@@
static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
unsigned long timeo;
if (state == FL_ERASING)
unsigned long timeo;
if (state == FL_ERASING)
- timeo =
CFG_HZ * 4
00;
+ timeo =
(CFG_HZ * 400) / 10
00;
else
else
- timeo =
CFG_HZ * 2
0;
+ timeo =
(CFG_HZ * 20) / 100
0;
if ((state == FL_ERASING) && (this->options & NAND_IS_AND))
this->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
if ((state == FL_ERASING) && (this->options & NAND_IS_AND))
this->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1);
@@
-852,8
+852,8
@@
static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
while (1) {
if (get_timer(0) > timeo) {
printf("Timeout!");
while (1) {
if (get_timer(0) > timeo) {
printf("Timeout!");
- return 0;
-
}
+ return 0
x01
;
+ }
if (this->dev_ready) {
if (this->dev_ready(mtd))
if (this->dev_ready) {
if (this->dev_ready(mtd))
@@
-1713,6
+1713,7
@@
static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
goto out;
}
*retlen = written;
goto out;
}
*retlen = written;
+ bufstart = (u_char*) &buf[written];
ofs = autoplace ? mtd->oobavail : mtd->oobsize;
if (eccbuf)
ofs = autoplace ? mtd->oobavail : mtd->oobsize;
if (eccbuf)
@@
-2337,7
+2338,7
@@
int nand_scan (struct mtd_info *mtd, int maxchips)
mtd->oobblock = 1024 << (extid & 0x3);
extid >>= 2;
/* Calc oobsize */
mtd->oobblock = 1024 << (extid & 0x3);
extid >>= 2;
/* Calc oobsize */
- mtd->oobsize = (8 << (extid & 0x0
3
)) * (mtd->oobblock / 512);
+ mtd->oobsize = (8 << (extid & 0x0
1
)) * (mtd->oobblock / 512);
extid >>= 2;
/* Calc blocksize. Blocksize is multiples of 64KiB */
mtd->erasesize = (64 * 1024) << (extid & 0x03);
extid >>= 2;
/* Calc blocksize. Blocksize is multiples of 64KiB */
mtd->erasesize = (64 * 1024) << (extid & 0x03);