TLDR: I want to add support for a SPI NOR chip in my own copy of the source before I ask for it to be patched to the kernel, so I can get a working build now. I cannot find directions or hints from the code anywhere....
I am trying to use some Winbond chips I bought recently, but the JEDEC ID is not recognized...
Message from kernel is:
m25p80 spi0.0: unrecognized JEDEC id bytes: ef, 70, 17
The chip is W25Q64JV-SIM
I am building for MIPS, ar71xx/tiny
(This is a flash upgrade from 4 MB to 8 MB
I recompiled u-boot and it comes up fine)
I realized that there is a file in the build_dir that contains the info for all supported SPI NOR chips...but this is after you generate at least one build. I can't find anything related on github except for .patch files which I don't really understand. But I do understand that the kernel needs to be rebuilt to change chips supported...
for my situation, after a build I ran:
find . -name spi-nor.c
and the reply was:
./build_dir/toolchain-mips_24kc_gcc-7.3.0_musl/linux-4.9.152/drivers/mtd/spi-nor/spi-nor.c
After looking through that file I found the lines:
{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
{ "w25q128jv", INFO(0xef7018, 0, 64 * 1024, 256,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)},
The funny thing is, the JEDEC ID of ef, 40, 17 is indeed for the JV series...but only the chips that end with -IQ...
From the datasheet:
W25Q64JV-_IQ: 4017h
W25Q64JV-_IM: 7017h
I bought the -SIM package because (at the time) I was worried I would be stuck in Quad SPI mode...and that I needed the /WP pin to write. That seems to not be true after reading the datasheet more carefully...
I attempted to add the following line to spi-nor.c, since it is exactly the same as the W25Q128JV but half the size.
{ "w25q64jv", INFO(0xef7017, 0, 64 * 1024, 128, SECT_4K) },
and then proceed as usual:
make menuconfig
nohup make V=s &
Build was successful...but I get the same kernel message, and MTD parts are never found, so rootfs cannot mount...
What am I missing and why is this so complicated?
Do I have to run make distclean and start over? or remove staging_dir?