summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-12-22 21:16:17 +0100
committerWolfgang Denk <wd@denx.de>2010-12-22 21:16:17 +0100
commitcdc51c294ad33879c4e57edf4c9d2155381b1d59 (patch)
treefc1c3f2c23a2507e91358a6a6dfa881965bf603f /drivers/mtd/nand/nand_base.c
parent250ef029844be2cb98635f265359396866d1749f (diff)
parentb8339e2b9f32663411dba0f48e25b23f542d53bc (diff)
downloadu-boot-imx-cdc51c294ad33879c4e57edf4c9d2155381b1d59.zip
u-boot-imx-cdc51c294ad33879c4e57edf4c9d2155381b1d59.tar.gz
u-boot-imx-cdc51c294ad33879c4e57edf4c9d2155381b1d59.tar.bz2
Merge branch 'next' of ../next
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 21cc5a3..5239c1f 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -439,11 +439,12 @@ void nand_wait_ready(struct mtd_info *mtd)
{
struct nand_chip *chip = mtd->priv;
u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
+ u32 time_start;
- reset_timer();
+ time_start = get_timer(0);
/* wait until command is processed or timeout occures */
- while (get_timer(0) < timeo) {
+ while (get_timer(time_start) < timeo) {
if (chip->dev_ready)
if (chip->dev_ready(mtd))
break;
@@ -704,6 +705,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
{
unsigned long timeo;
int state = this->state;
+ u32 time_start;
if (state == FL_ERASING)
timeo = (CONFIG_SYS_HZ * 400) / 1000;
@@ -715,10 +717,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
else
this->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
- reset_timer();
+ time_start = get_timer(0);
while (1) {
- if (get_timer(0) > timeo) {
+ if (get_timer(time_start) > timeo) {
printf("Timeout!");
return 0x01;
}
@@ -732,8 +734,9 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)
}
}
#ifdef PPCHAMELON_NAND_TIMER_HACK
- reset_timer();
- while (get_timer(0) < 10);
+ time_start = get_timer(0);
+ while (get_timer(time_start) < 10)
+ ;
#endif /* PPCHAMELON_NAND_TIMER_HACK */
return this->read_byte(mtd);
@@ -2409,11 +2412,11 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
/*
* Get the flash and manufacturer id and lookup if the type is supported
*/
-static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
+static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
struct nand_chip *chip,
int busw, int *maf_id)
{
- struct nand_flash_dev *type = NULL;
+ const struct nand_flash_dev *type = NULL;
int i, dev_id, maf_idx;
int tmp_id, tmp_manf;
@@ -2587,7 +2590,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
{
int i, busw, nand_maf_id;
struct nand_chip *chip = mtd->priv;
- struct nand_flash_dev *type;
+ const struct nand_flash_dev *type;
/* Get buswidth to select the correct functions */
busw = chip->options & NAND_BUSWIDTH_16;