m25p_initialize() does not generate a block driver. I creates an MTD
driver. To get a block driver, you have to wrap the MTD driver
instances in an FTL (FLASH Translation Layer) instance. These should be
examples:
$ find . -name "*.c" | xargs grep -l ftl_initialize | xargs grep -l
nxffs_initialize
./arm/cxd56xx/common/src/cxd56_flash.c
./arm/lpc43xx/bambino-200e/src/lpc43_appinit.c
./arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c
./arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c
./arm/sam34/sam4e-ek/src/sam_at25.c
./arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c
./arm/sama5/sama5d2-xult/src/sam_at25.c
./arm/sama5/sama5d2-xult/src/sam_nandflash.c
./arm/sama5/sama5d3-xplained/src/sam_at25.c
./arm/sama5/sama5d3-xplained/src/sam_nandflash.c
./arm/sama5/sama5d3x-ek/src/sam_at24.c
./arm/sama5/sama5d3x-ek/src/sam_at25.c
./arm/sama5/sama5d3x-ek/src/sam_nandflash.c
./arm/sama5/sama5d4-ek/src/sam_at25.c
./arm/sama5/sama5d4-ek/src/sam_nandflash.c
./arm/samd5e5/metro-m4/src/sam_at24.c
./arm/samv7/samv71-xult/src/sam_bringup.c
./arm/stm32/cloudctrl/src/stm32_w25.c
./arm/stm32/fire-stm32v2/src/stm32_w25.c
./arm/stm32/shenzhou/src/stm32_w25.c
./arm/stm32/stm32f103-minimum/src/stm32_at24.c
./arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
./arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c
./mips/pic32mx/mirtoo/src/pic32_appinit.c
./xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c
./xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c
./xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c
The block driver should be called /dev/mtdblockN where N is the minor
device number passed as the first argument to ftl_initialize().
On 8/25/2021 11:04 AM, Tim wrote:
I seem to have got over most of my SPI flash and EEPROM issues now and my
256Mb SPI flash is properly recognised.
I think I am at the last hurdle. Here is the console output, along with my
question of the day :)
Successfully initialized M25P SPI
m25p_initialize: dev: 0x2005b970
m25p_readid: priv: 0x2005b990
m25p_readid: manufacturer: 20 memory: ba capacity: 19
m25p_initialize: Return 0x2005b990
Successfully bound SPI0 CS1 to the SPI FLASH driver
m25p_ioctl: cmd: 1537
m25p_ioctl: blocksize: 256 erasesize: 4096 neraseblocks: 8192
m25p_ioctl: return 0
m25p_bread: startblock: 00000000 nblocks: 1
m25p_read: offset: 00000000 nbytes: 256
m25p_waitwritecomplete: Complete
m25p_read: return nbytes: 256
nxffs_nextentry: No entry found
nxffs_limits: No inodes found
nxffs_limits: Free FLASH region begins at offset: 5
nxffs_limits: First inode at offset 5
Succesfully initialised NXFSS
nx_mount: ERROR: Failed to find block driver (null)
Failed to mount the NXFSS volume -15
I believe the block driver would be "/dev/M25P" (M25P, for example) but
there is no code I have found that specifies the block driver location. I
have:
ret = nxfss_initialize(mtd);
then
ret = nx_mount("NULL, "/mnt/M25P", 0, NUL);
and that seems to be in common with other "bringup" code; using NULL rather
than "/dev/something".
Just need the last piece of this jigsaw if anyone could be so kind :)