From nobody Tue Feb 10 07:22:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) client-ip=209.85.218.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1613780037; cv=none; d=zohomail.com; s=zohoarc; b=eRz1DFXDKZdvZYR9x8TiFIndpnS3CRgNp+eF5AawNQnjmnlhhtq9n/FJxF4JRNj4hs+32SM7u6/gMpIy4LQLQnjIXmMVNnELdzVupkuSbjztb2lZFsiqeSmt3gbDFXk3Q1MeOQ8+SLS0YK8gGEVCQH5DpxT1Yc0c5+/0tf6Zv5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613780037; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5r9uQjDLFi6eLClRWOICufpqmGktPWbrOwAV+KCU7UQ=; b=Zk3pWCnqFTIX8wJTfIe1OV33lXBnHgC2MMZD8YIrPQS1dlgIneG/Gz6YUS5OgInEuxD2uGFndTjlpz0FMaDTME3O9BlCcKIKDe4AbygeKXR/HtGoAMMS1ZyJEfW7zeCQbIzFXTOsxuK5f1n4nTUE7rhb3VjKwEuHbLcym+yrBHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by mx.zohomail.com with SMTPS id 16137800373751012.8908424486996; Fri, 19 Feb 2021 16:13:57 -0800 (PST) Received: by mail-ej1-f49.google.com with SMTP id d8so16917068ejc.4 for ; Fri, 19 Feb 2021 16:13:55 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id y29sm6410223edl.91.2021.02.19.16.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 16:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5r9uQjDLFi6eLClRWOICufpqmGktPWbrOwAV+KCU7UQ=; b=jFyGipKfEkAY+qNILhK+Jyn4icVAI2JYBEKwE9bTp9U4iMje2z5/D2af0hnFhM4EaD C9vkFu40kdNzz4ft579mb4kzMxhmjnVzGsoQjABeJCdgtSzR0nvp8jN1FP8SHyDeovCl Q6axue5dhYMZ5y2100K9FO6+hkY54lkFfAKA3qltmdsxULUjdJOfYMSIl89FyPzSAM3b T6y/Cjalg+WE8ULSe3+MzmpqYPNtQY+vxH1eU8T+jRxGMa7d6gi4gflKQDKpuAdDNNAk thKXISIEyPA8huqQhN7yMFu6fBguEn/p7d9+ORLcptzt7SoMRDrlMnhRQ9+Wa/kdnpti +uLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5r9uQjDLFi6eLClRWOICufpqmGktPWbrOwAV+KCU7UQ=; b=AC5ZwgU4FV/uUo6oJAf8NmTcTXcwWCcwP4e+SRZyyf7xe4WvgH3SpH9qMvcZCBBI8G mdjjmtIHkpwqln8S61uTtK/vV4x6FvG+/4ioOSsQHXkvclAMmLqoQmn7DLd3uYSkpp/G cHbk9gYiOyln+2GxMfnjS1b3O8pNGdB4Y/SLhvsAIMzw7MJRLWBjnjdGYbX1hRsS40UF DQvqnWcaeoZszM66R176MACLfzMQPKWcmKpOCfDURxomyHEn+QwwzGnR1eLQm1LdJwxN eTOwASrjXAJ4u1vFek63sY4ZfzLIzJbSskxtkXUyg5d6nXOuV2YUr9NaziqGZLzwgVVn 3jeg== X-Gm-Message-State: AOAM5329Ie98e1hlYF6pk+MEhxCAKaFuROKWpRFpqzRs9a3bvW3qnuhZ l7wuUnAmq/1dBEuwaZmnwPY= X-Google-Smtp-Source: ABdhPJy46SGoUfvFAn7rDMoOmhEDDtH27zsPNiMiEsSSuhPUh2Yv3lZK3O1aSDZu8LQQbZZsf/ASew== X-Received: by 2002:a17:906:5d15:: with SMTP id g21mr11358902ejt.373.1613780034488; Fri, 19 Feb 2021 16:13:54 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bin Meng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/18] hw/sd: ssi-sd: Fix STOP_TRANSMISSION (CMD12) response Date: Sat, 20 Feb 2021 01:12:59 +0100 Message-Id: <20210220001309.2225022-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210220001309.2225022-1-f4bug@amsat.org> References: <20210220001309.2225022-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Bin Meng CMD12's response type is R1b, which is basically a R1 plus optional addition of the busy signal token that can be any number of bytes. A zero value indicates card is busy and a non-zero value indicates the card is ready for the next command. Current implementation sends the busy signal token without sending the R1 first. This does not break the U-Boot/Linux mmc_spi driver, but it does not make the VxWorks driver happy. Move the testing logic of s->stopping in the SSI_SD_RESPONSE state a bit later, after the first byte of the card reponse is sent out, to conform with the spec. After the busy signal token is sent, the state should be transferred to SSI_SD_CMD. Fixes: 775616c3ae8c ("Partial SD card SPI mode support") Signed-off-by: Bin Meng Message-Id: <20210128063035.15674-9-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/ssi-sd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index 84c873b3fd4..907d681d19e 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -243,14 +243,15 @@ static uint32_t ssi_sd_transfer(SSIPeripheral *dev, u= int32_t val) s->mode =3D SSI_SD_RESPONSE; return SSI_DUMMY; case SSI_SD_RESPONSE: - if (s->stopping) { - s->stopping =3D 0; - return SSI_DUMMY; - } if (s->response_pos < s->arglen) { DPRINTF("Response 0x%02x\n", s->response[s->response_pos]); return s->response[s->response_pos++]; } + if (s->stopping) { + s->stopping =3D 0; + s->mode =3D SSI_SD_CMD; + return SSI_DUMMY; + } if (sdbus_data_ready(&s->sdbus)) { DPRINTF("Data read\n"); s->mode =3D SSI_SD_DATA_START; --=20 2.26.2