Commit 097bf5dcf79a3fc461c3e27102113cac7372afcf

Authored by Ye Li
1 parent 764cc673d3

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>

Showing 1 changed file with 18 additions and 0 deletions Side-by-side Diff

... ... @@ -14,6 +14,9 @@
14 14 #include <memalign.h>
15 15 #include <sata.h>
16 16 #include <search.h>
  17 +#ifdef CONFIG_DM_SCSI
  18 +#include <scsi.h>
  19 +#endif
17 20  
18 21 #if defined(CONFIG_ENV_SIZE_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND)
19 22 #error ENV REDUND not supported
20 23  
... ... @@ -48,12 +51,19 @@
48 51 struct blk_desc *sata = NULL;
49 52 int env_sata, ret;
50 53  
  54 +#ifndef CONFIG_DM_SCSI
51 55 if (sata_initialize())
52 56 return 1;
53 57  
54 58 env_sata = sata_get_env_dev();
55 59  
56 60 sata = sata_get_dev(env_sata);
  61 +#else
  62 + scsi_scan(false);
  63 + env_sata = sata_get_env_dev();
  64 +
  65 + sata = blk_get_dev("scsi", env_sata);
  66 +#endif
57 67 if (sata == NULL) {
58 68 printf("Unknown SATA(%d) device for environment!\n",
59 69 env_sata);
60 70  
... ... @@ -94,12 +104,20 @@
94 104 struct blk_desc *sata = NULL;
95 105 int env_sata;
96 106  
  107 +#ifndef CONFIG_DM_SCSI
97 108 if (sata_initialize())
98 109 return -EIO;
99 110  
100 111 env_sata = sata_get_env_dev();
101 112  
102 113 sata = sata_get_dev(env_sata);
  114 +#else
  115 + scsi_scan(false);
  116 + env_sata = sata_get_env_dev();
  117 +
  118 + sata = blk_get_dev("scsi", env_sata);
  119 +#endif
  120 +
103 121 if (sata == NULL) {
104 122 printf("Unknown SATA(%d) device for environment!\n", env_sata);
105 123 return -EIO;