#ifndef FLASH_LAYOUT_H
#define FLASH_LAYOUT_H

//----------------------------------------------------------------------------
// Flash Partition configuration
//----------------------------------------------------------------------------
#ifdef DEMO_BOARD
#define NAND_FLASH_TOTAL_SIZE           ((UINT64) 8*1024*1024*1024 & 0xFFFFFFFFF)
#else
#define NAND_FLASH_TOTAL_SIZE           ((UINT64)16*1024*1024*1024 & 0xFFFFFFFFF)
#endif
//#define MAX_UPGRADE_IMAGE_FILE_SIZE      ((UINT64)4*1024*1024*1024)

#ifdef CC_3RD_RO_DBG
#define NAND_FLASH_3RD_SIZE             ((UINT64)(205*1024*1024))     /* 205 MB */
#else
#ifdef CC_CP_CUST
#define NAND_FLASH_3RD_SIZE             ((UINT64)(128*1024*1024))     /* 128 MB */ /* Change back to 128MB because EU&PAD 3rd is around 120MB*/
#else
#define NAND_FLASH_3RD_SIZE             ((UINT64)(128*1024*1024))     /* 128 MB */
#endif
#endif
#define NAND_FLASH_3RD_RW_SIZE          ((UINT64)(256*1024*1024))     /* 256 MB */

#define NAND_FLASH_PQ_SIZE              ((UINT64)(8*1024*1024))      /*  8 MB */  /* not use now . PQ & AQ are already in file based partition */

#ifdef CC_DISABLE_BASIC_PART
#define NAND_FLASH_ROOTFS_SIZE          ((UINT64)(128*1024*1024))      /*128 MB */ /* Normal behavior */
#define NAND_FLASH_APPIMAGE_SIZE        ((UINT64)(128*1024*1024))     /* 128 MB */ /* Normal behavior */
#else
#define NAND_FLASH_ROOTFS_SIZE          ((UINT64)(26*1024*1024))      /*  26 MB */ /* Debug+Development purpose */
#define NAND_FLASH_APPIMAGE_SIZE        ((UINT64)(240*1024*1024))     /* 240 MB */ /* Debug+Development purpose */
#endif /* endif CC_DISABLE_BASIC_PART */

#define NAND_FLASH_LOADER_SIZE              ((UINT64)(4*1024*1024))       /*   4 MB */ /* M5 change to 4M for HQ LOGO */
#ifdef  CC_DUALLOADER_SUPPORT
#define NAND_FLASH_LOADER_SIZE_B             ((UINT64)(8*1024*1024))       /*   8 MB */ /* M5 change to 8M for HQ LOGO */
#endif
#define NAND_FLASH_UBOOT_SIZE               ((UINT64)(2*1024*1024))       /*   2 MB */
#define NAND_FLASH_MISC_SIZE                ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_RECV_SIZE                ((UINT64)(64*1024*1024))      /*  64MB */ /* not use M5 */
#define NAND_FLASH_BOOT_SIZE                ((UINT64)(64*1024*1024))      /*  64 MB */

#define NAND_FLASH_CACH_SIZE                ((UINT64)(128*1024*1024))     /* 128 MB */ /* not use M5*/
#define NAND_FLASH_RSVD_SIZE                ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SINGLE_CHANNELLIST_SIZE  ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_AQ_SIZE                  ((UINT64)(1*1024*1024))       /*   1 MB */ /* uot use M5 */
//#define NAND_FLASH_CAPTURE_LOGO_SIZE        ((UINT64)(4*1024*1024))       /*   4 MB */
#define NAND_FLASH_LOADER_LOGO_SIZE         ((UINT64)(4*1024*1024))       /*   4 MB */ /* not use M5 */
#define NAND_FLASH_TRUSTZONE_SIZE           ((UINT64)(6*1024*1024))       /*   6 MB */  //for BOOT_NO_LZHS=true  2MB>6MB
//#define NAND_FLASH_SIGNATURE_SIZE           ((UINT64)(2*1024*1024))       /*   2 MB */
#define NAND_FLASH_KERNEL_SIZE              ((UINT64)(3*1024*1024))       /*   2 MB */ /* not use M5 */
#define NAND_FLASH_PERM_SIZE                ((UINT64)(8*1024*1024))       /*   8 MB */
#define NAND_FLASH_PANEL_SIZE               ((UINT64)(1*1024*1024))       /*   1 MB */ /* note use M5  panel.bin move to recipe */
#define NAND_FLASH_CIPLUS_SIZE              ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_EDID_SIZE                ((UINT64)(1*1024*1024))       /*   1 MB */ /* not use M5  move to other file based partition */
#define NAND_FLASH_SERVICE_MODE_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_DVBS_DEFAULT_DB_SIZE     ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_PERSIST_SIZE             ((UINT64)(96*1024*1024))      /*  96 MB */

#define NAND_FLASH_EPG_CACHE_SIZE           ((UINT64)(48*1024*1024))      /*   48 MB */
#ifdef NDEBUG
#define NAND_FLASH_ARIB_NVRAM_SIZE          ((UINT64)(512*1024*1024))       /*   512 MB */
#else
#define NAND_FLASH_ARIB_NVRAM_SIZE          ((UINT64)(128*1024*1024))       /*   128 MB */
#endif

#ifdef ADSP_BIN_SUPPORT  /* ADSP & AARM partiton not use M5 */
    #define PART_ADSP_SIZE              (8*1024*1024) /* audio dsp size */
#ifdef CC_AUD_ARM_SUPPORT
	#define PART_AARM_SIZE				((UINT64)(8*1024*1024)) /* 8 MB*/
    #else
        #define PART_AARM_SIZE			((UINT64)(8*1024*1024)) /* 8 MB */
#endif
#else
    #define PART_ADSP_SIZE              ((UINT64)(8*1024*1024))       /*   8 MB */
    #define PART_AARM_SIZE	            ((UINT64)(8*1024*1024)) /* 8 MB */
#endif  

#define NAND_FLASH_VERSION_SIZE             ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_REPLACE_EEPROM_SIZE      ((UINT64)(1*1024*1024))       /*  1  MB for each*/
#define NAND_FLASH_RESERVE_SIZE             ((UINT64)(1*1024*1024))       /*   1 MB */
/* BE child partition not use M5  move to recipe file based*/
#define NAND_FLASH_SONY_BE_DDRI_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_MLFW_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_LDAT_SIZE        ((UINT64)(3*1024*1024))       /*   3 MB */
#define NAND_FLASH_SONY_BE_MAFW_SIZE        ((UINT64)(6*1024*1024))       /*   6 MB */
#define NAND_FLASH_SONY_BE_DFW1_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_DFW2_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_PDAT_SIZE        ((UINT64)(5*1024*1024))       /*   5 MB */
#define NAND_FLASH_SONY_BE_BDAT_SIZE        ((UINT64)(8*1024*1024))       /*   8 MB */
#define NAND_FLASH_SONY_BE_NDAT_SIZE        ((UINT64)(2*1024*1024))       /*   2 MB */
#define NAND_FLASH_SONY_BE_FDAT_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_UDAT_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_BDIX_SIZE        ((UINT64)(2*1024*1024))       /*   2 MB */
#define NAND_FLASH_SONY_BE_MINF_SIZE        ((UINT64)(1*1024*1024))       /*   1 MB */
#define NAND_FLASH_SONY_BE_BEDAT_SIZE       ((UINT64)(6*1024*1024))       /*   6 MB */
//#define NAND_FLASH_SONY_BE_RESV_SIZE        ((UINT64)(8*1024*1024))       /*   8 MB */
#define NAND_FLASH_UDT_SIZE                 ((UINT64)(1*1024*1024))       /*   1 MB */

