Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1093904imm; Thu, 31 May 2018 15:19:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIVyKrvmLWySQ585H8V/uGcPfRvZXWxzVSpnXSPJmmw0rRbFlXkfYqMADaTThwYPrM0UgkZ X-Received: by 2002:a63:9b19:: with SMTP id r25-v6mr6736113pgd.197.1527805199898; Thu, 31 May 2018 15:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527805199; cv=none; d=google.com; s=arc-20160816; b=fuYww+sXdzwPC28DMgKI+rkJQIvmFBEEBge4Jxbex+EY/VcS3rGEzTEmElx6gWozkT U3ihc6F5DVWvpQv5Eng6dp24oyy4w/D32AY0g9oK7bm/SenPxQuxTi7V5XMIVYyxtMzv 8QhupEFCQ6AoQ11D842Yo8VBGPbv9ORFFMwLFjg91NpyXqYCEdIziQM1ehnLtPyCofj+ q1tfn/3/+K4SGbt5gQ0RbdNR2Sxk5YHEQ+O6FdoHFmf06/6SBCS1eK4+F8U7G+goMsdk Jac4FBTDKyb2vF+e8ghQK54gulWxp4zFkQk2G8CjEzUb9xMO8ARWUYoCOCF+k56mxE0n fI3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uEUp6ok13yJoGcRdIsSolUa09Si2hAC5o1SptuorM9I=; b=c6KBy0Ra2qOqm4TTzbTIEUcHwTzUubwoqv/RVVFHtYa4DsJFlKfpzFXMX+xYtHUJpB O6zmZmgjKBZ7lkta64b0Anr2xJBwX4sTQFueFTr/VtcQ+IZrzOChLPwGbYs7is5RJOQ8 Iivv1MuC7htkoqVW0R23AFXHLZVxOkXOh6qpJd/lmPdsaNhlZ+rdcVxUKtYjVjUy9i1B G5FDGU4Stk8++OwM74dfOsfVtJwhX4ykM+L6fLBBHZJzP65XryKePcg3nKiD5B6lh4rL HP6AZdrx5TNaDjn0v6Hx7RZQM8y3iENvneg904/sqaUGIhFINTKdMJIxd5D9KgCYeAbC Jxyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=xParOeQ8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si39405286plr.42.2018.05.31.15.19.45; Thu, 31 May 2018 15:19:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=xParOeQ8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751439AbeEaWRw (ORCPT + 99 others); Thu, 31 May 2018 18:17:52 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:37506 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbeEaWQl (ORCPT ); Thu, 31 May 2018 18:16:41 -0400 Received: from trochilidae.toradex.int (unknown [37.17.239.3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 2EB675C1EED; Fri, 1 Jun 2018 00:16:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1527804999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uEUp6ok13yJoGcRdIsSolUa09Si2hAC5o1SptuorM9I=; b=xParOeQ8l5iGMjvILkEeDoymRiVW0S6atN22oy+r7TWPcMo/b8j71BskoR4PhzF2DqrFH8 Zt+xMpMDQDUHaRKJvBMZSk0Dn/ModhWaPp8pNto7KpjVTlvZUv5TI1syHVPWHcQ5Xps7D6 Y0N7fEuo8r6Q9bqDJJ0Xf6ydnd0kDL8= From: Stefan Agner To: boris.brezillon@bootlin.com, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, thierry.reding@gmail.com Cc: dev@lynxeye.de, miquel.raynal@bootlin.com, richard@nod.at, marcel@ziswiler.com, krzk@kernel.org, digetx@gmail.com, benjamin.lindqvist@endian.se, jonathanh@nvidia.com, pdeschrijver@nvidia.com, pgaikwad@nvidia.com, mirza.krak@gmail.com, stefan@agner.ch, linux-mtd@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/6] mtd: rawnand: add an option to specify NAND chip as a boot device Date: Fri, 1 Jun 2018 00:16:33 +0200 Message-Id: <20180531221637.6017-3-stefan@agner.ch> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531221637.6017-1-stefan@agner.ch> References: <20180531221637.6017-1-stefan@agner.ch> X-Spamd-Result: default: False [-2.10 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[23]; BAYES_HAM(-3.00)[100.00%]; RCVD_TLS_ALL(0.00)[]; TAGGED_RCPT(0.00)[dt]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MID_CONTAINS_FROM(1.00)[]; ASN(0.00)[asn:13030, ipnet:37.17.238.0/23, country:CH]; TO_DN_NONE(0.00)[]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow to define a NAND chip as a boot device. This can be helpful for the selection of the ECC algorithm and strength in case the boot ROM supports only a subset of controller provided options. Signed-off-by: Stefan Agner --- Documentation/devicetree/bindings/mtd/nand.txt | 4 ++++ drivers/mtd/nand/raw/nand_base.c | 3 +++ include/linux/mtd/rawnand.h | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt index 8bb11d809429..8daf81b9748c 100644 --- a/Documentation/devicetree/bindings/mtd/nand.txt +++ b/Documentation/devicetree/bindings/mtd/nand.txt @@ -43,6 +43,10 @@ Optional NAND chip properties: This is particularly useful when only the in-band area is used by the upper layers, and you want to make your NAND as reliable as possible. +- nand-is-boot-medium: Whether the NAND chip is a boot medium. Drivers might use + this information to select ECC algorithms supported by + the boot ROM or similar restrictions. + - nand-rb: shall contain the native Ready/Busy ids. The ECC strength and ECC step size properties define the correction capability diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 9eb5678dd6d0..c8fb7c9855e2 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5826,6 +5826,9 @@ static int nand_dt_init(struct nand_chip *chip) if (of_get_nand_bus_width(dn) == 16) chip->options |= NAND_BUSWIDTH_16; + if (of_property_read_bool(dn, "nand-is-boot-medium")) + chip->options |= NAND_IS_BOOT_MEDIUM; + if (of_get_nand_on_flash_bbt(dn)) chip->bbt_options |= NAND_BBT_USE_FLASH; diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 6a82da8c44ce..8e54fcf2fa94 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -212,6 +212,12 @@ enum nand_ecc_algo { */ #define NAND_WAIT_TCCS 0x00200000 +/* + * Whether the NAND chip is a boot medium. Drivers might use this information + * to select ECC algorithms supported by the boot ROM or similar restrictions. + */ +#define NAND_IS_BOOT_MEDIUM 0x00400000 + /* Options set by nand scan */ /* Nand scan has allocated controller struct */ #define NAND_CONTROLLER_ALLOC 0x80000000 -- 2.17.0