Skip to content

Commit 68fedad

Browse files
committed
Skip BB check for SPI
1 parent f5b2792 commit 68fedad

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

firmware/programmer/flash_hal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "chip.h"
1010
#include "chip_info.h"
11+
#include <stdbool.h>
1112

1213
enum
1314
{
@@ -29,6 +30,7 @@ typedef struct
2930
uint32_t data_size);
3031
void (*write_page_async)(uint8_t *buf, uint32_t page, uint32_t page_size);
3132
uint32_t (*read_status)();
33+
bool (*is_bb_supported)();
3234
} flash_hal_t;
3335

3436
#endif /* _FLASH_HAL_H_ */

firmware/programmer/fsmc_nand.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ static uint32_t nand_erase_block(uint32_t page)
438438
return nand_get_status();
439439
}
440440

441+
static inline bool nand_is_bb_supported()
442+
{
443+
return true;
444+
}
445+
441446
flash_hal_t hal_fsmc =
442447
{
443448
.init = nand_init,
@@ -447,6 +452,7 @@ flash_hal_t hal_fsmc =
447452
.read_page = nand_read_page,
448453
.read_spare_data = nand_read_spare_data,
449454
.write_page_async = nand_write_page_async,
450-
.read_status = nand_read_status
455+
.read_status = nand_read_status,
456+
.is_bb_supported = nand_is_bb_supported
451457
};
452458

firmware/programmer/nand_programmer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ static int _np_cmd_read_bad_blocks(np_prog_t *prog)
392392
bool is_bad;
393393
uint32_t block, block_num, page_num, page;
394394

395+
if (!hal[prog->hal]->is_bb_supported())
396+
goto Exit;
397+
395398
block_num = prog->chip_info.total_size / prog->chip_info.block_size;
396399
page_num = prog->chip_info.block_size / prog->chip_info.page_size;
397400

@@ -417,6 +420,7 @@ static int _np_cmd_read_bad_blocks(np_prog_t *prog)
417420
return NP_ERR_BBT_OVERFLOW;
418421
}
419422

423+
Exit:
420424
prog->bb_is_read = 1;
421425

422426
return 0;

firmware/programmer/spi_flash.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ static uint32_t spi_flash_erase_block(uint32_t page)
278278
return spi_flash_get_status();
279279
}
280280

281+
static inline bool spi_flash_is_bb_supported()
282+
{
283+
return false;
284+
}
285+
281286
flash_hal_t hal_spi =
282287
{
283288
.init = spi_flash_init,
@@ -287,5 +292,6 @@ flash_hal_t hal_spi =
287292
.read_page = spi_flash_read_page,
288293
.read_spare_data = spi_flash_read_spare_data,
289294
.write_page_async = spi_flash_write_page_async,
290-
.read_status = spi_flash_read_status
295+
.read_status = spi_flash_read_status,
296+
.is_bb_supported = spi_flash_is_bb_supported
291297
};

0 commit comments

Comments
 (0)