#ifdef DEMO_BOARD
#define NAND_FLASH_UPGRADE_SIZE             ((UINT64) 1024*1024*1024 & 0xFFFFFFFFFFF)    /* 1024MB */
#define NAND_FLASH_DATA_DEMO_SIZE           ((UINT64)(400*1024*1024))     /* 400MB */
#define NAND_FLASH_SYSM_SIZE                ((UINT64) 1800*1024*1024 & 0xFFFFFFFFFFF)    /* 1800MB */
#define NAND_FLASH_USRD_SIZE                ((UINT64) 1024*1024*1024 & 0xFFFFFFFFFFF)    /* 1024MB */
#else
#define NAND_FLASH_UPGRADE_SIZE             ((UINT64) 32*1024*1024 & 0xFFFFFFFFFFF)    /* 32MB */ /* just for boot image*/
#define NAND_FLASH_DATA_DEMO_SIZE           ((UINT64) 1024*1024*1024 & 0xFFFFFFFFFFF)    /* 1024MB */
#define NAND_FLASH_SYSM_SIZE                ((UINT64) 2750*1024*1024 & 0xFFFFFFFFFFF)    /* 2750MB */
#ifdef CC_CP_CHD_CUST
#define NAND_FLASH_USRD_SIZE                ((UINT64) 48947*1024*1024 & 0xFFFFFFFFFFF)    /* 48947MB */
#else
#define NAND_FLASH_USRD_SIZE                ((UINT64) 4317*1024*1024 & 0xFFFFFFFFFFF)
#endif 
#endif

#define NAND_FLASH_VEND_SIZE                ((UINT64) 700*1024*1024 & 0xFFFFFFFFFFF)    /*700MB */ /* vendor image */
#define NAND_FLASH_PROD_SIZE                ((UINT64) 1000*1024*1024 & 0xFFFFFFFFFFF)    /*1000MB */ /* product image */
#define NAND_FLASH_FDAT_SIZE                ((UINT64) 4*1024*1024 & 0xFFFFFFFFFFF)    /*4MB */ /* FSW use it */
#define NAND_FLASH_RDAT_SIZE                ((UINT64) 4*1024*1024 & 0xFFFFFFFFFFF)    /*4MB */ /* for product  or development ndata or EXT4(MVT) */
#define NAND_FLASH_CM4S_SIZE                ((UINT64) 5*1024*1024 & 0xFFFFFFFFFFF)    /*5MB */ /* cm4s image */
#define NAND_FLASH_VBMETA_SIZE              ((UINT64) 1*1024*1024 & 0xFFFFFFFFFFF)    /*1MB */ /* vbmeta.image.info */
#define NAND_FLASH_RECIPE_SIZE              ((UINT64) 256*1024*1024 & 0xFFFFFFFFFFF)    /*256MB */ /* recipe data , file based partion*/
#define NAND_FLASH_DTBO_SIZE                ((UINT64) 8*1024*1024 & 0xFFFFFFFFFFF)    /*8MB */ /* device tree overlay*/
#define NAND_FLASH_RAWDAT_SIZE              ((UINT64) 4*1024*1024 & 0xFFFFFFFFFFF)    /*8MB */ /* rdata_file.info*/

#define NAND_FLASH_SDCARD_SIZE              ((UINT64)(1*1024*1024))         /* 1 MB */ /* not use M5 */

#define NAND_FLASH_HDCP_SIZE                ((UINT64)(1*1024*1024))         /* 1 MB */ /* for HDCP1.4 + HDCP2.0 + WFD HDCP*/

#define NAND_FLASH_OOPS_SIZE                ((UINT64)(1*1024*1024))         /* 1 MB */
#define NAND_FLASH_SPQD_SIZE                ((UINT64)(2*1024*1024))         /* 2 MB */ /* not use  M5.move to recipe */
#define NAND_FLASH_SPQC_SIZE                ((UINT64)(3*1024*1024))         /* 3 MB */ /* not use  M5.move to recipe */

#ifndef CC_DUALLOADER_SUPPORT
#define NAND_PART_SIZE_0                    (NAND_FLASH_LOADER_SIZE)                /* loader image                  */
#define NAND_PART_SIZE_1                    (NAND_FLASH_UBOOT_SIZE)                 /* nand_1  - uboot env           */
#define NAND_PART_ID_EEPROM_A               (2)
#define NAND_PART_SIZE_2                    (NAND_FLASH_REPLACE_EEPROM_SIZE)
#define NAND_PART_SIZE_3                    (NAND_FLASH_PERM_SIZE)
#define NAND_PART_SIZE_4                    (NAND_FLASH_BOOT_SIZE)
#define NAND_PART_SIZE_5                    (NAND_FLASH_RSVD_SIZE)
#define NAND_PART_SIZE_6                    (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)
#define NAND_PART_SIZE_7                    (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)
#define NAND_PART_SIZE_8                    (NAND_FLASH_PQ_SIZE)
#define NAND_PART_SIZE_9                    (NAND_FLASH_AQ_SIZE)
#define NAND_PART_SIZE_10                   (NAND_FLASH_LOADER_LOGO_SIZE)
#define NAND_PART_SIZE_11                   (NAND_FLASH_TRUSTZONE_SIZE)
#define NAND_PART_SIZE_12                   (NAND_FLASH_ROOTFS_SIZE)                /* nand_6  - rootfs A            */
#define NAND_PART_SIZE_13                   (NAND_FLASH_APPIMAGE_SIZE)              /* nand_8  - basic               */
#define NAND_PART_SIZE_14                   (NAND_FLASH_3RD_RW_SIZE)                /* nand_9  - 3rd_rw              */
#define NAND_PART_SIZE_15                   (NAND_FLASH_HDCP_SIZE)
#define NAND_PART_SIZE_16                   (NAND_FLASH_3RD_SIZE)                   /* nand_12 - 3rd_ro              */
#define NAND_PART_SIZE_17                   (NAND_FLASH_PANEL_SIZE)                 /* nand_17 - Flash Panel         */
#define NAND_PART_SIZE_18                   (NAND_FLASH_CIPLUS_SIZE)                /* nand_18 - ci                  */
#define NAND_PART_SIZE_19                   (NAND_FLASH_EDID_SIZE)                  /* nand_19 - edid                */
#define NAND_PART_SIZE_20                   (NAND_FLASH_SERVICE_MODE_SIZE)          /* nand_20 - Service mode        */
#define NAND_PART_SIZE_21                   (NAND_FLASH_DVBS_DEFAULT_DB_SIZE)       /* nand_21 - DVBS Default DB     */
#define NAND_PART_SIZE_22                   (NAND_FLASH_EPG_CACHE_SIZE)             /* nand_22 - EPG Cache           */
#define NAND_PART_ID_ADSPBIN                (23)
#define NAND_PART_SIZE_23                   (PART_ADSP_SIZE)               /* ADSP partition */
#define NAND_PART_SIZE_24                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_25                   (NAND_FLASH_HDCP_SIZE)
#define NAND_PART_SIZE_26                   (NAND_FLASH_SONY_BE_DDRI_SIZE)          /* Sony backend IC DDR Init FW */
#define NAND_PART_SIZE_27                   (NAND_FLASH_SONY_BE_MLFW_SIZE)          /* Sony backend IC Main Loader FW*/
#define NAND_PART_SIZE_28                   (NAND_FLASH_SONY_BE_LDAT_SIZE)          /* Sony backend IC L-Data */     
#define NAND_PART_SIZE_29                   (NAND_FLASH_SONY_BE_MAFW_SIZE)          /* Sony backend IC Main FW */    
#define NAND_PART_SIZE_30                   (NAND_FLASH_SONY_BE_DFW1_SIZE)          /* Sony backend IC DFW1 */       
#define NAND_PART_SIZE_31                   (NAND_FLASH_SONY_BE_DFW2_SIZE)          /* Sony backend IC DFW2 */       
#define NAND_PART_SIZE_32                   (NAND_FLASH_SONY_BE_PDAT_SIZE)          /* Sony backend IC P-Data */     
#define NAND_PART_SIZE_33                   (NAND_FLASH_SONY_BE_BDAT_SIZE)          /* Sony backend IC B-Data */     
#define NAND_PART_SIZE_34                   (NAND_FLASH_SONY_BE_NDAT_SIZE)          /* Sony backend IC N-Data */     
#define NAND_PART_SIZE_35                   (NAND_FLASH_SONY_BE_FDAT_SIZE)          /* Sony backend IC F-Data */     
#define NAND_PART_SIZE_36                   (NAND_FLASH_SONY_BE_UDAT_SIZE)          /* Sony backend IC U-Data */   
#define NAND_PART_SIZE_37                   (NAND_FLASH_SONY_BE_BDIX_SIZE)          /* Sony backend IC BDI */   
#define NAND_PART_SIZE_38                   (NAND_FLASH_SONY_BE_MINF_SIZE)          /* map info */   
#define NAND_PART_SIZE_39                   (NAND_FLASH_SONY_BE_BEDAT_SIZE)         /* This have child partition */   

