7 NAND
7.1 Add MCP (NAND) support on MDM9x07 platform
If NAND part is ONFI-compliant, it is automatically detected during ONFI probe. There is
no need to add this part to the code.
Make the following changes to add the non-ONFI NAND part:
Add NAND flash part in "supported_nand_devices[]" in
boot_images/core/storage/flash/src/dal/flash_nand_config.c
Add supported_nand_devices[]" in
modem_proc/core/storage/flash/src/dal/flash_nand_config.c
Add supported_flash[] in bootable/bootloader/lk/platform/msm_shared/qpic_nand.c
Add manufacture id define in Apps_proc\include\linux\mtd\nand.h
Add in nand_flash_ids[] in the file Apps_proc\drivers\mtd\nand\nand_ids.c
Add in nand_manuf_ids[] in the file Apps_proc\drivers\mtd\nand\nand_ids.c if the
memory vendor is not there in list.
7.2 ECC length supported on MDM9x07
MDM9x07 can support 4-bit ECC and 8-bit ECC NAND parts. BCH algorithm is used for
both 4-bit and 8-bit ECC.
7.3 Required application processor build changes for a 2k
page NAND part
The application processor build requires the following changes for a 2000-page NAND
part:
Set the PAGE_SIZE to 2048 in oe-core/meta-msm/conf/machine/mdm9607.conf file
Change MKUBIFS_ARGS and UBINIZE_ARGS to specify 2048 for -m and -s
options.
Example changes to support 2 KB-page boot and system UBI image support:
File – apps_proc/oe-core/meta-msm/conf/machine/mdm9607.conf
For the kernel image:
PAGE_SIZE = '2048'
For a system/usr UBI image:
#UBINIZE Args
UBINIZE_ARGS = "-m 2048 -p 128KiB -s 2048"
#MKUBIFS Args
MKUBIFS_ARGS = "-m 2048 -e 126976 -c 567 -F"
Change MKUBIFS_ARGS to specify 2048 for the -m option in the following file:
File – apps_proc/oe-core/meta-msm/recipes/images/mdm9607-recovery-image.inc
For example:
MKUBIFS_ARGS = "-m 2048 -e 126976 -c 74 -F"
NOTE:
-c is number of blocks in the system partition. The value depends on the rest of
the partition size, see the partition.xml file in the build for the partition size.
The changes are made in file poky\meta-qti-
bsp\conf\machine\include\mdm9607.inc instead of apps_proc/oe-core/meta-
msm/conf/machine/mdm9607.conf from LE.2.0 PL onwards. There is no change
required for 2K page as PAGE_SIZE_2K and UBINIZE_ARGS_2K are already
defined in mdm9607.inc file.
7.4 Use SCRUB partition
SCRUB partition is used to Flash Scrub feature.
The Flash Scrub feature is intended to enable the NAND Flash and the data stored in
the NAND Flash in MDM targets to survive 15 years of use. This feature is intended only
for MDM customers who have products with a 15 year life expectancy and are using
NAND Flash with extra space for Flash Scrub.
Flash Scrub Feature (80-NK633-1) provides more information on how Flash Scrub
works, what are Flash Scrub security risks, how to enable Flash Scrub, Flash Scrub
configurable items, runtime APIs and QMI commands as well as Flash Scrub debug tips
and limitations.
7.5 Detect the bad block information of NAND flash
Detect the bad block information of NAND flash on MDM9x07 as follows:
1. On application processor Cortex A7 TRACE32 window, change directory to the boot
build directory:
<Boot Build>\boot_images\core\storage\flash\tools\src\nand
2. Perform either of the following:
Run “do nand_diagnose.cmm” and select option 6 – Block Utilities
Run “do nand_block_util.cmm
7.6 Configure the NAND flash partition
The file common\build\partition_nand.xml specifies all the partitions. You can modify this
file to add or delete a partition. KB Solution 00026274 provides partition specification in
this XML file.
Each partition is described with following fields.
<name> field specify the name of the partition.
<size_kb> is the size of the partition in KB.
<pad_kb> is the extra space to accommodate bad blocks in this partition.
<which_flash> is the device_id of that partition. Multiple clients can access the same
partition and each client gets separate device_id for this partition. These IDs are
given dynamically and are "0" in XML.
Each partition has four attribute fields, and each attribute field is a byte size value
(0 to 0xFF):
Type of flash. Must be set to 0xFF.
Type of ECC to be used for the partition.
Use driver default – 0xFF
ECC on main only – 0x0
ECC on main and spare – 0x1
Image upgrade through QPST
Set to 0 – If the partition is an image partition and the image must be downloaded
via QPST.
Default to 0xFF – Required if QPST is not used for image upgrades.
7.7 NAND flash driver page layouts on MDM9x07
See NAND HAL Flash Driver Page Layouts on MDM9x35, MDM9x45, and MDM9x55
Chipsets (80-NH740-71), the flash page layout is the same for M