[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200117101346.3611dc0a@xps13>
Date: Fri, 17 Jan 2020 10:13:46 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: masonccyang@...c.com.tw
Cc: bbrezillon@...nel.org, computersforpeace@...il.com,
devicetree@...r.kernel.org, dwmw2@...radead.org,
juliensu@...c.com.tw, linux-kernel@...r.kernel.org,
linux-mtd@...ts.infradead.org, marek.vasut@...il.com,
mark.rutland@....com, richard@....at, robh+dt@...nel.org,
vigneshr@...com
Subject: Re: [PATCH v4 1/2] mtd: rawnand: Add support for Macronix NAND
randomizer
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
Powered by blists - more mailing lists