Hi,
MK40 DSPI module could works as SPI slave, after receive the data from SPI bus, it could trigger a DMA transfer to move data to internal memory.
Customer can move data to the internal RAM. Then customer can program related data from RAM to internal Flash memory.
Please check attached two example codes about how to use DSPI module with DMA and another example shows how to emulate Flash memory as EEPROM.
Wish it helps.