From nobody Mon Nov 3 00:31:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527984825010326.7550403106038; Sat, 2 Jun 2018 17:13:45 -0700 (PDT) Received: from localhost ([::1]:33138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPGeW-0007Pv-4M for importer@patchew.org; Sat, 02 Jun 2018 20:13:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPGZi-0003rs-S2 for qemu-devel@nongnu.org; Sat, 02 Jun 2018 20:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPGZh-0002v5-Px for qemu-devel@nongnu.org; Sat, 02 Jun 2018 20:08:46 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:42647) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPGZh-0002un-LA; Sat, 02 Jun 2018 20:08:45 -0400 Received: by mail-qt0-x241.google.com with SMTP id y31-v6so6606837qty.9; Sat, 02 Jun 2018 17:08:45 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id 17-v6sm10610894qkg.97.2018.06.02.17.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 17:08:44 -0700 (PDT) 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=8hDwejCWx11ArNCUrJgK57kvn6QwEkI8TsaoZIyD2nw=; b=aemB3cWoNlPmUfM3sJonXvBTSzU9wlr0R1uw1QwI7d6kyajGJdcoE9Fy7z9dvzvsVe nSWfM5Mf1/HZneGgsA0OQAlMp/6b3hHClcaIYwy0iVEmDe3C0s4yun3To2TB9adheYEG JfgYv0AM/pamv+IfYHEo3lrxarQYmeB22mh2XXqKIJxWVBei51f5du5HuzQdzrGbbBWi BNwci0JrKbzY2v1RPVtGI01oX93l5SKZ4IbGUA1IjEysYJRx7XNxxGcylhZ3rUM/922+ 6Hsk1p0xGYG4nzUOXDk3V7yG03AEqifc+5Ww1TFf7UQ6Mbuq7/iKC+MM5JNHzz+IialY Cb3w== 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=8hDwejCWx11ArNCUrJgK57kvn6QwEkI8TsaoZIyD2nw=; b=oJDZjSU6ipHq0dPQhvlaj1lRXhaWwu6mQtMquSgHT4tvVDZ1Yrn3iEAAqv2Bluss0Y tZfvQxK5Hj883YKA5Y3dTU5awjLsSyLpGupOGNi6ZGUx7CboNBGg98UDcGunCQhLcX3p q9HZUXhRuU31lUaxUKzP24JBpk52vBk0kWcEBt0GbSJackApBZUmGEp9HA4mnDKaAoHQ VuleNAW47x1FTJ/OkcQPBQzNsxTpbDITRHRFmDTQWbvPGQgReu9VvS915PqegC3D7shg gG7S+mijmgCfihfIDxbpE8BwI8pbvb8E5UGykRp7aq88TOkfqBwVOPitQmR1/Jmd0A8M gxXg== X-Gm-Message-State: APt69E0MoWwHo05nBLVndL0Gd4FoNhRx55NLy4OTqKrNesxsGF/Hoigb cYiktVE9ppTZELUdzVTJIXQ= X-Google-Smtp-Source: ADUXVKL4B28C59j6oyzO0enYRvg1WyZztIKrG+nCfYMwB24QAM7Z7g+LL3Auy0+j4yGKieamOfAmLg== X-Received: by 2002:ac8:8d4:: with SMTP id y20-v6mr16417607qth.187.1527984525205; Sat, 02 Jun 2018 17:08:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , Peter Maydell Date: Sat, 2 Jun 2018 21:08:22 -0300 Message-Id: <20180603000827.30872-4-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180603000827.30872-1-f4bug@amsat.org> References: <20180603000827.30872-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 3/8] sdcard: Add a 'spec_version' property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis --- include/hw/sd/sd.h | 4 ++++ hw/sd/sd.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 9bdb3c9285..49f22b0b89 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -54,6 +54,10 @@ #define APP_CMD (1 << 5) #define AKE_SEQ_ERROR (1 << 3) =20 +enum SDPhySpecificationVersion { + SD_PHY_SPECv1_10_VERS =3D 1, +}; + typedef enum { SD_VOLTAGE_0_4V =3D 400, /* currently not supported */ SD_VOLTAGE_1_8V =3D 1800, diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 80e70dd93e..5ddd211114 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -91,6 +91,7 @@ struct SDState { uint8_t sd_status[64]; =20 /* Configurable properties */ + uint8_t spec_version; BlockBackend *blk; bool spi; =20 @@ -2058,6 +2059,14 @@ static void sd_realize(DeviceState *dev, Error **err= p) =20 sd->proto_name =3D sd->spi ? "SPI" : "SD"; =20 + switch (sd->spec_version) { + case SD_PHY_SPECv1_10_VERS: + break; + default: + error_setg(errp, "Invalid SD card Spec version: %u", sd->spec_vers= ion); + return; + } + if (sd->blk && blk_is_read_only(sd->blk)) { error_setg(errp, "Cannot use read-only drive as SD card"); return; @@ -2074,6 +2083,8 @@ static void sd_realize(DeviceState *dev, Error **errp) } =20 static Property sd_properties[] =3D { + DEFINE_PROP_UINT8("spec_version", SDState, + spec_version, SD_PHY_SPECv1_10_VERS), DEFINE_PROP_DRIVE("drive", SDState, blk), /* We do not model the chip select pin, so allow the board to select * whether card should be in SSI or MMC/SD mode. It is also up to the --=20 2.17.1