diff options
author | Qianyu Gong <qianyu.gong@nxp.com> | 2016-08-03 11:04:25 +0800 |
---|---|---|
committer | York Sun <york.sun@nxp.com> | 2016-09-14 14:04:56 -0700 |
commit | 77b571da3b2c2fd46d6a80e4e045f3aae392d979 (patch) | |
tree | 9606b1a8eafd775c4b648abc024007ddeccd186b /drivers | |
parent | 8cbb389bb3da80cbf8911f8386cbff92c6a78afe (diff) | |
download | u-boot-77b571da3b2c2fd46d6a80e4e045f3aae392d979.tar.gz |
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: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fm/fm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 5eb773e587..17a088602b 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -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 { |