From patchwork Mon Mar 10 05:52:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872367 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FBE91B4153 for ; Mon, 10 Mar 2025 05:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.141.245 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586158; cv=none; b=a8+NwNWz1ZJLRZzlVWRISsNnsCcN6XCvrEOlW9MztULTFWMvOKB65p/uvOB88ZUoQroYqVcUXr4B2AQdd3dWY/tUwZHhQUlBadwzXq1Rta/cSKiAB8bxRmGt2mDHoGIIkGcR0kVZPh8ua6apBcHN3yrjalAJn/vhGiobJbFU+jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586158; c=relaxed/simple; bh=tbYTUff95T/hojr46ultYWRwbKU6UTWGo+9SSH7oHto=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SvmPjkHrEy7cyqoPB5hUFzCKQp8+Vi4tzJW0VqixaLNLBYT0f45eqi5lMVVRlPVIz4ZNLW4VTf4NQAi5rvd93HVMNVMNCTjtsIF9nu01fezm9zHWALMzhgBox45eZAvpw/3quYYAJoqmhTmPju6rfP0DOk/QnHGV1KcJ5xQsxzg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=SdHzCCLK; arc=none smtp.client-ip=68.232.141.245 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="SdHzCCLK" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586157; x=1773122157; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tbYTUff95T/hojr46ultYWRwbKU6UTWGo+9SSH7oHto=; b=SdHzCCLKFGHxYCgDgJ0XxUqQR2Q5qpe8PNnVkV6tXl8LOwcxm7qAgXcH oRBS//DZxW/+WqLn4HLY+7m2mTDepGYucI3R/Mv4u8oyFPG1ILxrEUROr 3PGE+DXeUvd/JG6c5XWpJbONnVYLKauc7IuH7DSKCbBLnAS77uenepwkE p+U/TZdq/B+hOa0PbxTH1OBiUK3Cdn6rqGTmJGLvlrPGNRIfhy1kQSJrV bAfDTmAfm2Vo790/VG9mvxlTxSdyBd/uobYANBInUwiBabqwC/Gq6yjMZ WzLLDsBDxSi1a1BtqHRpExSNMHBmQXtAe2leFQdYUvx59/i2mHWmDIvZV w==; X-CSE-ConnectionGUID: EvayTR7rTdS4yR2mEyVMDA== X-CSE-MsgGUID: 6cj55fqYRweEvbeWXGKX2Q== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="46164460" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:55:56 +0800 IronPort-SDR: 67ce7119_TxXuOwWeSkVJyKhQiEwhF/Ja6QxanHfX3I+nyOy0MF51NmM 4qDkv+U+apvfIiQ66SQoZx8pmrePnx6T37W5P2A== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:56:57 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:55:56 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 1/7] mmc-utils: lsmmc: Break early in scr read Date: Mon, 10 Mar 2025 07:52:25 +0200 Message-Id: <20250310055231.304728-2-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit refactors the SCR case in the process_dir function to use the bus type check instead of comparing the type string directly. This change simplifies the logic and makes it consistent with other parts of the code that use the bus type. Signed-off-by: Avri Altman --- lsmmc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index 7e0ea23..bc0e264 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -2146,15 +2146,16 @@ static int process_dir(struct config *config, enum REG_TYPE reg) break; case SCR: - if (!strcmp(type, "SD")) { - reg_content = read_file("scr"); - if (!reg_content) { - fprintf(stderr, "Could not read SD card " - "configuration in directory '%s'.\n", - config->dir); - ret = -1; - goto err; - } + if (config->bus != SD) + break; + + reg_content = read_file("scr"); + if (!reg_content) { + fprintf(stderr, "Could not read SD card " + "configuration in directory '%s'.\n", + config->dir); + ret = -1; + goto err; } print_sd_scr(config, reg_content); From patchwork Mon Mar 10 05:52:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872719 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB9F11B4153 for ; Mon, 10 Mar 2025 05:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.141.245 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586164; cv=none; b=uyMLpPv80azc0OePCLAibShfdwgKkdIaF2ubbVr6kmRyXg6G9NpBZRMb7nCVwden3UYZIOuDbOplO/m8iDo0PbgUirDF1FA3A/cNhAwhlM1bZ8Dor+gDfBiNohLpA+f1eLRoH08a4JA1qApnMHvYNc4D3XUFLcH18nEenbhPMzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586164; c=relaxed/simple; bh=K4GO1r7TD/0wQ6o1XNUWn7x9JuNiAKRCKy9LrWS61D8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ATSaVk771E4336dJmORGAUmbN1ZZrAbRfEvuDyMzApuZu/nNsMksM48lFFa5nHhBnwaAH10u0seMU4+X5EmMYk2O91PahopLZnSf4kogs2TRyea5xkYeXj4SvmOGy/aLYC8WbyPCpJndspd87VrDoRbS/XkPMlS68sQrBPgu5KI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=JHXTbEwy; arc=none smtp.client-ip=68.232.141.245 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="JHXTbEwy" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586161; x=1773122161; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K4GO1r7TD/0wQ6o1XNUWn7x9JuNiAKRCKy9LrWS61D8=; b=JHXTbEwy/v11HUVCbRRRMf0clJJE9NCmosLzToH4aOG0eO474nxpHea8 PFxumJGRJ8cM90zQCHWoiqHVv9mIDXISzQUghMwR8qAry/505Yti/HJB+ 0PB+ylgz/rJlt/+JwHFxsqL6wBzsK6+vbEs2RIzfGs3ueM174nyr65N16 ef9Sb2s17XQMoSVBQDVCoPpXA2WfVeowGT6h83KMob9okkvrRM+UPt89G wI6QEmvzDdpwLyakOVKCJD/1c+PBTqAuk1umerfzq398j8ZvuppU/t4ts 1Upzs5snJRKjJhWwRCAhpRIrpkM5yNDCjkUCoopBREq8s3XBmDI9GwFd9 g==; X-CSE-ConnectionGUID: ztnsQCMaSlKNF63LOz+xDA== X-CSE-MsgGUID: 8TRZtjjJQgef5TomvRPzKg== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="46164493" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:01 +0800 IronPort-SDR: 67ce711d_UUYpClo+SnmDoODJcwxQe2dBibU5/ka/nWK10F9JvlDMOeA /gGHxMVLWOnJKC7yAgWSnbJ6HNN7QSrU9TpqVxQ== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:01 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:01 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 2/7] mmc-utils: lsmmc: Remove redundant argument checks in do_read_ Date: Mon, 10 Mar 2025 07:52:26 +0200 Message-Id: <20250310055231.304728-3-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit removes unnecessary argument checks in the do_read_csd, do_read_cid, and do_read_scr functions. The checks are redundant because the use of optarg in do_read_reg already ensures that all necessary arguments are provided and validated. The optarg mechanism in do_read_reg inherently handles argument validation, making these additional checks superfluous. This simplifies the code and avoids redundant checks. Signed-off-by: Avri Altman --- lsmmc.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index bc0e264..468a533 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -2192,30 +2192,15 @@ static int do_read_reg(int argc, char **argv, enum REG_TYPE reg) int do_read_csd(int argc, char **argv) { - if (argc != 2 && argc != 3) { - fprintf(stderr, "Usage: Print CSD data from .\n"); - exit(1); - } - return do_read_reg(argc, argv, CSD); } int do_read_cid(int argc, char **argv) { - if (argc != 2 && argc != 3) { - fprintf(stderr, "Usage: Print CID data from .\n"); - exit(1); - } - return do_read_reg(argc, argv, CID); } int do_read_scr(int argc, char **argv) { - if (argc != 2 && argc != 3) { - fprintf(stderr, "Usage: Print SCR data from .\n"); - exit(1); - } - return do_read_reg(argc, argv, SCR); } From patchwork Mon Mar 10 05:52:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872366 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1D6C1C7013 for ; Mon, 10 Mar 2025 05:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.141.245 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586168; cv=none; b=PZLs8NkCUAkGz61x8GyrswZEq6dFcSDRoUzp5zlVy5pUajLAAjciVBD0Do0VJJiYidpUjv7MC2sd0vFzEz+jn6aLr7r2JOxiCYdVSqud/ODOFpXr0JVUQnhyQDs8OOracufufWiwvxDri3b/7XYRab+tB6lFK4TTMoxlMMPwTbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586168; c=relaxed/simple; bh=OjknDet2JooRE9NzX99Ydxu/vUoeElSzHiHtsj0GGDo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K+F3s77oWG1uAdWHl1pG1HK6S7wYMK3I5iXDLlhV3URAcYM4kIGBo5NXzmq0r3jJYBEM4/Iq1FLyVeWHLg/Aji+hoJMDALNBTFhdI8lw3xI4Z+AOJl+nPwju8zqBlLm6Aw3RDzUIGud1RyywV8wEDQDyaQv8B1JazP2887t+Tp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=lv5Cm3US; arc=none smtp.client-ip=68.232.141.245 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="lv5Cm3US" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586164; x=1773122164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OjknDet2JooRE9NzX99Ydxu/vUoeElSzHiHtsj0GGDo=; b=lv5Cm3USMDwklBxDiLiFuEYRzOogqaE1wN3YPZW/by7hqudmqGG1TP6B vYvqIzs/We5SY3tHRpZxH8wpHZbp5NOnyQdfQC70U+K+xLrAZjjYhhTaA Dn5lqA4kfcgTKXhZpqjslXxFzqIji405qwJ6dxYy63jBAKYpR/09K2npk ELJiO1wjq8ScIi+XziWKyG34GGE9oOBkNtV+0aoGNA2yDyYBoy0VprlCr bBOQiiL7oZ5Xn+0KRSIuMlX70RymaHrM9oSnz8fZG2MajLZWdI+r1swd8 V24iUPLfUj/kzSQq92khviO76Lq3M67aoEBcKWv4Wht6xYVqLTIhiDTVk A==; X-CSE-ConnectionGUID: CNZ/gNc9QQyN3PJpV2xxIg== X-CSE-MsgGUID: b+rPHQeLSlaWliT8UeyQMg== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="46164539" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:04 +0800 IronPort-SDR: 67ce7120_hda1t/rIauFacVIcQFpMKTd0lKk4h3AJBPEYB1SjjNC62mO 4r94Wc7xrJaZ1r4Euv1I80yHR9Gydw/d1+6Lwuw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:05 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:04 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 3/7] mmc-utils: lsmmc: Pass program name to usage function Date: Mon, 10 Mar 2025 07:52:27 +0200 Message-Id: <20250310055231.304728-4-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit updates the usage function to accept the program name as an argument, allowing the usage message to display the correct program name dynamically. This change improves the clarity and accuracy of the usage message. This enhancement ensures that the usage message accurately reflects the name of the register: cid, csd or scr, being read. Signed-off-by: Avri Altman --- lsmmc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index 468a533..ae30799 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -232,9 +232,9 @@ static struct ids_database mmc_database[] = { }; /* Command line parsing functions */ -static void usage(void) +static void usage(char *progname) { - printf("Usage: print mmc [-h] [-v] \n"); + printf("Usage: %s [-h] [-v] \n", progname); printf("\n"); printf("Options:\n"); printf("\t-h\tShow this help.\n"); @@ -248,7 +248,7 @@ static int parse_opts(int argc, char **argv, struct config *config) while ((c = getopt(argc, argv, "hv")) != -1) { switch (c) { case 'h': - usage(); + usage(argv[0]); return -1; case 'v': config->verbose = true; @@ -256,12 +256,12 @@ static int parse_opts(int argc, char **argv, struct config *config) case '?': fprintf(stderr, "Unknown option '%c' encountered.\n\n", c); - usage(); + usage(argv[0]); return -1; case ':': fprintf(stderr, "Argument for option '%c' missing.\n\n", c); - usage(); + usage(argv[0]); return -1; default: fprintf(stderr, @@ -272,11 +272,12 @@ static int parse_opts(int argc, char **argv, struct config *config) if (optind >= argc) { fprintf(stderr, "Expected mmc directory arguments.\n\n"); - usage(); + usage(argv[0]); return -1; } config->dir = strdup(argv[optind]); + return 0; } From patchwork Mon Mar 10 05:52:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872718 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D3C91B4153 for ; Mon, 10 Mar 2025 05:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586175; cv=none; b=Fldy0DQEfNgk+dy7Z5SU5Fu9Dpa3OttRdB75ky3fkCgeAJyKmh3tejsJ18E+T4b19mqZx6KPcKP+AEYrSwDMxXiYhl8IEBzXgV9H/XBBHQH1w++yqRsuh6IrqdLjL0351boesuUE5pbxCkrtIlXUPYUgaYtaEr4XfwV4brPlem8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586175; c=relaxed/simple; bh=SGu3ZDLCJ9MF6SGoXb/jypwM5D1amvazIz2XygvCCvw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N2DoywlmUghRZvPaXiLKuwfAS7jY976GnW8763ufmtxSyx2R0oo1QYUwryot9o9Ces5AYbIsghntIXUhND3/dCtTXZnck0qYXPdDKG9C8MEbN/Nf9/P/+mAB0TbSbnv07XvBbnLBcn5i70E3xi4enx/9USonPqCpUuMVTJ2i/XE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=Mz4i7425; arc=none smtp.client-ip=216.71.154.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="Mz4i7425" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586173; x=1773122173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SGu3ZDLCJ9MF6SGoXb/jypwM5D1amvazIz2XygvCCvw=; b=Mz4i7425aqA1v9yFSxjW0emkRk5A15h8/iSADUIcmiqps2/EnreXLZsG eEIqTq/26LiRLWr7sgAaqUAveYKYxEOFkX8dnhm70alsxrblv44vbXVWH aqxaF7ZfciTlsCQ5y8j+2jq/pXCt9te0j2EdwF3LXzIWlmLd6kTQRYnH9 VQnDsy2bDGVbOmQid1kJX/CoUguwVhuN9RzFO/TI19gqsmw+a62qJzVzf vUZv9hnzIlN0cJXUXKhfU/kkli9swYDSWvf+4ESr8IhBl3ukCAGGsjXP/ 6epj+grwGZVArN5yrilj2LEmJUp8D++w9MdHjeK5KD+zq3LMlIjpGk5rm w==; X-CSE-ConnectionGUID: 1d2QUsSgSzO46qKR4Hn9BQ== X-CSE-MsgGUID: L0rlq4qGQZeRcwphCBy3jA== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="45704324" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:12 +0800 IronPort-SDR: 67ce7128_5B0Eev59akjRBz1HbE9XQiXcMCHFv+d0e+Ra4sicBYHUIKm JMEqU+EtbqK8OqAzEPLVGqCbQIZQSJiwDSeUiQg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:13 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:12 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 4/7] mmc-utils: lsmmc: Update HOWTO to include CSD and CID read commands Date: Mon, 10 Mar 2025 07:52:28 +0200 Message-Id: <20250310055231.304728-5-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit updates the HOWTO documentation to include instructions for reading CSD and CID data from a specified device path. While at it, further clarify the description to specify that the path is of the sysfs file directory. Signed-off-by: Avri Altman --- docs/HOWTO.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/HOWTO.rst b/docs/HOWTO.rst index 095a9bd..f4dd5c4 100644 --- a/docs/HOWTO.rst +++ b/docs/HOWTO.rst @@ -31,8 +31,14 @@ Running mmc-utils ``writeprotect user set `` Set user area write protection. + ``csd read `` + Print CSD data from . The device path should specify the csd sysfs file directory. + + ``cid read `` + Print CID data from . The device path should specify the cid sysfs file directory. + ``scr read `` - Print SCR data from . The device path should specify the scr file directory. + Print SCR data from . The device path should specify the scr sysfs file directory. ``ffu [chunk-bytes]`` Default mode. Run Field Firmware Update with `` on ``. `[chunk-bytes]` is optional and defaults to its max - 512k. Should be in decimal bytes and sector aligned. From patchwork Mon Mar 10 05:52:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872365 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 331781B4153 for ; Mon, 10 Mar 2025 05:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.153.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586181; cv=none; b=u1hDF5G3rMg5HRxusldjDEM/5130S2uK1Hf7bKp2+TmB7zxxxh2ZZ8kNCjuC9MBQc/3U4ef6n0h00+954pWDWYt6a+NFvNLpq2jTumIudB7cMtHlzf54OMcrsdCoU1ZRyY4m+XdTBS6E8pqQGBszEhY6ZQvVbYYEvAVogN8W8l0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586181; c=relaxed/simple; bh=r/LCjAgW/TZLpcjNcZzguHFpUseBSheEcPe8zmaaL0A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C4g452RJ71DwaS5NjsKc+IQU90PcTWSxLpqVHDcrqWFleZw63a613w9qVa0IEz9ZgReceLmT9lsRvoMre0LnJODNx7JKxcBg7zJaGphalaH/87sUyixfddr7t0TTdyl36/r1lxJ1sOqsZA3jYF/qqhB2Y/UrTQ8xsQGnNf/8hzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=N0cPsqX6; arc=none smtp.client-ip=216.71.153.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="N0cPsqX6" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586180; x=1773122180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r/LCjAgW/TZLpcjNcZzguHFpUseBSheEcPe8zmaaL0A=; b=N0cPsqX6OjtKawSYCYN4A3Am+fA6TOD1rIn5xMopSkC+XK2x1Z+HVAvX YcmMv9J6jh7n8/v8D5c7seNNGwOOg6mpW+O/g8NJNT/mrc1UW6vJwZ9oZ 3iApZl7hXyybs1IyA86kX11LaSp4aPZPbk5x8j9xqZaoe91bqu7Q7/KF8 XibIUc/J1/MCwxofaooC2XRed1XnQgNUOBin635dJAXTthRO9I9cHWgrX TmIE/OvmOBx+K0sxaLe8wfNvyBHxhxqgNzsxuB/bPcQqe+wU9Bu+TBzQW JBcJv72Bggo5cKkD7mEpfS3HHNz/aybW4Xs7EA+Wd5k27bm+uBFjgjkom g==; X-CSE-ConnectionGUID: i4/x67ZhSUW5+6h69WtUmA== X-CSE-MsgGUID: 15+ARkx2TI6fZy0nL/yQkQ== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="45168267" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:20 +0800 IronPort-SDR: 67ce712f_Pj1SaiFv/CpsE1EWG44FxFmsLhhXMWScAw9jAJKe0YGOGDZ yCmDIcAoi0IXT335oPcWcYxrZTc3TZRR04Pfzfg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:19 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:19 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 5/7] mmc-utils: lsmmc: Refactor register processing Date: Mon, 10 Mar 2025 07:52:29 +0200 Message-Id: <20250310055231.304728-6-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit introduces a preliminary phase that allows nnc-utils accept register values as arguments instead of reading them from their sysfs paths. This change refactors the `process_dir` function and introduces a new `process_reg` function to handle the register content directly. This change sets the groundwork for future enhancements where register values can be provided directly, improving flexibility and usability. Signed-off-by: Avri Altman --- lsmmc.c | 98 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 29 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index ae30799..726adf8 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -2084,38 +2084,12 @@ static void print_sd_scr(struct config *config, char *scr) } } -static int process_dir(struct config *config, enum REG_TYPE reg) +static int process_reg(struct config *config, char *reg_content, enum REG_TYPE reg) { - char *type = NULL; - char *reg_content = NULL; int ret = 0; - if (chdir(config->dir) < 0) { - fprintf(stderr, - "MMC/SD information directory '%s' does not exist.\n", - config->dir); - return -1; - } - - type = read_file("type"); - if (!type) { - fprintf(stderr, - "Could not read card interface type in directory '%s'.\n", - config->dir); - return -1; - } - - if (strcmp(type, "MMC") && strcmp(type, "SD")) { - fprintf(stderr, "Unknown type: '%s'\n", type); - ret = -1; - goto err; - } - - config->bus = strcmp(type, "MMC") ? SD : MMC; - switch (reg) { case CID: - reg_content = read_file("cid"); if (!reg_content) { fprintf(stderr, "Could not read card identity in directory '%s'.\n", @@ -2131,7 +2105,6 @@ static int process_dir(struct config *config, enum REG_TYPE reg) break; case CSD: - reg_content = read_file("csd"); if (!reg_content) { fprintf(stderr, "Could not read card specific data in " @@ -2150,7 +2123,6 @@ static int process_dir(struct config *config, enum REG_TYPE reg) if (config->bus != SD) break; - reg_content = read_file("scr"); if (!reg_content) { fprintf(stderr, "Could not read SD card " "configuration in directory '%s'.\n", @@ -2166,8 +2138,76 @@ static int process_dir(struct config *config, enum REG_TYPE reg) goto err; } +err: + + return ret; +} + +static int process_reg_from_file(struct config *config, enum REG_TYPE reg) +{ + char *reg_content = NULL; + int ret = 0; + + switch (reg) { + case CID: + reg_content = read_file("cid"); + ret = process_reg(config, reg_content, CID); + + break; + case CSD: + reg_content = read_file("csd"); + ret = process_reg(config, reg_content, CSD); + + break; + case SCR: + if (config->bus != SD) + break; + + reg_content = read_file("scr"); + ret = process_reg(config, reg_content, SCR); + + break; + default: + goto err; + } + err: free(reg_content); + + return ret; +} + +static int process_dir(struct config *config, enum REG_TYPE reg) +{ + char *type = NULL; + int ret = 0; + + if (chdir(config->dir) < 0) { + fprintf(stderr, + "MMC/SD information directory '%s' does not exist.\n", + config->dir); + return -1; + } + + type = read_file("type"); + if (!type) { + fprintf(stderr, + "Could not read card interface type in directory '%s'.\n", + config->dir); + return -1; + } + + if (strcmp(type, "MMC") && strcmp(type, "SD")) { + fprintf(stderr, "Unknown type: '%s'\n", type); + ret = -1; + goto err; + } + + config->bus = strcmp(type, "MMC") ? SD : MMC; + + ret = process_reg_from_file(config, reg); + +err: free(type); return ret; From patchwork Mon Mar 10 05:52:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872717 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F15118FDAB for ; Mon, 10 Mar 2025 05:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.143.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586254; cv=none; b=riUu6y+9QfQVF39Z5R+GuYZSoCp511sKyiig8UJBf2btxgce9XZK0tX0pYN41QNY4mHWVYSIidnceTdJ4/oRMvyKsOgneSwXEkmllNDR3t070iLpDa07LsaiwjvpwmCREPGJ6pHF3iaa8ltW399YWorY4ADBI0qHYbT3HFrxNoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586254; c=relaxed/simple; bh=EMA0v5C+BGpsXxlJN0PfWk57Kp4HQdorP0dTll7d++Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D+fMj5Zg5wT2HdoTAXWo8T/e0E/TC5aKwOdyQU3Ix3sPjraXg14qdeQG9ve4c5MPonBxfJeaMsScfU1bApvKHCZ8zDu/N6z/Yg0uI5oxM/Loj7CqU4BsqNKetF5l3CanSXJ/8ViLVAKnldVTRm/imnCX8CSo5MydZNqaWTHJMNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=eUet3gg5; arc=none smtp.client-ip=68.232.143.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="eUet3gg5" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586253; x=1773122253; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EMA0v5C+BGpsXxlJN0PfWk57Kp4HQdorP0dTll7d++Y=; b=eUet3gg5ShQaqhz8kxfF0dYo85ASUrQwZulMkkNt3h646A15DlPaMQUD OmhHQL+ap8/afeP7Y4YlB/TaBNtII53Wqqr3XsPf7ZJ3m0Z+Sc59Bo8wr adKtEwmPZ9qhClhjp+3oee8OxV1DBt0AxdBgDGuZccauUSxcQaoqpVq7E PzTBXG421c2PEPdcwWT26gp8vsqQcky50YUg32NxoF1SndVw297eBA75t nQvj1a0zVCzxgTaCO12LCodW14e7p1qKosK65nDyur5J3Zicqrbou2yeU zcV/Vm9v0AZYeASthA4oFYIjabsLrkxXQlWGEvIkuEES9Eb3XuhsuPDwk Q==; X-CSE-ConnectionGUID: 7AWAe5ojQ3S6FDPdWy1uGA== X-CSE-MsgGUID: 25udmJL2SIij4eSVa2oasw== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="46599990" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:25 +0800 IronPort-SDR: 67ce7135_CF+EH3pijOEeDMRLcEn56f9Fhj8LnoW9TLhaAc6Lw4SkIDt 2RKGVpaiclCNO+yyOkr21S3t1UpAWlskJKN41Eg== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:25 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:24 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 6/7] mmc-utils: lsmmc: Allow getting registers value as an argument Date: Mon, 10 Mar 2025 07:52:30 +0200 Message-Id: <20250310055231.304728-7-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 read was invented to read the register value from its sysfs entry. However, often we are getting the register value from customers or field application engineers for analysis, without having the actual platform. Allow to parse the content of those registers for those cases as well. While at it, remove some unused fields from struct config. Signed-off-by: Avri Altman --- lsmmc.c | 69 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/lsmmc.c b/lsmmc.c index 726adf8..799e1ea 100644 --- a/lsmmc.c +++ b/lsmmc.c @@ -62,16 +62,11 @@ enum bus_type { }; struct config { - char *idsfile; char *dir; bool verbose; enum bus_type bus; - char *type; - char *cid; - char *csd; - char *scr; - char *ext_csd; + char *reg; }; enum REG_TYPE { @@ -234,24 +229,53 @@ static struct ids_database mmc_database[] = { /* Command line parsing functions */ static void usage(char *progname) { - printf("Usage: %s [-h] [-v] \n", progname); + printf("Usage: %s [-h] [-v] [-b bus_type] [-r register] \n", progname); printf("\n"); printf("Options:\n"); + printf("\t-b\t bus type. Either sd or mmc. if specified, register value must be given.\n"); + printf("\t-r\t The register content. if specified no need for device path\n"); printf("\t-h\tShow this help.\n"); printf("\t-v\tEnable verbose mode.\n"); } +static void to_lowercase(char *str) +{ + for (; *str; ++str) + *str = tolower((unsigned char)*str); +} + static int parse_opts(int argc, char **argv, struct config *config) { int c; + bool bus_given = false; + bool reg_given = false; - while ((c = getopt(argc, argv, "hv")) != -1) { + while ((c = getopt(argc, argv, "hvb:r:")) != -1) { switch (c) { case 'h': usage(argv[0]); return -1; case 'v': config->verbose = true; + break; + case 'b': + to_lowercase(optarg); + if (strcmp(optarg, "mmc") == 0) { + config->bus = MMC; + } else if (strcmp(optarg, "sd") == 0) { + config->bus = SD; + } else { + fprintf(stderr, "Unknown bus type '%s'.\n\n", optarg); + usage(argv[0]); + return -1; + } + bus_given = true; + + break; + case 'r': + config->reg = strdup(optarg); + reg_given = true; + break; case '?': fprintf(stderr, @@ -270,13 +294,27 @@ static int parse_opts(int argc, char **argv, struct config *config) } } - if (optind >= argc) { - fprintf(stderr, "Expected mmc directory arguments.\n\n"); + if (bus_given != reg_given) { + fprintf(stderr, "Both bus type and register must be provided together.\n\n"); usage(argv[0]); return -1; } - config->dir = strdup(argv[optind]); + if (reg_given) { + if (optind < argc) { + fprintf(stderr, "Either register or directory, not both.\n\n"); + usage(argv[0]); + return -1; + } + } else { + if (optind >= argc) { + fprintf(stderr, "Expected mmc directory arguments.\n\n"); + usage(argv[0]); + return -1; + } + + config->dir = strdup(argv[optind]); + } return 0; } @@ -2222,13 +2260,14 @@ static int do_read_reg(int argc, char **argv, enum REG_TYPE reg) if (ret) return ret; - if (cfg.dir) + if (cfg.dir) { ret = process_dir(&cfg, reg); - - free(cfg.dir); + free(cfg.dir); + } else if (cfg.reg) { + ret = process_reg(&cfg, cfg.reg, reg); + } return ret; - } int do_read_csd(int argc, char **argv) From patchwork Mon Mar 10 05:52:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 872364 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E21EB1ADC7E for ; Mon, 10 Mar 2025 05:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.143.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586256; cv=none; b=eMHiHZWsuT4hkP2h1qF0XDs3sN0BUsiZSJeFIW803mWN0rgx9c9ElDQ2S4O8Vj+XSV9pKrXtIyL4U0tVoH6V3PI6rw4kFUSnDV3903eeWiVASZOgsgYq6dk3kCVqRhOMuRNaDxl424DS1yLktZlAyqdwFBG1jWVY/fQT4PHuVi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741586256; c=relaxed/simple; bh=O7G+WkwPrecCAI3wecop9Kf4SESvYjPH3muh2jQOBJw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mGZUeG00KVZX6db6j9Lkh3CjGlKvXO1TxnX86H4ztiKRSLr5XTsb/4hTG7TiINgTcXEc/QMX8SDKHHzwnX1b9hOO+ZMQ9I2wTA7zEV3IrDr1PYNvZRp9R77GpjkfeAuNrbCZd2bVgC/zQ5Lj9KLKci1YccpitAlpyItzdt7Hfr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com; spf=pass smtp.mailfrom=sandisk.com; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b=XDUmA9HS; arc=none smtp.client-ip=68.232.143.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=sandisk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sandisk.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sandisk.com header.i=@sandisk.com header.b="XDUmA9HS" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=sandisk.com; i=@sandisk.com; q=dns/txt; s=dkim.sandisk.com; t=1741586254; x=1773122254; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O7G+WkwPrecCAI3wecop9Kf4SESvYjPH3muh2jQOBJw=; b=XDUmA9HSRFwvBojOJKY+7h/IVBbUQk9FCfy2Wk2hltJ9PXYEjJcCuX9t vMQfSIE9OosM5Av60DfGDY8+BMJ6+2pSB15uqrSIUoSHIzOgsP9GYAt7o K6OCnG8x9BB8C+FxeLuF7X2BQE6WntCmFnP/q3ZWNFYm8U/n1GtXFMCyD l250y2MnpT2POGCPNxT/6T23OhT4P7JBbePrjZ7P1/7kzDxA7eH/lL6F+ 6PBtnXmvuH49ojGQdvB8qswoFNlvHRnwpxagp7ch/N0TW14sElVV+MhQv PkB8YewEGzt2MlFRPsITGT3wKRclAV6EbKnUb2JnMIzjfvzKj7EST6D2o Q==; X-CSE-ConnectionGUID: 64mWkJk1SxKLQ3BG5EgoYw== X-CSE-MsgGUID: FlINO0pTQsiKBupg9EIguw== X-IronPort-AV: E=Sophos;i="6.14,235,1736784000"; d="scan'208";a="46600016" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Mar 2025 13:56:28 +0800 IronPort-SDR: 67ce7138_EYlg2Rshwuz+CA759/mlibx7U9y0/xKfA9Z3w06T2CBBb9l 4Jpz+HqYHRUY026f/j9vWgYUJ3okE/gQPELISOw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 21:57:29 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Mar 2025 22:56:28 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Avri Altman Subject: [PATCH 7/7] mmc-utils: lsmmc: Update docs to include new options Date: Mon, 10 Mar 2025 07:52:31 +0200 Message-Id: <20250310055231.304728-8-avri.altman@sandisk.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250310055231.304728-1-avri.altman@sandisk.com> References: <20250310055231.304728-1-avri.altman@sandisk.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit updates the man and HOWTO page entries to include the new options for the csd, cid, and scr commands. The updated entries reflect the changes allowing the use of bus_type and register content as arguments. These updates provide users with clear instructions on how to use the new options for the csd, cid, and scr read commands. Signed-off-by: Avri Altman --- docs/HOWTO.rst | 8 +++++++- mmc.1 | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/HOWTO.rst b/docs/HOWTO.rst index f4dd5c4..3c308c7 100644 --- a/docs/HOWTO.rst +++ b/docs/HOWTO.rst @@ -31,14 +31,20 @@ Running mmc-utils ``writeprotect user set `` Set user area write protection. - ``csd read `` + ``csd read [-h] [-v] [-b bus_type] [-r register] `` Print CSD data from . The device path should specify the csd sysfs file directory. + if [bus_type] is passed (mmc or sd) the [register] content must be passed as well, and no need for device path. + it is useful for cases we are getting the register value without having the actual platform. ``cid read `` Print CID data from . The device path should specify the cid sysfs file directory. + if [bus_type] is passed (mmc or sd) the [register] content must be passed as well, and no need for device path. + it is useful for cases we are getting the register value without having the actual platform. ``scr read `` Print SCR data from . The device path should specify the scr sysfs file directory. + if [bus_type] is passed (mmc or sd) the [register] content must be passed as well, and no need for device path. + it is useful for cases we are getting the register value without having the actual platform. ``ffu [chunk-bytes]`` Default mode. Run Field Firmware Update with `` on ``. `[chunk-bytes]` is optional and defaults to its max - 512k. Should be in decimal bytes and sector aligned. diff --git a/mmc.1 b/mmc.1 index 543742c..85f8109 100644 --- a/mmc.1 +++ b/mmc.1 @@ -173,17 +173,29 @@ Disable the eMMC cache feature on the device. .br NOTE! The cache is an optional feature on devices >= eMMC4.5. .TP -.BI csd " " read " " \fidevice\-path\fR +.BI csd " " read " " \fR[-h] \fR[-v] " " \fR[-b " " \fIbus_type\fR] " " \fR[-r " " \fIregister\fR] " " \fI\fR Print CSD data from \fIdevice\-path\fR. The device path should specify the csd sysfs file directory. +.br +If \fIbus_type\fR is passed (mmc or sd), the \fIregister\fR content must be passed as well, and no need for device path. +.br +It is useful for cases where we are getting the register value without having the actual platform. .TP -.BI cid " " read " " \fIdevice\-path\fR +.BI cid " " read " " \fR[-h] \fR[-v] " " \fR[-b " " \fIbus_type\fR] " " \fR[-r " " \fIregister\fR] " " \fI\fR Print CID data from \fIdevice\-path\fR. The device path should specify the cid sysfs file directory. +.br +If \fIbus_type\fR is passed (mmc or sd), the \fIregister\fR content must be passed as well, and no need for device path. +.br +It is useful for cases where we are getting the register value without having the actual platform. .TP -.BI scr " " read " " \fIdevice\-path\fR +.BI scr " " read " " \fR[-h] \fR[-v] " " \fR[-b " " \fIbus_type\fR] " " \fR[-r " " \fIregister\fR] " " \fI\fR Print SCR data from \fIdevice\-path\fR. The device path should specify the scr sysfs file directory. +.br +If \fIbus_type\fR is passed (mmc or sd), the \fIregister\fR content must be passed as well, and no need for device path. +.br +It is useful for cases where we are getting the register value without having the actual platform. .TP .BI ffu " " \fIimage\-file\-name\fR " " \fIdevice\fR " " [\fIchunk\-bytes\fR] Run Field Firmware Update with \fIimage\-file\-name\fR on the device.