[U-Boot] do_nand_status( ) patch

masonccyang at mxic.com.tw masonccyang at mxic.com.tw
Fri Sep 1 01:28:16 UTC 2017


Hi,

Checking all nand chip is necessary and some of NAND host implement 
cmd_ctrl() from cmdfunc( ).
The select_chip() is required.


===============================================================================
diff --git a/cmd/nand.c b/cmd/nand.c
index 5b9d4b3..a7c781a 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -156,13 +156,18 @@ static void do_nand_status(nand_info_t *nand)
        ulong block_start = 0;
        ulong off;
        int last_status = -1;
+       int chipnr;

        struct nand_chip *nand_chip = nand->priv;
        /* check the WP bit */
-       nand_chip->cmdfunc(nand, NAND_CMD_STATUS, -1, -1);
-       printf("device is %swrite protected\n",
-               (nand_chip->read_byte(nand) & 0x80 ?
-               "NOT " : ""));
+       for (chipnr = 0; chipnr < nand_chip->numchips; chipnr++) {
+               nand_chip->select_chip(nand, chipnr);
+               nand_chip->cmdfunc(nand, NAND_CMD_STATUS, -1, -1);
+               printf("device %d is %swrite protected\n", chipnr,
+                       (nand_chip->read_byte(nand) & 0x80 ?
+                       "NOT " : ""));
+               nand_chip->select_chip(nand, -1);
+       }

        for (off = 0; off < nand->size; off += nand->erasesize) {
                int s = nand_get_lock_status(nand, off);
======================================================================

Thanks & Best Regards,
Mason Yang 
Macronix International Co., Ltd


CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================



============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================


More information about the U-Boot mailing list