mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] imx-bbu-nand-fcb: Show additional information from decoded FCB
@ 2021-10-12  1:53 Trent Piepho
  2021-10-12  1:53 ` [PATCH 2/3] imx-bbu-nand-fcb: Save bootloader location into device parameters Trent Piepho
  2021-10-12  1:53 ` [PATCH 3/3] imx-bbu-nand-fcb: Add command to help debug FCB issues Trent Piepho
  0 siblings, 2 replies; 7+ messages in thread
From: Trent Piepho @ 2021-10-12  1:53 UTC (permalink / raw)
  To: Barebox List; +Cc: Yunus Bas, Trent Piepho

In additional to the raw FCB fields, show some useful values calculated
from them.  E.g., display the size of the bootloader image in kB based
on the configured NAND page size and number of pages in the bootloader
image.  Example (all values in "()" are added):

Checksum:                   0xfffffa78
FingerPrint:                0x20424346
Version:                    0x01000000
DataSetup:                  0x50
DataHold:                   0x3c
AddressSetup:               0x19
DSAMPLE_TIME:               0x06
NandTimingState:            0x00
REA:                        0x00
RLOH:                       0x00
RHOH:                       0x00
PageDataSize:               0x00000800 (2 kB)
TotalPageSize:              0x00000840
SectorsPerBlock:            0x00000040 (128 kB eraseblocks)
NumberOfNANDs:              0x00000000
TotalInternalDie:           0x00000000
CellType:                   0x00000000
EccBlockNEccType:           0x00000004 (8 bits ECC)
EccBlock0Size:              0x00000200
EccBlockNSize:              0x00000200
EccBlock0EccType:           0x00000004 (8 bits ECC)
MetadataBytes:              0x0000000a
NumEccBlocksPerPage:        0x00000003 (total 4 blocks/page)
EccBlockNEccLevelSDK:       0x00000000
EccBlock0SizeSDK:           0x00000000
EccBlockNSizeSDK:           0x00000000
EccBlock0EccLevelSDK:       0x00000000
NumEccBlocksPerPageSDK:     0x00000000
MetadataBytesSDK:           0x00000000
EraseThreshold:             0x00000000
BootPatch:                  0x00000000
PatchSectors:               0x00000000
Firmware1_startingPage:     0x00000100 (address 0x080000)
Firmware2_startingPage:     0x00000380 (address 0x1c0000)
PagesInFirmware1:           0x000000f2 (484 kB)
PagesInFirmware2:           0x000000f2 (484 kB)
DBBTSearchAreaStartAddress: 0x00000001 (address 0x000800)
BadBlockMarkerByte:         0x000007cf
BadBlockMarkerStartBit:     0x00000000
BBMarkerPhysicalOffset:     0x00000800
BCHType:                    0x00000000
TMTiming2_ReadLatency:      0x00000000
TMTiming2_PreambleDelay:    0x00000000
TMTiming2_CEDelay:          0x00000000
TMTiming2_PostambleDelay:   0x00000000
TMTiming2_CmdAddPause:      0x00000000
TMTiming2_DataPause:        0x00000000
TMSpeed:                    0x00000000
TMTiming1_BusyTimeout:      0x00000000
DISBBM:                     0x00000000 (BBM swap enabled)
BBMarkerPhysOfsInSpareData: 0x00000000

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
---
 common/imx-bbu-nand-fcb.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 3b07d539e..7108a327a 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -293,18 +293,23 @@ static __maybe_unused void dump_fcb(void *buf)
 	pr_debug("REA:                        0x%02x\n", fcb->REA);
 	pr_debug("RLOH:                       0x%02x\n", fcb->RLOH);
 	pr_debug("RHOH:                       0x%02x\n", fcb->RHOH);
-	pr_debug("PageDataSize:               0x%08x\n", fcb->PageDataSize);
+	pr_debug("PageDataSize:               0x%08x (%d kB)\n",
+		 fcb->PageDataSize, fcb->PageDataSize / 1024);
 	pr_debug("TotalPageSize:              0x%08x\n", fcb->TotalPageSize);
-	pr_debug("SectorsPerBlock:            0x%08x\n", fcb->SectorsPerBlock);
+	pr_debug("SectorsPerBlock:            0x%08x (%u kB eraseblocks)\n",
+		 fcb->SectorsPerBlock, fcb->PageDataSize * fcb->SectorsPerBlock / 1024);
 	pr_debug("NumberOfNANDs:              0x%08x\n", fcb->NumberOfNANDs);
 	pr_debug("TotalInternalDie:           0x%08x\n", fcb->TotalInternalDie);
 	pr_debug("CellType:                   0x%08x\n", fcb->CellType);
-	pr_debug("EccBlockNEccType:           0x%08x\n", fcb->EccBlockNEccType);
+	pr_debug("EccBlockNEccType:           0x%08x (%d bits ECC)\n",
+		 fcb->EccBlockNEccType, fcb->EccBlockNEccType * 2);
 	pr_debug("EccBlock0Size:              0x%08x\n", fcb->EccBlock0Size);
 	pr_debug("EccBlockNSize:              0x%08x\n", fcb->EccBlockNSize);
