#define BOOT_COPY_NUM (BOOT_TOTAL_PAGES / BOOT_PAGES_PER_COPY)
/*it also means normal device start addrress */
#define RESERVED_BLOCK_NUM 48
+/* reserved region info */
+#define NAND_GAP_BLOCK_NUM 4
+#define NAND_BBT_BLOCK_NUM 4
+#define NAND_ENV_BLOCK_NUM 8
+#define NAND_KEY_BLOCK_NUM 8
+#define NAND_DTB_BLOCK_NUM 4
#define AML_CHIP_NONE_RB 4
#define AML_INTERLEAVING_MODE 8
/*bootloader occupy 1024 pages*/
bbt_start_block = BOOT_TOTAL_PAGES >> pages_per_blk_shift;
- bbt_start_block += 4; /*gap occupy 4 blocks*/
+ bbt_start_block += NAND_GAP_BLOCK_NUM; /*gap occupy 4 blocks*/
aml_chip->rsv_data_buf = kzalloc(mtd->writesize, GFP_KERNEL);
if (aml_chip->rsv_data_buf == NULL)
aml_chip->aml_nandbbt_info->valid_node->phy_blk_addr = -1;
aml_chip->aml_nandbbt_info->start_block = bbt_start_block;
aml_chip->aml_nandbbt_info->end_block =
- aml_chip->aml_nandbbt_info->start_block + 4;
+ aml_chip->aml_nandbbt_info->start_block + NAND_BBT_BLOCK_NUM;
aml_chip->aml_nandbbt_info->size = mtd->size >> phys_erase_shift;
memcpy(aml_chip->aml_nandbbt_info->name, BBT_NAND_MAGIC, 4);
aml_chip->aml_nandenv_info->start_block =
aml_chip->aml_nandbbt_info->end_block;
aml_chip->aml_nandenv_info->end_block =
- aml_chip->aml_nandbbt_info->end_block + 8;
+ aml_chip->aml_nandbbt_info->end_block + NAND_ENV_BLOCK_NUM;
aml_chip->aml_nandenv_info->size = CONFIG_ENV_SIZE;
memcpy(aml_chip->aml_nandenv_info->name, ENV_NAND_MAGIC, 4);
aml_chip->aml_nandkey_info->start_block =
aml_chip->aml_nandenv_info->end_block;
aml_chip->aml_nandkey_info->end_block =
- aml_chip->aml_nandenv_info->end_block + 8;
+ aml_chip->aml_nandenv_info->end_block + NAND_KEY_BLOCK_NUM;
aml_chip->aml_nandkey_info->size = aml_chip->keysize;
memcpy(aml_chip->aml_nandkey_info->name, KEY_NAND_MAGIC, 4);
aml_chip->aml_nanddtb_info->start_block =
aml_chip->aml_nandkey_info->end_block;
aml_chip->aml_nanddtb_info->end_block =
- aml_chip->aml_nandkey_info->end_block + 4;
+ aml_chip->aml_nandkey_info->end_block + NAND_DTB_BLOCK_NUM;
aml_chip->aml_nanddtb_info->size = aml_chip->dtbsize;
memcpy(aml_chip->aml_nanddtb_info->name, DTB_NAND_MAGIC, 4);