I am trying to access SPI Flash (N25Q256) from Beaglebone Black using MTD. This is a follow-up to my earlier post Booting Beaglebone Black from SPI Flash (N25Q256) which was resolved and I was able to program SPI flash and load SPL, bootloader and kernel from SPI flash into RAM.
However I was never able to configure the kernel to detect SPI flash as MTD device so I can now only access SPI flash from U-boot prompt with sspi and sf commands.
While configuring the kernel I have set up the following options:
- enabled MTD support
- enabled command line partition table parsing (MTD_CMDLINE_PARTS [=y])
- enabled Support most SPI Flash chips (AT26DF, M25P, W25X, ...) (MTD_M25P80 [=y])
- just in case enabled CONFIG_MTD_CFI: and CONFIG_MTD_JEDECPROBE:
I set up the kernel command line for Linux network boot is as follows (mtdparts matches organisation of files on SPI flash used for booting BBB)
[ 0.000000] Kernel command line: console=ttyO0,115200n8 mtdparts=m25p80-flash
.0:128k(SPL),384k(u-boot),5000k(kernel),128k(fdt),-(unused) root=/dev/nfs nfsroom
t=192.168.1.2:/opt/ti-sdk-am335x-evm-08.00.00.00/targetNFS,nolock rw ip=dhcp
To load SPI driver I modified the device tree and I can see the devices spidev1.0 and spidev1.1 following kernel boot.
However there are no sign whatsoever of the mtd driver m25p80 loading or SPI flash being detected during kernel boot. /proc/mtd is also empty.
What should I do to initialise MTD and access SPI flash? Do I also have to change a board initialisation file and specify valid mtd_partition there? If yes, what would be that file and could you guide me to a relevant example?
Regards
Eugene