From patchwork Sat Nov 10 21:14:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 150753 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1418593ljp; Sat, 10 Nov 2018 13:14:53 -0800 (PST) X-Google-Smtp-Source: AJdET5c7z9HA+5nOX6vkq2yhKkxq8bF1qItgy2JVQIHYno2iIfnGDIUmqsCUOSb/+kkIZspqyoGj X-Received: by 2002:a63:5224:: with SMTP id g36-v6mr12389689pgb.253.1541884493287; Sat, 10 Nov 2018 13:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541884493; cv=none; d=google.com; s=arc-20160816; b=HyzJj4bwUHigONfvImKrWbCVzjfx2fNp6OWt5N2CbSZROcJJMmMFI+KvWs2oYbiv7/ zZRgWAzky/B3AmkcfcMVdoTlRztftCKXzB8BHdPQpiBsX4GICPzyFm+UoKuTRDYnR3Nk O2gtwRqdhDGvVPjZOJqX85X100juvc1ujpit6uMaMbk8pkHpB81rpoa+elyDOvtoDz81 IUALRcNEpU04JAbykzRBZIYWWs4fLmX6f7M0PuUtwBaXwgi5KBtauilQI3MysANjtnuI 4PdcBQTah20S03vUz9ecnhql0rwmMel8RAcw50AFStRccLCMWdFG6mrtlhTBrGn4DPPi 5vMA== 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:message-id:date:subject:to:from :dkim-signature:dkim-signature; bh=1T//nm8U2Mo9EX2ZHkzxBVT/bneFgJfIXQd5mDte40g=; b=oqWGGf2mALK/18NaNJFIvllvhJ/PibG8Rrp6ZtoduYo7fStjlS8WKfYObBFBpiGFN2 0dURorEHKSoPZa/QBpIb2OprURf3jkvc4Cvb6XGuiI9fygkQHEmU2Fyk0K+YGfkM2pgG 0eZG8/t6cxWTw1RGHy0WpCYN/W0oSyGOrxjH340EKyxpRcwrVUf1/oBuzT+T4tNpw5FY tiuDQ+KMTJx8UDTQaW9+eRtwpQyPj+39JRrSt8A3Y8jCwWjlW0DGwN3joJA/Y2+9uS+S AEHAn2JfACcmirJTzxUVPYJPLePSj67lhq9lq/yGbzFsdwUBKqYHMK+JWeDznu8pacPf RWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=Ox2wVVwp; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SB8MRiRL; 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 s82-v6si12871526pfk.197.2018.11.10.13.14.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 13:14:53 -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=Ox2wVVwp; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SB8MRiRL; 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: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:In-Reply-To:References: List-Owner; bh=1T//nm8U2Mo9EX2ZHkzxBVT/bneFgJfIXQd5mDte40g=; b=Ox2wVVwpbW5IXQ qlTuVbtCuaCFhpZS01+Pv0obI+Hz94C/xoYlwNS/pwugDT+g9QCbZcnKPVUFgFK8HguYnNPo1HJ41 ydLjjdyQ1W3Edw7h8mSDQpPmW+f4ZJLoEL7FeI2Bav1gA7UEqq6jzkysEp/ROSgk3eZaMC3VJFP5m WP+yfTpzXxZwjZyQdb8amgUUj18xHcfIijcZcg87htW+Pyre0E0IlUHtEA67CZc/1PUONJim6ARXe UO60uf77Q83VLlBcqDchkOPVR2Lg4kHtpGWOOUSW0EPLI3dJbabGlm3SZXbFvsQc0pGG8/5L8Oc5h tTBPjaINy6UM5tOZoEbw==; 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 1gLaaY-00079m-BP; Sat, 10 Nov 2018 21:14:42 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaaT-000791-Ue for linux-mtd@lists.infradead.org; Sat, 10 Nov 2018 21:14:39 +0000 Received: by mail-lf1-x143.google.com with SMTP id e26so1905030lfc.2 for ; Sat, 10 Nov 2018 13:14:23 -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:mime-version :content-transfer-encoding; bh=QKs0gydDw9X6yqGoSM6q297ISZLJIJvfWWKrF+2P8bY=; b=SB8MRiRLdQUv4ojsV69RFolzlwyS83cyc0DKzgufwb8InWnFH4/thNXV0h1clemcqt fZ48DGR5lJBteHPENH1+3z9Fa5no4z3endygDjKupZvNiAwf/nmJvvVPJT83vYA7112s qwhAf2rtm7v8h//YEavEiu/HL/8e5V/2vzBgw= 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:mime-version :content-transfer-encoding; bh=QKs0gydDw9X6yqGoSM6q297ISZLJIJvfWWKrF+2P8bY=; b=WKK3325ZcagIMMip1RDlq+yHHm8WmZ26eVDktyuNmzff47uFUUQHMmdCfio4jJR9i8 qrPiW/HZ1ZHV/3I3kD6/nLKCBMyhwCAHep28KiM6vc12tAzbgilGHgteB+bZTeF9a5mS K9JbOMZrpNQX0xXxcREjL5J6v7jL4jtFBm8RtfMxL9s3aB9TpdFNthMjkKqLUlus9k2y JprHr0DUlNWmmN2XjadqgSf+PSCN9yDr5jpaNB7CRBNC4DA6w+7sQp3MetbvUI+koeDM LIvmzwlSHCQJfvS/AevH/ObisDKrHXMEdXyJwbt+HwCbMoEX44fp1qOvXCph888pIaJM rtCg== X-Gm-Message-State: AGRZ1gI0yNuHrYty4krlbxvb6DNrDX5Rhm7tue6EC2wbevhOaEiWSHUk iUMZ89TC2ouZGID1x/TdXPD+xQ== X-Received: by 2002:a19:d58e:: with SMTP id m136mr8749775lfg.70.1541884461854; Sat, 10 Nov 2018 13:14:21 -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 j18-v6sm2158237ljc.52.2018.11.10.13.14.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 13:14:20 -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 v3] mtd: partitions: Add OF support to RedBoot partitions Date: Sat, 10 Nov 2018 22:14:13 +0100 Message-Id: <20181110211413.15707-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_131438_044541_03B3548C X-CRM114-Status: GOOD ( 19.38 ) 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:143 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 v2->v3: - Fix copy/paste bug identified by the build robot. 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..cc04a36c8251 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_redboot_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);