一、入口:
spl_spi_load_image()->
spi_flash_probe();
spi_flash_read(flash, header); //获取image头信息
spi_parse_image_header();
spi_flash_read(flash, image.size); //获取image的数据
二、spi_flash probe过程:
spi_flash_probe_slave() ->
1、spi_flash_cmd(spi, CMD_READ_ID, idcode); 首先获取SPI_FLASH ID;
2、spi_flash_validate_params(spi, idcode);
jedec = idcode[1] << 8 | idcode[2];
ext_jedec = idcode[3] << 8 | idcode[4];
从全局参数列表spi_flash_params_table[]中匹配jedec和ext_jedec;
flash->read_cmd = //
这里根据RD_FULL匹配QUAD_FAST(4线模式);
DU_FULL匹配DU_FAST(2线模式);
普通(1线模式);
flash->write_cmd = 同上。
spi_flash_set_qeb(); 设置spi-flash的qeb标识,标识启动FAST传输模式。