Skip to content
Snippets Groups Projects
Commit 77b571da authored by Qianyu Gong's avatar Qianyu Gong Committed by York Sun
Browse files

net: fm: fix spi flash probe for using driver model


The current code would always use the speed and mode set by
CONFIG_ENV_SPI_MAX_HZ and CONFIG_ENV_SPI_MODE. But if using
SPI driver model it should get the values from DT.

Signed-off-by: default avatarGong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: default avatarJagan Teki <jteki@openedev.com>
Reviewed-by: default avatarJoe Hershberger <joe.hershberger@ni.com>
Reviewed-by: default avatarYork Sun <york.sun@nxp.com>
parent 8cbb389b
No related branches found
No related tags found
No related merge requests found
......@@ -368,8 +368,18 @@ int fm_init_common(int index, struct ccsr_fman *reg)
void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
int ret = 0;
#ifdef CONFIG_DM_SPI_FLASH
struct udevice *new;
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
0, 0, &new);
ucode_flash = dev_get_uclass_priv(new);
#else
ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
#endif
if (!ucode_flash)
printf("SF: probe for ucode failed\n");
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment