From patchwork Fri Jul 5 22:04:21 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: 810451 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1775503wru; Fri, 5 Jul 2024 15:06:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVUcrKYW9xXVIeVWrwoPSYfWOAmlmdBk5oYLp5G+hrY7utkBcZcSn2beFVmZu7phy2lH9SJUNnnRlY+d2Mgvb3m X-Google-Smtp-Source: AGHT+IHq4ojywoXy8JSMnfXZSVlxdBFwGNkuWv0Gwt434uLuOs2RNuR7WWNsu4Rw6/z1mtosuva5 X-Received: by 2002:a05:6808:3c92:b0:3d9:22df:8e0d with SMTP id 5614622812f47-3d922df8f46mr1497346b6e.18.1720217212487; Fri, 05 Jul 2024 15:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720217212; cv=none; d=google.com; s=arc-20160816; b=lNxrkvFGWamx5XoSh2T6/+LzBmKlEqGpv1ofw1/wzUfOwitoAcIVwbZaUCIhUIIYa5 UT/tvh+khkbDvirdqVTtbBUpWhgmlVv7ERXtxhZjTdWPSwuqLVYWDr1nZbUalgM+touR BAQ3y8/yAjfWdxVNYN6noR/kMyT6BSMY1dluNAs7dgrZhcMmL2pIGAHn5X0nk3EKn+rZ QMiALAU7ueZNBowaV650vFWZY8OKeEFtKwTXxRYqfiY3CqJEQJR6uysgEdbkaTBSIWzy 0ubFMh0Eg0m+UKT+N6D2o8X3quRweZAc8HeEaY03SrDHBO7me/zQqxoBOEpoqS06UlMK GBcw== 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=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=IaP0LwNUjogojpbObIa9cgOS43K1z7RVL65clKvLOP3iMnErCsYzMrpGNikfrZRSKm rFdmtxfF/KBsFGqx+bQnajdFjZ16Urp2hv0zFGKQ/LGPwfcozQyGW9bmVOt9a2FzL/bk zNCsmWVSEQMwF78V6jxb7Hs8sJaZRZWOGmjyE/ovqIDDGOVN9jatwx+IQdNwOqZZcBL8 5ipEnBX6SkijcfjoMRz07+jSR2vvkfpKAUPIWcWYwVvYmeargmfeCjSq3kPnpAVBjFfT 2CLpFr1zYnzTbbd4NBqm2yvW1o42+Jk88Go3e0MaN4Uz7jDnyOQlrbSzqiJ5l0VHIN7c Bb2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSFv5lrU; 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 d75a77b69052e-44651487616si195923181cf.348.2024.07.05.15.06.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jul 2024 15:06:52 -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=eSFv5lrU; 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 1sPr35-0001f1-C5; Fri, 05 Jul 2024 18:04:59 -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 1sPr33-0001bS-W7 for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:58 -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 1sPr31-0007B9-Mr for qemu-devel@nongnu.org; Fri, 05 Jul 2024 18:04:57 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42562e4b5d1so14194465e9.1 for ; Fri, 05 Jul 2024 15:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720217093; x=1720821893; 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=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; b=eSFv5lrUqg6iPQxnQIA2470Hz3T3ZSIFlRtReW1ZYMLoxFiEouUk8DnSq3bLYdIym9 o79Aer9xK6tANtIlD5U+Sy8Il8wi+Iep04CHn41StVmiyEeQrGeN5KQNqB8JjwgEBx/m I+HNUwVYif46tj3/be33xGFVafhP/ALk8z0VYDPhQMftou+aFKMbS5oC/9knIKVKT7dq r+d1+XZkaPlvZ7MuwYcLOvtUf+Ccc6WNyOAP1oW9Zn2YI3/fm4XlTfYcgZ/tEj7oISXv 9Il1BnJGDM3VaWVmqmI1S8NnJ9CRGQl8aePbs5/dcd0u8qphaxuc4gK73RrKiRzE1PVs QbZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720217093; x=1720821893; 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=uDcwrWNYcnZcMeZ/8KRw8egv2ZLimv3SUep7b6VkVhI=; b=l6EB0qbwXrHx+VWeq/FIgBa128gWmaJ8wNzt/FFRcRvY7oZujrNcZlpJmwR2RLXw2o O2UjWwHADNpUlyxuKF6UsfiZP6ZPiaxhM9wIrrz5KhCVwk4z0ZnZcUVLmWP93oGuMLh5 Mij8vmZvfwi8+o62bJvCsi141kns8O12gTmd0xfmWicCJ/ujjkT81DdNsI2o0R1Brw8G Iaf1u+H8qj6LvyFg9jl4lylNY/WUiE4BiPZ1r7GtOuFDG4nWXufflaWg5EDEY0nss/3m P45zg5tg7RfjjDcg0pgQFSxo0mPRLb4omOE91nm7INkGKRr1yi33MRw8k4N/X9YRghbs JNXQ== X-Gm-Message-State: AOJu0Yxghs5bVB21tSDyDVebfNITlDUpbA5uKsFN89xbUFbvFirskqjY b4crmQMrcuzzFgwpFRTIgLskfWhZAqY2/EKXUPm7/s2U2LQd8pJBTz1a5NU7CHs1d0YhQVUbmzx S X-Received: by 2002:a05:600c:45c9:b0:425:632b:b924 with SMTP id 5b1f17b1804b1-4264a3e3520mr40787315e9.16.1720217092790; Fri, 05 Jul 2024 15:04:52 -0700 (PDT) Received: from m1x-phil.lan ([176.176.163.129]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264d6d41cesm61526645e9.16.2024.07.05.15.04.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jul 2024 15:04:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: 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 03/16] tests/qtest/npcm7xx_sdhci: Access the card using its published address Date: Sat, 6 Jul 2024 00:04:21 +0200 Message-ID: <20240705220435.15415-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240705220435.15415-1-philmd@linaro.org> References: <20240705220435.15415-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=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 Currently setup_sd_card() asks the card its address, but discard the response and use hardcoded 0x4567. Set the SDHC_CMD_RESPONSE bit to have the controller record the bus response, and read the response from the RSPREG0 register. Then we can select the card with its real address. Signed-off-by: Philippe Mathieu-Daudé Tested-by: Cédric Le Goater Reviewed-by: Cédric Le Goater Message-Id: <20240702140842.54242-4-philmd@linaro.org> --- tests/qtest/libqos/sdhci-cmd.h | 2 ++ tests/qtest/npcm7xx_sdhci-test.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqos/sdhci-cmd.h b/tests/qtest/libqos/sdhci-cmd.h index 9e61dd4944..90efa028ef 100644 --- a/tests/qtest/libqos/sdhci-cmd.h +++ b/tests/qtest/libqos/sdhci-cmd.h @@ -22,6 +22,7 @@ #define SDHC_ARGUMENT 0x08 #define SDHC_TRNMOD 0x0C #define SDHC_CMDREG 0x0E +#define SDHC_RSPREG0 0x10 #define SDHC_BDATA 0x20 #define SDHC_PRNSTS 0x24 #define SDHC_BLKGAP 0x2A @@ -38,6 +39,7 @@ #define SDHC_TRNS_MULTI 0x0020 /* CMD Reg */ +#define SDHC_CMD_RESPONSE (3 << 0) #define SDHC_CMD_DATA_PRESENT (1 << 5) #define SDHC_ALL_SEND_CID (2 << 8) #define SDHC_SEND_RELATIVE_ADDR (3 << 8) diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c index 5d68540e52..01f237a816 100644 --- a/tests/qtest/npcm7xx_sdhci-test.c +++ b/tests/qtest/npcm7xx_sdhci-test.c @@ -30,6 +30,8 @@ char *sd_path; static QTestState *setup_sd_card(void) { + uint16_t rca; + QTestState *qts = qtest_initf( "-machine kudo-bmc " "-device sd-card,drive=drive0 " @@ -43,8 +45,10 @@ static QTestState *setup_sd_card(void) sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_APP_CMD); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x41200000, 0, (41 << 8)); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID); - sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR); - sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0, + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR + | SDHC_CMD_RESPONSE); + rca = qtest_readl(qts, NPCM7XX_MMC_BA + SDHC_RSPREG0) >> 16; + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, rca << 16, 0, SDHC_SELECT_DESELECT_CARD); return qts;