From patchwork Fri Jun 21 08:05:31 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: 806318 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp653324wrt; Fri, 21 Jun 2024 01:06:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/wV5khs1LJ0Q0YETKgQO+XjHVZ+BJM4k7Vkwifsy2bg8+hAe/M/7Nf2ZRgX2MuK2fFOCVxrbtL5ii4xN8p2mO X-Google-Smtp-Source: AGHT+IE5nX9InX2kYOub3JVcDiCdppf6qNerZ74U3RF3Ry73LqwP28Ato3LlpJF4Ldccb+TC55q6 X-Received: by 2002:a0c:dc13:0:b0:6b0:7e44:c89 with SMTP id 6a1803df08f44-6b501ec345emr86827836d6.60.1718957198171; Fri, 21 Jun 2024 01:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718957198; cv=none; d=google.com; s=arc-20160816; b=0jQ7q+oJgSrN+gaUViqNIFrRkIUOiybSwRF62vrJxMBJX35UgjOUmrg7V120BSCuvw bxNkIpKHTMuTlUCKeBbvVDpF7qLRM2R22RYKg80I7hWa3qNp+a/AePdZrMe22Jesk8H1 x2/cBhrkjrTUTU45ChhCCxvylfHkdulkqzYJ6Dfi32yTbeyhLpc+Xys/G4Sa2WVI9CZ4 /hmONfr+mEL3511CQNztPXUF7wr+KpxmUpQdNnXrlWdvjwSgH3Y5yOC5pqwo39ox5YIo M2WuptFQoKu+f+4bdHQr4Z6/0dFRP6AmRBTejwO1KAlAaDJ8T067JIAdw8IeLULNMptS VvRg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=KN16E9BUKPMQG4T8oHAz1JXgBHAHT3sIYZJzcPVZl5U=; fh=4tJ/d82yAWDoMCdtS7XMchCPfoLOmYo0Z8GLnfFVPIE=; b=lO3NVhj09mp/AqPG4FYhC9BJAZzsVHCNMvkxoj/H9348PpCNyk3IGvKPw8UtI79TsJ Wj4Fn8Tu9oVsko2+kfHyc7T4DoQOKIG18lUk411+Y34h1b0VK4940P88AYEqKMrt+sSj jNVaEk2V1EnHR11CQpHIToxmBqggExg9CHwpuVAUBzzJ/Uj4CsfSRJBd5GaHjOAkcEEI ehslg4wE8N6cWBxGnUSLSZTfMaEtez8Ob1KM0n+ZWMC1/TsOyOhGhiyhHBi7dOIHpvGy LIJzRqPtpPxKzDYBcpb+KWP3ppK2b9tktSCfoxXp1rVfVvbq6i7touIkbO30oJEBvEsP KtRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qR1MWZAU; 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-6b51ef64ae7si10524896d6.583.2024.06.21.01.06.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Jun 2024 01:06:38 -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=qR1MWZAU; 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 1sKZHX-00052v-OO; Fri, 21 Jun 2024 04:06:03 -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 1sKZHU-00050o-Ho for qemu-devel@nongnu.org; Fri, 21 Jun 2024 04:06:01 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKZHS-0008Dj-VG for qemu-devel@nongnu.org; Fri, 21 Jun 2024 04:06:00 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4218180a122so12893355e9.1 for ; Fri, 21 Jun 2024 01:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718957157; x=1719561957; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KN16E9BUKPMQG4T8oHAz1JXgBHAHT3sIYZJzcPVZl5U=; b=qR1MWZAUk8LeMowk1kn/qfpueKB5+FuFDgRxkTamdphhLmbh4MzMTSzsXAnaZdcvdV uUD4k401+VXGRyTUuDlvYX3lx24pTm9mCKWGgXfxHEjZp+j6xsRyOvxoclLWq7xrnjyJ zTQrf2CBP81Y8YUzU9A3aPF6oGUb+neAxQ/Szas0s/Gx9inR9W6Dh3Jse+6wjDewViCo yFfcMm1PkhKaJycNp+fWyrt0EtUhYpd2eolAvEVzNAqKAseeP3Git34nX0gppRWaWbXU nB1RoCMdjYc3US3WZjx+EI4wSaaCC5W0pTrF5owdzBFZOOH9brpsCiKgaq6nxLfOaFIa qudw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718957157; x=1719561957; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KN16E9BUKPMQG4T8oHAz1JXgBHAHT3sIYZJzcPVZl5U=; b=VOFj88EELZRKAj+/3GlpOrZi4gDUf9VVVie177hQDjhF02kyxljj7kFNIJeoxnnPny Gxaqv9Z2BFosqvssP5XJp3BriRi9R6b9WxXQ8lXEilNobYqXBJUEWj7ZGECelXClOw9H iohj5S2sFxwBXDX5kvVUplAvabxIU1cZQrHKdLscxJfXRoLsWTjHyphVXv/rYrRIv5S/ G+3FOdDnHF2SxMduC0xW6f6mv7DD2v7ZAzxNZzzeJoAgEYCURMZHt/yJNANAN60OtSup 1Lk7c0co0C+LDdLchnT+w6Lq8PZU4KCLpg/Zw/jj9mTHx61mJubUk+yvSvTuvGm2e5f6 Pusg== X-Gm-Message-State: AOJu0YxvNnalESZEm1NDlotQMK9koj485BiJU6g5JkXlM4ATKE3nk9KA kHrR+pwUfgXz2CJbbZZGl3zoAl2r34J5P7vqtT/EjCbmdexpwrMM31DHQ7xkjq7uVMi4llU3+84 / X-Received: by 2002:a05:600c:2141:b0:424:74ed:dbfc with SMTP id 5b1f17b1804b1-4247529fbeamr62112725e9.35.1718957157187; Fri, 21 Jun 2024 01:05:57 -0700 (PDT) Received: from m1x-phil.lan ([176.176.128.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d21243esm53095695e9.43.2024.06.21.01.05.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Jun 2024 01:05:56 -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?= , Joel Stanley , Bin Meng , Sai Pavan Boddu , qemu-block@nongnu.org Subject: [PATCH 00/23] hw/sd/sdcard: Accumulation of cleanups and fixes Date: Fri, 21 Jun 2024 10:05:31 +0200 Message-ID: <20240621080554.18986-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Various SD card cleanups and fixes accumulated over the years. Various have been useful to help integrating eMMC support (which will come later). Based-on: <20240621075607.17902-1-philmd@linaro.org> st24_be_p() Philippe Mathieu-Daudé (23): hw/sd/sdcard: Correct code indentation hw/sd/sdcard: Rewrite sd_cmd_ALL_SEND_CID using switch case (CMD2) hw/sd/sdcard: Fix typo in SEND_OP_COND command name hw/sd/sdcard: Use HWBLOCK_SHIFT definition instead of magic values hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition hw/sd/sdcard: Use Load/Store API to fill some CID/CSD registers hw/sd/sdcard: Remove ACMD6 handler for SPI mode hw/sd/sdcard: Remove explicit entries for illegal commands hw/sd/sdcard: Generate random RCA value hw/sd/sdcard: Track last command used to help logging hw/sd/sdcard: Trace update of block count (CMD23) hw/sd/sdcard: Trace block offset in READ/WRITE data accesses hw/sd/sdcard: Have cmd_valid_while_locked() return a boolean value hw/sd/sdcard: Factor sd_req_get_rca() method out hw/sd/sdcard: Only call sd_req_get_rca() where RCA is used hw/sd/sdcard: Factor sd_req_get_address() method out hw/sd/sdcard: Only call sd_req_get_address() where address is used hw/sd/sdcard: Add sd_invalid_mode_for_cmd to report invalid mode switch hw/sd/sdcard: Inline BLK_READ_BLOCK / BLK_WRITE_BLOCK macros hw/sd/sdcard: Add comments around registers and commands hw/sd/sdcard: Do not store vendor data on block drive (CMD56) hw/sd/sdcard: Send WRITE_PROT bits MSB first (CMD30) hw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22) hw/sd/sd.c | 278 +++++++++++++++++++++++------------------ hw/sd/sdmmc-internal.c | 2 +- hw/sd/trace-events | 7 +- 3 files changed, 159 insertions(+), 128 deletions(-) Tested-by: Cédric Le Goater