Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2424700ybl; Thu, 9 Jan 2020 12:31:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxeeC7I7myRJkiCQzAK/DTY02qkv3aNdi2ZG2jtUP/GBnlGxsXka3HDpESkjEQR9t68IGbl X-Received: by 2002:a05:6830:3003:: with SMTP id a3mr9928580otn.118.1578601867295; Thu, 09 Jan 2020 12:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578601867; cv=none; d=google.com; s=arc-20160816; b=zSfjfSFbc5tA8psE2cUWmjK4JRgFTWabD9agbYOZzqgWsO1iLyblcwJFjwWjKL0j/w Py7nBR2gK0me9KFQHUJiVZaRnmSTV5JfBiAHnL8kJU1VG0WYrbysE7QOyNpTqbxdhV09 V0JKQfKmAliZJOPG2ppIkNMXpip8SkvKKyBxERtsHdOtVqUb3BSwD1LIoBAam93LGyG+ BAMegb2CRJOeREnoDVFyVn0VM2BAHIozKPLZsdCtEYShdjepcLLRDVXBtMPr6VB/vk1/ 97P3QJqqDoyx7/CczrOXfcOQ4a6ItJxMVi/MACbsCF3MwGYKKxA689fd+PVPNdSBjTk8 iCiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=4vpNlOsEn/5UpTzml0361x56C5zIUbrsEosrncQTTHg=; b=FiXogdVG4O/n1RE1zp9FZxn8ux5DjYDxBPIiuD5jqwFKnoYT88mF5j/up+DsYYNsWO 28Z1ylYsacaWMsWNRt7kTuvDHbjd9yt0H6N8Z8zVT5hD2bSMa8LCyl9/7R/DaZXFKioM M7Y5dWr+tYtWGmp6q/MdnCPydg17WJdCFlZjlZGQboSlrDky2a/itURFGID+Gmbs44gC 76kFbWBHvg2aXOc7NCmeny/ZfP0ocHzgoMUuNMj45dI5z5uPVhBzhdz/INGAnP79sbWH RQdgpN7qCjEr7wnZFaCotTgtDOCNlmClvuEEXPII24wfBLMMdf/Bwc7n2iFM64LhmJxY k18A== ARC-Authentication-Results: i=1; mx.google.com; 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 f98si4987710otf.145.2020.01.09.12.30.55; Thu, 09 Jan 2020 12:31:07 -0800 (PST) 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; 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 S2387883AbgAIQvN convert rfc822-to-8bit (ORCPT + 99 others); Thu, 9 Jan 2020 11:51:13 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:54967 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731549AbgAIQvN (ORCPT ); Thu, 9 Jan 2020 11:51:13 -0500 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id D0FFA240004; Thu, 9 Jan 2020 16:51:08 +0000 (UTC) Date: Thu, 9 Jan 2020 17:51:07 +0100 From: Miquel Raynal To: Mason Yang Cc: richard@nod.at, marek.vasut@gmail.com, dwmw2@infradead.org, bbrezillon@kernel.org, computersforpeace@gmail.com, vigneshr@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: Re: [PATCH v4 1/2] mtd: rawnand: Add support for Macronix NAND randomizer Message-ID: <20200109175107.57566c18@xps13> In-Reply-To: <1571902807-10388-2-git-send-email-masonccyang@mxic.com.tw> References: <1571902807-10388-1-git-send-email-masonccyang@mxic.com.tw> <1571902807-10388-2-git-send-email-masonccyang@mxic.com.tw> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mason, Mason Yang wrote on Thu, 24 Oct 2019 15:40:06 +0800: > Macronix NANDs support randomizer operation for user data scrambled, > which can be enabled with a SET_FEATURE. > > User data written to the NAND device without randomizer is still readable > after randomizer function enabled. > The penalty of randomizer are subpage accesses prohibited and more time > period is needed in program operation and entering deep power-down mode. > i.e., tPROG 300us to 340us(randomizer enabled) > > For more high-reliability concern, if subpage write not available with > hardware ECC and then to enable randomizer is recommended by default. > Driver checks byte 167 of Vendor Blocks in ONFI parameter page table > to see if this high-reliability function is supported. By adding a new > specific DT property in children nodes to enable randomizer function. > > Signed-off-by: Mason Yang > --- > drivers/mtd/nand/raw/nand_macronix.c | 69 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 69 insertions(+) > > diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c > index 58511ae..89101fa 100644 > --- a/drivers/mtd/nand/raw/nand_macronix.c > +++ b/drivers/mtd/nand/raw/nand_macronix.c > @@ -11,6 +11,14 @@ > #define MACRONIX_READ_RETRY_BIT BIT(0) > #define MACRONIX_NUM_READ_RETRY_MODES 6 > > +#define MACRONIX_RANDOMIZER_BIT BIT(1) > +#define ONFI_FEATURE_ADDR_MXIC_RANDOMIZER 0xB0 > +#define ENPGM BIT(0) > +#define RANDEN BIT(1) > +#define RANDOPT BIT(2) I forgot: please be consistent with the naming. Thanks, Miquèl