From patchwork Mon Jul 3 13:24:45 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: 698671 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1749778wrs; Mon, 3 Jul 2023 06:26:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdy93GZeZ3hzUsegGOeMAVtW5YfdzIWdNsVVJUA9tLeZYNYTWHOJapB9rlgd5T5Nk8X3kP X-Received: by 2002:a05:6359:6797:b0:134:e4fe:e162 with SMTP id sq23-20020a056359679700b00134e4fee162mr5449514rwb.13.1688390807644; Mon, 03 Jul 2023 06:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688390807; cv=none; d=google.com; s=arc-20160816; b=W4yfEXCZC/SfUr/nQ1gfAiXjhFf03WYEtB1FtHJSPxxFqw/gLLcwtVKuI9HJA3pxA5 0rssEU2vXAqDZvoj2C5NQH34lQkkYceeyactplZY9tvZFBx9DMRDYt5PxVGoHP8h7rn+ Ma0Y37aPmJ+lLDeu6deEAYxP0Vk5U3zYYODMDfoWZqtXyAdwMPUuCTEakg+v+ec4QsvE Zz/s4zNFYM2P8QO7dAS7S2pF9uRjuSmAsP/PH0TKn5XcSYlrpg+HG1Wehzdmg3YSptYO o06mazUQWgBgmamM0DhPcMZ2DhlbXcosSkL++wLGygiqkjkpa+dRQY5CxrESGt43tVnW 1YLQ== 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=1TrT0PYyEK7er4Ab9GZHs8q84ATye5Z3OY6erb1zI7k=; b=U2kBwmqyxiS30qqqFFGUzUDs0YASOQLqeTjLCkZ0RPsFDTIimIqPl1sTGGjMvdrkGM AyDX6X/97o/jnkAA/hywD/y+r8B1l7AGluynllj9A5veKFiuxaXQJ6OchBkNGEp27gMo LW9kS9C+J8irffYEK+eMOMTcU4B8BdQRH1MqTRNEKAsSBsgIbPS4vtNtRoB+uwFMGKOs +5Iv8maaQHzfSqJV4SJHsuAyOh2Gk9TMlPolUtvhDWdydcjBtuhBRMCD/a8HMhlVrzTw VVQMNwyHR/vFMu+xRGDbQZtITbcyZbNPpUv1WtRZnF9q1HE+RVIpZnKsUG3Unq9DtHzF iIbA== 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 f12-20020a37ad0c000000b0075778fd36aasi9612234qkm.709.2023.07.03.06.26.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2023 06:26:47 -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 1qGJYv-0008So-7R; Mon, 03 Jul 2023 09:25:53 -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 1qGJYm-0008Rv-2p for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:45 -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 1qGJYk-0000kY-H0 for qemu-devel@nongnu.org; Mon, 03 Jul 2023 09:25:43 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Qvmrj6NgXz4wxn; Mon, 3 Jul 2023 23:25:41 +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 4Qvmrg3DHTz4wZp; Mon, 3 Jul 2023 23:25:39 +1000 (AEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng , Peter Maydell , Lucien Murray-Pitts , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH 08/32] hw/sd: Add sd_cmd_SEND_OP_CMD() handler Date: Mon, 3 Jul 2023 15:24:45 +0200 Message-ID: <20230703132509.2474225-9-clg@kaod.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703132509.2474225-1-clg@kaod.org> References: <20230703132509.2474225-1-clg@kaod.org> MIME-Version: 1.0 Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=mKPa=CV=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, T_SCC_BODY_TEXT_LINE=-0.01 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",