From patchwork Fri May 4 15:59:01 2018 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: 10380957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0344560353 for ; Fri, 4 May 2018 16:02:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCE10294D5 for ; Fri, 4 May 2018 16:02:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1365294D8; Fri, 4 May 2018 16:02:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2B9A1294D5 for ; Fri, 4 May 2018 16:02:18 +0000 (UTC) Received: from localhost ([::1]:35021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEdA2-0003rT-2t for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 May 2018 12:02:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEd7R-0002SR-GF for qemu-devel@nongnu.org; Fri, 04 May 2018 11:59:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEd7Q-0001RO-Qz for qemu-devel@nongnu.org; Fri, 04 May 2018 11:59:37 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:44337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEd7Q-0001Qx-Mn for qemu-devel@nongnu.org; Fri, 04 May 2018 11:59:36 -0400 Received: by mail-qt0-x243.google.com with SMTP id d3-v6so27912864qtp.11 for ; Fri, 04 May 2018 08:59:36 -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=5aqbhsgHCCjJfifDH1qGloIHvlHvJDa3Lmhz/H9lDWM=; b=TvuFZ8nl03kdDM0Oo2/IghQGFD+WxnnILG4K5c+PN0s0Je/fF8tNrKn/nnxFzGcOAf 2v5X3KJ81YQCrbCpByk6tWqwC3rmrEFNIns7jOtuc2/rnH6xcKeNY1fqFpyDE7groz+2 SwriPI8KyUATJRsq4GJ4ceWrW/n30v8AMAC7FdpmerlEb5QvI6+vgEX5slOIKFecd6n9 UAbj72nyQztVHtFXmXY+TcY4Seo3NjmptcOEm7+1YDb6LYl3t2jabWqGrUSKkuQaWfhf qNZJewDj3++0cuhPbeju/P+vhIC4M/umWhO3ZPHy/LSMbEfrCtXFdvC4jFCfJt/yy4wa Pz3A== 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=5aqbhsgHCCjJfifDH1qGloIHvlHvJDa3Lmhz/H9lDWM=; b=QemH0iwjNiEB+XcuzIntHzaZulpoTez70jZdKMcikCEFcx43YCuJNb4anMlnprm1L8 irK6OH9PCFwfqSkPsrQdik9kKr8AwFzOq022JZRM25sgg6pOtlO23Hav6MoEJYNz4Pa1 TwqJi64LFxqcYRbmNHcEaJFncDofRNmwDHwIaA5pDl63axcz4147AaSFw+77dtYILkrs wQOVxlcdiZspm0lAcjJi6Z3C0ppUUJLHR0O1PKXUw0vHu2rXSFnc7l8Jqk7psX+pqAYo YoePJtKq7tuAL+zLA69P1IaIfK3jwprwcfyVooDwurEXdkzXVnRuf09Apt2yCGPgFF54 1G/A== X-Gm-Message-State: ALQs6tCH2BphWDmT2JINRSU9kEK0Ra68ahJBpTb8+5cHry9Pqq57JK+m EaDWQ2vJ5hS/Od5Wm+WcjCA= X-Google-Smtp-Source: AB8JxZo1uUdneBEHm75/Az3WCbNn4F25Jy5YBLU34+7Ul2S1i02CrSzPxenFG+v2Z9rawnTaUU1GSg== X-Received: by 2002:ac8:7259:: with SMTP id l25-v6mr24087218qtp.325.1525449576102; Fri, 04 May 2018 08:59:36 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id a83sm8587066qkb.22.2018.05.04.08.59.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 08:59:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Peter Maydell , "Edgar E . Iglesias" Date: Fri, 4 May 2018 12:59:01 -0300 Message-Id: <20180504155918.21287-4-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504155918.21287-1-f4bug@amsat.org> References: <20180504155918.21287-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH 03/20] sdcard: Rename the SDRequest as SDFrame48 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 , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP SD requests are 48-bit SD frames, while SD responses can be 48-bit or 136-bit frames. The 48-bit response frames share the same CRC logic than request frames. Unify the 48-bit framing to reuse the same CRC logic between requests and responses. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/sd/sd.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 9bdb3c9285..f0b41232f7 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -76,11 +76,22 @@ typedef enum { sd_adtc, /* addressed with data transfer */ } sd_cmd_type_t; -typedef struct { +/** + * SDFrame48: 48 bits commands or responses + * + * @cmd: request: command + * response: mirrored command + * @arg: request: address information or parameter + * response: status information, OCR register, RCA + * @crc: 7-bit CRC checksum + */ +typedef struct SDFrame48 { uint8_t cmd; uint32_t arg; uint8_t crc; -} SDRequest; +} SDFrame48; + +typedef struct SDFrame48 SDRequest; typedef struct SDState SDState; typedef struct SDBus SDBus;