Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D94C5C433FE for ; Thu, 13 Oct 2022 12:34:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F00384F61; Thu, 13 Oct 2022 14:31:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CX9Y0o7E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 762CF84F1A; Thu, 13 Oct 2022 14:30:50 +0200 (CEST) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CA5D284F41 for ; Thu, 13 Oct 2022 14:30:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id l127so1156020iof.12 for ; Thu, 13 Oct 2022 05:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AbYAWRA/q4q/iSs3iukdzqYFhmr1MBccVOjvT8rjmt0=; b=CX9Y0o7EkLSqbTdrmZv2C7g60B2zc2jvsto38pZDTVQc5Oi4piG2zf2I0QNQzscCg6 A3ubTGe2TvsQKC+Yb84cOWB+6o87iHfEJ2N01UoieI19c60B2FBcXuDumoixn7xELKTl Xd2RQSIsD09LvbmAnIDEl4B+yNyUaawVlsr7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AbYAWRA/q4q/iSs3iukdzqYFhmr1MBccVOjvT8rjmt0=; b=iiCGWE3sQmqlwhlLs0dW+aToWa9ILp5DzlrFiym1JjcQRlIn7fyo+9gjcQDwAw3mC9 CwGVROOKEGWgxMcz3KOi8+W3d9QGnVHlX6bbs7rNPtEXWEKm0XBV1mCTdLh+jFmhdqGp +Gew/TDLG4cqXPeCrkmDBiM9l+N/PrhyQWz2HIDKSxkUp1w6GEHrbpwlcK2XetM+uKL1 rJfO9DNMg7cJbJAo0UBOQP2d1wWiHD4E5aavJ/JUf+XQ+BsKweFzRBsabLUHe2DSkszM T+qtWEdCHdoGGINJugh8wAjXPtZd8nWXZnGArrmdOY2UWwIKvJfbSP79g0WOtvnl7u+3 qFiw== X-Gm-Message-State: ACrzQf0Gj4b62jOgyEGO5RaOddSmVOdv4/eXVbZ2moNyvJdW17TrVqJG d5aMiFQsyD1Eqd5HUX4xofGXz/7xYFXa6w== X-Google-Smtp-Source: AMsMyM6ozQDD3B32aEOOYUnSWTGDsuaCAZX8oaDm9E7b0Ptq9HI/YZwFfwHVqkfuR6d6oXLCrHyunQ== X-Received: by 2002:a05:6638:d4e:b0:363:9941:a10 with SMTP id d14-20020a0566380d4e00b0036399410a10mr17039753jak.146.1665664230666; Thu, 13 Oct 2022 05:30:30 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id a9-20020a027a09000000b003635ab4a7b7sm7321626jac.3.2022.10.13.05.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 05:30:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Jaehoon Chung , Marek Vasut , Pavel Herrmann , Peng Fan Subject: [PATCH v2 22/45] dm: mmc: Allow sandbox emulator to build without writes Date: Thu, 13 Oct 2022 06:29:04 -0600 Message-Id: <20221013122927.636867-23-sjg@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221013122927.636867-1-sjg@chromium.org> References: <20221013122927.636867-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 --- (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