From patchwork Fri Oct 19 07:06:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 149242 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2949674lji; Fri, 19 Oct 2018 00:08:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV611RfYIRT/NQ4MkV9IDl1b1cYEF/gNO34nCLRNp89bSw/lI6/BfjjZ5Szq0VMUEpAiDw+ii X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr32286976plb.71.1539932881723; Fri, 19 Oct 2018 00:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539932881; cv=none; d=google.com; s=arc-20160816; b=vl1JnL3PhzSfY/j/f+Y/H6OFGyr6McG+NSwvyl13tsOrzFSsPv+NlzuaL2RYed9Bep kQUqHA7pCv3u82hCQyGXLAmkjDiuWmE1arkk2qmS/fuLNAIXyfEjTYiIRcqNmx3OfOlP l+FRzBnDrJNQYuJjYjQsDZklQlM+T22+uj0HKNUYeXejJlmOKop4HEuZbkMyqPt93iRg nbikKxl4AaVEhHIfB7EZQHSZQJFnvgRthQVOOfr8nr6Kharifv2tyzIDuyaYXpbsjfno +u4Hn9C/QvDuMZjlsP15rnrjP525Fg7ktnAVtrOUSH5AxZye0AN6I43q26Or1HedJJMe mhYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=zBug2SjwnVnXtUd1B9wABESgEQG4em+ZamevW+I2x1c=; b=adlL86IWPlFw6HCsqb3q0QVCcXBxWY4MXwcVDvSSAAehFR7ClLD498Dq7RLpKT+iK+ 8z3Xg+WQeC5WRqQzd94m7pfzLuIoojeY/hjeEOsioRCVWftiML182NSGFaYHikNM40fX HU5v/dO/yQUZmQUM6j0SPTXFINysTMvFCF0hY2Xa0dsUBvo+F9bzOw4CVFwUqqUU5GUq fuRumepe6aBZtMPNQbk0Dg1dx5j0TUGNuGV6fV/dEQdVBPjXiIJkxv/biizRah+iRX+f 5GqWUSAsbd0GmfWoKcuBM9DSxhjIQ+0w3cP8U/FDbIXphvu71ZgEdtZpbOY5xYcA34j3 WlgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=WSjnm0Ux; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=P1TNKeyP; 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 h18-v6si21363665pgv.47.2018.10.19.00.08.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 00:08:01 -0700 (PDT) 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=WSjnm0Ux; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=P1TNKeyP; 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=zBug2SjwnVnXtUd1B9wABESgEQG4em+ZamevW+I2x1c=; b=WSjnm0UxTsF9jPftDUpF2Htjsp rg8A2aCYYBgzq37Anx2xUdeet20jzSam5hQebWNtdQvgzUh69DwxjjYZL5zTy6Uy73P4YVoOiztIV WYroEJ+xdUQ7A1MT/KGnK6cHi5lS4b3fgUBG1jU+qZ+e45KQO30AloYJm/3qN+PcxMBCAS9dBJxPT TgvhIm8irNjksv2PgpDmM6hGxf3pjjnguS9zx4MiLBZAID42nubL3Tl6FIfuJFhThD+UmfVsHmYKW 5+XtEftp5++BajCB12T/1/gXpFbz0v+X1qVg/QjiTbLF/ZrMYffGfVg0RRpxI9fnBHbtDySHo5zvS thCRafig==; 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 1gDOst-0004AA-Df; Fri, 19 Oct 2018 07:07:47 +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 1gDOrr-0003e5-O7 for linux-mtd@lists.infradead.org; Fri, 19 Oct 2018 07:06:45 +0000 Received: by mail-lf1-x142.google.com with SMTP id l1-v6so4663952lfc.3 for ; Fri, 19 Oct 2018 00:06:33 -0700 (PDT) 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; bh=t99Q+i/SoyorLvc8faum8S770uSZRfnM+qqD2AM2ppI=; b=P1TNKeyPvyDiNwGhk5p8DVsytN+Q7+jD6G4vRBbr47j2UkbqFossmZ/ydVZUUV6PVf wLCElWkgUKCb4OQjl4/pDYAVXX2kFUIV4XtFo68j1i6xx5jq01+2YO8K8y62JSANS01m kgPXSrG0pvjjSsXGcxZfGFppLq7TjtIdiKOsI= 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; bh=t99Q+i/SoyorLvc8faum8S770uSZRfnM+qqD2AM2ppI=; b=SWM1MkmQWypJLU+QF0k8lpKR0yNGYY/w/uzMKOGxhM9IES1BXfuLEpgaBrz24gR4Zr VclkFeHftzxFApVrLkz2+dx0l2q2/v8RzXt0pU9O5Z3IXOm/L9ZW6JOE5pPA6rQPOTqA TzGAaFTCp+TEObhlUy7MI7Kra6c3hNvr+Zbq915NBcbCKBMV47fQkunXmfyMtkMm41aa u3vuKkgo0cvomBCkfGxiDJLis7GoFskEUBM2DmVSM1UyXRVdEsKvTkQQ2gvHua31ea+f W6LJg5HdQVYQOI6UIgKfOwg/UIOwHcK/C0o5lyBaMXOfDTH8yJ3Vb6xscv52W2u8U/zs QFFQ== X-Gm-Message-State: ABuFfoiF07Hp+QkHBx7IUUbtMH9vYocJIZ5N7KQt5ov8r/jYdxShJuSB yZJPGLIoxVS5d/cPJDfXVpXVXQ== X-Received: by 2002:a19:771b:: with SMTP id s27-v6mr2149756lfc.84.1539932791622; Fri, 19 Oct 2018 00:06:31 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id m12-v6sm5537lfj.39.2018.10.19.00.06.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 00:06:30 -0700 (PDT) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 3/3] mtd: partitions: Add OF support to RedBoot partitions Date: Fri, 19 Oct 2018 09:06:22 +0200 Message-Id: <20181019070622.26661-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181019070622.26661-1-linus.walleij@linaro.org> References: <20181019070622.26661-1-linus.walleij@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181019_000643_778812_7538904A X-CRM114-Status: GOOD ( 20.54 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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 MIME-Version: 1.0 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 --- drivers/mtd/parsers/redboot.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) -- 2.17.2 ______________________________________________________ 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);