I have an AM3517 board that uses an external at25d041a on the SPI bus. The unique thing is the flash device will not be present at boot time, so I must figure out how to mount it at runtime.
Right now I have the board configured in my board file in the traditional way. (As a platform device using the m25p80.c driver). If the device is connected at boot time, the m25p80 driver successfully identifies the chip as an "at25df041a" and I can mount/read/write etc. However, if the device is not connected at boot time, the mtdblock0 device still gets created but the m25p80 driver fails to auto detect the chip and configures it to be a "m25p05-nonjedec" with only 64Kbytes of space. If I plug the spi flash in at this time, the spi bus obviously will not re-probe the bus so it stays configured as m25p05-nonjedec and I cannot read/write. I need to find a way to force this to be identified as an "at25df041a" at run time.
By the way, I have a gpio that I can read to detect if the flash has been inserted or not...
I can think of 2 ways to go about this, neither of which I have been able to figure out how to do:
1) Somehow turn off jedec auto-detection in the m25p80 driver. If I can force it to always configure the spi device as at25df041a regardless of hardware presence, this would be the easiest solution. Is there a way to disable auto detection (jedec) in the board file for my device?
2) Compile the m25p80 (or some other driver) as a module and insmod / rmmod when I detect the device getting inserted and removed via my gpio. This way, the driver would run it's probe procedure and auto detect the chip correctly. However, I have not been able to figure out how to configure an m25p80 device as a module driver. Can this be done?
I apologize for the wall of text. Thanks in advance.
Sean