#define NAND_PART_SIZE_40                   (NAND_FLASH_UPGRADE_SIZE)
#define NAND_PART_SIZE_41                   (NAND_FLASH_MISC_SIZE)
#define NAND_PART_SIZE_42                   (NAND_FLASH_RECV_SIZE)
#define NAND_PART_SIZE_43                   (NAND_FLASH_SYSM_SIZE)
#define NAND_PART_SIZE_44                   (NAND_FLASH_USRD_SIZE)
#define NAND_PART_SIZE_45                   (NAND_FLASH_CACH_SIZE)
#define NAND_PART_SIZE_46                   (NAND_FLASH_SDCARD_SIZE)
#define NAND_PART_SIZE_47                   (NAND_FLASH_UDT_SIZE)
#define NAND_PART_SIZE_48                   (NAND_FLASH_ARIB_NVRAM_SIZE)
#define NAND_PART_SIZE_49                   (PART_AARM_SIZE)
#define NAND_PART_SIZE_50                   (NAND_FLASH_DATA_DEMO_SIZE)
#define NAND_PART_SIZE_51                   (NAND_FLASH_VERSION_SIZE)
#define NAND_PART_SIZE_52                   (NAND_FLASH_OOPS_SIZE)
#define NAND_PART_SIZE_53                   (NAND_FLASH_SPQD_SIZE)
#define NAND_PART_SIZE_54                   (NAND_FLASH_SPQC_SIZE)
#define NAND_PART_SIZE_55                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_56                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_57                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_58                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_59                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_60                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_61                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_62                   (NAND_FLASH_RESERVE_SIZE)
#else
#if 0
#define NAND_PART_SIZE_0                    (NAND_FLASH_LOADER_SIZE) 
#define NAND_PART_SIZE_1                    (NAND_FLASH_LOADER_SIZE_B)                
#define NAND_PART_SIZE_2                    (NAND_FLASH_UBOOT_SIZE)                
#define NAND_PART_ID_EEPROM_A               (3)
#define NAND_PART_SIZE_3                    (NAND_FLASH_REPLACE_EEPROM_SIZE)
#define NAND_PART_SIZE_4                    (NAND_FLASH_PERM_SIZE)
#define NAND_PART_SIZE_5                    (NAND_FLASH_BOOT_SIZE)
#define NAND_PART_SIZE_6                    (NAND_FLASH_RSVD_SIZE)
#define NAND_PART_SIZE_7                    (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)
#define NAND_PART_SIZE_8                    (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)
#define NAND_PART_SIZE_9                    (NAND_FLASH_PQ_SIZE)
#define NAND_PART_SIZE_10                   (NAND_FLASH_AQ_SIZE)
#define NAND_PART_SIZE_11                   (NAND_FLASH_LOADER_LOGO_SIZE)
#define NAND_PART_SIZE_12                   (NAND_FLASH_TRUSTZONE_SIZE)
#define NAND_PART_SIZE_13                   (NAND_FLASH_ROOTFS_SIZE)                /* nand_6  - rootfs A            */
#define NAND_PART_SIZE_14                   (NAND_FLASH_APPIMAGE_SIZE)              /* nand_8  - basic               */
#define NAND_PART_SIZE_15                   (NAND_FLASH_3RD_RW_SIZE)                /* nand_9  - 3rd_rw              */
#define NAND_PART_SIZE_16                   (NAND_FLASH_HDCP_SIZE)
#define NAND_PART_SIZE_17                   (NAND_FLASH_3RD_SIZE)                   /* nand_12 - 3rd_ro              */
#define NAND_PART_SIZE_18                   (NAND_FLASH_PANEL_SIZE)                 /* nand_17 - Flash Panel         */
#define NAND_PART_SIZE_19                   (NAND_FLASH_CIPLUS_SIZE)                /* nand_18 - ci                  */
#define NAND_PART_SIZE_20                   (NAND_FLASH_EDID_SIZE)                  /* nand_19 - edid                */
#define NAND_PART_SIZE_21                   (NAND_FLASH_SERVICE_MODE_SIZE)          /* nand_20 - Service mode        */
#define NAND_PART_SIZE_22                   (NAND_FLASH_DVBS_DEFAULT_DB_SIZE)       /* nand_21 - DVBS Default DB     */
#define NAND_PART_SIZE_23                   (NAND_FLASH_EPG_CACHE_SIZE)             /* nand_22 - EPG Cache           */
#define NAND_PART_ID_ADSPBIN                (24)
#define NAND_PART_SIZE_24                   (PART_ADSP_SIZE)               /* ADSP partition */
#define NAND_PART_SIZE_25                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_26                   (NAND_FLASH_HDCP_SIZE)
#define NAND_PART_SIZE_27                   (NAND_FLASH_SONY_BE_DDRI_SIZE)          /* Sony backend IC DDR Init FW */
#define NAND_PART_SIZE_28                   (NAND_FLASH_SONY_BE_MLFW_SIZE)          /* Sony backend IC Main Loader FW*/
#define NAND_PART_SIZE_29                   (NAND_FLASH_SONY_BE_LDAT_SIZE)          /* Sony backend IC L-Data */     
#define NAND_PART_SIZE_30                   (NAND_FLASH_SONY_BE_MAFW_SIZE)          /* Sony backend IC Main FW */    
#define NAND_PART_SIZE_31                   (NAND_FLASH_SONY_BE_DFW1_SIZE)          /* Sony backend IC DFW1 */       
#define NAND_PART_SIZE_32                   (NAND_FLASH_SONY_BE_DFW2_SIZE)          /* Sony backend IC DFW2 */       
#define NAND_PART_SIZE_33                   (NAND_FLASH_SONY_BE_PDAT_SIZE)          /* Sony backend IC P-Data */     
#define NAND_PART_SIZE_34                   (NAND_FLASH_SONY_BE_BDAT_SIZE)          /* Sony backend IC B-Data */     
#define NAND_PART_SIZE_35                   (NAND_FLASH_SONY_BE_NDAT_SIZE)          /* Sony backend IC N-Data */     
#define NAND_PART_SIZE_36                   (NAND_FLASH_SONY_BE_FDAT_SIZE)          /* Sony backend IC F-Data */     
#define NAND_PART_SIZE_37                   (NAND_FLASH_SONY_BE_UDAT_SIZE)          /* Sony backend IC U-Data */   
#define NAND_PART_SIZE_38                   (NAND_FLASH_SONY_BE_BDIX_SIZE)          /* Sony backend IC BDI */   
#define NAND_PART_SIZE_39                   (NAND_FLASH_SONY_BE_MINF_SIZE)          /* map info */   
#define NAND_PART_SIZE_40                   (NAND_FLASH_SONY_BE_BEDAT_SIZE)         /* This have child partition */   

