From patchwork Fri Sep 1 09:42:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 719508 Delivered-To: patch@linaro.org Received: by 2002:adf:d08b:0:b0:31d:da82:a3b4 with SMTP id y11csp141968wrh; Fri, 1 Sep 2023 02:45:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKdwRwsWhsKMsGxC9NdbAGQUPTRQ2bUhUVjR+mibi03s1skALtu5zuIf/V3xDI223dRGId X-Received: by 2002:a05:620a:88a:b0:76f:20df:f032 with SMTP id b10-20020a05620a088a00b0076f20dff032mr1801199qka.69.1693561549376; Fri, 01 Sep 2023 02:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693561549; cv=none; d=google.com; s=arc-20160816; b=tFdBsv1VMsEXGZsZmDaBYWTPRpaMa7W7Y/v67Ts1107ixorP4y8f7M/+KgrHcPxYJN Txel0ZSjlKXD2jjxx2X1ecihanWTC1IEsOX8kWgKaKpr2EEp7eoDzwkmmFVzaUC97nwl gWOWbnMMtcAzEXldT16d+WfGfEhhCFUeK5nRW3qMEj9F2NfFF9817z4ZA9LApRVmBYVA sQjIySwngZvYbF8S0AeoF3Nd1JkoSx6lJrKMnYHd2Nb+HHaR/u8+7S4gvQFim8fBiw3w eBIh2nSQMMg3iM15uRGg1EDoXhCj1+PrTzN82Wjw5DsfgPIlsVNXzDB+VafI16ZfKj4M 2qPw== 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; bh=xGJE5HZteIMYGPvh2ElraRI9/2W5TopZRK40cQYCvkM=; fh=0FldW4XPCIVeBr3v546UBzvfCk0aVDrArGpyFJOOCns=; b=g8ZJCr1nQq/vpE0CAhNGsmsymZMpOr6R2yZiaKhBYjDE8K3Pmnspepl+XhayYTNItf GyDop2f4SrAuLys38v+2WZlgMfrmDcD0+31vCVupm5oD0Lkk4edq5upGp/CBmRpPD7FX zrKtkOWN37zGqsOMB81KrnfNEtQNdTcc/tYZ+bDPpTJOuR0YRXc60uFHDmhsnDqWLasg kx2EgCg95rTc4F14Cls5orP4ctJMp7c5pg4yVy5E6ihhpTnl/n+Ussa4QFP9Ec8S3TPk Ed/MBuh0g6YUrpnwelDdrqiOg1qNXe+SqTwrsE72I1YUV/ysMQrR8P8Kbo4KTVAFB9MP lNXA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z14-20020a0cda8e000000b0064f43bcd73fsi2131874qvj.402.2023.09.01.02.45.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2023 02:45:49 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qc0gM-0002es-5x; Fri, 01 Sep 2023 05:43:14 -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 1qc0gJ-0002aw-Sw; Fri, 01 Sep 2023 05:43:11 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qc0gH-00039v-Jk; Fri, 01 Sep 2023 05:43:11 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4RcY4D4WN8z4wxW; Fri, 1 Sep 2023 19:43:08 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4RcY4C0sJpz4wy6; Fri, 1 Sep 2023 19:43:06 +1000 (AEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-arm@nongnu.org, 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 21/26] hw/sd: Add sd_cmd_SEND_OP_CMD() handler Date: Fri, 1 Sep 2023 11:42:09 +0200 Message-ID: <20230901094214.296918-22-clg@kaod.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230901094214.296918-1-clg@kaod.org> References: <20230901094214.296918-1-clg@kaod.org> MIME-Version: 1.0 Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=SnXb=ER=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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 From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé [ clg: Update cmd_abbrev ] Message-Id: <20210624142209.1193073-9-f4bug@amsat.org> Signed-off-by: Cédric Le Goater --- hw/sd/sd.c | 18 +++++++++--------- hw/sd/sdmmc-internal.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 535b72ff5c2a..bd67c50894fe 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1030,6 +1030,13 @@ static sd_rsp_type_t sd_cmd_GO_IDLE_STATE(SDState *sd, SDRequest req) return sd->spi ? sd_r1 : sd_r0; } +static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd, SDRequest req) +{ + sd->state = sd_transfer_state; + + return sd_r1; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; @@ -1069,10 +1076,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ - case 1: /* CMD1: SEND_OP_CMD */ - sd->state = sd_transfer_state; - return sd_r1; - case 2: /* CMD2: ALL_SEND_CID */ switch (sd->state) { case sd_ready_state: @@ -1622,11 +1625,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, break; case 41: /* ACMD41: SD_APP_OP_COND */ - if (sd->spi) { - /* SEND_OP_CMD */ - sd->state = sd_transfer_state; - return sd_r1; - } if (sd->state != sd_idle_state) { break; } @@ -2131,6 +2129,7 @@ static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { [0] = sd_cmd_GO_IDLE_STATE, + [1] = sd_cmd_SEND_OP_CMD, [2 ... 4] = sd_cmd_illegal, [5] = sd_cmd_illegal, [7] = sd_cmd_illegal, @@ -2140,6 +2139,7 @@ static const SDProto sd_proto_spi = { }, .acmd = { [6] = sd_cmd_unimplemented, + [41] = sd_cmd_SEND_OP_CMD, }, }; diff --git a/hw/sd/sdmmc-internal.c b/hw/sd/sdmmc-internal.c index 2053def3f10b..8648a7808dcc 100644 --- a/hw/sd/sdmmc-internal.c +++ b/hw/sd/sdmmc-internal.c @@ -14,7 +14,7 @@ const char *sd_cmd_name(uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [0] = "GO_IDLE_STATE", + [0] = "GO_IDLE_STATE", [1] = "SEND_OP_CMD", [2] = "ALL_SEND_CID", [3] = "SEND_RELATIVE_ADDR", [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD",