summaryrefslogtreecommitdiff
path: root/common/cmd_nand.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-09-11 19:48:06 +0000
committerwdenk <wdenk>2003-09-11 19:48:06 +0000
commita43278a43d522fba7fea0ed3045b718a9c8d22ac (patch)
treec21920a271992ce76e5e679c3e3e8bb11054d356 /common/cmd_nand.c
parent7205e4075d8b50e4dd89fe39ed03860b23cbb704 (diff)
downloadu-boot-imx-a43278a43d522fba7fea0ed3045b718a9c8d22ac.zip
u-boot-imx-a43278a43d522fba7fea0ed3045b718a9c8d22ac.tar.gz
u-boot-imx-a43278a43d522fba7fea0ed3045b718a9c8d22ac.tar.bz2
* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices * Patch by Denis Peter, 11 Sep 2003: - fix USB data pointer assignment for bulk only transfer. - prevent to display erased directories in FAT filesystem. * Change output format for NAND flash - make it look like for other memory, too
Diffstat (limited to 'common/cmd_nand.c')
-rw-r--r--common/cmd_nand.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 60cdd8e..0e49e9f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -38,7 +38,7 @@ struct nand_oob_config {
int eccvalid_pos; /* position of ECC valid flag inside oob -1 = inactive */
} oob_config = { {0}, 0, 0};
-#define NAND_DEBUG
+#undef NAND_DEBUG
#undef PSYCHO_DEBUG
/* ****************** WARNING *********************
@@ -734,7 +734,9 @@ static void NanD_ScanChips(struct nand_chip *nand)
/* If there are none at all that we recognise, bail */
if (!nand->numchips) {
+#ifdef NAND_DEBUG
puts ("No NAND flash chips recognised.\n");
+#endif
return;
}
@@ -1408,7 +1410,7 @@ static inline int nandcheck(unsigned long potential, unsigned long physadr)
return 0;
}
-void nand_probe(unsigned long physadr)
+unsigned long nand_probe(unsigned long physadr)
{
struct nand_chip *nand = NULL;
int i = 0, ChipID = 1;
@@ -1434,10 +1436,12 @@ void nand_probe(unsigned long physadr)
for (i=0; i<CFG_MAX_NAND_DEVICE; i++) {
if (nand_dev_desc[i].ChipID == NAND_ChipID_UNKNOWN) {
- nand = nand_dev_desc + i;
+ nand = &nand_dev_desc[i];
break;
}
}
+ if (!nand)
+ return (0);
memset((char *)nand, 0, sizeof(struct nand_chip));
@@ -1449,7 +1453,7 @@ void nand_probe(unsigned long physadr)
/* no chips found, clean up and quit */
memset((char *)nand, 0, sizeof(struct nand_chip));
nand->ChipID = NAND_ChipID_UNKNOWN;
- return;
+ return (0);
}
nand->ChipID = ChipID;
@@ -1459,8 +1463,10 @@ void nand_probe(unsigned long physadr)
nand->data_buf = malloc (nand->oobblock + nand->oobsize);
if (!nand->data_buf) {
puts ("Cannot allocate memory for data structures.\n");
- return;
+ return (0);
}
+
+ return (nand->totlen);
}
#ifdef CONFIG_MTD_NAND_ECC