From 745b3e3551fb362b5bf0df0a502a2d6b5aa56f04 Mon Sep 17 00:00:00 2001 From: Shakti Bhatnagar Date: Mon, 12 Jan 2015 19:01:27 +0530 Subject: [PATCH] nandps8_v2_0: Setting BBT Max Block value based upon Total blocks in flash. Comparing total number of blocks with Max Number of blocks for BBT search, if found less then keeping Max Number of blocks for BBT to 4. Signed-off-by: Shakti Bhatnagar --- .../drivers/nandps8_v2_0/src/xnandps8_bbm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c b/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c index bbd69d8e..eac0919d 100644 --- a/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c +++ b/XilinxProcessorIPLib/drivers/nandps8_v2_0/src/xnandps8_bbm.c @@ -124,6 +124,14 @@ void XNandPs8_InitBbtDesc(XNandPs8 *InstancePtr) InstancePtr->BbtDesc.Valid = 0U; InstancePtr->BbtDesc.Option = XNANDPS8_BBT_OOB; + /* + * Assuming that the flash device will have at least 4 blocks. + */ + if (InstancePtr->Geometry.NumTargetBlocks <= InstancePtr-> + BbtDesc.MaxBlocks){ + InstancePtr->BbtDesc.MaxBlocks = 4U; + } + /* * Initialize mirror Bad Block Table(BBT) */ @@ -151,6 +159,14 @@ void XNandPs8_InitBbtDesc(XNandPs8 *InstancePtr) InstancePtr->BbtMirrorDesc.Valid = 0U; InstancePtr->BbtMirrorDesc.Option = XNANDPS8_BBT_OOB; + /* + * Assuming that the flash device will have at least 4 blocks. + */ + if (InstancePtr->Geometry.NumTargetBlocks <= InstancePtr-> + BbtMirrorDesc.MaxBlocks){ + InstancePtr->BbtMirrorDesc.MaxBlocks = 4U; + } + /* * Initialize Bad block search pattern structure */