diff options
author | Ye Li <ye.li@nxp.com> | 2019-07-22 18:23:05 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:36:20 -0700 |
commit | 712e7746fb8d111f504d80f1d3464c64a144dc9d (patch) | |
tree | adcbb4f202c9420dea9fe4fbdb551e085336f480 /env | |
parent | 7d202309cf64cb6a383f0009c9422f20065f9c5d (diff) |
MLK-22293-5 env: Update SATA env location driver to use SCSI
When DM SCSI is enabled with AHCI, use SCSI device to replace SATA
device to access the peripheral.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 097bf5dcf79a3fc461c3e27102113cac7372afcf)
Diffstat (limited to 'env')
-rw-r--r-- | env/sata.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/env/sata.c b/env/sata.c index cb52322891..0349862f53 100644 --- a/env/sata.c +++ b/env/sata.c @@ -15,6 +15,9 @@ #include <memalign.h> #include <sata.h> #include <search.h> +#ifdef CONFIG_DM_SCSI +#include <scsi.h> +#endif #if defined(CONFIG_ENV_OFFSET_REDUND) #error ENV REDUND not supported @@ -49,12 +52,19 @@ static int env_sata_save(void) struct blk_desc *sata = NULL; int env_sata, ret; +#ifndef CONFIG_DM_SCSI if (sata_initialize()) return 1; env_sata = sata_get_env_dev(); sata = sata_get_dev(env_sata); +#else + scsi_scan(false); + env_sata = sata_get_env_dev(); + + sata = blk_get_dev("scsi", env_sata); +#endif if (sata == NULL) { printf("Unknown SATA(%d) device for environment!\n", env_sata); @@ -95,12 +105,20 @@ static int env_sata_load(void) struct blk_desc *sata = NULL; int env_sata; +#ifndef CONFIG_DM_SCSI if (sata_initialize()) return -EIO; env_sata = sata_get_env_dev(); sata = sata_get_dev(env_sata); +#else + scsi_scan(false); + env_sata = sata_get_env_dev(); + + sata = blk_get_dev("scsi", env_sata); +#endif + if (sata == NULL) { printf("Unknown SATA(%d) device for environment!\n", env_sata); return -EIO; |