bdk: emmc: utilize emmc_end

This commit is contained in:
CTCaer 2022-10-11 04:12:04 +03:00
parent 8bbe403e41
commit 07695196cb
2 changed files with 14 additions and 11 deletions

View file

@ -61,6 +61,8 @@ u32 emmc_get_mode()
return emmc_mode; return emmc_mode;
} }
void emmc_end() { sdmmc_storage_end(&emmc_storage); }
int emmc_init_retry(bool power_cycle) int emmc_init_retry(bool power_cycle)
{ {
u32 bus_width = SDMMC_BUS_WIDTH_8; u32 bus_width = SDMMC_BUS_WIDTH_8;
@ -70,7 +72,7 @@ int emmc_init_retry(bool power_cycle)
if (power_cycle) if (power_cycle)
{ {
emmc_mode--; emmc_mode--;
sdmmc_storage_end(&emmc_storage); emmc_end();
} }
// Get init parameters. // Get init parameters.
@ -105,7 +107,7 @@ bool emmc_initialize(bool power_cycle)
emmc_mode = EMMC_MMC_HS400; emmc_mode = EMMC_MMC_HS400;
if (power_cycle) if (power_cycle)
sdmmc_storage_end(&emmc_storage); emmc_end();
int res = !emmc_init_retry(false); int res = !emmc_init_retry(false);
@ -124,7 +126,7 @@ bool emmc_initialize(bool power_cycle)
} }
} }
sdmmc_storage_end(&emmc_storage); emmc_end();
return false; return false;
} }

View file

@ -30,18 +30,18 @@
enum enum
{ {
EMMC_INIT_FAIL = 0, EMMC_INIT_FAIL = 0,
EMMC_1BIT_HS52 = 1, EMMC_1BIT_HS52 = 1,
EMMC_8BIT_HS52 = 2, EMMC_8BIT_HS52 = 2,
EMMC_MMC_HS200 = 3, EMMC_MMC_HS200 = 3,
EMMC_MMC_HS400 = 4, EMMC_MMC_HS400 = 4,
}; };
enum enum
{ {
EMMC_ERROR_INIT_FAIL = 0, EMMC_ERROR_INIT_FAIL = 0,
EMMC_ERROR_RW_FAIL = 1, EMMC_ERROR_RW_FAIL = 1,
EMMC_ERROR_RW_RETRY = 2 EMMC_ERROR_RW_RETRY = 2
}; };
typedef struct _emmc_part_t typedef struct _emmc_part_t
@ -63,6 +63,7 @@ u16 *emmc_get_error_count();
u32 emmc_get_mode(); u32 emmc_get_mode();
int emmc_init_retry(bool power_cycle); int emmc_init_retry(bool power_cycle);
bool emmc_initialize(bool power_cycle); bool emmc_initialize(bool power_cycle);
void emmc_end();
void emmc_gpt_parse(link_t *gpt); void emmc_gpt_parse(link_t *gpt);
void emmc_gpt_free(link_t *gpt); void emmc_gpt_free(link_t *gpt);