From patchwork Thu Jun 27 17:10: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: 807888 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp913480wrn; Thu, 27 Jun 2024 10:12:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXonDvLPWMk8NC1qATMcQiY6v2SjeB0EVuZ95OF39tJBSKqwm9puRoZADAYi3+FpP9/knpVcQRdmc1Jziua5oKX X-Google-Smtp-Source: AGHT+IGZ8GhpHNjkovbqK+FbMId1q3+ZSRWbPpsOwHC932FRkIJ6rrHywWHXtNZlmN/sWiXwy79O X-Received: by 2002:a05:6820:283:b0:5c2:2a3d:a671 with SMTP id 006d021491bc7-5c22a3da789mr5093497eaf.8.1719508376130; Thu, 27 Jun 2024 10:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719508376; cv=none; d=google.com; s=arc-20160816; b=fSc/u03sib1sLMMNzOLO9aSbfUvXA1YGahN4PTeS+8xZwayHf0WFjFeTVVtzEYSPy5 qYVwyHA2rcXpWepQcrZr0YsPrPqH/XC6MZHOHRg6+OfoNGAC7Gljw8qNqu/5ojdSwXmP lg+xdcCiWCIg3wnla5vyFIvMXdUJ5IY87JWwDKUtN9fS/HW4aRxMcnA0DqGfSisB8xsp eoclXtHUn02JFNmOG/javlTx0ZcQJgBAoYzqKdFTuec94wWZykd/h+3Gw4Q7CdSdqaXJ 6gFsg0zooKVqP+8SSPrEuLk5rcifTggZXhMDWICkqioWnA8iwTjZDXErnZYj+yw1LZRW 8dNQ== 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=z9Lv5oRHhagfJkOeTGJdPKagMg6fgJmQOzE+waR1EWA=; fh=hi+Z1uczzb3Vo1qwBJMClbqKaoMhkHGylvMWIc31pRE=; b=zdiVxRUJI6V+3tyPzbfvJbvdaxfqNhmSUlYEBEHmRFxcw/rvVu7tBPBqjKZhpZ2Rc4 72gZzCprtjSqqCPirWj1wS/0C0Z3W2gqaNsHeyYm9awwgc0DWn5DoLmsk2SFvOXI3uoh epR3Z+kZbwJPPBIaXotNHwloxcfcsAsECTZ4ZLhM+JRubqklBj+p4x9VifuLJr1qgf1l NN8bre1YQnmnq6eHDPOOUrJVFuTo1irCP0p0ptNsL1QKwvGC+CBUR5cawJKgg0LejQ4+ Ll+M2Gz5FJ7A1TpDfW4ZJW3q71hruduPEsgyw3F6ePdF2b+jPmUo4pG/qzUx3+c9I4H9 n8IA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WFbFROm3; 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 6a1803df08f44-6b59e6169a8si677606d6.562.2024.06.27.10.12.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2024 10:12:56 -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=WFbFROm3; 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 1sMsfd-0008Nj-UV; Thu, 27 Jun 2024 13:12:31 -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 1sMsfY-0008Ab-Bv for qemu-devel@nongnu.org; Thu, 27 Jun 2024 13:12:24 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMsfW-0002Hv-PQ for qemu-devel@nongnu.org; Thu, 27 Jun 2024 13:12:24 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4255fa23f7bso15163645e9.2 for ; Thu, 27 Jun 2024 10:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719508339; x=1720113139; 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=z9Lv5oRHhagfJkOeTGJdPKagMg6fgJmQOzE+waR1EWA=; b=WFbFROm34UxZorvMkRKKGtpRHQMQaTtofOS/ynldgAz9fG3CNPWLhGdvUoP8O7m9oa b4LbLRFdp2SQwa4xuN2N2S5HmSA7vYq85Mc3CbcZTU3QgMUqRcMai0aiRLDMQr3DvK4y 2AG30CUMUUxLCOqW2zOTNWl5PWBxB8dBe1l7mAgok84GWmIxXDKgGRqTpmM5VgmffKLB fjtloFRfpEa3Wa1seD/9Nedr0UwE75ecrUhycFM1IKbg3gqglprsLyilyEs62DV3QBw7 /7GkyH9IIiZIe1XVpe9SlRzJbZWjnZMAsBf22WsbFKmU4uyLlKDOUmd4rfYoaqdgEmt7 vxuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719508339; x=1720113139; 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=z9Lv5oRHhagfJkOeTGJdPKagMg6fgJmQOzE+waR1EWA=; b=FUWQgs9dzG29vKHoirgEph2JnY/N258+iPfQ2l033W9pXEtubx+pO2zBy1l7OzA9e4 QhV/vBaEmcyJtz1PFymuApGbuzgtDxd3uOq0z0QH5IX2ANlJIaHbXiJK5q85flpKwbeR 35sMnNInEDb+xfIwFSBuKR4cy0tFfL+L/FNErVjPwePMxNIplkDHJU+S/cXTkEOLAh+3 Ers8PZ85TLSQn7pARkpxFT2id+ovr3vc55UHdRsucCp0KhHfadtIyN4CHe0WeJO/ad7m 7RZFNGK6UOJzsADIoN95ip45GUJlnMMaPcEllgOhwJbrdHUlzZopWMh8dj8QH0RaLudX 1qXA== X-Gm-Message-State: AOJu0YzP72t8NYI+C928Hta5uLug+4I97AyGBAYbnmZBkknkrbRhYHG1 bNEY2YuOMWU5ZWcb5VG0RMijUuJuUJ7x5VvRlX1geFowsMW8m2ZF1GX2mqh9PNxreoiO5ssEP+v 8o+c= X-Received: by 2002:a7b:cbd0:0:b0:424:ac14:ddc8 with SMTP id 5b1f17b1804b1-424ac14deddmr42871175e9.17.1719508338799; Thu, 27 Jun 2024 10:12:18 -0700 (PDT) Received: from localhost.localdomain (33.red-95-127-46.staticip.rima-tde.net. [95.127.46.33]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3674369ed92sm2490144f8f.105.2024.06.27.10.12.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 27 Jun 2024 10:12:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Joel Stanley , Luc Michel , Francisco Iglesias , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Vincent Palatin , Sai Pavan Boddu , Bin Meng , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Sai Pavan Boddu , "Edgar E . Iglesias" Subject: [PATCH 07/19] hw/sd/sdcard: Add emmc_cmd_SEND_OP_COND handler (CMD1) Date: Thu, 27 Jun 2024 19:10:47 +0200 Message-ID: <20240627171059.84349-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240627171059.84349-1-philmd@linaro.org> References: <20240627171059.84349-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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 From: Sai Pavan Boddu Add support to Power up the card and send response r3 in case of MMC. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias Signed-off-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index c6e5c93acb..2dc0209482 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1190,6 +1190,12 @@ static sd_rsp_type_t spi_cmd_SEND_OP_COND(SDState *sd, SDRequest req) return sd_r1; } +static sd_rsp_type_t emmc_cmd_SEND_OP_COND(SDState *sd, SDRequest req) +{ + sd_ocr_powerup(sd); + return sd->state == sd_idle_state ? sd_r3 : sd_r0; +} + /* CMD2 */ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req) { @@ -2398,6 +2404,7 @@ static const SDProto sd_proto_emmc = { .name = "eMMC", .cmd = { [0] = {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, + [1] = {0, sd_bcr, "SEND_OP_COND", emmc_cmd_SEND_OP_COND}, [2] = {0, sd_bcr, "ALL_SEND_CID", sd_cmd_ALL_SEND_CID}, [3] = {0, sd_ac, "SET_RELATIVE_ADDR", emmc_cmd_SET_RELATIVE_ADDR}, [4] = {0, sd_bc, "SEND_DSR", sd_cmd_unimplemented},