#define NAND_PART_SIZE_41                   (NAND_FLASH_UPGRADE_SIZE)
#define NAND_PART_SIZE_42                   (NAND_FLASH_MISC_SIZE)
#define NAND_PART_SIZE_43                   (NAND_FLASH_RECV_SIZE)
#define NAND_PART_SIZE_44                   (NAND_FLASH_SYSM_SIZE)
#define NAND_PART_SIZE_45                   (NAND_FLASH_USRD_SIZE)
#define NAND_PART_SIZE_46                   (NAND_FLASH_CACH_SIZE)
#define NAND_PART_SIZE_47                   (NAND_FLASH_SDCARD_SIZE)
#define NAND_PART_SIZE_48                   (NAND_FLASH_UDT_SIZE)
#define NAND_PART_SIZE_49                   (NAND_FLASH_ARIB_NVRAM_SIZE)
#define NAND_PART_SIZE_50                   (PART_AARM_SIZE)
#define NAND_PART_SIZE_51                   (NAND_FLASH_DATA_DEMO_SIZE)
#define NAND_PART_SIZE_52                   (NAND_FLASH_VERSION_SIZE)
#define NAND_PART_SIZE_53                   (NAND_FLASH_OOPS_SIZE)
#define NAND_PART_SIZE_54                   (NAND_FLASH_SPQD_SIZE)
#define NAND_PART_SIZE_55                   (NAND_FLASH_SPQC_SIZE)
#define NAND_PART_SIZE_56                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_57                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_58                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_59                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_60                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_61                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_62                   (NAND_FLASH_RESERVE_SIZE)
#define NAND_PART_SIZE_63                   (NAND_FLASH_RESERVE_SIZE)
#endif
#define NAND_PART_SIZE_0                    (NAND_FLASH_LOADER_SIZE)                // load A               4M
#define NAND_PART_SIZE_1                    (NAND_FLASH_LOADER_SIZE_B)              // load B               8M
#define NAND_PART_SIZE_2                    (NAND_FLASH_REPLACE_EEPROM_SIZE)        // eeprom_A         1M
#define NAND_PART_ID_EEPROM_A               (2) // 3>2
#define NAND_PART_SIZE_3                    (NAND_FLASH_PERM_SIZE)                  // perm                 8M
#define NAND_PART_SIZE_4                    (NAND_FLASH_HDCP_SIZE)                  // hdmi                 1M
#define NAND_PART_SIZE_5                    (NAND_FLASH_RESERVE_SIZE)               // reserved           1M
#define NAND_PART_SIZE_6                    (NAND_FLASH_CIPLUS_SIZE)                // ci                      1M
#define NAND_PART_SIZE_7                    (NAND_FLASH_PERSIST_SIZE)               // persist              96M
#define NAND_PART_SIZE_8                    (NAND_FLASH_FDAT_SIZE)                  // fdata                4M
#define NAND_PART_SIZE_9                    (NAND_FLASH_RDAT_SIZE)                  // rdata                4M
#define NAND_PART_SIZE_10                   (NAND_FLASH_MISC_SIZE)                  // misc                 1M
#define NAND_PART_SIZE_11                   (NAND_FLASH_UBOOT_SIZE)                 // uboot_env_a    2M
#define NAND_PART_SIZE_12                   (NAND_FLASH_UBOOT_SIZE)                 // uboot_env_b    2M
#define NAND_PART_SIZE_13                   (NAND_FLASH_RESERVE_SIZE)               // reserved           1M
#define NAND_PART_SIZE_14                   (NAND_FLASH_RESERVE_SIZE)               // reserved           1M
#define NAND_PART_SIZE_15                   (NAND_FLASH_RESERVE_SIZE)               // reserved           1M / product partition 8M remove to back down
#define NAND_PART_SIZE_16                   (NAND_FLASH_RESERVE_SIZE)               // reserved           1M / product partition 8M remove to baci down
#define NAND_PART_SIZE_17                   (NAND_FLASH_CM4S_SIZE)                  // cm4s_a            5M
#define NAND_PART_SIZE_18                   (NAND_FLASH_CM4S_SIZE)                  // cm4s_b            5M
#define NAND_PART_SIZE_19                   (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)    // channelA          1M
#define NAND_PART_SIZE_20                   (NAND_FLASH_SINGLE_CHANNELLIST_SIZE)    // channelB          1M
#define NAND_PART_SIZE_21                   (NAND_FLASH_DVBS_DEFAULT_DB_SIZE)       // ddbb_a             1M
#define NAND_PART_SIZE_22                   (NAND_FLASH_DVBS_DEFAULT_DB_SIZE)       // ddbb_b             1M
#define NAND_PART_SIZE_23                   (NAND_FLASH_EPG_CACHE_SIZE)             // epg                  48M
#define NAND_PART_SIZE_24                   (NAND_FLASH_SERVICE_MODE_SIZE)          // svc                   1M
#define NAND_PART_SIZE_25                   (NAND_FLASH_OOPS_SIZE)                  // oops                 1M
#define NAND_PART_SIZE_26                   (NAND_FLASH_VBMETA_SIZE)                // vbmeta_a         1M
#define NAND_PART_SIZE_27                   (NAND_FLASH_VBMETA_SIZE)                // vbmeta_b         1M
#define NAND_PART_SIZE_28                   (NAND_FLASH_TRUSTZONE_SIZE)             // tzbp_a              6M
#define NAND_PART_SIZE_29                   (NAND_FLASH_TRUSTZONE_SIZE)             // tzbp_b              6M
#define NAND_PART_SIZE_30                   (NAND_FLASH_RAWDAT_SIZE)                // raw_data          4M
#define NAND_PART_SIZE_31                   (NAND_FLASH_RECIPE_SIZE)                // recipe_a            256M
#define NAND_PART_SIZE_32                   (NAND_FLASH_RECIPE_SIZE)                // recipe_b            256M
#define NAND_PART_SIZE_33                   (NAND_FLASH_BOOT_SIZE)                  // boot_a              64M
#define NAND_PART_SIZE_34                   (NAND_FLASH_BOOT_SIZE)                  // boot_b              64M
#define NAND_PART_SIZE_35                   (NAND_FLASH_DTBO_SIZE)                  // dtbo_a              8M
#define NAND_PART_SIZE_36                   (NAND_FLASH_DTBO_SIZE)                  // dtbo_b              8M
#define NAND_PART_SIZE_37                   (NAND_FLASH_ROOTFS_SIZE)                // linux_rootfsA    128M
#define NAND_PART_SIZE_38                   (NAND_FLASH_ROOTFS_SIZE)                // linux_rootfsB    128M
#define NAND_PART_SIZE_39                   (NAND_FLASH_3RD_RW_SIZE)                // 3rd_rw             256M
#define NAND_PART_SIZE_40                   (NAND_FLASH_3RD_SIZE)                   // 3rd_ro_a          128M
#define NAND_PART_SIZE_41                   (NAND_FLASH_3RD_SIZE)                   // 3rd_ro_b          128M
#define NAND_PART_SIZE_42                   (NAND_FLASH_VEND_SIZE)                  // vendor_a          700M
#define NAND_PART_SIZE_43                   (NAND_FLASH_SYSM_SIZE)                  // system_a         2750M
#define NAND_PART_SIZE_44                   (NAND_FLASH_PROD_SIZE)                  // prod_a              1000M
#define NAND_PART_SIZE_45                   (NAND_FLASH_VEND_SIZE)                  // vendor_b          700M
#define NAND_PART_SIZE_46                   (NAND_FLASH_SYSM_SIZE)                  // system_b         2750M
#define NAND_PART_SIZE_47                   (NAND_FLASH_PROD_SIZE)                  // prod_b              1000M
#define NAND_PART_SIZE_48                   (NAND_FLASH_UPGRADE_SIZE)               // upgrade size     32M
#define NAND_PART_SIZE_49                   (NAND_FLASH_USRD_SIZE)                  // 32GB EMMC Userdata size = 19245MB, 16GB EMMC Userdata size = 4317MB

