Emulating QSPI NOR Flash in QEMU

292 Views Asked by At

I am trying to emulator a QSPI NOR Flash from TI in QEMU. I have create a m25p80 flash device and a basic QSPI controller to control the serial flash. I already wrote successfully to the nor flash via the ssi_transfer function. But I did not see any function such as ssi_receive to read data from the serial flash. Tracing while running U-Boot, I could send the read JEDEC_ID command but I do not know how to get the return information. Below is my tracing log:

m25p80_binding [0x55b60bf28000] Binding to IF_MTD drive
m25p80_reset_done [0x55b60bf28000] Reset done.
m25p80_transfer [0x55b60bf28000] Transfer state 0x0 len 0x0 needed 0x0 pos 0x0 addr 0x0 tx 0x0
m25p80_command_decoded [0x55b60bf28000] new command:0x0
m25p80_transfer [0x55b60bf28000] Transfer state 0x0 len 0x0 needed 0x0 pos 0x0 addr 0x0 tx 0x0
m25p80_command_decoded [0x55b60bf28000] new command:0x0
m25p80_transfer [0x55b60bf28000] Transfer state 0x0 len 0x0 needed 0x0 pos 0x0 addr 0x0 tx 0x0
m25p80_command_decoded [0x55b60bf28000] new command:0x0
m25p80_transfer [0x55b60bf28000] Transfer state 0x0 len 0x0 needed 0x0 pos 0x0 addr 0x0 tx 0x0
m25p80_command_decoded [0x55b60bf28000] new command:0x0
m25p80_transfer [0x55b60bf28000] Transfer state 0x0 len 0x0 needed 0x0 pos 0x0 addr 0x0 tx 0x9f
m25p80_command_decoded [0x55b60bf28000] new command:0x9f
m25p80_populated_jedec [0x55b60bf28000] populated jedec code
m25p80_transfer [0x55b60bf28000] Transfer state 0x5 len 0x6 needed 0x0 pos 0x0 addr 0x0 tx 0x0
m25p80_read_data [0x55b60bf28000] Read data 0x0=0x20
m25p80_transfer [0x55b60bf28000] Transfer state 0x5 len 0x6 needed 0x0 pos 0x1 addr 0x0 tx 0x0
m25p80_read_data [0x55b60bf28000] Read data 0x1=0xbb
m25p80_transfer [0x55b60bf28000] Transfer state 0x5 len 0x6 needed 0x0 pos 0x2 addr 0x0 tx 0x0
m25p80_read_data [0x55b60bf28000] Read data 0x2=0x19

You can see the value from m25p80 is JEDEC_ID of n25q256a11.I desire to get the return value and then store to some register for U-Boot processing. Could you please suggest some idea or documentation to understand and implement the ssi bus and serial flash in QEMU.

0

There are 0 best solutions below