From 8d65c90a8a92f4164241cdf9f3650b31a7ca265d Mon Sep 17 00:00:00 2001 From: Sarthak Garg Date: Wed, 9 Dec 2020 14:11:57 +0530 Subject: [PATCH] mtd: msm_qpic_nand: Workaround to get the correct density for JSC part MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 8 x 8 JSC MCP part has 2 x 4Gbit NAND dies from Hynyx and supports ONFI. But ONFI parameter page field values below read from the device only account for 4Gbit instead of 8Gbit: Pages/Block : 64 Page size : 4096 num_blocks_per_unit : 2048 num_units : 1 JSC vendor has no plans to “correct” the ONFI parameter page field values in their current and future 8 x 8 MCP parts to properly identify the NAND device size as 8Gbit. Using Read ID values (manufacture ID (0xAD), device ID(0xA3)) instead to identify the part and multiplying the density to identify the part as 8Gbit device size. Change-Id: Id900f3475e68740597fbc4e6decb1b7920f09c57 Signed-off-by: Sarthak Garg --- drivers/mtd/devices/msm_qpic_nand.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index d80a03af3c58..80b20c9c13fd 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -734,6 +734,7 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info) struct flash_identification *flash = &info->flash_dev; uint32_t crc_chk_count = 0, page_address = 0; int ret = 0, i = 0, submitted_num_desc = 1; + uint32_t manid, devid; /* SPS parameters */ struct msm_nand_sps_cmd *cmd, *curr_cmd; @@ -945,6 +946,14 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info) pr_info("Found an ONFI compliant device %s\n", onfi_param_page_ptr->device_model); + + manid = flash->flash_id & 0xFF; + devid = (flash->flash_id >> 8) & 0xFF; + + /* hack for 8 x 8 JSC MCP part */ + if (manid == 0xAD && devid == 0xA3) + flash->density = flash->density * 2; + /* * Temporary hack for MT29F4G08ABC device. * Since the device is not properly adhering