- Fix an issue with fsl_esdhc_imx - Consider GP partitions in "mmc hwpartition user enh start -"
This commit is contained in:
22
cmd/mmc.c
22
cmd/mmc.c
@@ -597,7 +597,7 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
|
|||||||
struct mmc_hwpart_conf *pconf,
|
struct mmc_hwpart_conf *pconf,
|
||||||
char *argv)
|
char *argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int i, ret;
|
||||||
|
|
||||||
pconf->user.enh_size = 0;
|
pconf->user.enh_size = 0;
|
||||||
|
|
||||||
@@ -606,7 +606,7 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
|
|||||||
ret = mmc_send_ext_csd(mmc, ext_csd);
|
ret = mmc_send_ext_csd(mmc, ext_csd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return;
|
return;
|
||||||
/* This value is in 512B block units */
|
/* The enh_size value is in 512B block units */
|
||||||
pconf->user.enh_size =
|
pconf->user.enh_size =
|
||||||
((ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 2] << 16) +
|
((ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 2] << 16) +
|
||||||
(ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 1] << 8) +
|
(ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 1] << 8) +
|
||||||
@@ -614,6 +614,24 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
|
|||||||
ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
|
ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
|
||||||
ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
|
ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
|
||||||
pconf->user.enh_size -= pconf->user.enh_start;
|
pconf->user.enh_size -= pconf->user.enh_start;
|
||||||
|
for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) {
|
||||||
|
/*
|
||||||
|
* If the eMMC already has GP partitions set,
|
||||||
|
* subtract their size from the maximum USER
|
||||||
|
* partition size.
|
||||||
|
*
|
||||||
|
* Else, if the command was used to configure new
|
||||||
|
* GP partitions, subtract their size from maximum
|
||||||
|
* USER partition size.
|
||||||
|
*/
|
||||||
|
if (mmc->capacity_gp[i]) {
|
||||||
|
/* The capacity_gp is in 1B units */
|
||||||
|
pconf->user.enh_size -= mmc->capacity_gp[i] >> 9;
|
||||||
|
} else if (pconf->gp_part[i].size) {
|
||||||
|
/* The gp_part[].size is in 512B units */
|
||||||
|
pconf->user.enh_size -= pconf->gp_part[i].size;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pconf->user.enh_size = dectoul(argv, NULL);
|
pconf->user.enh_size = dectoul(argv, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -336,9 +336,8 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SYS_FSL_ESDHC_USE_PIO))
|
esdhc_setup_watermark_level(priv, data);
|
||||||
esdhc_setup_watermark_level(priv, data);
|
if (!IS_ENABLED(CONFIG_SYS_FSL_ESDHC_USE_PIO))
|
||||||
else
|
|
||||||
esdhc_setup_dma(priv, data);
|
esdhc_setup_dma(priv, data);
|
||||||
|
|
||||||
/* Calculate the timeout period for data transactions */
|
/* Calculate the timeout period for data transactions */
|
||||||
|
Reference in New Issue
Block a user