Commit 712e7746fb8d111f504d80f1d3464c64a144dc9d
1 parent
7d202309cf
Exists in
smarc_8mq-imx_v2020.04_5.4.24_2.1.0
and in
3 other branches
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)
Showing 1 changed file with 18 additions and 0 deletions Side-by-side Diff
env/sata.c
... | ... | @@ -15,6 +15,9 @@ |
15 | 15 | #include <memalign.h> |
16 | 16 | #include <sata.h> |
17 | 17 | #include <search.h> |
18 | +#ifdef CONFIG_DM_SCSI | |
19 | +#include <scsi.h> | |
20 | +#endif | |
18 | 21 | |
19 | 22 | #if defined(CONFIG_ENV_OFFSET_REDUND) |
20 | 23 | #error ENV REDUND not supported |
21 | 24 | |
... | ... | @@ -49,12 +52,19 @@ |
49 | 52 | struct blk_desc *sata = NULL; |
50 | 53 | int env_sata, ret; |
51 | 54 | |
55 | +#ifndef CONFIG_DM_SCSI | |
52 | 56 | if (sata_initialize()) |
53 | 57 | return 1; |
54 | 58 | |
55 | 59 | env_sata = sata_get_env_dev(); |
56 | 60 | |
57 | 61 | sata = sata_get_dev(env_sata); |
62 | +#else | |
63 | + scsi_scan(false); | |
64 | + env_sata = sata_get_env_dev(); | |
65 | + | |
66 | + sata = blk_get_dev("scsi", env_sata); | |
67 | +#endif | |
58 | 68 | if (sata == NULL) { |
59 | 69 | printf("Unknown SATA(%d) device for environment!\n", |
60 | 70 | env_sata); |
61 | 71 | |
... | ... | @@ -95,12 +105,20 @@ |
95 | 105 | struct blk_desc *sata = NULL; |
96 | 106 | int env_sata; |
97 | 107 | |
108 | +#ifndef CONFIG_DM_SCSI | |
98 | 109 | if (sata_initialize()) |
99 | 110 | return -EIO; |
100 | 111 | |
101 | 112 | env_sata = sata_get_env_dev(); |
102 | 113 | |
103 | 114 | sata = sata_get_dev(env_sata); |
115 | +#else | |
116 | + scsi_scan(false); | |
117 | + env_sata = sata_get_env_dev(); | |
118 | + | |
119 | + sata = blk_get_dev("scsi", env_sata); | |
120 | +#endif | |
121 | + | |
104 | 122 | if (sata == NULL) { |
105 | 123 | printf("Unknown SATA(%d) device for environment!\n", env_sata); |
106 | 124 | return -EIO; |