From patchwork Sat Nov 10 20:01:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 995982 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Xb4JXlXc"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Y0M3ikv2"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42snxC5H9Lz9s3q for ; Sun, 11 Nov 2018 07:02:21 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GBp0TaneKrj2KjPzStmeJ05R6S4CAFW9HISRvDZsnCQ=; b=Xb4JXlXcmrCLFt kf1l9g+y5qnDZYGNNlLoXTqziYFbvitx7S1HIPE57i/399Z7AJIIYdghbQDqtlS/Z52pw2HSbmfEq Quq7XN+7CnaVvoI1mMx4cEQsvN+4SM9D1Ry4bv7fdPE3qcnhG3F/gPz20VFysF+yZPC88pH48KQtT FPZfgIhXlKvNF1ozqRuYHF9xxrJuDkadG8iLHgzJe8BIPJpfTYM5R6LFsGB5IN8J10eJkoKLx0rml P7/1TPHh0Wt2SQAqmGCNncEgj+wx/fL/x8nS7CQfdD0M+HSY1+qyIzFEbUdlZ/zPwHN/eZqW7NJ07 OmCplHldsaOD3yHe9cvg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLZSP-0008G6-0R; Sat, 10 Nov 2018 20:02:13 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLZS4-00088L-BM for linux-mtd@lists.infradead.org; Sat, 10 Nov 2018 20:01:53 +0000 Received: by mail-lf1-x142.google.com with SMTP id b20so3603982lfa.12 for ; Sat, 10 Nov 2018 12:01:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ociZpFm65LWdTxJXKcKsVU0ihnxY1+uXjBJHvs1iKfM=; b=Y0M3ikv2fIQKEBtmX7sVqiGN8Mis+n0AKqR2pUVYmxEZwppBi8p8mm5bxPvXItEcx9 eHlevur3ivLfXym3TZU8HdV0yW+B6ZuKVJUd2cSvOceCYLsNYlPx7uuV+JW+Q9kZffwK 0Z4IhXrJM7vuv9vo5j5C5yMvqsyt/oaXvfKuM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ociZpFm65LWdTxJXKcKsVU0ihnxY1+uXjBJHvs1iKfM=; b=ovUUI8oh4WFKBT1QgeMHc0qVR7ed67ZWWqfKioNojyFKUastLtJRxlQwwnKq8ACZZk +zhh3tdyc2xHhk4jl6Y5UVUP07gTOvdxytDGVvHwULFpL+0G+GgADAXXzEyJxVnrcCQY RUDRIt3i6h3WW0QTJGkgQ+qDbzTQvOTiEylUbjp0GaSlP+VKUybmYN9bOg390A8j/QI0 32nQiQTybmv2TZ4cCoigxbQRHILLvg9BTchMcauEjM7sh7jYTcnpYf8p0foIr/qUSe4V EGpOcQS5VY6YYy0a6+i4AHpkUi0f/ljbljh/MoJQC4DwK/cUqREWIQ64zSqakdYIYb8D PqJw== X-Gm-Message-State: AGRZ1gLqop8ptLj2tnVHLp+ThXEsKWRNjfJ71SJugk6GfQGqZGyqAoAo Is2DoShet9TEUSl+fV0WovnIlw== X-Google-Smtp-Source: AJdET5cnuwJNg8MOpZwUkDr+VkKjXbNp150pSHII0p44ThI2Hj0nc576pOJpkIK8cjK0ghMEMexKUA== X-Received: by 2002:a19:200b:: with SMTP id g11mr7966915lfg.58.1541880100375; Sat, 10 Nov 2018 12:01:40 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 75-v6sm2234606ljs.50.2018.11.10.12.01.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 12:01:39 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 2/3 v2] mtd: partitions: Add RedBoot FIS DT bindings Date: Sat, 10 Nov 2018 21:01:26 +0100 Message-Id: <20181110200127.13847-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181110200127.13847-1-linus.walleij@linaro.org> References: <20181110200127.13847-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_120152_385054_F645DA49 X-CRM114-Status: GOOD ( 17.99 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This adds device tree bindings for the RedBoot FIS partition format. Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased on linux-mtd-next for v4.21 - Collected Rob's ACK --- .../bindings/mtd/partitions/redboot-fis.txt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/redboot-fis.txt diff --git a/Documentation/devicetree/bindings/mtd/partitions/redboot-fis.txt b/Documentation/devicetree/bindings/mtd/partitions/redboot-fis.txt new file mode 100644 index 000000000000..fd0ebe4e3415 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/redboot-fis.txt @@ -0,0 +1,27 @@ +RedBoot FLASH Image System (FIS) Partitions +=========================================== + +The FLASH Image System (FIS) directory is a flash description +format closely associated with the RedBoot boot loader. + +It uses one single flash eraseblock in the flash to store an index of +all images in the flash. + +This block size will vary depending on flash but is typically +32 KB in size. + +Required properties: +- compatible : (required) must be "redboot-fis" +- fis-index-block : (required) a index to the eraseblock containing + the FIS directory on this device. On a flash memory with 32KB + eraseblocks, 0 means the first eraseblock at 0x00000000, 1 means the + second eraseblock at 0x00008000 and so on. + +Example: + +flash@0 { + partitions { + compatible = "redboot-fis"; + fis-index-block = <0>; + }; +}; From patchwork Sat Nov 10 20:01:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 995984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FYrxH6Aa"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ib5lJQwq"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42snxK55Vgz9rxp for ; Sun, 11 Nov 2018 07:02:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S4tetLgG+YUmsu9jTNwKjSlxLPg2eOC84raQ9SZlvXM=; b=FYrxH6AazBnfez 1GsDWlN/+H0GACf9ajCbdhI4KO7P8caw3MIUKzV7xteOWL0LMsO3dBQY8jrXp++wSMutiWHy954JT NpTJa92Daf/Duj83XLGadne0djFUEjo12+cl06SoeYUSGQtqBTkrLIA9WZqRYP+0hEMLHQm8T8Bxj BJAl8m5vFnHo+OuNkPIWNgIq/s5dmJ0lzpHuUgjTf5vRxtJN5mRynOblXSvPJ7mkZxin+dLZr3cCN V20J7yGgHwpP4IqCJUSQcER3iSmPuPzPUgoO5RrHutjYMdCvdOlsqdDeh/SuYE223GTmt/8jrVYpb ubvOJtyiKjD/qvr2b9yw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLZSX-0008Te-Hu; Sat, 10 Nov 2018 20:02:21 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLZS8-00088R-Cj for linux-mtd@lists.infradead.org; Sat, 10 Nov 2018 20:01:57 +0000 Received: by mail-lf1-x141.google.com with SMTP id f23so3608647lfc.13 for ; Sat, 10 Nov 2018 12:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WgT1oSEcBV7fiD22HGBOrPHrPcqRjdIDraFAdxJP7qg=; b=ib5lJQwqr22yHt/0qlNPsF2Y5J6SDcDmDh8B4jMSlIihvCwnQGctIp37Dw1a80nGv0 OdWaZmqElN7J1rTeskmHZvAxelOz4P9yyoTWxCeQAjpe256pr1PYwNu/eNvJkxuAEqMT ueTyPe0U5E48diHX9iRzV9Pprk4DJQTtyI9zg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WgT1oSEcBV7fiD22HGBOrPHrPcqRjdIDraFAdxJP7qg=; b=QdYVIzZ0LpjNDpSh08DPt/vpQ/DA/9tGrEP7/fPO8Sj54qnLY6mkLIVyKyaI1uh1Fd AZ4hZ+qqUilBrg/Uk4s0Gxr21SijPEMF0x2v2+Xddw8gIsf74aN7WiXydTMy6FGWoLgA bC88+4Fc78Wp8lMtLP3RssJ14m5R5YiIzMoIhVPbByccttM/zrVER9fvuqo6kDFHbtaj PMT8B9dus3r6czDOgXeG2uzZwIUBTPiwFWftvcUV4ERHuqKGonxrdPHEbmdbZjQD4Red vjQ/r5sNuPMjynoHhDeEQX81dN5Smn+kDrqdurB9at0lQcroNVe/F9dE3GcYCcQZ7KVd MYQA== X-Gm-Message-State: AGRZ1gIROQi7MBPmWEBuz8Lxsn7wuzlMi5MTTKJCFyZAuhagb2/VV/+n SfC7r/sE3f/jCYlRtwZ7Gv7COg== X-Google-Smtp-Source: AJdET5f43uhNkYosxa7LumnbNRGGLwObbwAr1sawrSel35wK7sSO+Xk0nJN5SpUfE8n/ObMH9FeWfA== X-Received: by 2002:a19:1d0d:: with SMTP id d13mr7684185lfd.74.1541880103515; Sat, 10 Nov 2018 12:01:43 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 75-v6sm2234606ljs.50.2018.11.10.12.01.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 12:01:42 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 3/3 v2] mtd: partitions: Add OF support to RedBoot partitions Date: Sat, 10 Nov 2018 21:01:27 +0100 Message-Id: <20181110200127.13847-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181110200127.13847-1-linus.walleij@linaro.org> References: <20181110200127.13847-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_120156_425918_E5D224AA X-CRM114-Status: GOOD ( 20.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:141 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This adds device tree support for RedBoot partitioning. We read out the FIS directory block information from the device tree and then parse the partition table from there. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased on linux-mtd-next for v4.21 --- drivers/mtd/parsers/redboot.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index 7623ac5fc586..fb816825aa19 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -25,7 +25,7 @@ #include #include #include - +#include #include #include #include @@ -56,6 +56,31 @@ static inline int redboot_checksum(struct fis_image_desc *img) return 1; } +#ifdef CONFIG_OF +static void parse_redboot_of(struct mtd_info *master) +{ + struct device_node *np; + u32 dirblock; + int ret; + + np = mtd_get_of_node(master); + if (!np) + return; + ret = of_property_read_u32(np, "fis-index-block", &dirblock); + if (ret) + return; + /* + * Assign the block found in the device tree to the local + * directory block pointer. + */ + directory = dirblock; +} +#else +static void parse_redboot_of(struct mtd_info *master) +{ +} +#endif + static int parse_redboot_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) @@ -75,6 +100,7 @@ static int parse_redboot_partitions(struct mtd_info *master, #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED static char nullstring[] = "unallocated"; #endif + parse_redboot_of(master); if ( directory < 0 ) { offset = master->size + directory * master->erasesize; @@ -289,9 +315,16 @@ static int parse_redboot_partitions(struct mtd_info *master, return ret; } +static const struct of_device_id mtd_parser_redboot_of_match_table[] = { + { .compatible = "redboot-fis" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table); + static struct mtd_part_parser redboot_parser = { .parse_fn = parse_redboot_partitions, .name = "RedBoot", + .of_match_table = mtd_parser_redboot_of_match_table, }; module_mtd_part_parser(redboot_parser);