#define NAND_PART_SIZE_50                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_51                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_52                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_53                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_54                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_55                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_56                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_57                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_58                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_59                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_60                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_61                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_62                   ((UINT64)(0))                           // reserved
#define NAND_PART_SIZE_63                   ((UINT64)(0))                           // reserved
#endif


#ifdef CC_MTD_ENCRYPT_SUPPORT

#ifndef CC_DUALLOADER_SUPPORT
#define NAND_PART_ENCRYPT_1                 (0)
#define NAND_PART_ENCRYPT_2                 (0)
#define NAND_PART_ENCRYPT_3                 (0)
#define NAND_PART_ENCRYPT_4                 (1)                 /* boot */
#define NAND_PART_ENCRYPT_5                 (0)
#define NAND_PART_ENCRYPT_6                 (0)
#define NAND_PART_ENCRYPT_7                 (0)
#define NAND_PART_ENCRYPT_8                 (0)
#define NAND_PART_ENCRYPT_9                 (0)
#define NAND_PART_ENCRYPT_10                (0)
#define NAND_PART_ENCRYPT_11                (0)
#define NAND_PART_ENCRYPT_12                (1)                 /* rfs */
#define NAND_PART_ENCRYPT_13                (0)
#define NAND_PART_ENCRYPT_14                (0)
#define NAND_PART_ENCRYPT_15                (0)
#define NAND_PART_ENCRYPT_16                (1)                 /* 3rdp */
#define NAND_PART_ENCRYPT_17                (0)
#define NAND_PART_ENCRYPT_18                (0)
#define NAND_PART_ENCRYPT_19                (0)
#define NAND_PART_ENCRYPT_20                (0)
#define NAND_PART_ENCRYPT_21                (0)
#define NAND_PART_ENCRYPT_22                (0)
#define NAND_PART_ENCRYPT_23                (0)
#define NAND_PART_ENCRYPT_24                (0)
#define NAND_PART_ENCRYPT_25                (0)
#define NAND_PART_ENCRYPT_26                (0)
#define NAND_PART_ENCRYPT_27                (0)
#define NAND_PART_ENCRYPT_28                (0)
#define NAND_PART_ENCRYPT_29                (0)
#define NAND_PART_ENCRYPT_30                (0)
#define NAND_PART_ENCRYPT_31                (0)
#define NAND_PART_ENCRYPT_32                (0)
#define NAND_PART_ENCRYPT_33                (0)
#define NAND_PART_ENCRYPT_34                (0)
#define NAND_PART_ENCRYPT_35                (0)
#define NAND_PART_ENCRYPT_36                (0)
#define NAND_PART_ENCRYPT_37                (0)
#define NAND_PART_ENCRYPT_38                (0)
#define NAND_PART_ENCRYPT_39                (0)
#define NAND_PART_ENCRYPT_40                (0)
#define NAND_PART_ENCRYPT_41                (0)
#define NAND_PART_ENCRYPT_42                (0)
#define NAND_PART_ENCRYPT_43                (1)                 /* system */
#define NAND_PART_ENCRYPT_44                (0)
#define NAND_PART_ENCRYPT_45                (0)
#define NAND_PART_ENCRYPT_46                (0)
#define NAND_PART_ENCRYPT_47                (0)
#define NAND_PART_ENCRYPT_48                (0)
#define NAND_PART_ENCRYPT_49                (0)
#define NAND_PART_ENCRYPT_50                (0)
#define NAND_PART_ENCRYPT_51                (0)

