Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8804873ybl; Fri, 17 Jan 2020 01:15:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyiSAmWenD5a12dP6ZWfPD19UGaMKQE4E29B3ERfFwAbSfa7ynUTyrrOkzCCH8yFyZgKp2U X-Received: by 2002:aca:5490:: with SMTP id i138mr2704120oib.69.1579252507999; Fri, 17 Jan 2020 01:15:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579252507; cv=none; d=google.com; s=arc-20160816; b=HpBnjlUZ3vQlRFugWzKU8jvfkfdQegbBZJneGfYKMnQn2+143Iw3jKN0dI0qsp03Cj SpHoc0GlsPMcHYgYMmEtWeNmmFofq3iDYLfCxEmnQaRPloHfUx1sIFsTVex9q05Mem8r MbLdf5n2R/I8fQZlv6nuPlgriX65BqDrzis91wtG6EJQDvXHt4P5QNY9YIG3ptbWy3uG lX4x9a3FS5n5MOkRYKyPpVYupg20KZib+4MVQZT2o39X1zJf/QTnWxGEZnJ9zEImakF+ SC53t+tk7D65udaeN3clyVv3euJz9TMG86nSi/QWaoCkaxIs8NmlSaDtjq9g4GzRsIvG Jstg== 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=+UiI28s8jXTkY9hCFiYw9iijFTxr3cUgFL58dUuSoOU=; b=UXp6j1GUZM6BHGbo42Xkb6cjZXoLfhs+RnEHblTDUyUny8yl/MQhYDw8GnqHz44cPx MLsXENZFR661nJfiafcXUMzqFuMJVGhbfS7Mw8DK/WFUUXNZsQdesqZ/hssmNsAVxRZi HwADA6jT4I2V0F4tRt2OKNSNqpzzGbcoom4HK36SN2AAUOlUnwN2IMSVyqHQ1TGYbpiu YM3xGeOUX0yTzrxeaaWhUjDy3kmu787vVRRFqvsueersTQIs7vQ3EgTDnNdKEJhIuB0W W86PDgFa92H/Qwi0eVtm/gBkyMPFHXHPpu3HOoZhPq6ILc9cDfzSJW4sJFj7tYpkmEUe 10bw== 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 m4si14648015otr.122.2020.01.17.01.14.54; Fri, 17 Jan 2020 01:15: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 S1729208AbgAQJNx convert rfc822-to-8bit (ORCPT + 99 others); Fri, 17 Jan 2020 04:13:53 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:52479 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgAQJNv (ORCPT ); Fri, 17 Jan 2020 04:13:51 -0500 X-Originating-IP: 90.76.211.102 Received: from xps13 (lfbn-tou-1-1151-102.w90-76.abo.wanadoo.fr [90.76.211.102]) (Authenticated sender: miquel.raynal@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 0B6A9FF80F; Fri, 17 Jan 2020 09:13:46 +0000 (UTC) Date: Fri, 17 Jan 2020 10:13:46 +0100 From: Miquel Raynal To: masonccyang@mxic.com.tw Cc: bbrezillon@kernel.org, computersforpeace@gmail.com, devicetree@vger.kernel.org, dwmw2@infradead.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, mark.rutland@arm.com, richard@nod.at, robh+dt@kernel.org, vigneshr@ti.com Subject: Re: [PATCH v4 1/2] mtd: rawnand: Add support for Macronix NAND randomizer Message-ID: <20200117101346.3611dc0a@xps13> In-Reply-To: References: <1571902807-10388-1-git-send-email-masonccyang@mxic.com.tw> <1571902807-10388-2-git-send-email-masonccyang@mxic.com.tw> <20200109172816.6c1d7be7@xps13> 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, > > > +} > > > + > > > static void macronix_nand_onfi_init(struct nand_chip *chip) > > > { > > > struct nand_parameters *p = &chip->parameters; > > > struct nand_onfi_vendor_macronix *mxic; > > > + struct device_node *dn = nand_get_flash_node(chip); > > > + int rand_otp = 0; > > > + int ret; > > > > > > if (!p->onfi) > > > return; > > > > > > + if (of_find_property(dn, "mxic,enable-randomizer-otp", NULL)) > > > + rand_otp = 1; > > > + > > > mxic = (struct nand_onfi_vendor_macronix *)p->onfi->vendor; > > > + /* Subpage write is prohibited in randomizer operatoin */ > > > > with operation > > > > > + if (rand_otp && chip->options & NAND_NO_SUBPAGE_WRITE && > > > + mxic->reliability_func & MACRONIX_RANDOMIZER_BIT) { > > > + if (p->supports_set_get_features) { > > > + bitmap_set(p->set_feature_list, > > > + ONFI_FEATURE_ADDR_MXIC_RANDOMIZER, 1); > > > + bitmap_set(p->get_feature_list, > > > + ONFI_FEATURE_ADDR_MXIC_RANDOMIZER, 1); > > > + ret = macronix_nand_randomizer_check_enable(chip); > > > + if (ret < 0) > > > + pr_info("Macronix NAND randomizer failed\n"); > > > + else > > > + pr_info("Macronix NAND randomizer enabled\n"); > > > > Maybe we should update the bitmaps only if it succeeds? > > okay, will drop pr_info(); It's not my point, you can keep the pr_info, I just say that you should check ret before updating the bitmap maybe? Otherwise if macronix_nand_randomizer_check_enable() fails, you end up without the feature but with its bit set in the bitmap. Thanks, Miquèl