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: 150746 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1367432ljp; Sat, 10 Nov 2018 12:02:33 -0800 (PST) X-Google-Smtp-Source: AJdET5ePMjyX0cYZuH7yLbR15kd7LSHDC2MHU99o2vxERyEYhiOF9JZ7ZIJhX0NnTKyvxjDDn0Bm X-Received: by 2002:a62:d148:: with SMTP id t8-v6mr13917490pfl.212.1541880153258; Sat, 10 Nov 2018 12:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541880153; cv=none; d=google.com; s=arc-20160816; b=l3dQe/BRQ26LFFSoIjtG1XBMybkBidFdkfTG0+AfdGf21Or6iQToksgtBSqMx4kLFV L9UuP6T3V+ZVXisS6C3hJDFSNUdFIaPeupX5tFOeCKSyJkA+9UQpPgYNZJ7Jqg8lxiqc X2RywtkfwPmn5KB5WVyrPl2zG93SpiWHgvpWqb6Qr0SIRSLZXgHOzuICUCc5d9eYrBVL l0Ll+mnp00Am9mKP+IH/+wzq82yTWFY6hixBDcEGobazKzXnkWjML9MIlcewKtJEmY0l hvCeW+GFpjYkpyFh2x5BboLgxkEcfPlDhP1qz0DqwcZxep7RAY2tX6hvPyuVx+shsesj OvAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=S4tetLgG+YUmsu9jTNwKjSlxLPg2eOC84raQ9SZlvXM=; b=RubH9zRSlma/MOCVi6dYl4t4f+PHYOvAjpN+UTESLYj5RdUuP1jnEQUhMZj+JBsmlp 75cfSBh2QSdBBAKtiOGkX7H2AjJ8lz/BuklgH9hnjAYjwmtxFswuOfGj+BmVDnVWNqrx hclMbjZtjIkyl5fbjufn+gJwztAuNVwU+ptFnaFmHn1ZUOn3CA0/C0GUklAXMUYs6t2c IqHDhueK7rtco/CA+OFYs5KXUWFwPHjeNnSGutmhxeDsE5H4V/BvCFEIGy22fI9ErfsA 4eODv2XKqSMaTvpqArmtHl0xw/AgwPrjR82ci2qUSWTAHHXOXgJnxCE+ekobEv7ORYzQ FDSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=FYrxH6Aa; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ib5lJQwq; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 22si10101978pgl.107.2018.11.10.12.02.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 12:02:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=FYrxH6Aa; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ib5lJQwq; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 1gLZSY-0008Te-7K; Sat, 10 Nov 2018 20:02:22 +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-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+patch=linaro.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(-) -- 2.19.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ 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);