From patchwork Tue Jul 16 18:41:37 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: 812800 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp447504wrr; Tue, 16 Jul 2024 11:44:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/bKSLa9kEgEIsKH6gce3EMwLEK/XuEIO8h4DY3R4Cuvenl9cAscHH+bk1E2l3ZnkJsGxyMHCwqiDs+GmwgEUQ X-Google-Smtp-Source: AGHT+IGgf4qE7r7zufftntyfP6mdrB0NVTZclKZFW6XmKfu68JNZ8xVLVceyqrlTrCcZAJ4ia16i X-Received: by 2002:a05:620a:6893:b0:79f:69:c43f with SMTP id af79cd13be357-7a17b700c28mr298846685a.72.1721155447140; Tue, 16 Jul 2024 11:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721155447; cv=none; d=google.com; s=arc-20160816; b=Yhx1KT5c1hyDkixCeSuS7s2C4oFEPc26Fk0pJLwDh5rUF2+bsjgQqciTx5OYMCTDvm lm5jWzqtHSaVmU0gS+qRfxLRAxN1vLrFYjpQCV8FAf63axMEel8RN/0f98Z3pbkIkvkl TMpTk8hGq9Q4lpasDz2NcsxxibV7v0An8c8/eKAgsCPEEo8ELQPW3U1+opkxu78psneK XbjQEcr9BJzXY2fEfzMB8pfGDGIZY/04n5Z5THvB+88UM5/HWZsluLX97ceHu1/D63XB fKKtuErd82wGQE8RG2d7+D2YVizEzjKdnZvfj21XV0Yb7NWcVbPssJeIkR2CIHsj6v4/ 8C1g== 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=Ddj9Nfg7HiixSUrxPsTSL9gKvyRW8bVsKrGjjlgbR1M=; fh=PL8ckMkyAhAkso3TNNQ58kdISuodHNUfk6+te16KrPk=; b=DPDYfe/a+4YuKaPfF2q7EWhBzGsJAf2lOTnbZbmcWMDqSIQd/PAG23X9M6l9VKM+hU Saxg5vRTa2OUtxxiG5Rwbpjhl2ehAIBMx/2GZgZ+3EFQxAJsK1ql3dFjaPMeyDts11eb tRPUbk3k0jFBgcvWG64a+Fi7pO+ZWrvlUkF+a2/LdlkFkwqGBDtkryPSEzEwR+JBI1Q8 CulHy4NZpWgLkuV86Hre5rYEhOYg5rKfn5w/4BDZee//xYfuW/7PPPXV6vp2tIFVVYKF 4KxZTx80IZH75iuZirpEgE23mwMa5ceFh9ovaafTHCLy+RQsh/+M3IFmWvQ511FqrENJ Jimw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GE0i4UVx; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a160c49f34si826151385a.291.2024.07.16.11.44.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:44:07 -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=GE0i4UVx; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTn7y-000138-3m; Tue, 16 Jul 2024 14:42:18 -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 1sTn7w-0000wT-Fh for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:42:16 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTn7u-0007MC-RW for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:42:16 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-367ab76d5e1so1948512f8f.3 for ; Tue, 16 Jul 2024 11:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721155333; x=1721760133; 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=Ddj9Nfg7HiixSUrxPsTSL9gKvyRW8bVsKrGjjlgbR1M=; b=GE0i4UVxHHZ7E6L/7S5Md6ujrPhabsp/Rn76khxF8AqNJtlmMCivK0yUYYsfQxUdV2 LevtCsAg6LvkEy+pvhfFrVqZyhICZ7O/chbnYFOO4W2MptSdPD105zLZKrUspNZcthMK 4cgC09AWJeNgshX/DUrPh/5sTAnDUozMD3K/EC7o44C8uvGmg0y7K2g6/arieRJIiiw8 Ntdmn0eSUXVkLHojMyebTE1USIFkASx6yCll+1F6DGX2WE22tQc/OQxs4hzi8wXWuK0t qzvqZxRCVfl/Hxlhk+tR8pcxknlAHHlai0azSCGIohFp2LdEnv+rI3O0woWnCxv1cBDK Q+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721155333; x=1721760133; 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=Ddj9Nfg7HiixSUrxPsTSL9gKvyRW8bVsKrGjjlgbR1M=; b=FKX1W5cnM3ylYACJ+WAwvAtimPsyX73NU6SiJw04FukrA5qE5xryRNBX4N/G53FXZo WfZpJLkITnBUPZIH/5uzXdLnNBhfVxKtYVGYapwwcXmnIEE0pfD6aFWdqQuTNWBg+fQl nmN4ueeDLZduZUR/PdtUXK6ZcgU6zcQ4FasUxoHm1nrT9Lk5rXYPs8JnYdnd0bwknDe5 ECWYODul4ea32LiPIuzPmvkwBrVws/cxkrY2748PY2uqnkfAAc7dLnippTxM4VCquHjq vZXBA96fP3Vz4MYC71FHRqPs8H2AOf53RFsh6GT5+HAgwhqfzqHABm/VHTWoAnEo0pZ0 Sadw== X-Gm-Message-State: AOJu0Yw/HLbVm4HrKVrOuGGRdesgxCUyZ9ljtPSwnp28692Dd7Mz0Jue DWxXcHPfICLYAVYcNORtMsAD2Aqa54eoGGO438n7r9bPaSBkFHWjaNU1BCfUD5JoRNVVxSX1edA 1B4F8KQ== X-Received: by 2002:a5d:4747:0:b0:367:8a3b:2098 with SMTP id ffacd0b85a97d-36825f70f1cmr2056230f8f.3.1721155333054; Tue, 16 Jul 2024 11:42:13 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5ef550asm138512235e9.46.2024.07.16.11.42.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:42:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Andrew Jeffery , =?utf-8?q?C=C3=A9dric_Le_Goat?= =?utf-8?q?er?= Subject: [PULL 04/11] hw/sd/sdcard: Add emmc_cmd_SET_RELATIVE_ADDR handler (CMD3) Date: Tue, 16 Jul 2024 20:41:37 +0200 Message-ID: <20240716184144.42463-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716184144.42463-1-philmd@linaro.org> References: <20240716184144.42463-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 From: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Cédric Le Goater Tested-by: Andrew Jeffery Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Message-Id: <20240712162719.88165-5-philmd@linaro.org> --- hw/sd/sd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8a23e9eb23..ab502d19b8 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1280,6 +1280,20 @@ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req) } } +static sd_rsp_type_t emmc_cmd_SET_RELATIVE_ADDR(SDState *sd, SDRequest req) +{ + switch (sd->state) { + case sd_identification_state: + case sd_standby_state: + sd->state = sd_standby_state; + sd_set_rca(sd, req.arg >> 16); + return sd_r1; + + default: + return sd_invalid_state_for_cmd(sd, req); + } +} + /* CMD6 */ static sd_rsp_type_t sd_cmd_SWITCH_FUNCTION(SDState *sd, SDRequest req) { @@ -2445,6 +2459,7 @@ static const SDProto sd_proto_emmc = { [0] = {0, sd_bc, "GO_IDLE_STATE", sd_cmd_GO_IDLE_STATE}, [1] = {0, sd_bcr, "SEND_OP_COND", sd_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}, [7] = {0, sd_ac, "(DE)SELECT_CARD", sd_cmd_DE_SELECT_CARD}, [9] = {0, sd_ac, "SEND_CSD", sd_cmd_SEND_CSD},