#define NAND_PART_ENCRYPT_52                (0)
#define NAND_PART_ENCRYPT_53                (0)
#define NAND_PART_ENCRYPT_54                (0)
#define NAND_PART_ENCRYPT_55                (0)
#define NAND_PART_ENCRYPT_56                (0)
#define NAND_PART_ENCRYPT_57                (0)
#define NAND_PART_ENCRYPT_58                (0)
#define NAND_PART_ENCRYPT_59                (0)
#define NAND_PART_ENCRYPT_60                (0)
#define NAND_PART_ENCRYPT_61                (0)
#define NAND_PART_ENCRYPT_62                (0)
#else
#define NAND_PART_ENCRYPT_1                 (0)
#define NAND_PART_ENCRYPT_2                 (0)
#define NAND_PART_ENCRYPT_3                 (0)
#define NAND_PART_ENCRYPT_4                 (0)                 
#define NAND_PART_ENCRYPT_5                 (0)
#define NAND_PART_ENCRYPT_6                 (0)
#define NAND_PART_ENCRYPT_7                 (0)
#define NAND_PART_ENCRYPT_8                 (0)
#define NAND_PART_ENCRYPT_9                 (0)
#define NAND_PART_ENCRYPT_10                (1) // misc
#define NAND_PART_ENCRYPT_11                (1) // uboot_env_a
#define NAND_PART_ENCRYPT_12                (1) // uboot_env_b
#define NAND_PART_ENCRYPT_13                (0)
#define NAND_PART_ENCRYPT_14                (0)
#define NAND_PART_ENCRYPT_15                (0)
#define NAND_PART_ENCRYPT_16                (0)                 
#define NAND_PART_ENCRYPT_17                (0)
#define NAND_PART_ENCRYPT_18                (0)
#define NAND_PART_ENCRYPT_19                (0)
#define NAND_PART_ENCRYPT_20                (0)
#define NAND_PART_ENCRYPT_21                (0)
#define NAND_PART_ENCRYPT_22                (0)
#define NAND_PART_ENCRYPT_23                (0)
#define NAND_PART_ENCRYPT_24                (0)
#define NAND_PART_ENCRYPT_25                (0)
#define NAND_PART_ENCRYPT_26                (0)
#define NAND_PART_ENCRYPT_27                (0)
#define NAND_PART_ENCRYPT_28                (0)
#define NAND_PART_ENCRYPT_29                (0)
#define NAND_PART_ENCRYPT_30                (0)
#define NAND_PART_ENCRYPT_31                (0)
#define NAND_PART_ENCRYPT_32                (0)
#define NAND_PART_ENCRYPT_33                (1) // boot_a
#define NAND_PART_ENCRYPT_34                (1) // boot_b
#define NAND_PART_ENCRYPT_35                (0)
#define NAND_PART_ENCRYPT_36                (0)
#define NAND_PART_ENCRYPT_37                (1) // linux_rootfs_a
#define NAND_PART_ENCRYPT_38                (1) // linux_rootfs_b
#define NAND_PART_ENCRYPT_39                (0)
#define NAND_PART_ENCRYPT_40                (1) // 3rd_ro_a
#define NAND_PART_ENCRYPT_41                (1) // 3rd_ro_b
#define NAND_PART_ENCRYPT_42                (1) // vendor_a
#define NAND_PART_ENCRYPT_43                (1) // system_a
#define NAND_PART_ENCRYPT_44                (1) // product_a
#define NAND_PART_ENCRYPT_45                (1) // vendor_b
#define NAND_PART_ENCRYPT_46                (1) // system_b
#define NAND_PART_ENCRYPT_47                (1) // product_b
#define NAND_PART_ENCRYPT_48                (0)
#define NAND_PART_ENCRYPT_49                (0)

#define NAND_PART_ENCRYPT_50                (0)
#define NAND_PART_ENCRYPT_51                (0)
#define NAND_PART_ENCRYPT_52                (0)
#define NAND_PART_ENCRYPT_53                (0)
#define NAND_PART_ENCRYPT_54                (0)
#define NAND_PART_ENCRYPT_55                (0)
#define NAND_PART_ENCRYPT_56                (0)
#define NAND_PART_ENCRYPT_57                (0)
#define NAND_PART_ENCRYPT_58                (0)
#define NAND_PART_ENCRYPT_59                (0)
#define NAND_PART_ENCRYPT_60                (0)
#define NAND_PART_ENCRYPT_61                (0)
#define NAND_PART_ENCRYPT_62                (0)
#define NAND_PART_ENCRYPT_63                (0)
#endif 
#endif /* endif CC_MTD_ENCRYPT_SUPPORT */

#ifndef CC_DUALLOADER_SUPPORT
#define NAND_PART_NAME_0                "uboot"
#define NAND_PART_NAME_1                "uboot_env"
#define NAND_PART_NAME_2                "eeprom_A"
#define NAND_PART_NAME_3                "perm"
#define NAND_PART_NAME_4                "boot"
#define NAND_PART_NAME_5                "reserved1"
#define NAND_PART_NAME_6                "channelA"
#define NAND_PART_NAME_7                "channelB"
#define NAND_PART_NAME_8                "pq"
#define NAND_PART_NAME_9                "aq"
#define NAND_PART_NAME_10               "bootlogo"
#ifdef CC_TZBIN_INDIVIDUAL_PARTITION
    #define NAND_PART_NAME_11           "tzbp"
    #define TRUSTZONE_FLASH_PARTITION   (11)
#endif /* endif CC_TZBIN_INDIVIDUAL_PARTITION */
#define NAND_PART_NAME_12               "linux_rootfsA"
#define NAND_PART_NAME_13               "basic"
#define NAND_PART_NAME_14               "3rd_rw"
#define NAND_PART_NAME_15               "hdmi"
#define NAND_PART_NAME_16               "3rd_ro"
#define NAND_PART_NAME_17               "panel"
#define NAND_PART_NAME_18               "ci"
#define NAND_PART_NAME_19               "edid"
#define NAND_PART_NAME_20               "svc"
#define NAND_PART_NAME_21               "ddb"
#define NAND_PART_NAME_22               "epg"
#define NAND_PART_NAME_23               "adsp"
#define NAND_PART_NAME_24               "reserved2"
#define NAND_PART_NAME_25               "wfdp"
#define NAND_PART_NAME_26               "ddri"
#define NAND_PART_NAME_27               "mlfw"
#define NAND_PART_NAME_28               "ldat"
#define NAND_PART_NAME_29               "mafw"
#define NAND_PART_NAME_30               "dfw1"
#define NAND_PART_NAME_31               "dfw2"
#define NAND_PART_NAME_32               "pdat"
#define NAND_PART_NAME_33               "bdat"
#define NAND_PART_NAME_34               "ndat"
#define NAND_PART_NAME_35               "fdat"
#define NAND_PART_NAME_36               "udat"
#define NAND_PART_NAME_37               "bdix"
#define NAND_PART_NAME_38               "minf"
#define NAND_PART_NAME_39               "bedat"
#define NAND_PART_NAME_40               "upgrade"
#define NAND_PART_NAME_41               "misc"
#define NAND_PART_NAME_42               "recovery"
#define NAND_PART_NAME_43               "system"
#define NAND_PART_NAME_44               "userdata"
#define NAND_PART_NAME_45               "cache"
#define NAND_PART_NAME_46               "sdcard"
#define NAND_PART_NAME_47               "udt"
#define NAND_PART_NAME_48               "arib_nvram"
#define NAND_PART_NAME_49               "sapost"
#define NAND_PART_NAME_50               "data_demo"
#define NAND_PART_NAME_51               "version"
#define NAND_PART_NAME_52               "oops"
#define NAND_PART_NAME_53               "spqd"
#define NAND_PART_NAME_54               "spqc"

#define NAND_PART_NAME_55               "reserved3"
#define NAND_PART_NAME_56               "reserved4"
#define NAND_PART_NAME_57               "reserved5"
#define NAND_PART_NAME_58               "reserved6"
#define NAND_PART_NAME_59               "reserved7"
#define NAND_PART_NAME_60               "reserved8"
#define NAND_PART_NAME_61               "reserved9"
#define NAND_PART_NAME_62               "reserved10"

