From mboxrd@z Thu Jan 1 00:00:00 1970 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 0F69AC433F5 for ; Fri, 14 Jan 2022 14:57:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FF97833BE; Fri, 14 Jan 2022 15:57:41 +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="rcWKletx"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="rcWKletx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 526158341A; Fri, 14 Jan 2022 15:57:40 +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 BE5958083E for ; Fri, 14 Jan 2022 15:57:36 +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 573484E2006; Fri, 14 Jan 2022 14:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1642172255; bh=CZdsx2DKNwtI4jjSU4Kwne6Q5NCXmEZXrlKha7qJCAE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=rcWKletxCrOsu/bU4JPBHlUPZ5XdSX6Zo4p54ou6AAIKxuh5VAk32XIgtuw+aGd0V rtnD1ATK3JGZkZYG7wUh0UsmOQ4YjoCCp27zZvICpTfyYVzphl/MIgGRCtldkRRcen rVEXYGdb+Ha6IY9qUz7dSqrlQfFGpGink8H4qHkA= 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 QASOdyq3NxKX; Fri, 14 Jan 2022 14:57:35 +0000 (UTC) Received: from www.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) by node.akkea.ca (Postfix) with ESMTPSA id 075334E2003; Fri, 14 Jan 2022 14:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1642172255; bh=CZdsx2DKNwtI4jjSU4Kwne6Q5NCXmEZXrlKha7qJCAE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=rcWKletxCrOsu/bU4JPBHlUPZ5XdSX6Zo4p54ou6AAIKxuh5VAk32XIgtuw+aGd0V rtnD1ATK3JGZkZYG7wUh0UsmOQ4YjoCCp27zZvICpTfyYVzphl/MIgGRCtldkRRcen rVEXYGdb+Ha6IY9qUz7dSqrlQfFGpGink8H4qHkA= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 14 Jan 2022 06:57:35 -0800 From: Angus Ainslie To: u-boot@lists.denx.de Cc: kernel@puri.sm, uboot-imx@nxp.com Subject: Re: [PATCH 2/2] cmd: fuse: Add a command to read fuses to memory In-Reply-To: <20211128160253.1468839-2-angus@akkea.ca> References: <20211128160253.1468839-1-angus@akkea.ca> <20211128160253.1468839-2-angus@akkea.ca> Message-ID: 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: > With the fuse values in memory we can use some of the other u-boot > shell > conditonal operators to do tests. > > Signed-off-by: Angus Ainslie > --- > cmd/fuse.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/cmd/fuse.c b/cmd/fuse.c > index 78b1065d99e..0676bb7a812 100644 > --- a/cmd/fuse.c > +++ b/cmd/fuse.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > > static int strtou32(const char *str, unsigned int base, u32 *result) > @@ -46,6 +47,8 @@ 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, cmp; > + ulong addr; > + void *buf, *start; > int ret, i; > > argc -= 2 + confirmed; > @@ -73,6 +76,28 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, > int argc, > printf(" %.8x", val); > } > putc('\n'); > + } else if (!strcmp(op, "readm")) { > + if (argc == 3) > + cnt = 1; > + else if (argc != 4 || strtou32(argv[3], 0, &cnt)) > + return CMD_RET_USAGE; > + > + addr = simple_strtoul(argv[2], NULL, 16); > + > + start = map_sysmem(addr, 4); > + buf = start; > + > + printf("Reading bank %u len %u to 0x%lx\n", bank, cnt, addr); > + for (i = 0; i < cnt; i++, word++) { > + ret = fuse_read(bank, word, &val); > + if (ret) > + goto err; > + > + *((u32 *)buf) = val; > + buf += 4; > + } > + > + unmap_sysmem(start); > } else if (!strcmp(op, "cmp")) { > if (argc != 3 || strtou32(argv[2], 0, &cmp)) > return CMD_RET_USAGE; > @@ -157,6 +182,8 @@ U_BOOT_CMD( > " starting at 'word'\n" > "fuse cmp - compare 'hexval' to fuse\n" > " at 'word'\n" > + "fuse readm [] - read 1 or 'cnt' fuse > words,\n" > + " starting at 'word' into memory at 'addr'\n" > "fuse sense [] - sense 1 or 'cnt' fuse words,\n" > " starting at 'word'\n" > "fuse prog [-y] [...] - program 1 > or\n"