Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37C7CC433EF for ; Fri, 14 Jan 2022 14:57:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6B85F833BE; Fri, 14 Jan 2022 15:57:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=akkea.ca header.i=@akkea.ca header.b="SnbSlDHQ"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="EUd2aOVh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA5B283461; Fri, 14 Jan 2022 15:57:01 +0100 (CET) Received: from node.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1ECDB833A2 for ; Fri, 14 Jan 2022 15:56:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angus@akkea.ca Received: from localhost (localhost [127.0.0.1]) by node.akkea.ca (Postfix) with ESMTP id A40FF4E2006; Fri, 14 Jan 2022 14:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1642172216; bh=BbTgna56t8eTJBy29p+5+a1k81U5Zt5rgXGQDbiCdKg=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=SnbSlDHQ8PoOlHCD4S+KXVEh8roN6TRPmUDuzGpDWQ61qd4xFEM+YN2AMPgNuPJDQ WzxSWHIDjQLTCMMPomsqENkgQz7J1AZxDNK6OFc0xxOC1Tj2mPVfzLXnKV7rTYFXgG lGySt5ZX23pYmLY72SVbk9U6wNsP/ZkqYUAqPGto= Received: from node.akkea.ca ([127.0.0.1]) by localhost (mail.akkea.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a1fqJ8619bBt; Fri, 14 Jan 2022 14:56:55 +0000 (UTC) Received: from www.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) by node.akkea.ca (Postfix) with ESMTPSA id 8830E4E2003; Fri, 14 Jan 2022 14:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1642172215; bh=BbTgna56t8eTJBy29p+5+a1k81U5Zt5rgXGQDbiCdKg=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=EUd2aOVh8Xh5sXh7n2klrHhd27UdfYT8bcClIiX4mM9sXD5y+2mV+51mrB9j8Wta9 5WZWhKoRoA/9dPnCSOSLpZdheRWz5oKGH8ef9vdpTsViZscI0A+MLKTAhC6+sO+3lD 07LSXRG0c4YO3t2YiJ/CsjFYVcihR1GEV7Jw2IbQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 14 Jan 2022 06:56:55 -0800 From: Angus Ainslie To: u-boot@lists.denx.de Cc: kernel@puri.sm, uboot-imx@nxp.com Subject: Re: [PATCH 1/2] cmd: fuse: add a fuse comparison function In-Reply-To: <20211128160253.1468839-1-angus@akkea.ca> References: <20211128160253.1468839-1-angus@akkea.ca> Message-ID: <6bb5490a3bae5f8779858c710b51e390@akkea.ca> X-Sender: angus@akkea.ca User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Are there any problems with this patch ? Thanks Angus On 2021-11-28 08:02, Angus Ainslie wrote: > Compare a hexval to the fuse value and return pass or fail. > > Signed-off-by: Angus Ainslie > --- > cmd/fuse.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/cmd/fuse.c b/cmd/fuse.c > index e001619d172..78b1065d99e 100644 > --- a/cmd/fuse.c > +++ b/cmd/fuse.c > @@ -45,7 +45,7 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, > int argc, > { > const char *op = argc >= 2 ? argv[1] : NULL; > int confirmed = argc >= 3 && !strcmp(argv[2], "-y"); > - u32 bank, word, cnt, val; > + u32 bank, word, cnt, val, cmp; > int ret, i; > > argc -= 2 + confirmed; > @@ -73,6 +73,24 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, > int argc, > printf(" %.8x", val); > } > putc('\n'); > + } else if (!strcmp(op, "cmp")) { > + if (argc != 3 || strtou32(argv[2], 0, &cmp)) > + return CMD_RET_USAGE; > + > + printf("Comparing bank %u:\n", bank); > + printf("\nWord 0x%.8x:", word); > + printf("\nValue 0x%.8x:", cmp); > + > + ret = fuse_read(bank, word, &val); > + if (ret) > + goto err; > + > + printf("0x%.8x\n", val); > + if (val != cmp) { > + printf("failed\n"); > + return CMD_RET_FAILURE; > + } > + printf("passed\n"); > } else if (!strcmp(op, "sense")) { > if (argc == 2) > cnt = 1; > @@ -137,6 +155,8 @@ U_BOOT_CMD( > "Fuse sub-system", > "read [] - read 1 or 'cnt' fuse words,\n" > " starting at 'word'\n" > + "fuse cmp - compare 'hexval' to fuse\n" > + " at 'word'\n" > "fuse sense [] - sense 1 or 'cnt' fuse words,\n" > " starting at 'word'\n" > "fuse prog [-y] [...] - program 1 > or\n"