[PATCH 3/3] NAND: add support for reading ONFI parameters from NAND device

Brian Norris norris at broadcom.com
Thu Aug 12 19:06:47 EDT 2010


On 08/12/2010 12:47 PM, Florian Fainelli wrote:
>> Also, previously, you said:
>>> +   if (!is_power_of_2(val) || val == 1 || val > (1 << 4)) {
>>> the !is_power_of_2 check does not work for ONFI version 2.1 (3), so I
>>> would only keep the two other checks."
>> So why is it now:
>>> +   if (is_power_of_2(val) || val == 1 || val > (1 << 4)) {
>> Is that a typo? Perhaps it's better to throw that test out altogether.
> That was not a typo, I actually misread the ONFI specification and confused bit
> is set, with the actual value. So this is the correct check, sorry about that.

Again, I might be mistaken, but it seems that the "is_power_of_2" would 
weed out ONFI 1.0, since val would be simply 1 << 1, i.e., val == 2. 
Really, it seems that the ONFI version number may or may not be a power 
of two. If so, then we should just check individual bits as performed in 
the other tests (and perhaps include a test to be sure "val & 1 == 0")

>> I "fixed" the changes I mentioned as well as a few coding style, logic
>> cleanups, etc. (e.g. too many levels of logic, creating lines > 80 chars).
>> Here's a new patch. I didn't change over the crc function to the library
>> function because that would require configuring the Kbuild options and
>> setting a dependency, which I'm not familiar with. I'm certainly not an
>> expert on most of this, so take my patch with a grain of salt!
> It is usually as simple as doing the proper select FOO in the related Kconfig.

Thanks for the tip. It worked for me.


More information about the linux-mtd mailing list