#define NAND_PART_END                   (63)
#else
/*
#define NAND_PART_NAME_0                "uboot"
#define NAND_PART_NAME_1                "uboot_B"
#define NAND_PART_NAME_2                "uboot_env"
#define NAND_PART_NAME_3                "eeprom_A"
#define NAND_PART_NAME_4                "perm"
#define NAND_PART_NAME_5                "boot"
#define NAND_PART_NAME_6                "reserved1"
#define NAND_PART_NAME_7                "channelA"
#define NAND_PART_NAME_8                "channelB"
#define NAND_PART_NAME_9                "pq"
#define NAND_PART_NAME_10               "aq"
#define NAND_PART_NAME_11               "bootlogo"
#ifdef CC_TZBIN_INDIVIDUAL_PARTITION
    #define NAND_PART_NAME_12           "tzbp"
    #define TRUSTZONE_FLASH_PARTITION   (12)
#endif 
#define NAND_PART_NAME_13               "linux_rootfsA"
#define NAND_PART_NAME_14               "basic"
#define NAND_PART_NAME_15               "3rd_rw"
#define NAND_PART_NAME_16               "hdmi"
#define NAND_PART_NAME_17               "3rd_ro"
#define NAND_PART_NAME_18               "panel"
#define NAND_PART_NAME_19               "ci"
#define NAND_PART_NAME_20               "edid"
#define NAND_PART_NAME_21               "svc"
#define NAND_PART_NAME_22               "ddb"
#define NAND_PART_NAME_23               "epg"
#define NAND_PART_NAME_24               "adsp"
#define NAND_PART_NAME_25               "reserved2"
#define NAND_PART_NAME_26               "wfdp"
#define NAND_PART_NAME_27               "ddri"
#define NAND_PART_NAME_28               "mlfw"
#define NAND_PART_NAME_29               "ldat"
#define NAND_PART_NAME_30               "mafw"
#define NAND_PART_NAME_31               "dfw1"
#define NAND_PART_NAME_32               "dfw2"
#define NAND_PART_NAME_33               "pdat"
#define NAND_PART_NAME_34               "bdat"
#define NAND_PART_NAME_35               "ndat"
#define NAND_PART_NAME_36               "fdat"
#define NAND_PART_NAME_37               "udat"
#define NAND_PART_NAME_38               "bdix"
#define NAND_PART_NAME_39               "minf"
#define NAND_PART_NAME_40               "bedat"
#define NAND_PART_NAME_41               "upgrade"
#define NAND_PART_NAME_42               "misc"
#define NAND_PART_NAME_43               "recovery"
#define NAND_PART_NAME_44               "system"
#define NAND_PART_NAME_45               "userdata"
#define NAND_PART_NAME_46               "cache"
#define NAND_PART_NAME_47               "sdcard"
#define NAND_PART_NAME_48               "udt"
#define NAND_PART_NAME_49               "arib_nvram"
#define NAND_PART_NAME_50               "sapost"
#define NAND_PART_NAME_51               "data_demo"
#define NAND_PART_NAME_52               "version"
#define NAND_PART_NAME_53               "oops"
#define NAND_PART_NAME_54               "spqd"
#define NAND_PART_NAME_55               "spqc"

#define NAND_PART_NAME_56               "reserved3"
#define NAND_PART_NAME_57               "reserved4"
#define NAND_PART_NAME_58               "reserved5"
#define NAND_PART_NAME_59               "reserved6"
#define NAND_PART_NAME_60               "reserved7"
#define NAND_PART_NAME_61               "reserved8"
#define NAND_PART_NAME_62               "reserved9"
#define NAND_PART_NAME_63               "reserved10"

#define NAND_PART_END                   (63)  //this value should be safe
*/
#define NAND_PART_NAME_0                "uboot"
#define NAND_PART_NAME_1                "uboot_B"
#define NAND_PART_NAME_2                "eeprom_A"
#define NAND_PART_NAME_3                "perm"
#define NAND_PART_NAME_4                "hdmi"
#define NAND_PART_NAME_5                "reserved1"
#define NAND_PART_NAME_6                "ci"
#define NAND_PART_NAME_7                "persist"
#define NAND_PART_NAME_8                "fdata"
#define NAND_PART_NAME_9                "rdata"
#define NAND_PART_NAME_10               "misc"
#define NAND_PART_NAME_11               "uboot_env_a"
#define NAND_PART_NAME_12               "uboot_env_b"
#define NAND_PART_NAME_13               "reserved2"
#define NAND_PART_NAME_14               "reserved3"
#define NAND_PART_NAME_15               "reserved4"
#define NAND_PART_NAME_16               "reserved5"

#ifdef CC_MTK_CM4_SUPPORT
#define NAND_PART_NAME_17               "cm4s_a"
#define NAND_PART_NAME_18               "cm4s_b"
#else
#define NAND_PART_NAME_17               "reserved6"
#define NAND_PART_NAME_18               "reserved7"
#endif

#define NAND_PART_NAME_19               "channelA"
#define NAND_PART_NAME_20               "channelB"
#define NAND_PART_NAME_21               "ddbb_a"
#define NAND_PART_NAME_22               "ddbb_b"
#define NAND_PART_NAME_23               "epg"
#define NAND_PART_NAME_24               "svc"
#define NAND_PART_NAME_25               "oops"
#define NAND_PART_NAME_26               "vbmeta_a"
#define NAND_PART_NAME_27               "vbmeta_b"
#ifdef CC_TZBIN_INDIVIDUAL_PARTITION
#define NAND_PART_NAME_28               "tzbp_a"
#define TRUSTZONE_FLASH_PARTITION       (28)
#else
#define NAND_PART_NAME_28               "tzbp_a"
#endif
#define NAND_PART_NAME_29               "tzbp_b"
#define NAND_PART_NAME_30               "raw_data"
#define NAND_PART_NAME_31               "recipe_a"
#define NAND_PART_NAME_32               "recipe_b"
#define NAND_PART_NAME_33               "boot_a"
#ifdef CC_SUPPORT_AB_UPDATE
#define NAND_PART_NAME_34               "boot_b"
#else
#define NAND_PART_NAME_34               "recovery"
#endif
#define NAND_PART_NAME_35               "dtbo_a"
#define NAND_PART_NAME_36               "dtbo_b"
#ifdef CC_SUPPORT_AB_UPDATE
#define NAND_PART_NAME_37               "linux_rootfs_a"
#define NAND_PART_NAME_38               "linux_rootfs_b"
#else
#define NAND_PART_NAME_37               "linux_rootfsA"
#define NAND_PART_NAME_38               "linux_rootfsB"
#endif
#define NAND_PART_NAME_39               "3rd_rw"
#define NAND_PART_NAME_40               "3rd_a"
#define NAND_PART_NAME_41               "3rd_b"
#define NAND_PART_NAME_42               "vendor_a"
#define NAND_PART_NAME_43               "system_a"
#define NAND_PART_NAME_44               "product_a"
#define NAND_PART_NAME_45               "vendor_b"
#define NAND_PART_NAME_46               "system_b"
#define NAND_PART_NAME_47               "product_b"
#define NAND_PART_NAME_48               "upgrade"
#define NAND_PART_NAME_49               "userdata"

