[PATCH v2 22/45] dm: mmc: Allow sandbox emulator to build without writes
정재훈
jh80.chung at samsung.com
Mon Oct 17 07:51:19 CEST 2022
> -----Original Message-----
> From: Simon Glass [mailto:sjg at chromium.org]
> Sent: Thursday, October 13, 2022 9:29 PM
> To: U-Boot Mailing List <u-boot at lists.denx.de>
> Cc: Tom Rini <trini at konsulko.com>; Simon Glass <sjg at chromium.org>; Jaehoon Chung
> <jh80.chung at samsung.com>; Marek Vasut <marex at denx.de>; Pavel Herrmann <morpheus.ibis at gmail.com>;
> Peng Fan <peng.fan at nxp.com>
> Subject: [PATCH v2 22/45] dm: mmc: Allow sandbox emulator to build without writes
>
> When MMC_WRITE is disabled this driver produced a build error. Fix this.
>
> Also update a comment while we are here.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>
Best Regards,
Jaehoon Chung
> ---
>
> (no changes since v1)
>
> drivers/mmc/sandbox_mmc.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
> index 451fe4a4e5a..ba79a5565c3 100644
> --- a/drivers/mmc/sandbox_mmc.c
> +++ b/drivers/mmc/sandbox_mmc.c
> @@ -23,6 +23,8 @@ struct sandbox_mmc_plat {
> #define MMC_CMULT 8 /* 8 because the card is high-capacity */
> #define MMC_BL_LEN_SHIFT 10
> #define MMC_BL_LEN BIT(MMC_BL_LEN_SHIFT)
> +
> +/* Granularity of priv->csize - this is 1MB */
> #define SIZE_MULTIPLE ((1 << (MMC_CMULT + 2)) * MMC_BL_LEN)
>
> struct sandbox_mmc_priv {
> @@ -41,7 +43,6 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
> struct mmc_data *data)
> {
> struct sandbox_mmc_priv *priv = dev_get_priv(dev);
> - struct mmc *mmc = mmc_get_mmc_dev(dev);
> static ulong erase_start, erase_end;
>
> switch (cmd->cmdidx) {
> @@ -95,10 +96,15 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
> case SD_CMD_ERASE_WR_BLK_END:
> erase_end = cmd->cmdarg;
> break;
> - case MMC_CMD_ERASE:
> +#if CONFIG_IS_ENABLED(MMC_WRITE)
> + case MMC_CMD_ERASE: {
> + struct mmc *mmc = mmc_get_mmc_dev(dev);
> +
> memset(&priv->buf[erase_start * mmc->write_bl_len], '\0',
> (erase_end - erase_start + 1) * mmc->write_bl_len);
> break;
> + }
> +#endif
> case SD_CMD_APP_SEND_OP_COND:
> cmd->response[0] = OCR_BUSY | OCR_HCS;
> cmd->response[1] = 0;
> --
> 2.38.0.rc1.362.ged0d419d3c-goog
More information about the U-Boot
mailing list