From patchwork Wed Feb 12 21:34:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Oppenlander X-Patchwork-Id: 211192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9753C352A4 for ; Wed, 12 Feb 2020 21:34:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 868EE24671 for ; Wed, 12 Feb 2020 21:34:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nGD0hPLa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbgBLVe4 (ORCPT ); Wed, 12 Feb 2020 16:34:56 -0500 Received: from mail-il1-f170.google.com ([209.85.166.170]:45596 "EHLO mail-il1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727947AbgBLVez (ORCPT ); Wed, 12 Feb 2020 16:34:55 -0500 Received: by mail-il1-f170.google.com with SMTP id p8so3068175iln.12 for ; Wed, 12 Feb 2020 13:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=w12Uk4zQnC+xm4GHXvQXhIjr4R0drGkqeHOjGRGVKRA=; b=nGD0hPLaoWfm9SsNH9PIixjvigE0si+TTOJZSuPm9GakC0PsjP2+CromiBVJRJwXdr Wf+QDToP8eLEw/BAbERoE0k0DTUWo54ksmpAKoDswmHBk6dgL1s+hd0qk0f2xMNNnMyq oY/ZpKnTeIMk4w7dCjuNbOJKnwRYybEdiSznacKKFQci0NRXiLHiNVSMz3Aqt2TDf/lf xqsBUlrXKQJ4DtBDPgzRJ8ZLB/Z81MsySrsbqDJJWoKN28efjrifveNddwG/06NqmPvF /k+EivcEm4RZqZkkX0kZDL+QKlmSiVuhR1kUbpJ/Q473uMQ6o/2dMujmNaZjtYlsc9YI 014Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=w12Uk4zQnC+xm4GHXvQXhIjr4R0drGkqeHOjGRGVKRA=; b=PvHyCTQAm0AmxIS6CiT/ICDDtOM3NGTD4zHVuc5hz7VvulW0YmerisAA6v7kWuhRam DBCzkFoc0XFUDidpuz1+YGOus9hxjUkK6onmGsctMpWQdtCaAl0UmPLf3o4d/t5kkxds ZmaWQaVtg4nYtCmGKEVh2G+Z0vx3AwO9m7zTSqwvePBEminjY5ELB4zB8sccsDdMARBx DE8/MgXMnHS96iiPIoEqmOVOEcg+L1VYhq63U1qqcaJubzfqgWesS28ym2A3KMxtcrEy tX8hXjbm49dervKyT012t3EWO142aAyGl8/TYx99GNRqQrBZoMTGyJasqLMyqkZIduvU WqFA== X-Gm-Message-State: APjAAAWWDnesm6dIuDzjNqvuwJxX44siNe67aPV2W/uhgMM7ItcS7f6I uQSKf2ZECAUcx8bYJ2vbjDubjlWxj8o2Pt/nmy2cKGuq X-Google-Smtp-Source: APXvYqwxNhn/TKvKC6PNrZkWdLDtRBZtKFX4gCeAjjM39czv6n5yxbo1Y8awtBH3kVWiYJ3GSDsgrZ3AJzuNysP25yQ= X-Received: by 2002:a92:3cc3:: with SMTP id j64mr11824282ilf.160.1581543295070; Wed, 12 Feb 2020 13:34:55 -0800 (PST) MIME-Version: 1.0 From: Patrick Oppenlander Date: Thu, 13 Feb 2020 08:34:43 +1100 Message-ID: Subject: mmc-utils mmc tool reports incorrect cache size To: linux-mmc@vger.kernel.org Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Hi, I recently noticed that 'mmc' reports cache size incorrectly. The unit in the extended CSD is kilobits rather than kilobytes, so for a display unit of 'KiB' it needs to be scaled appropriately. Alternatively the unit could change to Kibit, but I think that's less helpful. I've attached a patch which fixes the issue & includes references to the relevant parts of the JEDEC standard. Hope someone finds this helpful, Patrick >From fd741374278ec64bb0c26780d043fab0d7bcf40e Mon Sep 17 00:00:00 2001 From: Patrick Oppenlander Date: Mon, 4 Nov 2019 13:51:12 +1100 Subject: [PATCH] Scale ext_csd cache size from kilobits to kilobytes JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices. --- mmc_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmc_cmds.c b/mmc_cmds.c index fb37189..a1b1d75 100644 --- a/mmc_cmds.c +++ b/mmc_cmds.c @@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv) printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n", ext_csd[247]); printf("Cache Size [CACHE_SIZE] is %d KiB\n", - ext_csd[249] << 0 | (ext_csd[250] << 8) | - (ext_csd[251] << 16) | (ext_csd[252] << 24)); + (ext_csd[249] << 0 | (ext_csd[250] << 8) | + (ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8); } /* A441: Reserved [501:247] -- 2.23.0