#define NAND_PART_NAME_50               "reserved10"
#define NAND_PART_NAME_51               "reserved11"
#define NAND_PART_NAME_52               "reserved12"
#define NAND_PART_NAME_53               "reserved13"
#define NAND_PART_NAME_54               "reserved14"
#define NAND_PART_NAME_55               "reserved15"
#define NAND_PART_NAME_56               "reserved16"
#define NAND_PART_NAME_57               "reserved17"
#define NAND_PART_NAME_58               "reserved18"
#define NAND_PART_NAME_59               "reserved19"
#define NAND_PART_NAME_60               "reserved20"
#define NAND_PART_NAME_61               "reserved21"
#define NAND_PART_NAME_62               "reserved22"
#define NAND_PART_NAME_63               "reserved23"
#define NAND_PART_END                   (63)  //this value should be safe

#endif

/* Now already change to use file based to load adsp and arm11 bin */
#ifdef ADSP_BIN_SUPPORT
    #ifndef CC_DUALLOADER_SUPPORT
        #define FLASH_ADSP_BIN_PARTITION                (23)
        #define FLASH_AARM_BIN_PARTITION                (49)
    #else
        #define FLASH_ADSP_BIN_PARTITION				(35)
        #define FLASH_AARM_BIN_PARTITION				(13)
    #endif
#endif

#ifndef CC_DUALLOADER_SUPPORT

    #define NAND_FLASH_STATIC_LAST_PART_ID      (12)

    #define NAND_FLASH_STATIC_PART_SIZE \
        ((NAND_PART_SIZE_0) + \
        (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
        (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
        (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
        (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12))
#else
    #define NAND_FLASH_STATIC_LAST_PART_ID      (13)  //EMMC no need care

    #define NAND_FLASH_STATIC_PART_SIZE \
        ((NAND_PART_SIZE_0) + \
        (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
        (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
        (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
        (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12)+(NAND_PART_SIZE_13))
#endif
/*Flash PQ customization*/ /* not use M5 */
#ifdef SUPPORT_FLASH_PQ
    #define FLASH_PQ_USE_NAND_FLASH                 (1)
    #ifndef CC_DUALLOADER_SUPPORT
        #define FLASH_PQ_BASE_PARTITION                 (8)
    #else
        #define FLASH_PQ_BASE_PARTITION                 (15)
        #define FLASH_PQ_BASE_PARTITION_B               (16)
    #endif
    #ifndef DEMO_BOARD
    /* customer */
        #define SUPPORT_FLASH_PQ_ENABLE_QTY_SMART_PIC   (1)
        #define SUPPORT_FLASH_PQ_ENABLE_GAMMA           (0)
        #define SUPPORT_FLASH_PQ_ENABLE_QTY_MAX_MIN     (1)
        #define SUPPORT_NVM_GAMMA                       (1)
    #endif
#endif

#ifdef SUPPORT_FLASH_AQ
    #ifndef CC_DUALLOADER_SUPPORT
    #define FLASH_AQ_BASE_PARTITION             (9)
    #else
    #define FLASH_AQ_BASE_PARTITION             (17)
    #define FLASH_AQ_BASE_PARTITION_B           (18)
    #endif
    #define FLASH_AQ_BASE_ADDRESS               (0)
#endif

#ifndef CC_DUALLOADER_SUPPORT
    /* Flash EDID */
    #define HDMIEDID_NAND_FLASH_PART_ID         (19)
    #define HDMIEDID_NAND_FLASH_OFFSET          (0)
    #define HDMIEDID_NAND_FLASH_PART_SIZE       (NAND_FLASH_EDID_SIZE)
    #define VGAEDID_NAND_FLASH_PART_ID          (19)
    #define VGAEDID_NAND_FLASH_OFFSET           (0)
    #define VGAEDID_NAND_FLASH_PART_SIZE        (NAND_FLASH_EDID_SIZE)

    #define HDMI_BOSTON_FW_PART_ID         (50)

    /* Flash HDCP */
    #define HDCP_NAND_FLASH_PART_ID             (15)
    #define HDCP_NAND_FLASH_OFFSET              (0)

    #ifdef CC_HDMI_2_0_HDCP_BIN
    #define HDMI_HDCP22_PART_ID             (25)
    #define HDMI_HDCP22_OFFSET              (0x800)  // it is not in the eeprom
    #endif

    #ifndef WFD_HDCP22_PART_ID
    #define WFD_HDCP22_PART_ID        (5)
    #endif

    #ifndef WFD_HDCP22_OFFSET
    #define WFD_HDCP22_OFFSET          (0x1000)
    #endif


#else
    /* Flash EDID */ /*M3 M5  not use now */
    #define HDMIEDID_NAND_FLASH_PART_ID         (15)
    #define HDMIEDID_NAND_FLASH_OFFSET          (0)
    #define HDMIEDID_NAND_FLASH_PART_SIZE       (NAND_FLASH_EDID_SIZE)
    #define VGAEDID_NAND_FLASH_PART_ID          (15)
    #define VGAEDID_NAND_FLASH_OFFSET           (0)
    #define VGAEDID_NAND_FLASH_PART_SIZE        (NAND_FLASH_EDID_SIZE)

    /*M3 M5  not use now */
    #define HDMI_BOSTON_FW_PART_ID         (51)//no use again

    /* Flash HDCP */
    #define HDCP_NAND_FLASH_PART_ID             (4)//HDCP1.4
    #define HDCP_NAND_FLASH_OFFSET              (0)

    #ifdef CC_HDMI_2_0_HDCP_BIN
    #define HDMI_HDCP22_PART_ID             (4)//HDCP14+HDMI2.2(0x800)+WFD(0x1000)
    #define HDMI_HDCP22_OFFSET              (0x800)  // it is not in the eeprom
    #endif

    #ifndef WFD_HDCP22_PART_ID
    #define WFD_HDCP22_PART_ID        (4)
    #endif

    #ifndef WFD_HDCP22_OFFSET
    #define WFD_HDCP22_OFFSET          (0x1000)
    #endif

#endif

#ifndef CC_DUALLOADER_SUPPORT
    #define UBOOT_ENV_OFFSET                (NAND_FLASH_LOADER_SIZE)
#else
    #define UBOOT_ENV_OFFSET                (NAND_FLASH_LOADER_SIZE + NAND_FLASH_LOADER_SIZE_B +                          \
                                             NAND_FLASH_REPLACE_EEPROM_SIZE + NAND_FLASH_PERM_SIZE +                      \
                                             NAND_FLASH_HDCP_SIZE + NAND_FLASH_RESERVE_SIZE + NAND_FLASH_CIPLUS_SIZE +      \
                                             NAND_FLASH_PERSIST_SIZE + NAND_FLASH_FDAT_SIZE +                            \
                                             NAND_FLASH_RDAT_SIZE + NAND_FLASH_MISC_SIZE)      /* UBOOT ENV OFFSET = 129MB */
#endif

//----------------------------------------------------------------------------
// End - Flash Partition configuration
//----------------------------------------------------------------------------

#endif /*FLASH_LAYOUT_H*/
