[PATCH 1/1 v2] driver:mtd:spi-nor:fix spi_nor_scan overwrite platform ID point

Rafał Miłecki zajec5 at gmail.com
Wed Oct 22 00:06:51 PDT 2014


On 16 October 2014 02:52, bpqw <bpqw at micron.com> wrote:
> For example:
>
> const struct spi_device_id spi_nor_ids[] = {
> ......
> ......
> ......
>         { "n25q064",     INFO(0x20ba17, 0, 64 * 1024,  128, 0) },
>         { "n25q128a11",  INFO(0x20bb18, 0, 64 * 1024,  256, 0) },//former right platform point will be overwrote by this data info.
>         { "n25q128a13",  INFO(0x20bb18, 0x1234, 64 * 1024,  512, SECT_4K) },//this is the right platform data,I want to match this data info.
>         { "n25q256a",    INFO(0x20ba19, 0, 64 * 1024,  512, SECT_4K) },
>         { "n25q512a",    INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) },

Your initial commit was really missing some example indeed. It was
trying to understand it for 10 minutes with no luck (until seeing
above case) ;)

I see problem in spi-nor that your patch reveals:
ISSUE: spi-nor accepts any entry from spi_nor_ids with no ext_id
specified as long as the jedec_id matches
I guess reason behind this is to support chips with the same
parameters but different extended IDs. That simplifies the driver and
support for extra chips but may also cause problems like in your case.

So AFAIU your patch tries to force using specific flash info, because
JEDEC based detection fails. In general this is what we try to avoid.
We want to auto-detect flash chips and to relieve platform code / DT.

Could we drop this patch and modify spi-nor to detect your chip
automatically? That would be much cleaner solution to me.



More information about the linux-mtd mailing list