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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60EE7C433F5 for ; Fri, 22 Oct 2021 10:38:42 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9BADC610FF for ; Fri, 22 Oct 2021 10:38:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9BADC610FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 022B783461; Fri, 22 Oct 2021 12:38:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="jtCxmDIT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5DF98350D; Fri, 22 Oct 2021 12:38:26 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9932F83499 for ; Fri, 22 Oct 2021 12:38:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 132236112F; Fri, 22 Oct 2021 10:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634899098; bh=9J8XCISu0lpHB805RoXc+SUg/qIe73+Jjzj4SGCX6iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtCxmDIT20bW+ZSzNTucaiW65CLMhQwcGGBbS35lYFUAAwzxcBjCHghzMy7NzuLWx lgAhJ4OIIlrpq4H5lgfoND4sGel7Pr+1s2nTrUkLp5OmelVqJsGGwxYwGhLiTo7hp+ RVVkUHzbN0mu/QgL9V8+wa02NPjjfp5/6+ZDcPq/mbm/iPqRB2JIrawYpOd6nXvmvq 1hoYya9dwv5SlPYG91XzeoIDfeHIF29VOMQSmV6QQgH3dlz6yOXB1Al5tMDCx3rs4N 8vWh2on1MeytwyROe6V1M+XoqBnIV3oTJxuQxgU9fQ8CUITsX+8s3pe/Hy0oqN8vKO NcjgDSdQdd1kw== Received: by pali.im (Postfix) id 35A1CA75; Fri, 22 Oct 2021 12:38:16 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= , u-boot@lists.denx.de Subject: [PATCH 1/3] tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images Date: Fri, 22 Oct 2021 12:37:46 +0200 Message-Id: <20211022103748.25651-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211022103748.25651-1-pali@kernel.org> References: <20211022103748.25651-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 The NAND_PAGE_SIZE command is already supported by mkimage for v0 images, but not for v1 images. A38x and A39x BootROM supports reading NAND flash page size from v1 image in the same way as Kirkwood BootROM from v0 image. It it documented in A38x and A39x Functional Specification. Signed-off-by: Pali Rohár --- tools/kwbimage.c | 3 +++ tools/kwbimage.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index e9324baddba4..67c0c628ae9f 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -1231,6 +1231,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, e = image_find_option(IMAGE_CFG_NAND_BLKSZ); if (e) main_hdr->nandblocksize = e->nandblksz / (64 * 1024); + e = image_find_option(IMAGE_CFG_NAND_PAGESZ); + if (e) + main_hdr->nandpagesize = cpu_to_le16(e->nandpagesz); e = image_find_option(IMAGE_CFG_NAND_BADBLK_LOCATION); if (e) main_hdr->nandbadblklocation = e->nandbadblklocation; diff --git a/tools/kwbimage.h b/tools/kwbimage.h index 126d482fe722..f1ba95c2fa5b 100644 --- a/tools/kwbimage.h +++ b/tools/kwbimage.h @@ -73,7 +73,7 @@ struct ext_hdr_v0 { struct main_hdr_v1 { uint8_t blockid; /* 0x0 */ uint8_t flags; /* 0x1 */ - uint16_t reserved2; /* 0x2-0x3 */ + uint16_t nandpagesize; /* 0x2-0x3 */ uint32_t blocksize; /* 0x4-0x7 */ uint8_t version; /* 0x8 */ uint8_t headersz_msb; /* 0x9 */ -- 2.20.1