From: Miquel Raynal <miquel.raynal@bootlin.com>
To: masonccyang@mxic.com.tw
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
vigneshr@ti.com, bbrezillon@kernel.org, juliensu@mxic.com.tw,
richard@nod.at, linux-kernel@vger.kernel.org,
marek.vasut@gmail.com, robh+dt@kernel.org,
linux-mtd@lists.infradead.org, computersforpeace@gmail.com,
dwmw2@infradead.org
Subject: Re: [PATCH v4 1/2] mtd: rawnand: Add support for Macronix NAND randomizer
Date: Fri, 17 Jan 2020 10:13:46 +0100 [thread overview]
Message-ID: <20200117101346.3611dc0a@xps13> (raw)
In-Reply-To: <OFECBDB130.03AD44B7-ON482584F2.002B40F2-482584F2.002B720F@mxic.com.tw>
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
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
Date: Fri, 17 Jan 2020 10:13:46 +0100 [thread overview]
Message-ID: <20200117101346.3611dc0a@xps13> (raw)
In-Reply-To: <OFECBDB130.03AD44B7-ON482584F2.002B40F2-482584F2.002B720F@mxic.com.tw>
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
next prev parent reply other threads:[~2020-01-17 9:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 7:40 [PATCH v4 0/2] mtd: rawnand: Add support Macronix NAND randomizer Mason Yang
2019-10-24 7:40 ` Mason Yang
2019-10-24 7:40 ` [PATCH v4 1/2] mtd: rawnand: Add support for " Mason Yang
2019-10-24 7:40 ` Mason Yang
2020-01-09 16:28 ` Miquel Raynal
2020-01-09 16:28 ` Miquel Raynal
2020-01-17 7:54 ` masonccyang
2020-01-17 7:54 ` masonccyang
2020-01-17 9:13 ` Miquel Raynal [this message]
2020-01-17 9:13 ` Miquel Raynal
2020-01-20 9:28 ` masonccyang
2020-01-20 9:28 ` masonccyang
2020-01-09 16:51 ` Miquel Raynal
2020-01-09 16:51 ` Miquel Raynal
2020-01-16 8:08 ` masonccyang
2020-01-16 8:08 ` masonccyang
2019-10-24 7:40 ` [PATCH v4 2/2] dt-bindings: mtd: Document Macronix NAND device bindings Mason Yang
2019-10-24 7:40 ` Mason Yang
2019-10-25 19:12 ` Rob Herring
2019-10-25 19:12 ` Rob Herring
2020-01-09 16:30 ` Miquel Raynal
2020-01-09 16:30 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200117101346.3611dc0a@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=juliensu@mxic.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=mark.rutland@arm.com \
--cc=masonccyang@mxic.com.tw \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.