From 3fb0bdab95c1c16a8602ab5be99f5f826fcddb61 Mon Sep 17 00:00:00 2001 From: Pradeep P V K Date: Mon, 10 Aug 2020 21:03:31 +0530 Subject: [PATCH] mtd: msm_qpic_nand: Use logical unit count in flash density In an ONFI compliant devices, the flash parameters are calculated by reading the onfi parameter page of the device. Existing flash density is calculated based on a single logical unit(LUN). This shows wrong density information on Multi LUN flashes. So, always use number of LUNS value in flash density calculations. Change-Id: Idba4d4e129e7fdcdab1e509bd8c3149f26fc11f2 Signed-off-by: Pradeep P V K --- drivers/mtd/devices/msm_qpic_nand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index 9dcb277170f7..3b400f03805e 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -781,8 +781,9 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info) flash->blksize = onfi_param_page_ptr->number_of_pages_per_block * flash->pagesize; flash->oobsize = onfi_param_page_ptr->number_of_spare_bytes_per_page; - flash->density = onfi_param_page_ptr->number_of_blocks_per_logical_unit - * flash->blksize; + flash->density = onfi_param_page_ptr->number_of_logical_units * + onfi_param_page_ptr->number_of_blocks_per_logical_unit * + flash->blksize; flash->ecc_correctability = onfi_param_page_ptr->number_of_bits_ecc_correctability;