From patchwork Fri Jun 28 04:53:13 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: 808123 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp187708wrr; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVq7D1l7NEkcwXSLS0+MQCH7/YwLg/vVIvQUu+IxleKwmznuuyJaADdlMdiGrn88uNflzO+fS74m9lYPzJIdWYd X-Google-Smtp-Source: AGHT+IGOUNryZ5VJ8v4AbdCS5Jxs3SHcGYIXmpkYkAYS1VZ0o9tN5bNmzN8vUWLsndkkw23OEPdT X-Received: by 2002:a05:620a:4493:b0:795:5a78:6fc7 with SMTP id af79cd13be357-79be0c64f17mr1875518085a.42.1719550500231; Thu, 27 Jun 2024 21:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719550500; cv=none; d=google.com; s=arc-20160816; b=TRs26TEqYohheFHtadNpw3viBrofKRCHByzsBzs5/mXjVyYLrr+tU/GZ4qFASm24vX P0ZCefcwe71yiMZIgYSkf0ndBCFDYLTz/fLkN0erPxyGN50DIUcKAezyhMPvgp8NHfZj 7WIZhDpZidds/BQ/iD31hi8Qt+2c19f+k3f8U+hoxIoYxeAJ+HiBrahUvuQK0eG3cQ+e v7zfZIAWVlEd4Klnj9wp4lj3lyYCBEmKCUtBeF2bZjclfBc1Ie+Hf/w50jvmXIDVE/m7 utldrZ94CdABZ2clJFRjJ8LYxopO6iNZCOkaJa3oZuFVqRNcvBTafj4iWajWX50U7JH7 RcDg== 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=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; fh=mJ33vrhGd/NTdd5lBDp0lE29qLMBB1Ua1MFYaTj7EB4=; b=SgZ7cpkmaX1sgMwMz7F4grmbnPQ8L22QhL8ti6um7Cfv42AsupDY7W4DWYb4naMDvR 7s0PixhYnopjrY0JGP2V5UVWhJ/d0QnD/Bip/SzMvBjlTp2c50ZNOQxfK+h8Pmjnkj95 5JEF1jxbb858ELo0Vf6dUZxxjiE2DYRzX30UbWQ8wYISB94Th05kIZetcOgrzPs+m1iX P+W5JMBXWulkRiExQj4XdPEzPtGTZJQrh/joXt5lyV1cyJKotBcjl1OwcF/YKHPx7gCa lfM3TtrA0u/AsuHWDM54GidlNJ6HSjmtH1o3IcoMRC8CsRjX2WEwWGmiTKp55K0IRHRk 8h4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIiDPMkH; 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-79d69339d4fsi102177385a.568.2024.06.27.21.55.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 21:55:00 -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=nIiDPMkH; 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 1sN3cG-0008DN-J5; Fri, 28 Jun 2024 00:53:45 -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 1sN3c4-0008Al-86 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:33 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN3c2-00083r-Ax for qemu-devel@nongnu.org; Fri, 28 Jun 2024 00:53:31 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4217c7eb6b4so1887815e9.2 for ; Thu, 27 Jun 2024 21:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719550408; x=1720155208; 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=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; b=nIiDPMkHIaq9c/7QxbDC4b+/Jty15PrIMFR9kMGXT2uQX+UIU4kPLESG2CpNPy7hpr B1RkwGaUohdC6mWz19h9DX1gaN4O8wslxsVN2XmoKZSkitLahX/XPRnU3O3FbtJw/4py zzOjyiKbayxUR4ICa8K9zNgKjDtefTBFuya5iPYwxJ+/prSmE6L20Xore2Ay8WNf3V0a qXN5K4pwVgMagvO8wm3HClapMjPp3SL9iK+Wl1rlmS2KBaeOLbF4gGkM3E/HwBEG16SE J631Mn5PVnMXBgDLr7QSVpSby/ho7h66dCLzUr+fL9X5b2itlcc0E2w/i9kzQz8SyffJ /ZGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719550408; x=1720155208; 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=9vrkGwBcqZVZMukUtGlLs/nHFLle6eNwrj7janh4+hs=; b=O+cvkr3A09ducrnbfO6hETkTYmV4piVNVSDC07g5Omd92RQRpK35T6hmJIdUcEGhq+ KSBH5T543/ukdRiugGXMiwzcF58ykC1K2qXATjKTI/5wKHhczHX7VuG/nT0lSGMlMGxA VSzWU0UBUuYHrAlhekwHXf7wvusalTZKaLLkxsnLFoSXukzkBEMDxkj+GTEp1JJOhpUc XOYlL7yPI1bsAw+aIUxLCJ5pacCK2rppcKbp8AoHOMu+pnxtLgOmXP5YX0B2tiXbuC2y B2TEAEdUEuLyGCjxUiuN3iZJ1AetAs41PZJjnhieDaCtv671G1IPYfsAeSayHNvHix0P fcnw== X-Gm-Message-State: AOJu0YzfWHx9O72+/GCjeAoFJKfOpFb+OzLKBKSLGd94v3+xwBPdk1Um QFTYfLFJPG4M1E2EASCJcu/OqZafDTthH6JMD6oQIWt40rSruw17p9jG2Y49V1gYX27wNNGZEeG g19CAdw== X-Received: by 2002:a05:600c:12c5:b0:425:5fe5:f273 with SMTP id 5b1f17b1804b1-4255fe5f3d0mr42043715e9.26.1719550407561; Thu, 27 Jun 2024 21:53:27 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a32asm17899595e9.31.2024.06.27.21.53.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 21:53:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Francisco Iglesias , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Sai Pavan Boddu , Joel Stanley , Bin Meng , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 02/12] hw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13) Date: Fri, 28 Jun 2024 06:53:13 +0200 Message-ID: <20240628045323.86308-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627164815.82606-1-philmd@linaro.org> References: <20240627164815.82606-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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=unavailable 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é --- hw/sd/sd.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 0310a5a3a1..5323a42df2 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -260,7 +260,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd) static const char *sd_acmd_name(SDState *sd, uint8_t cmd) { static const char *acmd_abbrev[SDMMC_CMD_MAX] = { - [13] = "SD_STATUS", [14] = "DPS_spec", [15] = "DPS_spec", [16] = "DPS_spec", [18] = "SECU_spec", @@ -1683,6 +1682,13 @@ static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *sd, SDRequest req) return sd_r1; } +/* ACMD13 */ +static sd_rsp_type_t sd_acmd_SD_STATUS(SDState *sd, SDRequest req) +{ + return sd_cmd_to_sendingdata(sd, req, 0, + sd->sd_status, sizeof(sd->sd_status)); +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint64_t addr; @@ -1791,18 +1797,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } switch (req.cmd) { - case 13: /* ACMD13: SD_STATUS */ - switch (sd->state) { - case sd_transfer_state: - return sd_cmd_to_sendingdata(sd, req, 0, - sd->sd_status, - sizeof(sd->sd_status)); - - default: - break; - } - break; - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ switch (sd->state) { case sd_transfer_state: @@ -2329,6 +2323,7 @@ static const SDProto sd_proto_spi = { [59] = {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF}, }, .acmd = { + [13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS}, [41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND}, }, }; @@ -2386,6 +2381,7 @@ static const SDProto sd_proto_sd = { }, .acmd = { [6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH}, + [13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS}, }, };