From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Thu, 3 Aug 2017 02:31:01 -0700 Subject: [U-Boot] [PATCH 6/8] nvme: Fix number of blocks detection In-Reply-To: <1501752663-25088-1-git-send-email-bmeng.cn@gmail.com> References: <1501752663-25088-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1501752663-25088-7-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Jon Nettleton NVMe should use the nsze value from the queried device. This will reflect the total number of blocks of the device and fix detecting my Samsung 960 EVO 256GB. Original: Capacity: 40386.6 MB = 39.4 GB (82711872 x 512) Fixed: Capacity: 238475.1 MB = 232.8 GB (488397168 x 512) Signed-off-by: Jon Nettleton Reviewed-by: Bin Meng Tested-by: Bin Meng --- drivers/nvme/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index feea02a..bac253a 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -620,7 +620,7 @@ static int nvme_blk_probe(struct udevice *udev) flbas = id->flbas & NVME_NS_FLBAS_LBA_MASK; ns->flbas = flbas; ns->lba_shift = id->lbaf[flbas].ds; - ns->mode_select_num_blocks = le64_to_cpu(id->nuse); + ns->mode_select_num_blocks = le64_to_cpu(id->nsze); ns->mode_select_block_len = 1 << ns->lba_shift; list_add(&ns->list, &ndev->namespaces); -- 2.9.2