From patchwork Tue Jul 2 09:20:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 809089 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp118096wru; Tue, 2 Jul 2024 02:28:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpmN/WnqKt0ytgCo1de/+dElN6zQYfevTMS9Ome4wZqvRacfcYSlq4Gebpf6aO58BkyrLK12ipp+GaiqEVmV0s X-Google-Smtp-Source: AGHT+IEE5iqP9i8YFN+q9FNYPlt86rW3U3RJGOLorg9HPKTn08X9LZcYr3wBMsJ6DKOszMazlkba X-Received: by 2002:a05:620a:3bcb:b0:79b:a8df:7829 with SMTP id af79cd13be357-79d6ba4cccamr1615531785a.14.1719912510953; Tue, 02 Jul 2024 02:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719912510; cv=none; d=google.com; s=arc-20160816; b=Oo0mO77T6gwwhIr7c3QJRd41jHEhzdxsDtNpBGcqw+0i2udmkWuEuTiF8TtkSDhrhQ fXpjzTuPmAr8TtXHaqT3fzIE5a21xT1UWBEvOSlccl4bsRBsswsVE6SDKUiwWxtp/dnP DfZc4uiMOCv9VbXcngHQ7BoK2yiMy/sJ38MzCuFrY8wtzfa9cMNqyS7FCgrE6gRDdcvO Nudqe8XE5+8WgTZCEf4WLni++EGdG+2NJ/XPZLjQcsJRUxGjtkBle7oHD1JzOTFtqVGF uI1cjnIfeM33JR1YfSJNhnyk0hZcEusfmccNuGAeC52YAIllDIp/uDq1sIeDEXCtarnr cFJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PRpXZ/lTgoptLk88HU8T9HvMCsCj/dqSxIEhw3vh1zM=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=WQgIOlVznG5+g5vCFJnoalWqBzjBUKJgnRYK54t5yfy9UG+R6Ch7YhoFrgX0zoPBC6 Cce6AL/kKY/kk0sOKHL0gAvmrl4nkaLNpQbBw2t0t3S5jULUr7WzJ2Tda4LafRn4K2RC UY9mzAB4doNkV/vR1SFxYbwPG4W3Fochy0ottp0MuuNrbMuYf6IxTEdKEJIF4x1zrjJ0 dR/g0LDWqJwLhCEqLxei0izikvZrK6da1H/AAgdZZ3VZX3U1aablcD4vLLh/AII9oR6c WmdffD8tXmQA0PygoIt9R8jJ2AICarn7k0YqQbs8e08MBmJg2RM7z/uiMVuByboKM2Aq QW3A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lswc24F0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d69260c43si963088485a.34.2024.07.02.02.28.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 02:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lswc24F0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOZnE-0003tx-Ak; Tue, 02 Jul 2024 05:27:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOZn8-0003de-3y for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:27:14 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOZn6-0001bf-Bc for qemu-devel@nongnu.org; Tue, 02 Jul 2024 05:27:13 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3636c572257so2884571f8f.0 for ; Tue, 02 Jul 2024 02:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719912430; x=1720517230; darn=nongnu.org; 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=PRpXZ/lTgoptLk88HU8T9HvMCsCj/dqSxIEhw3vh1zM=; b=lswc24F04AUHre/zz29IdQAuPV8CngBhD2htQO6DLp7AS1uRHpZ85S5lLKrx/o7KC2 0T2z6BigeoMCxRScna7wPad7LlAfHaQwStHQjpklPtTIfK6ee+N+o900qFwvS11Q8dBm vDZphwwlbR+KEke7/riD1CdbSGTf6Q7Dps6/nvvfOFoX3eWZ2GuPjxMLsPbwL0zfryKm ynLzAE37DSjk4o+As1rSz++J8xyQkJaoUahVTclZ1ROUs3ISA+cMtUYtXeRvlnV1180/ 9nu4oigWtxi68Ad7u1XbgO8W1MZrrvgIppnLZeNmr6z8TH583ORMOGgtQRUnX4iqwERo Ir9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719912430; x=1720517230; 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=PRpXZ/lTgoptLk88HU8T9HvMCsCj/dqSxIEhw3vh1zM=; b=N4ODmxOmdL0ruQNaVva3gTTjDdZOjZ+ui1qkHUVuGVGo/2NqfA5FPY7beQ4a3TXIdJ POLqzJ557SBdIx9rN0jBQTt93qnjpMHciiZiTQpX+7hwpIpzTdGKP1CoW6Oa3EZzeEZA YLBONXmcMtoN0CVn9E2nqi9AKQTKekV5Gq2pQcaooUVYDc1WZ1ui6Ma2sDkdmaS6aQFC WpDXxlihWWIRdAN91sgyevSQaDZlncs1JvXoMwPOl/8JBSIEWs3bqijHxSOo7YbzgF3e iCihcD7eUpykAEtZhHFFZsS2s/147mPQPvA8cYLGRl9g+I/D9VScEF1N7dcTIeXAgU7S 68kQ== X-Gm-Message-State: AOJu0YwSnS7nWN1GSIYfIlGz9R170VJBOyo0N7e5CMey1yNyrE+Yt4Fu T6Yv90sWg1GVCHWOzPmb2AMicZYeok5m4QrKl9kTkyCHE/oEzP7Y26KKb5fzNz2qgrUzsk9/drG m X-Received: by 2002:a5d:6d04:0:b0:367:4dce:1ff4 with SMTP id ffacd0b85a97d-36775699516mr6639342f8f.14.1719912430016; Tue, 02 Jul 2024 02:27:10 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.58]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fc412sm12724646f8f.70.2024.07.02.02.27.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jul 2024 02:27:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 64/67] hw/sd/sdcard: Add sd_acmd_SET_WR_BLK_ERASE_COUNT handler (ACMD23) Date: Tue, 2 Jul 2024 11:20:47 +0200 Message-ID: <20240702092051.45754-65-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240702092051.45754-1-philmd@linaro.org> References: <20240702092051.45754-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Message-Id: <20240628070216.92609-72-philmd@linaro.org> --- hw/sd/sd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 6e9ab92a1a..c56790f091 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -261,7 +261,6 @@ static const char *sd_acmd_name(SDState *sd, uint8_t cmd) [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", - [23] = "SET_WR_BLK_ERASE_COUNT", [42] = "SET_CLR_CARD_DETECT", [51] = "SEND_SCR", [52] = "SECU_spec", [53] = "SECU_spec", @@ -1677,6 +1676,15 @@ static sd_rsp_type_t sd_acmd_SEND_NUM_WR_BLOCKS(SDState *sd, SDRequest req) &sd->blk_written, sizeof(sd->blk_written)); } +/* ACMD23 */ +static sd_rsp_type_t sd_acmd_SET_WR_BLK_ERASE_COUNT(SDState *sd, SDRequest req) +{ + if (sd->state != sd_transfer_state) { + return sd_invalid_state_for_cmd(sd, req); + } + return sd_r1; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1801,16 +1809,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } switch (req.cmd) { - case 23: /* ACMD23: SET_WR_BLK_ERASE_COUNT */ - switch (sd->state) { - case sd_transfer_state: - return sd_r1; - - default: - break; - } - break; - case 41: /* ACMD41: SD_APP_OP_COND */ if (sd->state != sd_idle_state) { break; @@ -2326,6 +2324,7 @@ static const SDProto sd_proto_spi = { .acmd = { [13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_spi, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, + [23] = {8, sd_spi, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2384,6 +2383,7 @@ static const SDProto sd_proto_sd = { [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, [22] = {8, sd_adtc, "SEND_NUM_WR_BLOCKS", sd_acmd_SEND_NUM_WR_BLOCKS}, + [23] = {8, sd_ac, "SET_WR_BLK_ERASE_COUNT", sd_acmd_SET_WR_BLK_ERASE_COUNT}, }, };