Skip to contentSkip to conversation

cmd: nand: Add support to print the manufacturer, model and size

PATCH In review Mihai Sain 2 participants 2 messages Mar 18, 2024

lore
Share & tools
lore

Mihai Sain

author
#0 lore raw

PATCH v2 1/1 cmd: nand: Add support to print the manufacturer, model and size

Add support to nand info for printing the manufacturer,model and size. The manufacturer and model are printed only for ONFI flashes.

U-Boot> nand info

Device 0: nand0, sector size 256 KiB
Manufacturer MACRONIX
Model MX30LF4G28AD
Device size 512 MiB
Page size 4096 b
OOB size 256 b
Erase size 262144 b
ecc strength 8 bits
ecc step size 512 b
subpagesize 4096 b
options 0x00004200
bbt options 0x00028000

Changes in v2:
--------------
* use #ifdef directive for ONFI flashes.
* use unsigned int for chipsize.

---
 cmd/nand.c | 5 +++++
 1 file changed, 5 insertions(+)
cmd/nand.c +5 -0
index fe834c4ac5..5773246d64 100644
@@ -418,6 +418,11 @@ static void nand_print_and_set_info(int idx)
 		printf("%dx ", chip->numchips);
 	printf("%s, sector size %u KiB\n",
 	       mtd->name, mtd->erasesize >> 10);
+#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
+	printf("  Manufacturer  %s \n", chip->onfi_params.manufacturer);
+	printf("  Model         %s \n", chip->onfi_params.model);
+#endif
+	printf("  Device size   %8u MiB\n", (unsigned int)(chip->chipsize >> 20));
 	printf("  Page size     %8d b\n", mtd->writesize);
 	printf("  OOB size      %8d b\n", mtd->oobsize);
 	printf("  Erase size    %8d b\n", mtd->erasesize);
Signature · 1 line
2.44.0
#1 lore raw
Quoted 34 lines · Mihai Sain

Add support to nand info for printing the manufacturer,model and size. The manufacturer and model are printed only for ONFI flashes.

U-Boot> nand info

Device 0: nand0, sector size 256 KiB
Manufacturer MACRONIX
Model MX30LF4G28AD
Device size 512 MiB
Page size 4096 b
OOB size 256 b
Erase size 262144 b
ecc strength 8 bits
ecc step size 512 b
subpagesize 4096 b
options 0x00004200
bbt options 0x00028000

Changes in v2:
--------------
* use #ifdef directive for ONFI flashes.
* use unsigned int for chipsize.

---
  cmd/nand.c | 5 +++++
  1 file changed, 5 insertions(+)
cmd/nand.c +0 -0
index fe834c4ac5..5773246d64 100644
@@ -418,6 +418,11 @@ static void nand_print_and_set_info(int idx)
  		printf("%dx ", chip->numchips);

cmd/nand.c static void nand_print_and_set_info(int idx) · line 428

Quoted 10 lines
cmd/nand.c +5 -0
  	printf("%s, sector size %u KiB\n",
  	       mtd->name, mtd->erasesize >> 10);
+#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
+	printf("  Manufacturer  %s \n", chip->onfi_params.manufacturer);
+	printf("  Model         %s \n", chip->onfi_params.model);
+#endif
+	printf("  Device size   %8u MiB\n", (unsigned int)(chip->chipsize >> 20));
  	printf("  Page size     %8d b\n", mtd->writesize);
  	printf("  OOB size      %8d b\n", mtd->oobsize);
  	printf("  Erase size    %8d b\n", mtd->erasesize);

Can you refactor the logic out of the end of nand_detect as a separate function and use that instead? That will cover more cases (e.g. JEDEC).

--Sean