-	pr_debug("EccBlock0EccType:           0x%08x\n", fcb->EccBlock0EccType);
+	pr_debug("EccBlock0EccType:           0x%08x (%d bits ECC)\n",
+		 fcb->EccBlock0EccType, fcb->EccBlock0EccType * 2);
 	pr_debug("MetadataBytes:              0x%08x\n", fcb->MetadataBytes);
-	pr_debug("NumEccBlocksPerPage:        0x%08x\n", fcb->NumEccBlocksPerPage);
+	pr_debug("NumEccBlocksPerPage:        0x%08x (total %d blocks/page)\n",
+		 fcb->NumEccBlocksPerPage, fcb->NumEccBlocksPerPage + 1);
 	pr_debug("EccBlockNEccLevelSDK:       0x%08x\n", fcb->EccBlockNEccLevelSDK);
 	pr_debug("EccBlock0SizeSDK:           0x%08x\n", fcb->EccBlock0SizeSDK);
 	pr_debug("EccBlockNSizeSDK:           0x%08x\n", fcb->EccBlockNSizeSDK);
@@ -314,11 +319,16 @@ static __maybe_unused void dump_fcb(void *buf)
 	pr_debug("EraseThreshold:             0x%08x\n", fcb->EraseThreshold);
 	pr_debug("BootPatch:                  0x%08x\n", fcb->BootPatch);
 	pr_debug("PatchSectors:               0x%08x\n", fcb->PatchSectors);
-	pr_debug("Firmware1_startingPage:     0x%08x\n", fcb->Firmware1_startingPage);
-	pr_debug("Firmware2_startingPage:     0x%08x\n", fcb->Firmware2_startingPage);
-	pr_debug("PagesInFirmware1:           0x%08x\n", fcb->PagesInFirmware1);
-	pr_debug("PagesInFirmware2:           0x%08x\n", fcb->PagesInFirmware2);
-	pr_debug("DBBTSearchAreaStartAddress: 0x%08x\n", fcb->DBBTSearchAreaStartAddress);
+	pr_debug("Firmware1_startingPage:     0x%08x (address 0x%06x)\n",
+		 fcb->Firmware1_startingPage, fcb->Firmware1_startingPage * fcb->PageDataSize);
+	pr_debug("Firmware2_startingPage:     0x%08x (address 0x%06x)\n",
+		 fcb->Firmware2_startingPage, fcb->Firmware2_startingPage * fcb->PageDataSize);
+	pr_debug("PagesInFirmware1:           0x%08x (%d kB)\n",
+		 fcb->PagesInFirmware1, fcb->PagesInFirmware1 * fcb->PageDataSize / 1024);
+	pr_debug("PagesInFirmware2:           0x%08x (%d kB)\n",
+		 fcb->PagesInFirmware2, fcb->PagesInFirmware2 * fcb->PageDataSize / 1024);
+	pr_debug("DBBTSearchAreaStartAddress: 0x%08x (address 0x%06x)\n",
+		 fcb->DBBTSearchAreaStartAddress, fcb->DBBTSearchAreaStartAddress * fcb->PageDataSize);
 	pr_debug("BadBlockMarkerByte:         0x%08x\n", fcb->BadBlockMarkerByte);
 	pr_debug("BadBlockMarkerStartBit:     0x%08x\n", fcb->BadBlockMarkerStartBit);
 	pr_debug("BBMarkerPhysicalOffset:     0x%08x\n", fcb->BBMarkerPhysicalOffset);
@@ -331,7 +341,8 @@ static __maybe_unused void dump_fcb(void *buf)
 	pr_debug("TMTiming2_DataPause:        0x%08x\n", fcb->TMTiming2_DataPause);
 	pr_debug("TMSpeed:                    0x%08x\n", fcb->TMSpeed);
 	pr_debug("TMTiming1_BusyTimeout:      0x%08x\n", fcb->TMTiming1_BusyTimeout);
-	pr_debug("DISBBM:                     0x%08x\n", fcb->DISBBM);
+	pr_debug("DISBBM:                     0x%08x (BBM swap %sabled)\n",
+		 fcb->DISBBM, fcb->DISBBM ? "dis" : "en");
 	pr_debug("BBMarkerPhysOfsInSpareData: 0x%08x\n", fcb->BBMarkerPhysicalOffsetInSpareData);
 }
 
-- 
2.31.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-14 12:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  1:53 [PATCH 1/3] imx-bbu-nand-fcb: Show additional information from decoded FCB Trent Piepho
2021-10-12  1:53 ` [PATCH 2/3] imx-bbu-nand-fcb: Save bootloader location into device parameters Trent Piepho
2021-10-12  8:11   ` Sascha Hauer
2021-10-12  1:53 ` [PATCH 3/3] imx-bbu-nand-fcb: Add command to help debug FCB issues Trent Piepho
2021-10-12  8:21   ` Sascha Hauer
2021-10-13 10:14     ` Trent Piepho
2021-10-14 12:09       ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox