From patchwork Fri Oct 19 07:06:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 986572 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="OujGfeT4"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UF3y5vOj"; 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 42bxmk4W1Pz9sDK for ; Fri, 19 Oct 2018 18:07:02 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=XcKhjGZ1tTyr1BsYogj0K7BRrS8cqHFDJZiid8nzktk=; b=Ouj GfeT4Lc8V4a4MN2KwGYQcAq+TiWBwcHc/CZh0QFIYzk0yct6BXDiktED7rxyco3xdhQlSlfAhokBN ZDFivY53ttYWsZMHe/cbMdtJgf00f1ZVjRt0oHVUi1q6TV3ZGneC2UEWyruU8vDH6iSmg+LQ1nO8M srZj3y/HjpX9itVm73naaaN6gjCRsz2fqnzTZCXLRbxzTx/cmjeej9p+XrTBujEEUYn8r5vbDqVMb IvOy7OzS4H3/0dHMAlInk7cfs2uzOEVcTihNcJrUxyUMxk7mzKLm++xnNVM9JQ2QwxAQfVzc+ncrr b8UhXAk+pZ5De5UODlRmzI1pGuvG83A==; 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 1gDOrt-0003gY-2X; Fri, 19 Oct 2018 07:06:45 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDOro-0003dW-Sm for linux-mtd@lists.infradead.org; Fri, 19 Oct 2018 07:06:42 +0000 Received: by mail-lj1-x244.google.com with SMTP id j4-v6so29912035ljc.12 for ; Fri, 19 Oct 2018 00:06:27 -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; bh=Zvmdz3n7BsO+Xv43kO7eT02mt7NsHGctgglnzRqWYeY=; b=UF3y5vOjQySXVeUhNwPA2INR7ofUv6Hr5EUYHFmbMMYizaYOBGDX2EEMHKIlR4/2/W 8MUfJHoNzNlD11+9baC5GEnbd1jqod34O0+QtDrDy+0xA3WibrjowVeuEluqSDp1wSuD YwkYdx/L8dSHvIX275InqNEuUvf7vf5XPsjW4= 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; bh=Zvmdz3n7BsO+Xv43kO7eT02mt7NsHGctgglnzRqWYeY=; b=FnLAh7Gc/nVDDITgumDCPwB9WuWbCBPssdfzYWFhqzH5fGPPpX4oVhNFw92y3mu2Px uB/5FMykcVclT6whMBNplO7D3ii1S12CO4RH5L+Jk7cLmVNRVYIvMpMEoSX5kA0r0uu+ AaEQCWYc7R1EQEbzLCyzdQd814/6t5TqklfCUsse091lEhk+og2ew5t+TPODqB8S72dA jTOrnZ+EHr2DaCzsUv4RH6xqJ5b/LVRkeOTU1yRr1hSCtiMnkqRljJkTG9QBZN58WEuf OEQRCvGQbwiRQaSv7yhOGa3vBP1XPLiJt3O4RHHAbsijRgKMCkrHOX+vfhdjROzVMiO+ lKlQ== X-Gm-Message-State: ABuFfohyo5pEeCjQv+9+jpoW5/ZRdj0EN0pD186pvfNsWbFTVy0w1EGY dNLovBu0QLJkkDO2mStUOgEozQ== X-Google-Smtp-Source: ACcGV609E7hIuFWse08Uz3kNsB4sqcskzsQDaeaLjc1UboN/7krH+DEDDZJ4OhuDXcHrmzGskBuBtA== X-Received: by 2002:a2e:990a:: with SMTP id v10-v6mr22709105lji.22.1539932786061; Fri, 19 Oct 2018 00:06:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 00:06:24 -0700 (PDT) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 1/3] mtd: Move Redboot partition parser Date: Fri, 19 Oct 2018 09:06:20 +0200 Message-Id: <20181019070622.26661-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181019_000640_936662_C270853D X-CRM114-Status: GOOD ( 19.10 ) 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:244 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+incoming=patchwork.ozlabs.org@lists.infradead.org This moves the Redboot partition parser down to the parsers subdirectory. Signed-off-by: Linus Walleij --- drivers/mtd/Kconfig | 50 ----------------------------- drivers/mtd/Makefile | 1 - drivers/mtd/parsers/Kconfig | 50 +++++++++++++++++++++++++++++ drivers/mtd/parsers/Makefile | 1 + drivers/mtd/{ => parsers}/redboot.c | 0 5 files changed, 51 insertions(+), 51 deletions(-) rename drivers/mtd/{ => parsers}/redboot.c (100%) diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index c77f537323ec..4523c875f29a 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -22,56 +22,6 @@ config MTD_TESTS WARNING: some of the tests will ERASE entire MTD device which they test. Do not use these tests unless you really know what you do. -config MTD_REDBOOT_PARTS - tristate "RedBoot partition table parsing" - help - RedBoot is a ROM monitor and bootloader which deals with multiple - 'images' in flash devices by putting a table one of the erase - blocks on the device, similar to a partition table, which gives - the offsets, lengths and names of all the images stored in the - flash. - - If you need code which can detect and parse this table, and register - MTD 'partitions' corresponding to each image in the table, enable - this option. - - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. The - SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for - example. - -if MTD_REDBOOT_PARTS - -config MTD_REDBOOT_DIRECTORY_BLOCK - int "Location of RedBoot partition table" - default "-1" - help - This option is the Linux counterpart to the - CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK RedBoot compile time - option. - - The option specifies which Flash sectors holds the RedBoot - partition table. A zero or positive value gives an absolute - erase block number. A negative value specifies a number of - sectors before the end of the device. - - For example "2" means block number 2, "-1" means the last - block and "-2" means the penultimate block. - -config MTD_REDBOOT_PARTS_UNALLOCATED - bool "Include unallocated flash regions" - help - If you need to register each unallocated flash region as a MTD - 'partition', enable this option. - -config MTD_REDBOOT_PARTS_READONLY - bool "Force read-only for RedBoot system images" - help - If you need to force read-only for 'RedBoot', 'RedBoot Config' and - 'FIS directory' images, enable this option. - -endif # MTD_REDBOOT_PARTS - config MTD_CMDLINE_PARTS tristate "Command line partition table parsing" depends on MTD diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile index 93473d215a38..58fc327a5276 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_MTD) += mtd.o mtd-y := mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o mtdchar.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o -obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig index ee5ab994132f..fccf1950e92d 100644 --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig @@ -14,3 +14,53 @@ config MTD_SHARPSL_PARTS This provides the read-only FTL logic necessary to read the partition table from the NAND flash of Sharp SL Series (Zaurus) and the MTD partition parser using this code. + +config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + help + RedBoot is a ROM monitor and bootloader which deals with multiple + 'images' in flash devices by putting a table one of the erase + blocks on the device, similar to a partition table, which gives + the offsets, lengths and names of all the images stored in the + flash. + + If you need code which can detect and parse this table, and register + MTD 'partitions' corresponding to each image in the table, enable + this option. + + You will still need the parsing functions to be called by the driver + for your particular device. It won't happen automatically. The + SA1100 map driver (CONFIG_MTD_SA1100) has an option for this, for + example. + +if MTD_REDBOOT_PARTS + +config MTD_REDBOOT_DIRECTORY_BLOCK + int "Location of RedBoot partition table" + default "-1" + help + This option is the Linux counterpart to the + CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK RedBoot compile time + option. + + The option specifies which Flash sectors holds the RedBoot + partition table. A zero or positive value gives an absolute + erase block number. A negative value specifies a number of + sectors before the end of the device. + + For example "2" means block number 2, "-1" means the last + block and "-2" means the penultimate block. + +config MTD_REDBOOT_PARTS_UNALLOCATED + bool "Include unallocated flash regions" + help + If you need to register each unallocated flash region as a MTD + 'partition', enable this option. + +config MTD_REDBOOT_PARTS_READONLY + bool "Force read-only for RedBoot system images" + help + If you need to force read-only for 'RedBoot', 'RedBoot Config' and + 'FIS directory' images, enable this option. + +endif # MTD_REDBOOT_PARTS diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile index 5b1bcc3d90d9..d8418bf6804a 100644 --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o +obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o diff --git a/drivers/mtd/redboot.c b/drivers/mtd/parsers/redboot.c similarity index 100% rename from drivers/mtd/redboot.c rename to drivers/mtd/parsers/redboot.c From patchwork Fri Oct 19 07:06:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 986573 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="q/9NL0oW"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="IOEyboW1"; 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 42bxn60hDNz9sDJ for ; Fri, 19 Oct 2018 18:07:22 +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: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=YYj1LWvgwhmv2N99FSVsglodgm/E41WkkiJJzE/ZuVc=; b=q/9NL0oWk7j7yC5FNO1pmUi+uQ yrie/h8KLk3/dR0Ry9I9n+JOVfWi+ZslweSE6TtogMNx59xPzf5h7w8uUH0ykPkWytz5Z2mWW77vA wYi7xVJtVsCAD37vTkElfBtKtGG7OTRd4xgS9s8GuE/wpQayYejhPcyyQvTx0PrlvB7warhVkIcLA xgN32hNLVfOBnRwlAu/vCRgZd8grhqw4Or2SeEK6sEWuLktJ8fUDTpMxo8XXFfURHj7Eh/Qh+bLGC /hMec5HgxugULWLBXxqcnJEdxhcceI2oxjKsyhAad2WvIZ5xQlYh2QykuUB68Dm3ZFXUHRL1j2BIt yP9OLeYw==; 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 1gDOsJ-0003tX-89; Fri, 19 Oct 2018 07:07:11 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDOrp-0003do-Jd for linux-mtd@lists.infradead.org; Fri, 19 Oct 2018 07:06:43 +0000 Received: by mail-lj1-x241.google.com with SMTP id j4-v6so29912126ljc.12 for ; Fri, 19 Oct 2018 00:06:30 -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=ap0OZ5j1N9CjR2H0fl5a5loJAmUZ0NLC8GZYUmVAU9Q=; b=IOEyboW1uDFx/d6VapJz0Y4LQQFAxKe12BRFV6s+zumlIxZZBz5n1TEiGUAqvzvKnq cNVDRv4wvFPdbJ62VbKORpm/mwuGims/fGBz6oMNKqvCMU0OLzpl8LavO5ztYWuMFrGk kiiW4h5YH1hRolKXn0ZDnnscoj9W/s0TBSAOc= 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=ap0OZ5j1N9CjR2H0fl5a5loJAmUZ0NLC8GZYUmVAU9Q=; b=CyxfiXovkRteu/9knkebrqp9e0mTdbO7CHv+DsYHkb7R2Bc+up7Pl2cN1FcbFrNFI0 1YGUnTNGqjM8vU+IDnkVzJnGOcb0bLe9CwoAjI2psDxNlGGnsRyJn8S+nJFX9iN0yfAo 3lhynXQslfdKLNPCxEBlUvZLkgYQG0UqswqgHz81vbx9Zk1VBhPTkIcGbXmWNmBOPhBR AIJor65sX36jAHnJjaROKKyearGEhswW2jzH8tSLw8AStVBAKpwKZs/p4qqXMU193mFy lLI8rHTQSFMlF0CsILYtk4xkOx3rMTdbxsJo3KHb32l48aixOIxmtiJb/X6cNBfQWZtJ 9Cbw== X-Gm-Message-State: ABuFfoiSO2BzE6dXdeidIiPZIQpsm5rQmqLVZ7xdK2grcvSddG/FNnZV gqkMUpxGiO3yju8K4NJpXGr3WQ== X-Google-Smtp-Source: ACcGV61+7/p0XzJLPgCxLqir5ih87WzPmOhRmiT3VN9dyWs2UqPM3b1+LStnDpp6ckRWELHkKaU/yA== X-Received: by 2002:a2e:6c0c:: with SMTP id h12-v6mr8056033ljc.112.1539932788799; Fri, 19 Oct 2018 00:06:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 00:06:27 -0700 (PDT) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 2/3] mtd: partitions: Add RedBoot FIS DT bindings Date: Fri, 19 Oct 2018 09:06:21 +0200 Message-Id: <20181019070622.26661-2-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_000641_683745_52B5DB96 X-CRM114-Status: GOOD ( 18.21 ) 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 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:241 listed in] [list.dnswl.org] 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: devicetree@vger.kernel.org, Linus Walleij MIME-Version: 1.0 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 Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- .../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 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: 986574 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="WSjnm0Ux"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="P1TNKeyP"; 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 42bxnv2xJWz9s8T for ; Fri, 19 Oct 2018 18:08:03 +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: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 1gDOss-0004AA-D7; Fri, 19 Oct 2018 07:07:46 +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-Google-Smtp-Source: ACcGV61VXpZ18Jko9VypMWLpR5yxtyZrbmRmQvZnaGtB7LW2ya2stnw4TF4oS5RAu9rJpknt9+t2fw== 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+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 --- 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);