From patchwork Mon Feb 22 08:20:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2511BC433E0 for ; Mon, 22 Feb 2021 08:24:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67B8E64E77 for ; Mon, 22 Feb 2021 08:24:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67B8E64E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Vr-0006A0-Dc for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:24:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OD-0004dM-7H; Mon, 22 Feb 2021 03:16:21 -0500 Received: from mail-mw2nam10on2076.outbound.protection.outlook.com ([40.107.94.76]:64640 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O5-0001kL-JM; Mon, 22 Feb 2021 03:16:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BpYEIf6jK2GBk7CvtYSqcjF7JshkVmQwo9G6ZIv9c2EseyFzPxFBPmpsl+h1MOriHqPmPabRADfxaGECLifNMWlyhB6sm+tc+3kJqJSdMOrHlArqIXCNQkt1KgyA6oDPdnNTOpn4xolEwVb3o4WAJDz0YY2vEET569I8j/vaQvfKDA3/pT3TlpC/FI3LZBgqTFLH/LVPwqT1114JoIcpAYPiEiXzMUgF1jPi50pVgZRF/6O5sy7PDfIU4w74cX4gDQQBjy1VIeUOWUQ0JHI5X5067Iq1UT/DZHBbnbW3L+InswA8JgGYTOLxqaCXE/ArqSD2bj8rgJQ8VXPvV2YvYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U+V58E0lPxN7LZLjHTVHiekcex7/jWy26Xfug+xaXrw=; b=N//z2HhGBKmPMJGbkWHzBUtYZBNVI6CMhPJfAAgZMGugcpvbEo98JUM7gMt+6GXtI/MktaPWfPv0VDnrIYPERdZ7hQBF/QiH3NTXpVci++QAIHvafQjr/pX7qA2Q63LE6khs/a28VEVGvmlEfqoctLechm7LP2L2sUYGjAC86YWsad/Z1DWwo/y3Z/TSCgCk3qAD0z+eHAzCLfbzTQMIO33/NdKS56M/eWAR/iyTy9VhJfNVZ+r9grjtCDDJSMAQ4/mgkbCpgwcRJLkKAfQLkrdgpyiMGhcFYQw95TgTeLq4EtDRJ6d6E+Xqdg3RWVRCK4PlTZ0WTbjT8L6lRTtCHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U+V58E0lPxN7LZLjHTVHiekcex7/jWy26Xfug+xaXrw=; b=h8c7y30ojIVzlsvEheIdf9w/QBaBGXf/eEi+V/wpr1d7CtPYZQbP0iEPs8qTD/DHFb7gQxLxfi3uvF7N4e1e+rMUtj3QXia+2RidWOLQYNrgJVpi7NeZ6mHJPSjQ/v8tCtO9jf4gehTlWUyr9IJlyM6Q/4arl1NikxL10XxHiA0= Received: from SN7PR04CA0259.namprd04.prod.outlook.com (2603:10b6:806:f3::24) by DM6PR02MB6249.namprd02.prod.outlook.com (2603:10b6:5:1d0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.30; Mon, 22 Feb 2021 08:16:09 +0000 Received: from SN1NAM02FT043.eop-nam02.prod.protection.outlook.com (2603:10b6:806:f3::4) by SN7PR04CA0259.outlook.office365.com (2603:10b6:806:f3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32 via Frontend Transport; Mon, 22 Feb 2021 08:16:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT043.mail.protection.outlook.com (10.152.72.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:08 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:15:59 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:15:59 -0800 Received: from [10.140.6.35] (port=59026 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nq-00036o-Ob; Mon, 22 Feb 2021 00:15:59 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id AA04813C01EB; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 01/22] block: add eMMC block device type Date: Mon, 22 Feb 2021 13:50:18 +0530 Message-ID: <1613982039-13861-2-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3338e57-3771-4304-95bd-08d8d70a1bbe X-MS-TrafficTypeDiagnostic: DM6PR02MB6249: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:265; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z92fr9Bf3qtq4P8KUzpkfIyIFR3zVeh/gLEQ9RevUciEcNfXLwbvxECzd7FZO3I2GnYwG9U5IoX1E5Zav1DhJ/3+syd/Zp+rTSEK0pqVv/8d8IjmX2kDGK4pR6MW7T5ulSH9t/c9u6zGplGFHKX7XGpyVhtQrXnr3WzkuY5c7EoUzCxLa/VyCnIaYMRR7hWw4viA85jpqKBk1L3+nA8z57+KssedvcX3qKwdGMTB2JsrHQdqU05vBzI1G+6rYf3T/Gai/jfsi5rYTHnFTSjtBln2gEBkY4KJBFO+PghzmiHqvP31htMezs/8Ls/nbzbAn3YdyDTaHUXZdaDMxrYuM1wGlTUAbQMfPUq0de5NCwthTwodVfgr1kvK1jXTN9BKM7qHAulTpsXGBBE+1oijT9soc9x12ScRJGAojkHOW2RZzKQIhP629K5CcikrbL/k6yE0diqHF5cJlUAClqUpnIc0oj7ZmbJxWZXImyrocIWx3SsGbb+Gg4De6w9Rg2/OBX55cqz9kqjmA3mi8Klu5d8mOaf73sOyEim7VmRsKwIL72ae4pnbjqmIiAQFdYSoxvXobcUeEk4AH7miGJ3So4D9IgegKgEbSaAMy/cgdC1tA65GovUlpb5rCKXWtyLw9iFLwqmuRpsKaWX3Ei1+7e+up5Kl0Njg5wOnzOKmrekt42xwkINNLBapW+bxEBZXtGlRgf3ph+Q+Vi/nxbQZ2Q== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(136003)(39850400004)(46966006)(36840700001)(8936002)(2906002)(36860700001)(54906003)(70206006)(5660300002)(426003)(478600001)(7636003)(42186006)(36756003)(83380400001)(26005)(36906005)(316002)(110136005)(82310400003)(356005)(70586007)(186003)(47076005)(107886003)(7416002)(8676002)(6666004)(6266002)(2616005)(4326008)(921005)(336012)(82740400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:08.7225 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3338e57-3771-4304-95bd-08d8d70a1bbe X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT043.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6249 Received-SPF: pass client-ip=40.107.94.76; envelope-from=saipava@xilinx.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vincent Palatin Add new block device type. Signed-off-by: Vincent Palatin [SPB: Rebased over 5.1 version] Signed-off-by: Sai Pavan Boddu Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater Reviewed-by: Alistair Francis --- include/sysemu/blockdev.h | 1 + blockdev.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 3b5fcda..eefae9f 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -24,6 +24,7 @@ typedef enum { */ IF_NONE = 0, IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, + IF_EMMC, IF_COUNT } BlockInterfaceType; diff --git a/blockdev.c b/blockdev.c index cd438e6..390d43c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -83,6 +83,7 @@ static const char *const if_name[IF_COUNT] = { [IF_SD] = "sd", [IF_VIRTIO] = "virtio", [IF_XEN] = "xen", + [IF_EMMC] = "emmc", }; static int if_max_devs[IF_COUNT] = { From patchwork Mon Feb 22 08:20:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F034C433DB for ; Mon, 22 Feb 2021 08:19:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04A4864DA5 for ; Mon, 22 Feb 2021 08:19:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04A4864DA5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Qp-00074F-2t for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:19:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OF-0004iJ-GI; Mon, 22 Feb 2021 03:16:23 -0500 Received: from mail-dm6nam11on2044.outbound.protection.outlook.com ([40.107.223.44]:32353 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O5-0001ki-Ep; Mon, 22 Feb 2021 03:16:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P6Eqfmw1y3/nYJWYhxDuPGc7BH/a2kjDrUOecI3TFUzWRMMP/9d2Z3k/R7Uud5hkHAM6q41nkpwcM0JMREn5nFH3tXExNE1bm+TsQ6gUfyDdGmrazrXs2pToS63d+QkXmcGiHlfGkR8Q9V3M2VeEcUMXX2Q1IEMAH2g8ZVMjVy+JVgWARB3BAEk8Tkkkb8j2XPD2G9nl8RncrMxMQmhmrvkVvYqWHoma+UD/kZOv2j1z5axHg4uvXF27++gZrHFbOYdMoa/XCh/St84IGgtV319GfKGUsR7zJTLyYB0/XMMnOk27tPwfYp0h+rsdlDRptdpot5nC2GOwFCL8L/LiAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+e9XFGU0YRS8i227VrynEUaXS6C9LJ8Z0iOADrj+eNE=; b=MHKn4NeXMlRpYdf8fXHeOeOH0deMIcHtqIAgT27TMuM0F7eXtbFnPm0IFBC+nyuSyHSIs3UvdxA+grufK8iUooO2Z5yjgjgTIgndXcLG6BUogADq+qH2XotCfT42YGJz/HwpTI4iV+LtIuc/Zv/ksDt11dIaKD3fsTJD5T5JZ8iMvSWVThdxQQE6OrNCgZVEhTYqZnzJNXd0kCD+3L03Vb/6q7X/Ji4M5w5EhFvj359iMJ894E5M8zuxldaljWZgi+3VQy0JvLU2IFoKmqQ+OKmhWlIbyRvUZVk6eU2L49eOnAmP0TLiWtxSsfmUwxtibuwFPKjNMu9kqhdd/WF8CA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+e9XFGU0YRS8i227VrynEUaXS6C9LJ8Z0iOADrj+eNE=; b=JC72Gjsz7m0cz97NNrKsuQdkfe+Jir5HPLJeM3wmNddBA1x4m7Zz668XmdzXWGdvRW0gch4EwuqdWQWacwdEa9DesN3mB0ka63Gfi0PBt8DBYBFXAh41HVTp0bxlqQ52/rbHzE4PtK9nisMj2W519XAZ/t8eckxjuXCMZdWB9v0= Received: from SN4PR0501CA0076.namprd05.prod.outlook.com (2603:10b6:803:22::14) by CY4PR02MB2757.namprd02.prod.outlook.com (2603:10b6:903:126::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:09 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::c6) by SN4PR0501CA0076.outlook.office365.com (2603:10b6:803:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.9 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:15:59 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:15:59 -0800 Received: from [10.140.6.35] (port=59028 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nq-00036p-Ot; Mon, 22 Feb 2021 00:15:59 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id AF02413C0246; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 02/22] sd: sd: Remove usage of tabs in the file Date: Mon, 22 Feb 2021 13:50:19 +0530 Message-ID: <1613982039-13861-3-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38c6200e-f75b-4c14-a4e9-08d8d70a1bf6 X-MS-TrafficTypeDiagnostic: CY4PR02MB2757: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AvC04eJLL6rZmO6DMP/K+ZPZAqUatGlzbLmYPfaXT8EepuMmqjqVy8meexUiNFWoeFOMvzwtWHSRDhUKYbVJUWa/VRukd6zY7HsbVg1JE+R1975OD6rgjzbB0g9H5T0pqYNjIHDVorYc6K/p2oeEvnnIFdBWMfpCYrIHwjtGixZ4t4jZ++PrJx7ytJVe+6E5+eOUR1SZR0TGP/hdlu8TX3OEI5RO/j2HqSROJz+7w4BiGPLQeYCCy0VZMjK0Y7qNyChuv4HjsDcK7a8/MW/bWzo4PruDfMWAhJygTDt7yQaP9ftEyjavdrXdNuXUKHe/d93wZR8r5W2FI8/bTV9ZoohlRFbPobB6VxrO4XXdg3gHuPSGEykLM6o2QcL2e0pl8vNFXhzX6ecLnktrPv0wfIEO5KmqboqLvDnJAe0SwIMvXF9/uAAj4/asm5qpVppPqRDP/WnTboeJM1b5+wJiMw6JNda3kPz2B61oqPsc+jlBH/vhBOUheU/wh3VWWblJYCoS6VAsNPP+THY/V7buih8HBUvN/kKhyGkrU2RWlFeyIm2Hkc3Y1Z+xOgXJ8N82blyWSQ/iyBWt0nmfypIXkUGNR4PXpNpe6TYdSa0vzYAjxsxLXZo69mGkYtFJPqDJStFysPsE4hw590VITCdktn5Zp9HKd0rDbpNMu/6YP5npBRUkMcf6rLyeiKxu+HtN8I+cJG5bBjWAVG3/2J/2ng== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(39850400004)(396003)(36840700001)(46966006)(8936002)(5660300002)(478600001)(70586007)(426003)(70206006)(2906002)(6266002)(54906003)(36860700001)(42186006)(83380400001)(36756003)(30864003)(26005)(110136005)(82310400003)(36906005)(47076005)(316002)(921005)(186003)(4326008)(107886003)(7416002)(8676002)(6666004)(2616005)(7636003)(356005)(82740400003)(336012)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:09.0909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38c6200e-f75b-4c14-a4e9-08d8d70a1bf6 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2757 Received-SPF: pass client-ip=40.107.223.44; envelope-from=saipava@xilinx.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Set tabstop as 4 and used expandtabs Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 190 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8517dbc..74b9162 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -332,39 +332,39 @@ static void sd_set_scr(SDState *sd) sd->scr[7] = 0x00; } -#define MID 0xaa -#define OID "XY" -#define PNM "QEMU!" -#define PRV 0x01 -#define MDT_YR 2006 -#define MDT_MON 2 +#define MID 0xaa +#define OID "XY" +#define PNM "QEMU!" +#define PRV 0x01 +#define MDT_YR 2006 +#define MDT_MON 2 static void sd_set_cid(SDState *sd) { - sd->cid[0] = MID; /* Fake card manufacturer ID (MID) */ - sd->cid[1] = OID[0]; /* OEM/Application ID (OID) */ + sd->cid[0] = MID; /* Fake card manufacturer ID (MID) */ + sd->cid[1] = OID[0]; /* OEM/Application ID (OID) */ sd->cid[2] = OID[1]; - sd->cid[3] = PNM[0]; /* Fake product name (PNM) */ + sd->cid[3] = PNM[0]; /* Fake product name (PNM) */ sd->cid[4] = PNM[1]; sd->cid[5] = PNM[2]; sd->cid[6] = PNM[3]; sd->cid[7] = PNM[4]; - sd->cid[8] = PRV; /* Fake product revision (PRV) */ - sd->cid[9] = 0xde; /* Fake serial number (PSN) */ + sd->cid[8] = PRV; /* Fake product revision (PRV) */ + sd->cid[9] = 0xde; /* Fake serial number (PSN) */ sd->cid[10] = 0xad; sd->cid[11] = 0xbe; sd->cid[12] = 0xef; - sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ + sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ ((MDT_YR - 2000) / 10); sd->cid[14] = ((MDT_YR % 10) << 4) | MDT_MON; sd->cid[15] = (sd_crc7(sd->cid, 15) << 1) | 1; } -#define HWBLOCK_SHIFT 9 /* 512 bytes */ -#define SECTOR_SHIFT 5 /* 16 kilobytes */ -#define WPGROUP_SHIFT 7 /* 2 megs */ -#define CMULT_SHIFT 9 /* 512 times HWBLOCK_SIZE */ -#define WPGROUP_SIZE (1 << (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) +#define HWBLOCK_SHIFT 9 /* 512 bytes */ +#define SECTOR_SHIFT 5 /* 16 kilobytes */ +#define WPGROUP_SHIFT 7 /* 2 megs */ +#define CMULT_SHIFT 9 /* 512 times HWBLOCK_SIZE */ +#define WPGROUP_SIZE (1 << (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) static const uint8_t sd_csd_rw_mask[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -385,31 +385,31 @@ static void sd_set_csd(SDState *sd, uint64_t size) csize = (size >> (CMULT_SHIFT + hwblock_shift)) - 1; if (size <= SDSC_MAX_CAPACITY) { /* Standard Capacity SD */ - sd->csd[0] = 0x00; /* CSD structure */ - sd->csd[1] = 0x26; /* Data read access-time-1 */ - sd->csd[2] = 0x00; /* Data read access-time-2 */ + sd->csd[0] = 0x00; /* CSD structure */ + sd->csd[1] = 0x26; /* Data read access-time-1 */ + sd->csd[2] = 0x00; /* Data read access-time-2 */ sd->csd[3] = 0x32; /* Max. data transfer rate: 25 MHz */ - sd->csd[4] = 0x5f; /* Card Command Classes */ - sd->csd[5] = 0x50 | /* Max. read data block length */ + sd->csd[4] = 0x5f; /* Card Command Classes */ + sd->csd[5] = 0x50 | /* Max. read data block length */ hwblock_shift; - sd->csd[6] = 0xe0 | /* Partial block for read allowed */ + sd->csd[6] = 0xe0 | /* Partial block for read allowed */ ((csize >> 10) & 0x03); - sd->csd[7] = 0x00 | /* Device size */ + sd->csd[7] = 0x00 | /* Device size */ ((csize >> 2) & 0xff); - sd->csd[8] = 0x3f | /* Max. read current */ + sd->csd[8] = 0x3f | /* Max. read current */ ((csize << 6) & 0xc0); - sd->csd[9] = 0xfc | /* Max. write current */ + sd->csd[9] = 0xfc | /* Max. write current */ ((CMULT_SHIFT - 2) >> 1); - sd->csd[10] = 0x40 | /* Erase sector size */ + sd->csd[10] = 0x40 | /* Erase sector size */ (((CMULT_SHIFT - 2) << 7) & 0x80) | (sectsize >> 1); - sd->csd[11] = 0x00 | /* Write protect group size */ + sd->csd[11] = 0x00 | /* Write protect group size */ ((sectsize << 7) & 0x80) | wpsize; - sd->csd[12] = 0x90 | /* Write speed factor */ + sd->csd[12] = 0x90 | /* Write speed factor */ (hwblock_shift >> 2); - sd->csd[13] = 0x20 | /* Max. write data block length */ + sd->csd[13] = 0x20 | /* Max. write data block length */ ((hwblock_shift << 6) & 0xc0); - sd->csd[14] = 0x00; /* File format group */ - } else { /* SDHC */ + sd->csd[14] = 0x00; /* File format group */ + } else { /* SDHC */ size /= 512 * KiB; size -= 1; sd->csd[0] = 0x40; @@ -503,7 +503,7 @@ static int sd_req_crc_validate(SDRequest *req) buffer[0] = 0x40 | req->cmd; stl_be_p(&buffer[1], req->arg); return 0; - return sd_crc7(buffer, 5) != req->crc; /* TODO */ + return sd_crc7(buffer, 5) != req->crc; /* TODO */ } static void sd_response_r1_make(SDState *sd, uint8_t *response) @@ -803,19 +803,19 @@ static void sd_function_switch(SDState *sd, uint32_t arg) int i, mode, new_func; mode = !!(arg & 0x80000000); - sd->data[0] = 0x00; /* Maximum current consumption */ + sd->data[0] = 0x00; /* Maximum current consumption */ sd->data[1] = 0x01; - sd->data[2] = 0x80; /* Supported group 6 functions */ + sd->data[2] = 0x80; /* Supported group 6 functions */ sd->data[3] = 0x01; - sd->data[4] = 0x80; /* Supported group 5 functions */ + sd->data[4] = 0x80; /* Supported group 5 functions */ sd->data[5] = 0x01; - sd->data[6] = 0x80; /* Supported group 4 functions */ + sd->data[6] = 0x80; /* Supported group 4 functions */ sd->data[7] = 0x01; - sd->data[8] = 0x80; /* Supported group 3 functions */ + sd->data[8] = 0x80; /* Supported group 3 functions */ sd->data[9] = 0x01; - sd->data[10] = 0x80; /* Supported group 2 functions */ + sd->data[10] = 0x80; /* Supported group 2 functions */ sd->data[11] = 0x43; - sd->data[12] = 0x80; /* Supported group 1 functions */ + sd->data[12] = 0x80; /* Supported group 1 functions */ sd->data[13] = 0x03; memset(&sd->data[14], 0, 3); @@ -940,7 +940,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ - case 0: /* CMD0: GO_IDLE_STATE */ + case 0: /* CMD0: GO_IDLE_STATE */ switch (sd->state) { case sd_inactive_state: return sd->spi ? sd_r1 : sd_r0; @@ -952,14 +952,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 1: /* CMD1: SEND_OP_CMD */ + case 1: /* CMD1: SEND_OP_CMD */ if (!sd->spi) goto bad_cmd; sd->state = sd_transfer_state; return sd_r1; - case 2: /* CMD2: ALL_SEND_CID */ + case 2: /* CMD2: ALL_SEND_CID */ if (sd->spi) goto bad_cmd; switch (sd->state) { @@ -972,7 +972,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 3: /* CMD3: SEND_RELATIVE_ADDR */ + case 3: /* CMD3: SEND_RELATIVE_ADDR */ if (sd->spi) goto bad_cmd; switch (sd->state) { @@ -987,7 +987,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 4: /* CMD4: SEND_DSR */ + case 4: /* CMD4: SEND_DSR */ if (sd->spi) goto bad_cmd; switch (sd->state) { @@ -1002,7 +1002,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case 5: /* CMD5: reserved for SDIO cards */ return sd_illegal; - case 6: /* CMD6: SWITCH_FUNCTION */ + case 6: /* CMD6: SWITCH_FUNCTION */ switch (sd->mode) { case sd_data_transfer_mode: sd_function_switch(sd, req.arg); @@ -1016,7 +1016,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 7: /* CMD7: SELECT/DESELECT_CARD */ + case 7: /* CMD7: SELECT/DESELECT_CARD */ if (sd->spi) goto bad_cmd; switch (sd->state) { @@ -1054,7 +1054,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 8: /* CMD8: SEND_IF_COND */ + case 8: /* CMD8: SEND_IF_COND */ if (sd->spec_version < SD_PHY_SPECv2_00_VERS) { break; } @@ -1072,7 +1072,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) sd->vhs = req.arg; return sd_r7; - case 9: /* CMD9: SEND_CSD */ + case 9: /* CMD9: SEND_CSD */ switch (sd->state) { case sd_standby_state: if (sd->rca != rca) @@ -1094,7 +1094,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 10: /* CMD10: SEND_CID */ + case 10: /* CMD10: SEND_CID */ switch (sd->state) { case sd_standby_state: if (sd->rca != rca) @@ -1116,7 +1116,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 12: /* CMD12: STOP_TRANSMISSION */ + case 12: /* CMD12: STOP_TRANSMISSION */ switch (sd->state) { case sd_sendingdata_state: sd->state = sd_transfer_state; @@ -1133,7 +1133,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 13: /* CMD13: SEND_STATUS */ + case 13: /* CMD13: SEND_STATUS */ switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) @@ -1146,7 +1146,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 15: /* CMD15: GO_INACTIVE_STATE */ + case 15: /* CMD15: GO_INACTIVE_STATE */ if (sd->spi) goto bad_cmd; switch (sd->mode) { @@ -1163,7 +1163,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; /* Block read commands (Classs 2) */ - case 16: /* CMD16: SET_BLOCKLEN */ + case 16: /* CMD16: SET_BLOCKLEN */ switch (sd->state) { case sd_transfer_state: if (req.arg > (1 << HWBLOCK_SHIFT)) { @@ -1180,7 +1180,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 17: /* CMD17: READ_SINGLE_BLOCK */ + case 17: /* CMD17: READ_SINGLE_BLOCK */ switch (sd->state) { case sd_transfer_state: @@ -1199,7 +1199,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 18: /* CMD18: READ_MULTIPLE_BLOCK */ + case 18: /* CMD18: READ_MULTIPLE_BLOCK */ switch (sd->state) { case sd_transfer_state: @@ -1244,7 +1244,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; /* Block write commands (Class 4) */ - case 24: /* CMD24: WRITE_SINGLE_BLOCK */ + case 24: /* CMD24: WRITE_SINGLE_BLOCK */ switch (sd->state) { case sd_transfer_state: /* Writing in SPI mode not implemented. */ @@ -1274,7 +1274,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ + case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ switch (sd->state) { case sd_transfer_state: /* Writing in SPI mode not implemented. */ @@ -1304,7 +1304,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 26: /* CMD26: PROGRAM_CID */ + case 26: /* CMD26: PROGRAM_CID */ if (sd->spi) goto bad_cmd; switch (sd->state) { @@ -1319,7 +1319,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 27: /* CMD27: PROGRAM_CSD */ + case 27: /* CMD27: PROGRAM_CSD */ switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; @@ -1333,7 +1333,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; /* Write protection (Class 6) */ - case 28: /* CMD28: SET_WRITE_PROT */ + case 28: /* CMD28: SET_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { @@ -1352,7 +1352,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 29: /* CMD29: CLR_WRITE_PROT */ + case 29: /* CMD29: CLR_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { @@ -1371,7 +1371,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 30: /* CMD30: SEND_WRITE_PROT */ + case 30: /* CMD30: SEND_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; @@ -1386,7 +1386,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; /* Erase commands (Class 5) */ - case 32: /* CMD32: ERASE_WR_BLK_START */ + case 32: /* CMD32: ERASE_WR_BLK_START */ switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; @@ -1397,7 +1397,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 33: /* CMD33: ERASE_WR_BLK_END */ + case 33: /* CMD33: ERASE_WR_BLK_END */ switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; @@ -1408,7 +1408,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 38: /* CMD38: ERASE */ + case 38: /* CMD38: ERASE */ switch (sd->state) { case sd_transfer_state: if (sd->csd[14] & 0x30) { @@ -1428,7 +1428,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; /* Lock card commands (Class 7) */ - case 42: /* CMD42: LOCK_UNLOCK */ + case 42: /* CMD42: LOCK_UNLOCK */ switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; @@ -1451,7 +1451,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_illegal; /* Application specific commands (Class 8) */ - case 55: /* CMD55: APP_CMD */ + case 55: /* CMD55: APP_CMD */ switch (sd->state) { case sd_ready_state: case sd_identification_state: @@ -1474,7 +1474,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) sd->card_status |= APP_CMD; return sd_r1; - case 56: /* CMD56: GEN_CMD */ + case 56: /* CMD56: GEN_CMD */ switch (sd->state) { case sd_transfer_state: sd->data_offset = 0; @@ -1518,7 +1518,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, req.cmd, req.arg, sd_state_name(sd->state)); sd->card_status |= APP_CMD; switch (req.cmd) { - case 6: /* ACMD6: SET_BUS_WIDTH */ + case 6: /* ACMD6: SET_BUS_WIDTH */ if (sd->spi) { goto unimplemented_spi_cmd; } @@ -1533,7 +1533,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } break; - case 13: /* ACMD13: SD_STATUS */ + case 13: /* ACMD13: SD_STATUS */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; @@ -1546,7 +1546,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } break; - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ + case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ switch (sd->state) { case sd_transfer_state: *(uint32_t *) sd->data = sd->blk_written; @@ -1561,7 +1561,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } break; - case 23: /* ACMD23: SET_WR_BLK_ERASE_COUNT */ + case 23: /* ACMD23: SET_WR_BLK_ERASE_COUNT */ switch (sd->state) { case sd_transfer_state: return sd_r1; @@ -1571,7 +1571,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } break; - case 41: /* ACMD41: SD_APP_OP_COND */ + case 41: /* ACMD41: SD_APP_OP_COND */ if (sd->spi) { /* SEND_OP_CMD */ sd->state = sd_transfer_state; @@ -1613,7 +1613,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, return sd_r3; - case 42: /* ACMD42: SET_CLR_CARD_DETECT */ + case 42: /* ACMD42: SET_CLR_CARD_DETECT */ switch (sd->state) { case sd_transfer_state: /* Bringing in the 50KOhm pull-up resistor... Done. */ @@ -1624,7 +1624,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, } break; - case 51: /* ACMD51: SEND_SCR */ + case 51: /* ACMD51: SEND_SCR */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; @@ -1808,9 +1808,9 @@ static void sd_blk_write(SDState *sd, uint64_t addr, uint32_t len) } } -#define BLK_READ_BLOCK(a, len) sd_blk_read(sd, a, len) -#define BLK_WRITE_BLOCK(a, len) sd_blk_write(sd, a, len) -#define APP_READ_BLOCK(a, len) memset(sd->data, 0xec, len) +#define BLK_READ_BLOCK(a, len) sd_blk_read(sd, a, len) +#define BLK_WRITE_BLOCK(a, len) sd_blk_write(sd, a, len) +#define APP_READ_BLOCK(a, len) memset(sd->data, 0xec, len) #define APP_WRITE_BLOCK(a, len) void sd_write_byte(SDState *sd, uint8_t value) @@ -1833,7 +1833,7 @@ void sd_write_byte(SDState *sd, uint8_t value) sd_acmd_name(sd->current_cmd), sd->current_cmd, value); switch (sd->current_cmd) { - case 24: /* CMD24: WRITE_SINGLE_BLOCK */ + case 24: /* CMD24: WRITE_SINGLE_BLOCK */ sd->data[sd->data_offset ++] = value; if (sd->data_offset >= sd->blk_len) { /* TODO: Check CRC before committing */ @@ -1846,7 +1846,7 @@ void sd_write_byte(SDState *sd, uint8_t value) } break; - case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ + case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { /* Start of the block - let's check the address is valid */ if (sd->data_start + sd->blk_len > sd->size) { @@ -1881,7 +1881,7 @@ void sd_write_byte(SDState *sd, uint8_t value) } break; - case 26: /* CMD26: PROGRAM_CID */ + case 26: /* CMD26: PROGRAM_CID */ sd->data[sd->data_offset ++] = value; if (sd->data_offset >= sizeof(sd->cid)) { /* TODO: Check CRC before committing */ @@ -1900,7 +1900,7 @@ void sd_write_byte(SDState *sd, uint8_t value) } break; - case 27: /* CMD27: PROGRAM_CSD */ + case 27: /* CMD27: PROGRAM_CSD */ sd->data[sd->data_offset ++] = value; if (sd->data_offset >= sizeof(sd->csd)) { /* TODO: Check CRC before committing */ @@ -1924,7 +1924,7 @@ void sd_write_byte(SDState *sd, uint8_t value) } break; - case 42: /* CMD42: LOCK_UNLOCK */ + case 42: /* CMD42: LOCK_UNLOCK */ sd->data[sd->data_offset ++] = value; if (sd->data_offset >= sd->blk_len) { /* TODO: Check CRC before committing */ @@ -1935,7 +1935,7 @@ void sd_write_byte(SDState *sd, uint8_t value) } break; - case 56: /* CMD56: GEN_CMD */ + case 56: /* CMD56: GEN_CMD */ sd->data[sd->data_offset ++] = value; if (sd->data_offset >= sd->blk_len) { APP_WRITE_BLOCK(sd->data_start, sd->data_offset); @@ -1987,29 +1987,29 @@ uint8_t sd_read_byte(SDState *sd) sd_acmd_name(sd->current_cmd), sd->current_cmd, io_len); switch (sd->current_cmd) { - case 6: /* CMD6: SWITCH_FUNCTION */ + case 6: /* CMD6: SWITCH_FUNCTION */ ret = sd->data[sd->data_offset ++]; if (sd->data_offset >= 64) sd->state = sd_transfer_state; break; - case 9: /* CMD9: SEND_CSD */ - case 10: /* CMD10: SEND_CID */ + case 9: /* CMD9: SEND_CSD */ + case 10: /* CMD10: SEND_CID */ ret = sd->data[sd->data_offset ++]; if (sd->data_offset >= 16) sd->state = sd_transfer_state; break; - case 13: /* ACMD13: SD_STATUS */ + case 13: /* ACMD13: SD_STATUS */ ret = sd->sd_status[sd->data_offset ++]; if (sd->data_offset >= sizeof(sd->sd_status)) sd->state = sd_transfer_state; break; - case 17: /* CMD17: READ_SINGLE_BLOCK */ + case 17: /* CMD17: READ_SINGLE_BLOCK */ if (sd->data_offset == 0) BLK_READ_BLOCK(sd->data_start, io_len); ret = sd->data[sd->data_offset ++]; @@ -2018,7 +2018,7 @@ uint8_t sd_read_byte(SDState *sd) sd->state = sd_transfer_state; break; - case 18: /* CMD18: READ_MULTIPLE_BLOCK */ + case 18: /* CMD18: READ_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { if (sd->data_start + io_len > sd->size) { sd->card_status |= ADDRESS_ERROR; @@ -2049,28 +2049,28 @@ uint8_t sd_read_byte(SDState *sd) ret = sd_tuning_block_pattern[sd->data_offset++]; break; - case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ + case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ ret = sd->data[sd->data_offset ++]; if (sd->data_offset >= 4) sd->state = sd_transfer_state; break; - case 30: /* CMD30: SEND_WRITE_PROT */ + case 30: /* CMD30: SEND_WRITE_PROT */ ret = sd->data[sd->data_offset ++]; if (sd->data_offset >= 4) sd->state = sd_transfer_state; break; - case 51: /* ACMD51: SEND_SCR */ + case 51: /* ACMD51: SEND_SCR */ ret = sd->scr[sd->data_offset ++]; if (sd->data_offset >= sizeof(sd->scr)) sd->state = sd_transfer_state; break; - case 56: /* CMD56: GEN_CMD */ + case 56: /* CMD56: GEN_CMD */ if (sd->data_offset == 0) APP_READ_BLOCK(sd->data_start, sd->blk_len); ret = sd->data[sd->data_offset ++]; From patchwork Mon Feb 22 08:20:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0309C433DB for ; Mon, 22 Feb 2021 08:20:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B80960C3E for ; Mon, 22 Feb 2021 08:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B80960C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6SC-0001dL-56 for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:20:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O6-0004Yd-U2; Mon, 22 Feb 2021 03:16:15 -0500 Received: from mail-dm6nam10on2047.outbound.protection.outlook.com ([40.107.93.47]:48609 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O3-0001jY-GH; Mon, 22 Feb 2021 03:16:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RevB8xkuxUD2erhp7Ea7Jz+RV214zMKUGW19YECmvxxCZl7RnEMqfi/2KKpUA4xbbYdi8PJ77kPH3OHKY40PdIG858D4+8dCo5XpZuAz9Ak2aaa/GqdlypQOLDDh46lR0TJamh30GqoTND2HLMFlZvTEi2v5z/U8d3LK3v+oIWG3HsRoukAX71hTlNWqtMu7RhcStvVPz29t6XCvA0xdBsK+AxeQF/ikGw+/YJ2YSx2gaidzhm4ajWtk8f54u0JY8S/1dpYxCspt/4SaGB17s74d51tC72V9b0Kc5yb+N859aY9e+SgUV9kh/Q4SkArbiWj0ksdTVv0jzEixwa/fjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c0+mhnlPyjB8La6iTFLxmLFtXlw0HL5IleRPvLVvicQ=; b=Fb9MB11k7HUe/Z9duS5yD7pxzpTAaaeMQlLEy5FBck+5vApf+UXjSDVPYAoUt0+QXWPWJhWXEtiz59Rx4tLMMDdFrdomNO93Wx0VNOj5ITFkFHRQPkmeknOiSuuUAf3nTj/UBnowdycmyyEBeF+ZoDoPieUoY564gfQ0Sq4szB4OftofxUJabUAi2URooS6VDkmgsILVnmPzs4xzUmTbgC/mSPNnFNreHHfGOPXMGriZ3gPcTWwAmvN51jXo7ZwlvG15Y/JUzbeQAUf1YH/6jHjXvFqYyCmMmQGjdMTPeiZT2Xc4PtMgT05RSif/IGpDu/9OxFgZdv6kEIbu+7Y28g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c0+mhnlPyjB8La6iTFLxmLFtXlw0HL5IleRPvLVvicQ=; b=kW8JwpW8Hmd7zI+oBfPjd15wfL7mghPpKvL2n5UJQYluXi1KtcPF0k307fKCYDr/pN/aL0i8Cb6W4e2qOdF1G64kLKVLyAkLGs3kzQR7NOk7Yy+1MdZDY3WPrORsy9P8L0qYlwCGV5zAuStHGaMqQiSe9MfZokrXvyjY7HbH62Q= Received: from SN4PR0501CA0075.namprd05.prod.outlook.com (2603:10b6:803:22::13) by DM6PR02MB6331.namprd02.prod.outlook.com (2603:10b6:5:1fa::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:08 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::f2) by SN4PR0501CA0075.outlook.office365.com (2603:10b6:803:22::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.8 via Frontend Transport; Mon, 22 Feb 2021 08:16:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:08 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:15:59 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:15:59 -0800 Received: from [10.140.6.35] (port=59030 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nq-0004Lp-PU; Mon, 22 Feb 2021 00:15:59 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id B195213C07A2; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 03/22] sd: emmc: Add support for eMMC cards Date: Mon, 22 Feb 2021 13:50:20 +0530 Message-ID: <1613982039-13861-4-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66c5a06a-febe-40cb-48d1-08d8d70a1bad X-MS-TrafficTypeDiagnostic: DM6PR02MB6331: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fYIM98YMICq7wHrBONjlWSq4sMuWuwn+SnET5PvTw1mcuy8LtEUSOiQ13VCdg97bCRQdW/Cqq0D4pw9O1Cr3ts7AqnCJtjJ73Lwk3fjjJSEcRGu1RDghWYKd5dTgMVYW8SF72lROggr/F06L2+To4LP8aqCIwI7cDXoYkc9OmN7sZ03CUT7ie97T7YgabPuD+ATR4CHbHWR38DcNTA0Q52nbhMnujeftTS2kRb5vaDmopRn3tbgbz29WDeKhXeEFEgXUAwIaWUcteKlX4wA+A5JHFgP7h0q4QvcIFsBJpJNHNRD0YRZru7Zsv8EpoeEfba7saEuEGDftxHist2Xz/2v4m0JjPNgiHpwNx1F/7dRLMDL2WhKKIwtor0KEqIBKJDJ5nQj9fb+0Fgf3y/SVZl3pMBqJ3C85mhNwfMLrzrmfSgGjAf8hBuvdf561OUdMkJAGAjjEcfDUUBcLIuvzRcUoH4DK+xvhgFPpeTBPxMzmHZLys8CRze1UYu91YHFzpgSd8Cwgo29Ee7p+lYbCUI83NWx6kY632DhSnlxly9b+H346dJ6unIIvI7VtUNM0p4xsFAFDRtMBCKnr4FaJidqNoB97ekXcpJ3ikH7UYUY2B8oqwrnyczz2EPf/rcOsjV/HqyCtitpTot8H1dDqu7n7fTSuFY6H+KFQ2sdOh9vmytVTuaANpxbeuk1nlG38hNFrORlk/gCBJ6gLjfuypg== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(39850400004)(376002)(346002)(136003)(46966006)(36840700001)(7636003)(2906002)(70206006)(36906005)(36756003)(110136005)(6666004)(70586007)(42186006)(54906003)(8676002)(82310400003)(107886003)(82740400003)(478600001)(356005)(8936002)(2616005)(83380400001)(26005)(426003)(186003)(316002)(6266002)(7416002)(47076005)(921005)(36860700001)(336012)(5660300002)(4326008)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:08.6091 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66c5a06a-febe-40cb-48d1-08d8d70a1bad X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6331 Received-SPF: pass client-ip=40.107.93.47; envelope-from=saipava@xilinx.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vincent Palatin This patch adds support for eMMC cards, change SET_RELATIVE_ADDR command to assign relative address as requested by user. Signed-off-by: Vincent Palatin Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater [spb: Split original patch series] Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 74b9162..42ee49c 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -108,6 +108,7 @@ struct SDState { uint8_t spec_version; BlockBackend *blk; bool spi; + bool emmc; /* Runtime changeables */ @@ -431,9 +432,13 @@ static void sd_set_csd(SDState *sd, uint64_t size) sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1; } -static void sd_set_rca(SDState *sd) +static void sd_set_rca(SDState *sd, uint16_t value) { - sd->rca += 0x4567; + if (sd->emmc) { + sd->rca = value; + } else { + sd->rca += 0x4567; + } } FIELD(CSR, AKE_SEQ_ERROR, 3, 1) @@ -979,8 +984,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; - sd_set_rca(sd); - return sd_r6; + sd_set_rca(sd, req.arg >> 16); + return sd->emmc ? sd_r1 : sd_r6; default: break; @@ -2176,6 +2181,7 @@ static Property sd_properties[] = { * board to ensure that ssi transfers only occur when the chip select * is asserted. */ DEFINE_PROP_BOOL("spi", SDState, spi, false), + DEFINE_PROP_BOOL("emmc", SDState, emmc, false), DEFINE_PROP_END_OF_LIST() }; From patchwork Mon Feb 22 08:20:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A51EC433E0 for ; Mon, 22 Feb 2021 08:18:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B24164EBE for ; Mon, 22 Feb 2021 08:18:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B24164EBE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6QS-0006em-IV for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:18:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O4-0004X4-JY; Mon, 22 Feb 2021 03:16:12 -0500 Received: from mail-bn8nam12on2055.outbound.protection.outlook.com ([40.107.237.55]:29795 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O0-0001i9-1B; Mon, 22 Feb 2021 03:16:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOxLXZm9QkX/YJvR5UFgl03TFCqRIr2L05pq967wpp3mxKMQG/FLxrORHOZXrb4OYt8Zhsmyh6Ck7+j6vRZo7yaO6YrEj1x47fxqOlJTGBVTsiazofnGVbxudECUSGr9IlhdOwaRxjLimz8uF4rvr983ueH04lJx+zkZtohrnp9z1kfQb+LfO2g1Dn965l6VlVgkzFXAcVGBXcQklFJdI74XyRVO92Hy/WnwT9VuzzDjf/aUsc3p+/BwcOWYKLOtSrVCvJ1+zPs588QeiOLYxjfTRKdZDfFq8mkxOyWtSdLUsQjg+j1V7juxLHJstDZWo4aqdBW+eRNvUK+QB/HJZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f+F0ocLDa7Zd899BGTGzpWOl0sKChGmJiyYbEDAklCA=; b=exbJC77veWP1jvFqua8xt3FDrigf25m++F+Y4rGAJKyW+5Dfr7N8d10bGPRaPCaCZyIWw90qiCGDarp38uDJU0rHcT6Y+2UOaXERlds5Y64xgacMS5KSe/zIDQUJlUSkr8QkQ/k4wgHXpu7JJkf46f756mLisoXbBCeEIivj87kPk4Dwv85WGUi6ovjwYJN28j2sX58KnlGXV1Jz7QnH6fP8BqDZIsUICJlpb6hbiboUevopGJKtsibDHuFFKsYNTxrlTPC7m4YMYRMtT27dYhM/wCDe891fP5ewy9/y9oN2KuA1HfNH7TKArPmYMHhhD/QvNLwsVK1RLXhHLWuyAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f+F0ocLDa7Zd899BGTGzpWOl0sKChGmJiyYbEDAklCA=; b=nhZ4gpo1uNJQIBrDbtSJrnvcd0vLzZU/isTnUf6HEhwSBpkcQA7Bl9w45xyE6OuoZSQ3UNJfXx6h/lq+hLgS02S8LepDE6KetoYPe6tKDqWuo2mYvvqVK8+QyKMi0KPM1Ct61P5Mp17B+3Ip4pNdZg3cYNOoZpa5EsdLLXpzkT8= Received: from CY4PR16CA0046.namprd16.prod.outlook.com (2603:10b6:910:60::33) by PH0PR02MB7366.namprd02.prod.outlook.com (2603:10b6:510:8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Mon, 22 Feb 2021 08:16:04 +0000 Received: from CY1NAM02FT023.eop-nam02.prod.protection.outlook.com (2603:10b6:910:60:cafe::7a) by CY4PR16CA0046.outlook.office365.com (2603:10b6:910:60::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT023.mail.protection.outlook.com (10.152.74.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:03 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:15:59 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:15:59 -0800 Received: from [10.140.6.35] (port=59032 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nq-0004Lq-R2; Mon, 22 Feb 2021 00:15:59 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id BBF8313C09CF; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 04/22] sd: emmc: update OCR fields for eMMC Date: Mon, 22 Feb 2021 13:50:21 +0530 Message-ID: <1613982039-13861-5-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 811c30d4-26dc-4e9e-3ac0-08d8d70a18ea X-MS-TrafficTypeDiagnostic: PH0PR02MB7366: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:153; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: stjI8fD7JK8KM0uenXGSHyrayoWhuPeSIjli5Qhy+0oEA/+OKyoHETiLoUMqDPwKHWg7bpZ49Xb1kttOTvh1oe0dBU9Ya5COYjuFTFFDHgkCZd/xdktHu71gOSlMkY/sG/rXu3Ti855fpIhuell1Pn1Z2b0t2cXZZPBcw4qflmdylEMqUMDNQKPbDPrO0QTBrBItpv1EapPTD57t4D2/XrdMuyzZGmeITzXJ/vm6OZPPwCyk3dchfawN6z8P19Aa88sNJqo5tviRwfwenh+cYHrL1nUXKOE4NRkYCrKG25jIqJpZFUbeZZ3RuKa4oNRvUvWySNJ8COIAWSqgh+UeclSAujw18jqK6pBcam0+htOjWNNghBdARkZwV830CICPXtfbozTbZQwq5AfYwGYgmFvaXELpST9/A4KBonlcCxv2tUNO6UPhopoKAJ5hv7/9S4/3Me6Jex0qVt3hMeTgjDK9FtyWBu9ISyph+MsWkIUk3VAauhqbLJtVcAJ/KWBHpRtcX+Eia8+Z9wagByI4WUy9URLqQJvLxUYhUR06W9CUPezpKbzbEl6Ka0VpTRWROSs29MsxYv+qHRqfB6knduQFxZBovvBYWw58ye4EQQKBbrZ+0n5dzKrCpx+Aogsmfofx6oLgrxnavuxVKeQriHw2ycZwwHuhjQzmOKoaxsMnv1L/BODDmZwJjwWDUHRyyIUE9t5aHzfpej8vcjtLeg== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(136003)(376002)(396003)(346002)(36840700001)(46966006)(316002)(110136005)(42186006)(54906003)(186003)(36906005)(82740400003)(356005)(7636003)(5660300002)(36860700001)(70206006)(70586007)(478600001)(8936002)(4326008)(82310400003)(6666004)(8676002)(2906002)(83380400001)(921005)(7416002)(47076005)(26005)(2616005)(107886003)(36756003)(6266002)(336012)(426003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:03.9943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 811c30d4-26dc-4e9e-3ac0-08d8d70a18ea X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT023.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7366 Received-SPF: pass client-ip=40.107.237.55; envelope-from=saipava@xilinx.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vincent Palatin eMMC OCR register doesn't has UHS-II field and voltage fields are different. Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 42ee49c..430bea5 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -283,6 +283,15 @@ FIELD(OCR, UHS_II_CARD, 29, 1) /* Only UHS-II */ FIELD(OCR, CARD_CAPACITY, 30, 1) /* 0:SDSC, 1:SDHC/SDXC */ FIELD(OCR, CARD_POWER_UP, 31, 1) +/* + * eMMC OCR register + */ +FIELD(EMMC_OCR, VDD_WINDOW_0, 7, 1) +FIELD(EMMC_OCR, VDD_WINDOW_1, 8, 7) +FIELD(EMMC_OCR, VDD_WINDOW_2, 15, 9) +FIELD(EMMC_OCR, ACCESS_MODE, 29, 2) +FIELD(EMMC_OCR, POWER_UP, 31, 1) + #define ACMD41_ENQUIRY_MASK 0x00ffffff #define ACMD41_R3_MASK (R_OCR_VDD_VOLTAGE_WIN_HI_MASK \ | R_OCR_ACCEPT_SWITCH_1V8_MASK \ @@ -292,8 +301,16 @@ FIELD(OCR, CARD_POWER_UP, 31, 1) static void sd_set_ocr(SDState *sd) { - /* All voltages OK */ - sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK; + if (sd->emmc) { + /* + * Dual Voltage eMMC card + */ + sd->ocr = R_EMMC_OCR_VDD_WINDOW_0_MASK | + R_EMMC_OCR_VDD_WINDOW_2_MASK; + } else { + /* All voltages OK */ + sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK; + } } static void sd_ocr_powerup(void *opaque) @@ -521,7 +538,11 @@ static void sd_response_r1_make(SDState *sd, uint8_t *response) static void sd_response_r3_make(SDState *sd, uint8_t *response) { - stl_be_p(response, sd->ocr & ACMD41_R3_MASK); + if (sd->emmc) { + stl_be_p(response, sd->ocr); + } else { + stl_be_p(response, sd->ocr & ACMD41_R3_MASK); + } } static void sd_response_r6_make(SDState *sd, uint8_t *response) From patchwork Mon Feb 22 08:20:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82556C433E0 for ; Mon, 22 Feb 2021 08:27:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7C0764E77 for ; Mon, 22 Feb 2021 08:27:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7C0764E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Z1-0001Hy-Us for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:27:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OJ-0004t6-FW; Mon, 22 Feb 2021 03:16:27 -0500 Received: from mail-mw2nam10on2046.outbound.protection.outlook.com ([40.107.94.46]:17800 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OE-0001pG-V0; Mon, 22 Feb 2021 03:16:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNpobVs8XdPoBVrc5Nm2MXJh8ii6DNV9Vl2mOtvMUo20qbAAb++LaOqvL1wdI0bS7VuyiS7xK7oR60qia4/0tXsBF+Wn7Lrp8ij2trsnkC6opgVApZemLoBgyZMW8MtANjFd4sLLUyeujs/nUmBSk2CgJNCmyK8D9ZJTKw86Ki06/Wgg4ivxH9NMlEaozo7VcTzotWVmlmjZkMO8bf2/XU6Kv2czh4vNk+O0DsiGXqLXT5PVDrZuI8fZGj1lr0oNayaPdfBr3G6BK1kUlQ+wjCKxUNy+gM9gTHWruDA1ym6orhdcJHnN+yR1dcc97Cb3snJb/j9oa7akCYqx8+QgJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YcDK66wp68Ls/9OPpGyStT159w+JN+cBUrxZemeqkpU=; b=LtP13jcS69IIg/yeokbvsrnI3cRw5vnym/t74lRagW5yKbuAT9EIy21jp1XRqpjWlB2Pmi56bS8t8CQiJVAUlYTgDcfU7HKzhaTZUI3Wa/2z3tLXkOz6WXEBDfcOYf/vyDXfBmaloKR0IGXdoSnyIQBkKlE3KDYDFtqZYa4Z7u3stJNdEng21qnSulfFFCL/FzXbBI7zU3rY/CqSul/ds7ZCsofpp/hm+9ZglkIBpWfzpxKg9eN/t3csFPC/rmnB2lsxzK8rwobjmTbCMdqFK4OSTftn/Khfq7yg54OEKXyo5GmOTr9cCfMIXuFvQiT/sDdLH3S6/F9nsLhwhDjukw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YcDK66wp68Ls/9OPpGyStT159w+JN+cBUrxZemeqkpU=; b=thhupB2WxL+qjN+Nmwp9ZZKn90LSO49hIBGa4TxMtaCPXjQX5GOtfad7YLStVVLMzxEGTqKCrW8cQMNTtkfylL3QxNnT4TYuxQ998anfRCOpxQJicwXTZDfhO8smQcPeO6lXamyvE87ts9TaAr3doAUPX4XULD+PrfkIY6LWe+c= Received: from DM3PR14CA0131.namprd14.prod.outlook.com (2603:10b6:0:53::15) by DM6PR02MB5658.namprd02.prod.outlook.com (2603:10b6:5:79::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:18 +0000 Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:0:53:cafe::2f) by DM3PR14CA0131.outlook.office365.com (2603:10b6:0:53::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59034 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-00036y-TO; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id C106413C09AA; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 05/22] sd: emmc: Add support for EXT_CSD & CSD for eMMC Date: Mon, 22 Feb 2021 13:50:22 +0530 Message-ID: <1613982039-13861-6-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc385592-a3aa-4a98-4267-08d8d70a2192 X-MS-TrafficTypeDiagnostic: DM6PR02MB5658: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: apK87TURba01JjSkI+FTdW8YBHfscwqLBMR0cdeZkLGuEXOy0Gt3GhfPfbF0zUAHa/kgWToPIMNafkX3hEkyoaPzmyhGinZroBfGj4Zv2uzyDPC6C/dLOvpF3wLR8/PlHIu5OhhX0ZQYa262w9LPvI7tEvUmoWPgxTqzDBgIay//1WVcSL2wvz2LvHlN8bxTKTrukraUQWBnqQp4axO27B5D1eLQv1U7wh4zXMoIYk1Tv838D269bHufCSLX6ovlmuuDl1bsZ98hiqRRAOymvdA6gwZXcBOTieIyh2rfrfm6RZgPISWcrYMxrqasBHuIUXLlDkoxg3wapqB5CES58ZVIH6kHG5wmz9ElgmI/c/4BTAdBbPiUWH6Jt1pCXTwTqa20kBMdB/zC7/SN7jU+TPZxYVWhwWRabW5puuSMzk+ZxiAJY8pC2TwGz6tpxB+x2C7ZKUL4n2KTLiv9/4by4E/j4ZE5xORujDxl0TeblNTwqyPgf2XcvwSkWFBPDUrDlbfzXx4yDwdG2PcCzdfUjWUf5OAMN9SNjklyc+WWtnbvwoe5APX1Q7RAexC3ZiQg1hCS0MqjCwiyms6czy/kUqWT+O3UHFrls7rdaQhc//0EGA3REY82vBeZOChFoVCMyy7hCizf5+W36LheRiyFW1RjWplgN1grH+NolbV4tGR2ExoNKqVax18hiB1x7JQ8tD2O9g8KAcZBVA5FNw0SFg== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(39850400004)(136003)(46966006)(36840700001)(921005)(83380400001)(478600001)(7416002)(70586007)(6666004)(4326008)(36756003)(8936002)(82740400003)(336012)(2616005)(356005)(316002)(7636003)(70206006)(426003)(5660300002)(54906003)(36860700001)(36906005)(42186006)(26005)(107886003)(6266002)(82310400003)(2906002)(47076005)(186003)(8676002)(110136005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:18.5173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc385592-a3aa-4a98-4267-08d8d70a2192 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5658 Received-SPF: pass client-ip=40.107.94.46; envelope-from=saipava@xilinx.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vincent Palatin eMMC CSD is similar to SD with an option to refer EXT_CSD for larger devices. Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 430bea5..4c211ba 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -135,6 +135,7 @@ struct SDState { uint64_t data_start; uint32_t data_offset; uint8_t data[512]; + uint8_t ext_csd[512]; qemu_irq readonly_cb; qemu_irq inserted_cb; QEMUTimer *ocr_power_timer; @@ -389,6 +390,51 @@ static const uint8_t sd_csd_rw_mask[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, }; +static void mmc_set_ext_csd(SDState *sd, uint64_t size) +{ + uint32_t sectcount = size >> HWBLOCK_SHIFT; + + memset(sd->ext_csd, 0, sizeof(sd->ext_csd)); + sd->ext_csd[504] = 0x1; /* supported command sets */ + sd->ext_csd[503] = 0x1; /* HPI features */ + sd->ext_csd[502] = 0x1; /* Background operations support */ + sd->ext_csd[241] = 0xA; /* 1st initialization time after partitioning */ + sd->ext_csd[232] = 0x1; /* Trim multiplier */ + sd->ext_csd[231] = 0x15; /* Secure feature support */ + sd->ext_csd[230] = 0x96; /* Secure erase support */ + sd->ext_csd[229] = 0x96; /* Secure TRIM multiplier */ + sd->ext_csd[228] = 0x7; /* Boot information */ + sd->ext_csd[226] = 0x8; /* Boot partition size */ + sd->ext_csd[225] = 0x6; /* Access size */ + sd->ext_csd[224] = 0x4; /* HC Erase unit size */ + sd->ext_csd[223] = 0x1; /* HC erase timeout */ + sd->ext_csd[222] = 0x1; /* Reliable write sector count */ + sd->ext_csd[221] = 0x4; /* HC write protect group size */ + sd->ext_csd[220] = 0x8; /* Sleep current VCC */ + sd->ext_csd[219] = 0x7; /* Sleep current VCCQ */ + sd->ext_csd[217] = 0x11; /* Sleep/Awake timeout */ + sd->ext_csd[215] = (sectcount >> 24) & 0xff; /* Sector count */ + sd->ext_csd[214] = (sectcount >> 16) & 0xff; /* ... */ + sd->ext_csd[213] = (sectcount >> 8) & 0xff; /* ... */ + sd->ext_csd[212] = (sectcount & 0xff); /* ... */ + sd->ext_csd[210] = 0xa; /* Min write perf for 8bit@52Mhz */ + sd->ext_csd[209] = 0xa; /* Min read perf for 8bit@52Mhz */ + sd->ext_csd[208] = 0xa; /* Min write perf for 4bit@52Mhz */ + sd->ext_csd[207] = 0xa; /* Min read perf for 4bit@52Mhz */ + sd->ext_csd[206] = 0xa; /* Min write perf for 4bit@26Mhz */ + sd->ext_csd[205] = 0xa; /* Min read perf for 4bit@26Mhz */ + sd->ext_csd[199] = 0x1; /* Partition switching timing */ + sd->ext_csd[198] = 0x1; /* Out-of-interrupt busy timing */ + sd->ext_csd[196] = 0xFF; /* Card type */ + sd->ext_csd[194] = 0x2; /* CSD Structure version */ + sd->ext_csd[192] = 0x5; /* Extended CSD revision */ + sd->ext_csd[168] = 0x1; /* RPMB size */ + sd->ext_csd[160] = 0x3; /* Partinioning support */ + sd->ext_csd[159] = 0x00; /* Max enhanced area size */ + sd->ext_csd[158] = 0x00; /* ... */ + sd->ext_csd[157] = 0xEC; /* ... */ +} + static void sd_set_csd(SDState *sd, uint64_t size) { int hwblock_shift = HWBLOCK_SHIFT; @@ -402,8 +448,11 @@ static void sd_set_csd(SDState *sd, uint64_t size) } csize = (size >> (CMULT_SHIFT + hwblock_shift)) - 1; - if (size <= SDSC_MAX_CAPACITY) { /* Standard Capacity SD */ - sd->csd[0] = 0x00; /* CSD structure */ + if (size <= SDSC_MAX_CAPACITY || sd->emmc) { /* Standard Capacity SD */ + if (sd->emmc && size >= SDSC_MAX_CAPACITY) { + csize = 0xfff; + } + sd->csd[0] = sd->emmc ? 0xd0 : 0x00; /* CSD structure */ sd->csd[1] = 0x26; /* Data read access-time-1 */ sd->csd[2] = 0x00; /* Data read access-time-2 */ sd->csd[3] = 0x32; /* Max. data transfer rate: 25 MHz */ @@ -447,6 +496,10 @@ static void sd_set_csd(SDState *sd, uint64_t size) sd->csd[14] = 0x00; } sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1; + + if (sd->emmc) { + mmc_set_ext_csd(sd, size); + } } static void sd_set_rca(SDState *sd, uint16_t value) From patchwork Mon Feb 22 08:20:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D55C433DB for ; Mon, 22 Feb 2021 08:35:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21D1F64E77 for ; Mon, 22 Feb 2021 08:35:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21D1F64E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6gz-0005PV-3P for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:35:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OH-0004pS-UF; Mon, 22 Feb 2021 03:16:25 -0500 Received: from mail-bn8nam08on2076.outbound.protection.outlook.com ([40.107.100.76]:20396 helo=NAM04-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OD-0001p2-QZ; Mon, 22 Feb 2021 03:16:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGmZ8UxRMjh5v6g8Cl3v/0HIhKlCIDKtJiqkMFLuFsthzuNWx6oplLNN2YJZgoU2FY4P/JeMdlXMXYShrm4AQ+0MvqXVOW3i2b5qM0PbB+/w0QxlovktPMbJ+b78Zh0hTcRX1jjopsgu3zOTJXGtHKg1qkgva7ss7qXoZknY8IPD+u2oWnw5gzdBZV124r9d+xNyItMetInQ1Xa+nSwHt3dnuaOZtilNfA6QDCDdHDAfr1nV0Yy2egIA9JNFZbZp6sehsj3YB90qLdEIaEnlKjGut3wP4NBsEIjuFk8Ysz6e1WYD9+WUbY8bTFGXccaxHlgbNoKNJpvJNVNEp8YaQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lYJbWbPg5PSh8eOo/Cg8+A8btjhpEWU4xUEXPl6QyGA=; b=BJI+RCT/uTshOBvTBF+/hkImN4fxXopXwUpRSRqZNOv57gKEpXNMqQA7ZRSErfsvdwLx8sAmUr81jw3+KAckO3wOoxN7ftBPXIFFS1ZgMMS0Pa6d2Y9J7P/g+qCWv6wH1zttp2H7F6tnE9BLF0iLZql6dyvpdLAR6SHvSq/0urf9KEVOiwTOVhN5DnoFxk5td+kyIoUqatzfLDt9z5YM6oFuakgMGTaiYhM1bRdE0bfwlKqR8bHseKB6zoWOqkdl3s4gub+1hYPXkNZyzvC0DZ5fxtEEgRawxX0t/MttrUPSl72YHmpJK7QnbsKy+1q2fNAatWwh+fmYHU+woyp6iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lYJbWbPg5PSh8eOo/Cg8+A8btjhpEWU4xUEXPl6QyGA=; b=pQd7d24PSGoCE2BOihnO9Y64RnHZ5FxBRRMWwJmp40U5p87uc289eyHRhiYW7jDNPsj8pnwTimqNM6mxbER6BN7A3QHGOaQjAewRLwxNsTk6Cv2ucV4Zr2E04lq+aVLqezM36hqfXOmSwkSyU2bgNnv0mP9EgnGYxZUmYZSxpHY= Received: from DM3PR14CA0147.namprd14.prod.outlook.com (2603:10b6:0:53::31) by MW2PR02MB3835.namprd02.prod.outlook.com (2603:10b6:907:7::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:18 +0000 Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:0:53:cafe::1e) by DM3PR14CA0147.outlook.office365.com (2603:10b6:0:53::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:17 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59036 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-00036z-TR; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id CAC8F13C0A08; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 06/22] sd: emmc: Update CMD8 to send EXT_CSD register Date: Mon, 22 Feb 2021 13:50:23 +0530 Message-ID: <1613982039-13861-7-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d995d623-88da-4afb-e532-08d8d70a210b X-MS-TrafficTypeDiagnostic: MW2PR02MB3835: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3O/bdrQdFh6r609UUG+bjLgFh6BngxCyrnXPr8vzat3sQJ/uyUcs2p2agmnMpe08mwL5FN6rFDve5YsYlvt1DAnfjRGngLGu6GLhLPYXqIUzHOkBD1PUSgj5C5kFVqRXa347+t7+pDtgjpngr4SrptCkKPD/GmUqfkG8svu5r78QwAo1rT6GCG1YHc9bdMBDRss6MLUPOazgwD3mzlCIdc7GZR+Nur1AMyhhQOywoOlzVg8LyTnze9NTjVc7QoNuX3k13JfRFs+Rxn68sVbqOuuCNzxcVjVuOweYi1MRqRI/2jcoBTLQGyHmyiEK39OPofCPWDtJzLkWzKMUP7adtFxEGUMUzZiH0zPJjYIf+I/Qp8gmHba3ZvuPBo65+mwYI1PMqs85uletWE07+C6teSdy6pETtLwjccAgsJRN167uF9NyXN5w58h1xLS1ZLcj6kMWYh3CC32+fEhtF5ToO4VJ4DFPbwlDGwHDBPHJxMSKoZuT4s6jzOmBkOj050Yspn4fPgZS1fV5gLs2kjB3sgwN7rTlt62GWfsaSNdG6gBZr5DsmRQfFCvhYN5qr1z23J93DIxhI3gkxKSqMOnUp343NBkl9NUhV6M8twvg+UmZO4MLV6tu5hP3EGDELOHJv4V2Gf7jFOvO73vZbKipp8wEYyq+3f9DT+Hf0Poxj5apC3PzXVoGEi3DaOTqANT1IUSISya73upcJtGLZ6KbyA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(136003)(39850400004)(396003)(376002)(46966006)(36840700001)(2906002)(82310400003)(356005)(83380400001)(8676002)(921005)(110136005)(336012)(107886003)(6266002)(4326008)(426003)(82740400003)(2616005)(42186006)(54906003)(6666004)(36906005)(5660300002)(186003)(70206006)(316002)(70586007)(478600001)(36756003)(7416002)(8936002)(47076005)(36860700001)(26005)(7636003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:17.6367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d995d623-88da-4afb-e532-08d8d70a210b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR02MB3835 Received-SPF: pass client-ip=40.107.100.76; envelope-from=saipava@xilinx.com; helo=NAM04-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vincent Palatin Sends the EXT_CSD register as response to CMD8. Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4c211ba..a4f93b5 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1133,24 +1133,37 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; - case 8: /* CMD8: SEND_IF_COND */ - if (sd->spec_version < SD_PHY_SPECv2_00_VERS) { - break; - } - if (sd->state != sd_idle_state) { - break; - } - sd->vhs = 0; - - /* No response if not exactly one VHS bit is set. */ - if (!(req.arg >> 8) || (req.arg >> (ctz32(req.arg & ~0xff) + 1))) { - return sd->spi ? sd_r7 : sd_r0; - } + case 8: /* CMD8: SEND_IF_COND / SEND_EXT_CSD */ + if (sd->emmc) { + switch (sd->state) { + case sd_transfer_state: + /* MMC : Sends the EXT_CSD register as a Block of data */ + sd->state = sd_sendingdata_state; + memcpy(sd->data, sd->ext_csd, sizeof(sd->ext_csd)); + sd->data_start = addr; + sd->data_offset = 0; + return sd_r1; + default: + break; + } + } else { + if (sd->spec_version < SD_PHY_SPECv2_00_VERS) { + break; + } + if (sd->state != sd_idle_state) { + break; + } + sd->vhs = 0; - /* Accept. */ - sd->vhs = req.arg; - return sd_r7; + /* No response if not exactly one VHS bit is set. */ + if (!(req.arg >> 8) || (req.arg >> (ctz32(req.arg & ~0xff) + 1))) { + return sd->spi ? sd_r7 : sd_r0; + } + /* Accept. */ + sd->vhs = req.arg; + return sd_r7; + } case 9: /* CMD9: SEND_CSD */ switch (sd->state) { case sd_standby_state: @@ -2073,6 +2086,13 @@ uint8_t sd_read_byte(SDState *sd) sd->state = sd_transfer_state; break; + case 8: /* CMD8: SEND_EXT_CSD on MMC */ + ret = sd->data[sd->data_offset++]; + if (sd->data_offset >= sizeof(sd->ext_csd)) { + sd->state = sd_transfer_state; + } + break; + case 9: /* CMD9: SEND_CSD */ case 10: /* CMD10: SEND_CID */ ret = sd->data[sd->data_offset ++]; From patchwork Mon Feb 22 08:20:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 553E3C433E0 for ; Mon, 22 Feb 2021 08:25:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F88C64E29 for ; Mon, 22 Feb 2021 08:25:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F88C64E29 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Wu-0007wn-IR for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:25:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O7-0004Yo-SI; Mon, 22 Feb 2021 03:16:16 -0500 Received: from mail-bn8nam12on2062.outbound.protection.outlook.com ([40.107.237.62]:38209 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O4-0001kH-LY; Mon, 22 Feb 2021 03:16:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DSoNUjYp4y/dUC4rOdEqCZwFzPUH98iMiP2OcnhFF4UHrRyDeVHIN2yOFTMgo4EWAZZ8pMpTZR6KtAQfPeMpYXGnBWn5fIovtXiWnTvDOlnV4XeDpQUuodbU3LH9NACeTqfJ+oNrPaHEMJiG6tgohWuzCveYia19D+C2stwH8tSJIYvdsA7BtcdNJ48fJpyFLLBecqHzOLEvVv/nENX0xWPy45MxF0IfRLAGA3c+31V8UYvkJD/NNagAirXgTomEHNCOwNjhQjb9zc4UwJ3nhc3lhFm5hT0PCh3W8bdKWrsI5BU7693XtodKlXXoI+J5iM5Rv3g9D8dnanVlOaJyWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49822Fx4kiWHj6GdrggARoggno8Z+Qc9mfLCL8CMIqE=; b=B8nQ+QqETbDvMDtr9mLY4NUCLHZwjgUtlZJxAcpDE4hfRqp1KaZR0BKI0/tx0NWcM/fQ2YvlX1P5EyvuVN9wQf/xWrfsGXY1tn5Jk1d/09eNFx+GKm4kD2Vcnn/izceJ+QEuUm7hwFyMMjcMgx1rOcOeB+0bR9QD5/X8dSVyaIAY7UTqGNm7M8B97Q3CvqQW559+zvaoBK7pKq0ExV9vMRBxvhHHs6ro+ocSL8odDEDi3cY1nDf9NUaThaiJiF2gvPIO2Gu7APB29bXk4+PPpoxUx0X+nZJwyw7NKd1zXzUnUdo/rgja9KN3+42LS2EKFZOSY/R0efk47UngjlcObQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49822Fx4kiWHj6GdrggARoggno8Z+Qc9mfLCL8CMIqE=; b=ppv1NjHYD0ADqZ8jSjK9GkI6yenprl3CRskeYh79vrcjL3/0dx0t1aLcJ8lzRTeOwXmJMdffAHXrJjdris4I9WykF1f1csyGqfx5d5Ki2y0LtcYSkNzilMk/QCnADOlfIEwFbhwSHLeaZSlaOo0G7aDZucrlxjjhWDZyxN7Y1wI= Received: from SN4PR0501CA0081.namprd05.prod.outlook.com (2603:10b6:803:22::19) by SJ0PR02MB7615.namprd02.prod.outlook.com (2603:10b6:a03:31b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Mon, 22 Feb 2021 08:16:09 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::97) by SN4PR0501CA0081.outlook.office365.com (2603:10b6:803:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.9 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59038 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-000370-U9; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id D4D6F13C0A6E; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 07/22] sd: sdmmc-internal: Add command string for SEND_OP_CMD Date: Mon, 22 Feb 2021 13:50:24 +0530 Message-ID: <1613982039-13861-8-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5eb0a9fe-6e43-4b21-4e92-08d8d70a1c49 X-MS-TrafficTypeDiagnostic: SJ0PR02MB7615: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:166; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tObXqHQv2qEkAy9pH1sCudHwCaqg35C2aojUxyxlKtUAXOAMDPbls8LrwgDjiRANd8Fxx/hqNvTUY8q5DmL2Gw5AviVJIiPYFdu/he7dCzrNj1C1NwJD5dJFLCHEHnBE4YcoIXKYrC1eou85D4Qlvn39vee6ARVImuchm0lUxp2iAvSIqY7lpzoILqBisbWnYUZm/2IyFWlZ0hl4Haima2J2ugJvMHumdStFnA4bjfiU/1kpoYIov2759GdDbunzJDUJrhDr8IHAjOL9DUy7BazxTQaSIpBDysBbnEgqFpoC8bNLdNcLHoG2agL/teZfj95iuHsfWd00NP7Rg/6Bae11kmbtUwiFhl1t1miGrfrc/fhzjd2WUTaXA0QETcyW/A9rmT+XOe5FAyJk58uIjQCZiiJ9lf2VlU1+k/IPAp0TcxGToQGIZLNvMHTQiFT1QDkKdu9m1SfTRbfaYkFI4C8oPj95Cg6vI+rBZ/LsTGaQkES40reUErFMREzNvwtUK3qlWCxmL6xe49TICk6hTAZY4oLXP6BGAfWCrM030bYgGX2xiTzeXqQn1KmBwnAKYER6DrGPdboFXIP5JAoDwWDUcLnOsOnkACAheL9LvKkNTI3yJdZMC9eCl0I11IJnCWebQ4aSPlO8O5flLhxuCBJIJCfUUBID/3YqU2KdsyXPZweZgHatHjJat0MLvtk87onporg327Pqu41XyOOwUA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(376002)(136003)(396003)(346002)(46966006)(36840700001)(8676002)(356005)(36906005)(54906003)(921005)(478600001)(316002)(82740400003)(47076005)(6666004)(7636003)(83380400001)(336012)(186003)(4326008)(42186006)(66574015)(8936002)(426003)(26005)(2616005)(110136005)(2906002)(70586007)(70206006)(4744005)(36860700001)(7416002)(82310400003)(5660300002)(107886003)(36756003)(6266002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:09.6326 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5eb0a9fe-6e43-4b21-4e92-08d8d70a1c49 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7615 Received-SPF: pass client-ip=40.107.237.62; envelope-from=saipava@xilinx.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater This adds extra info to trace log. Signed-off-by: Sai Pavan Boddu --- hw/sd/sdmmc-internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sdmmc-internal.c b/hw/sd/sdmmc-internal.c index 2053def..8648a78 100644 --- a/hw/sd/sdmmc-internal.c +++ b/hw/sd/sdmmc-internal.c @@ -14,7 +14,7 @@ const char *sd_cmd_name(uint8_t cmd) { static const char *cmd_abbrev[SDMMC_CMD_MAX] = { - [0] = "GO_IDLE_STATE", + [0] = "GO_IDLE_STATE", [1] = "SEND_OP_CMD", [2] = "ALL_SEND_CID", [3] = "SEND_RELATIVE_ADDR", [4] = "SET_DSR", [5] = "IO_SEND_OP_COND", [6] = "SWITCH_FUNC", [7] = "SELECT/DESELECT_CARD", From patchwork Mon Feb 22 08:20:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7557DC433E6 for ; Mon, 22 Feb 2021 08:33:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D55E064EE9 for ; Mon, 22 Feb 2021 08:33:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D55E064EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6f2-0001ja-Ou for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:33:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OH-0004oa-LM; Mon, 22 Feb 2021 03:16:25 -0500 Received: from mail-dm6nam10on2085.outbound.protection.outlook.com ([40.107.93.85]:43904 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OC-0001oF-Na; Mon, 22 Feb 2021 03:16:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cdy7t4aAP8D28CFh4oUQ3piErDy/zJFLHTg/BmD3dR1yW+6+neNYHBxP1pDDyyn0poF5YhLrVOnSO6RhgYAgHeTyN59p+oC1RiPmjjNvx4vmMCAtn3Kvj+eObt/5I+suY6cZb3PZWYq302S1C3opYTfUy1xMbf0pBFht1kx8c30m40QS0O+t46xr20yo5lf/mxkFc7bPWZ4ObiKT0jhlKU1JcrKgrCMsNCJV+5nC/tfnB80MV3hsXqSGufU1VMQbjVdJDHxHs6kSP4VyLwe63nUwhIMbd7fWGXvGjV04fk+BT/bbyAymprHyaQUOcYnPGE21v/XILmDz/NQX32vgdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=owCPV3kjQARbf1ccbOE1LxlZvmSn0BChFk9Xnbjeq7A=; b=ZkKE+72AbFE5dL9O81vSF8XGpQQyxF0LcyDLo4FcdbHKrDcSqUdyDL3rKQl2+c32GnEnT24rASb09v8ENtFgyQ1ultToRrCqXpNgzm8JaMDy5iv0kN5BTu6MbDLJ3YN9qkFynIPEwYaZWnGFPXJ5kDf4o0mzDNmvojPJxZmblcw15LHaIVE9Dy5L7ozaQRgo1Aj22viSxeswEvYydf5+BSd3yl7sdJtFB1eAVcpTMiRFSffH9+esyXplDiSDL3KKYLttWatNRJC3mj7snoUz0837yHSxsvsialY8fU0juLsTbRsI5HCIxQGGva2HuKuKSDj9c/DiMl4K9TH3ehzD2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=owCPV3kjQARbf1ccbOE1LxlZvmSn0BChFk9Xnbjeq7A=; b=Sk9k4tj2mhrVzJ4a8WHUVdRSqR4BO5ipKugWbG+xpcDBbvxnPd6k/tJMTVeDEioHwCG3OfoAIe1N/71WwczvPKh+dT2vF/gCO3b1JQ2uCw62b1k45fM4/1Pq3Kj0EElHxcq7DhrGxZaxodkcQD4upT3hjle5fEtE2ltwGE23q9k= Received: from DM3PR14CA0133.namprd14.prod.outlook.com (2603:10b6:0:53::17) by BY5PR02MB6417.namprd02.prod.outlook.com (2603:10b6:a03:1fe::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.34; Mon, 22 Feb 2021 08:16:16 +0000 Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:0:53:cafe::66) by DM3PR14CA0133.outlook.office365.com (2603:10b6:0:53::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:16 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59040 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-0004M3-UI; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id DC01413C0A77; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 08/22] sd: emmc: Dont not update CARD_CAPACITY for eMMC cards Date: Mon, 22 Feb 2021 13:50:25 +0530 Message-ID: <1613982039-13861-9-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ddd270c-3a84-4b35-3981-08d8d70a2036 X-MS-TrafficTypeDiagnostic: BY5PR02MB6417: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:862; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yC43w+hdHo8pUvSvSdRWVKUJR8nG7AFAVVPRSokJrheRZ0XGy+zuol6JP2+sxne+9kTN0sEIfDFPCFGgJnALGP05o7GiS6paLi5G4C7yRMaVcaZnvzXntfIc/WO2U70KYuYrPOnKyF6fm7JH3JwuhJZTfWb9nPBMp9JuMNg2auVRF+nn7hm1qIcYK6oAfT5+hkaxH8dlcyrYTpvgQSciWxj/wMxLHdruLJnMJcECKnUy5iIpXF0OUImV4Bz22rH2B4Dqm91LckB20OEYqDn1X7EptD6vtlUUdtfcKTp5GjOWzE9dT/eo/r+J7N/BB39f3zrRzj6ngCtsFqNAdeiEdvPJFEANmrkD7dmXsRm0V4ikyb9iC+1sApE1PUSIokaAHAgGV3sh0oEDagMDbEwwm3pYeLsvYk6cQ/Hlc0IoYJiI77crGHQ26GxFUE90RtCkiiVgPlISVDUm6LAvqO+6pbv8QY3IhMH/RDLMGsIcispjCsVwaoTyTIsxsJg8CcfuzFmBM23O1v3OzL9iaVjR89nMu0362b+wzs7/+s8vcbKr/6dF6H0Yd+eGXGNWgEWzm39wjFniOnyqZnQtf1Ikg3ts07DbQu0lU7QnnTfr9YYz88h6n+jAF6GmzNhD3yNjbEYXHUoM0GHDTxlg/RZmKGj0GcZgre+zciW8+ZBnd1oPrLvfpwNCSxoH/HwYy3yBn5rjhijIoOWjpyC0HRAeiiArsilMH93GlOCbbfA9wwc= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(376002)(136003)(346002)(396003)(36840700001)(46966006)(36756003)(83380400001)(26005)(47076005)(356005)(54906003)(5660300002)(6266002)(7416002)(36906005)(4744005)(921005)(107886003)(110136005)(8936002)(4326008)(6666004)(2616005)(70586007)(316002)(186003)(336012)(70206006)(426003)(478600001)(36860700001)(7636003)(82740400003)(8676002)(82310400003)(2906002)(42186006)(102446001)(192303002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:16.2354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ddd270c-3a84-4b35-3981-08d8d70a2036 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6417 Received-SPF: pass client-ip=40.107.93.85; envelope-from=saipava@xilinx.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" OCR.CARD_CAPACITY field is only valid for sd cards, So skip it for eMMC. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis --- hw/sd/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a4f93b5..9835f52 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -324,7 +324,8 @@ static void sd_ocr_powerup(void *opaque) /* card power-up OK */ sd->ocr = FIELD_DP32(sd->ocr, OCR, CARD_POWER_UP, 1); - if (sd->size > SDSC_MAX_CAPACITY) { + /* eMMC supports only Byte mode */ + if (!sd->emmc && sd->size > SDSC_MAX_CAPACITY) { sd->ocr = FIELD_DP32(sd->ocr, OCR, CARD_CAPACITY, 1); } } From patchwork Mon Feb 22 08:20:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 790A2C433DB for ; Mon, 22 Feb 2021 08:20:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA41D60C3E for ; Mon, 22 Feb 2021 08:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA41D60C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Sd-0001xs-Sb for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:20:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OA-0004Zh-K2; Mon, 22 Feb 2021 03:16:18 -0500 Received: from mail-dm6nam08on2044.outbound.protection.outlook.com ([40.107.102.44]:10784 helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O6-0001l9-VW; Mon, 22 Feb 2021 03:16:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HfrCk2KNjoWq2Ty/Sy/ZW7Fevu7nCAnYRT4ktji8Id+LrP+tSCC8Q4FzLhMmgFr/0KlgN2XuRdqnJqVnyHgwRYt4aDWb3H7ajdKw/Jr1pNpny23HCyQC1Owdi9NN1sUzgkMHY4Q9mtFJaqw1AXpMAZO4adWMVx5V9QfKGMVTuTQVys3fPN+K4RdJXNqs4ABkhOaLHQi71nWoua5gfcgVh/VGxSnMcHq4K6CnRndQAaZP61mL2e7zQvznGp/qIxcFr88twy7oQ0hV1M6zuaAiMXUgtzgOOloLAj70Rz3DvZ0ijfdgfEroR0y2nnKxZu/ILSUBFPDZhJ1MFKGw1fq/5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QCUvtISp3EkZoqzDRGXMfq7YpJHX2ZozQMfrUxT5CyE=; b=W0M/TiIV+GsJATDaDmk4BmeCa3nEaEXqb4cr39fhqKJuczjm4eC4DLXH5b7IfRsHoT3HklvXnID4iLa6+81VeW4+QfomMtH3yskOdXJpcpuKg9bJxyG5D1HGgmE0MOFrZL5eiQUTKjISyxQUS0C8r4wxBtBwXY8U6MsfIgdC8UQBmMmSaJQcuTNUAtp636QOJCVDj0oQ96PX342IFGhxdr8cTNJScKng33V5vdGi+b0PW1M6Vq+1mWLrFqQEaDivqlH3kGqWVfmcdwnwPZk1BICkDwD4gikUNZAdSI5F4mEWZdvvowWFEDDq9sIvseaFpD5JgDKlUABxRxli9lMjXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QCUvtISp3EkZoqzDRGXMfq7YpJHX2ZozQMfrUxT5CyE=; b=EfIxgSXQIBuBhiln4eQIcBSc5Rsz7UBXqGTmd2H/xcbcsVbQLQ5/9fsE0EYA0pQ0SZOozDJ3gE7o6yyJTUM1w5GO2s156V4k0fUk6Y1c29DiHUXj6YNRcWTq3c2EcEPz11WOV38auA3Dbk7QUWccvH3jejNyvW2pXimR/+9ibWo= Received: from SN7PR04CA0251.namprd04.prod.outlook.com (2603:10b6:806:f3::16) by PH0PR02MB7495.namprd02.prod.outlook.com (2603:10b6:510:12::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:09 +0000 Received: from SN1NAM02FT043.eop-nam02.prod.protection.outlook.com (2603:10b6:806:f3:cafe::ed) by SN7PR04CA0251.outlook.office365.com (2603:10b6:806:f3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT043.mail.protection.outlook.com (10.152.72.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59042 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-0004M5-Ub; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id E38B913C0A83; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 09/22] sd: emmc: Update CMD1 definition for eMMC Date: Mon, 22 Feb 2021 13:50:26 +0530 Message-ID: <1613982039-13861-10-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffb4e311-1e58-4bfe-3ccd-08d8d70a1c1e X-MS-TrafficTypeDiagnostic: PH0PR02MB7495: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NRcUcVMGIz7yW3TuYLWHcUzY1mrl5jvaqrazBKfIMndyFt+e6VYsB5ntGCo6h0SSN/Qqm0REK+ksbgwvbfzuIUEusFgBlSnv7TB+5Iie0QqZrz2YnHxlT9aOEXF8rcEkt9G7TVzE90t35LJqCgytJdqBqzD3A2c/NdXbMJ0czfLrNyavHm0VMIeuZZvdsrFx/YJBPCFrSmkXObJ2PpxqPN0g7rGrFd10TJg6a/e5yO0Pxv2rjW4fUfdvNFa0ibephUG4m2LSPaSIzhkx3y8cgP07KfxYt3yGmT216Zxty8FTUv4YjeDWUt9zSMeYu2B75hn7gmbfK1RYmSC+u3B8XZjcS0Dmtgl7lXi+rAg5S1hka9rtJwhn/n2emeaKO0E0RizrseW36PHHeeT9C/aT81NoKE5pxj8kjA3zsr9AA49oHo9MkACM5Q3SLCk5LmOk0RBjI93oHZIOFQRWhmW9pDM1TL4U6D4x6/5QgA3p1Zq4cUQY6OTV846tpZn95vFjf/wOki4Oy6+5A3gXsiKX5VLcl3NwQYxVnTjcK4UeETKYqVYaLk1BbfkzBVgCNxcvLq5MzIkL2t5nN+tEUBSY8sxOCA21LWUGC/ibdsbfB9Wl2YNt7oczw/4Gwax8dXwkteZH2Eppw8IduFgrc1gGKrkqAZJpxXO76eeQRr7S6FHzzMZxvLMjgmBxvyJ68KBOOdJ6Xhi4X0rkRNaGpgp4Tg== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(39850400004)(376002)(136003)(346002)(46966006)(36840700001)(70586007)(6666004)(316002)(42186006)(47076005)(2616005)(7416002)(36860700001)(70206006)(186003)(6266002)(36906005)(54906003)(8936002)(26005)(83380400001)(478600001)(8676002)(36756003)(2906002)(921005)(356005)(7636003)(82310400003)(426003)(82740400003)(110136005)(336012)(107886003)(5660300002)(4326008)(4744005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:09.3504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffb4e311-1e58-4bfe-3ccd-08d8d70a1c1e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT043.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7495 Received-SPF: pass client-ip=40.107.102.44; envelope-from=saipava@xilinx.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add support to Power up the card and send response r3 in case of eMMC. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis --- hw/sd/sd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9835f52..8bc8d5d 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1033,8 +1033,16 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; case 1: /* CMD1: SEND_OP_CMD */ - if (!sd->spi) + /* MMC: Powerup & send r3 + * SD: send r1 in spi mode + */ + if (sd->emmc) { + sd_ocr_powerup(sd); + return sd->state == sd_idle_state ? + sd_r3 : sd_r0; + } else if (!sd->spi) { goto bad_cmd; + } sd->state = sd_transfer_state; return sd_r1; From patchwork Mon Feb 22 08:20:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FD54C433E0 for ; Mon, 22 Feb 2021 08:30:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5F2264E00 for ; Mon, 22 Feb 2021 08:30:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5F2264E00 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6cE-0006XJ-SV for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:30:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OF-0004iV-G5; Mon, 22 Feb 2021 03:16:23 -0500 Received: from mail-co1nam11on2063.outbound.protection.outlook.com ([40.107.220.63]:49921 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OC-0001o4-Jl; Mon, 22 Feb 2021 03:16:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EDLsrrdt3MB5KoX7mUdOAN/87oDBFwc8Lsek4QBsLhYgEVAhyvwPlz+dPpLTXfBffCzySoHJGyiT20ArhmCyza8nr4Tvo6XcXpYD02aN84Iu+YrqyGRT7Kig8Zdrm3Q7+xMyygmFw8OHwzXILz6p7Jyf6Vwr/pxI712eJQihzoP+u4Ixbt9JuRwYUsUc8Odf2Fo8AhMjUrtAgMFENLaNDuZbaNTEOXZQvgceVvuhqwg4JfeMjOV0Bd3kSwG6mSAcGIlXgNPEcJwYoMJEJZJraR0thPLqQc/MhQ4rYDB3HWtQayS3qEtKfkc0Png7fkLTCIErGJKcvyEsVoe9AYE8zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bReCfou5wyjo9QA3gvSeJrzqiJLk3BT/gbk9q9Qwi8o=; b=EmkrI3Xi4hFpCHPUJJS+4ajiIdeBXhoA3kVEywXHJ30+FIDQt4C/bJSsGUOyHEk0CTMrHG2gVmcs+eDOxqeyYwwvYUBdoFu+qe1ECQYRdKvZ/cMQWdzTCPo7gd2gioDFt5RP//epwPTaUY6HnX8oHLNBYdwkNp9UMNmXUCxty3NwYAajuA42eO9kaN+siY9D2RNmgKv0wdCiL5Kd+Z9hFzPRMGTyEX0pjbFEVOWVYQcBZ/8jaShO7sOb97YF7QGz05V8ICX25VbnP1nYhAXDrlmpaRd1Kl/dCk3gIyRtDwxy0SdexfzdsTwik4H5Sy/EhKD28lUJ/UJwczl8IiJXng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bReCfou5wyjo9QA3gvSeJrzqiJLk3BT/gbk9q9Qwi8o=; b=hvCDvIGNVRkUa/m4rUr6ekPWRmljeh5J74bf6J7IUQKWGKqEnYKdJrTZyJFYezqvghKbGuFzswWT31+xIGbOrMgKcwg5JUPYWLL2YZVCVfeMmBsHXPTf3i+U/GUlRA/zMiBCNa9HIDfEMwbofOEJgfs5nPmaMoVSI/hIKRlgAA8= Received: from CY4PR18CA0064.namprd18.prod.outlook.com (2603:10b6:903:13f::26) by BYAPR02MB5414.namprd02.prod.outlook.com (2603:10b6:a03:95::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:16 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::2e) by CY4PR18CA0064.outlook.office365.com (2603:10b6:903:13f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:16 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59044 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-000371-Up; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id EB0AB13C0A8B; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 10/22] sd: emmc: support idle state in CMD2 Date: Mon, 22 Feb 2021 13:50:27 +0530 Message-ID: <1613982039-13861-11-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78d314f6-f31a-4e75-c915-08d8d70a207f X-MS-TrafficTypeDiagnostic: BYAPR02MB5414: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O0y4OZxGHb8MVMPimFTGo7bBq0IVu8PId4Xe48BEocgr6Nvdnsi0oQdRs9XTFoOpd7U6kyrCthxhLs7B5Qi4e2nybFMEEvrR21S7EeiogO82N5SRbncKstnP2OmfEDtg+5KmzfTyYIdAkNm/4TR8XE0oN4R11u+SbCNmdY+1cteWr/LkA5H7Zs5Xsmh4WXou1Dlus47UzkS5GAr7Y3qukBds2QogySH3BQNV4JwZmsAAb4pnzWxTuUuZYnt8ObuqfEKybUn61SJLMY2PB4ldBlKn+/DQn8xnCCMJZHK+E1Zc8uerSv4SmyU0xtN0zR7qlYC64gJfd7MDjwVU9IqZifRnf1B/MlBW0Ahj/cHUqUor6nWSCVSFZPJkmhu5O2HqXqvGfJQy+6SYAQEImHy5x7WyLPC/3LS9BMLOztn7cPrgCpUJrN8jVP1RZU6OWA4hL26WDVy1wMhEI97IG4zj48CTuWcuobDWjK2Q2KFfenr4gnBGFi3RAxEupPW395F2LIi1MAAYdNxHsv9Hwtg6DR4Iskbs9JY5qHR34w4maErjqj1m30PH/ETZZJQruzr6E2meI5y0R/NnmHttGDbjw/m3W4dYj9PB2SQTrHtWOKxvRBLYe3SS87GXfQcQ7KpGu82s84PuX20OIuLpo6VRQ2iOXDzodSzO5grP+l1Ow/+lWfet08Vlc++bVQ400pkh1cARsLdWeFEzAaZqhTGUgw== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(39850400004)(346002)(136003)(376002)(46966006)(36840700001)(6266002)(70586007)(36860700001)(70206006)(6666004)(336012)(426003)(7416002)(54906003)(82310400003)(316002)(26005)(42186006)(8676002)(110136005)(4326008)(478600001)(107886003)(186003)(2616005)(7636003)(47076005)(36906005)(82740400003)(2906002)(83380400001)(5660300002)(356005)(4744005)(36756003)(921005)(8936002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:16.7175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78d314f6-f31a-4e75-c915-08d8d70a207f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5414 Received-SPF: pass client-ip=40.107.220.63; envelope-from=saipava@xilinx.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" eMMC is expected to be in idle-state post CMD1. Ready state is an intermediate stage which we don't come across in Device identification mode. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis --- hw/sd/sd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8bc8d5d..ae5c5e8 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1051,6 +1051,10 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) if (sd->spi) goto bad_cmd; switch (sd->state) { + case sd_idle_state: + if (!sd->emmc) { + break; + } case sd_ready_state: sd->state = sd_identification_state; return sd_r2_i; From patchwork Mon Feb 22 08:20:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC5AC433E0 for ; Mon, 22 Feb 2021 08:26:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC14564E92 for ; Mon, 22 Feb 2021 08:26:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC14564E92 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Y4-0000MK-12 for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:26:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OG-0004lg-Ix; Mon, 22 Feb 2021 03:16:24 -0500 Received: from mail-bn8nam11on2046.outbound.protection.outlook.com ([40.107.236.46]:17377 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OD-0001ot-B2; Mon, 22 Feb 2021 03:16:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOGiwTNz1hGDjIT3Q9FZqBDYeP1JNQlyaz+3mBS94VaBrJSbGD/ljnmJ7KIOKAe422Wms/Yo5PyIoOWIzykj0R9ockP5dJA3XeB0MKJDIvdY9Qi6Q3sxZ+gfVmz2HEJqKFadNvHuQQJOKB1HWIZt3Qx6WIzD3qZOZdM8yTK+L5pUR2St5XJtikDhc6haQOF/fmePp14bNU0VhChOSYVEEdqqQ5Tyl6RUFa5KxGp35Du6NoG7dx7ByoPilW2XEQrq9AliQhW4HqqOw1gkIvZFStHDikGW/bT6fNGHaeBM7Z5wP4NLWvzLcwMyDE7D56nBTKkmwD6ERhTLQh33uhP6aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HdcxjJOnUS44mzIzeRMKZBaeJI+cGAne7OCsEsnZDKE=; b=VPkgMzCJsVu8/gaT2C/ihpltlRuy4+hzqGphWkR68goVkpxUno83HUAyxWgP04ckgdR9AiZOuYrE6Rx9VIMWMRr7GTUTcw1ycv3kNt9Ls/vFLXSqItum7wArh2pJT7JKb82zvCZzWIeZZ7Cd0iAPLenjxv/chk+L75Anp2jvl6MOv+vD5ekon/H6HdsnYfLu/R5OVEJ7lLh26SO3JvCqxGPInHPNMYt+Byp1hwRLk4GoYOKNs0ErbyUsxYmNAEwoNWTN+WgSspz/udUesL/CnA9kCw/6ivLMvCfmTUutTMNwmQFNVF4HJk4JmGxmigOeOF0CArfsCZQiAFocg0MH0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HdcxjJOnUS44mzIzeRMKZBaeJI+cGAne7OCsEsnZDKE=; b=LhNLrc8K9TPDWtBz+EU6BJZL7luueH+wVJJM0ufU1HSwsGPpqYC+twUBUaFfl2+XoKRfDm4kzz8A8fyRZ+kjdAIUR+FHQveM22JZWPQ+VBNEsozYYzV/RHx0ZYfau5hLMxwTEn+sXCcVq1/tlAAFFxBpOP7BB8+sNOZeBLKeGWc= Received: from CY4PR18CA0068.namprd18.prod.outlook.com (2603:10b6:903:13f::30) by BYAPR02MB4167.namprd02.prod.outlook.com (2603:10b6:a02:fb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:18 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::13) by CY4PR18CA0068.outlook.office365.com (2603:10b6:903:13f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59046 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nr-000372-WA; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id F283C13C0A9D; Mon, 22 Feb 2021 13:50:57 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 11/22] sd: emmc: Add mmc switch function support Date: Mon, 22 Feb 2021 13:50:28 +0530 Message-ID: <1613982039-13861-12-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d59440bf-2869-4611-f276-08d8d70a216c X-MS-TrafficTypeDiagnostic: BYAPR02MB4167: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RABzgN3dmQNamS3/PKxGoROsVf7KavYoIkhYDrUxxf94v8gTlPDGy9MwcE7CoI8BVsP+arrqjL+M2mwYWTkTryPX9BT6+bCycuZh4Naf38PypO6m+8A7QxE09ylBbd4aNzCP9cDm0hZx0qTaJZqY1OBfUrX2Qj/ouc4ljJM9VwOoXMUoSGt8uH8bvYtV38vGxfsmatExbFOeMAalhKWFeZ6yQlQ9wqfDSfcPhZrRRPO0yZbwYWEgDG18umUh7rQ8jZeUfx1HoZBHMuc2wDsZO9qszryIZ+IiRJoPY2I2b5Qid923dGnYqJeRJ97xjYo+IlGXJnfjTuvGtUCI9SEo0oByd22168Dqx+rP7e1zAbcxVcXly2ls1xLFWycVNrEPj3ALs4vpU38WnuNQd0gRlnjc0U6USdPKgX3MT6HpU8y8pAnPCfxAW1JHw3bVIG5WCPX+qP0J80wFcbXqoNTZN7ISoTJQcYBpYeDDyuazsLDHtY52J2jovoYYlj1cVn91tbJWFuy+GrpcGZiy6sT11i/bZ82f+99v+I8mmGlL36dsDFTM90tuNKXoZvL/kY4ux4vF1A3LffqFroGbPd8b9d8hbBpQck4MgkneW2G4VwPYJ6KcGPbtjuF5tgwgZGJpYQ2pAm6ls6UVjqGbBhsxBWTKfpe5IypGOsjcwqyFG/GIz51l4RR0Kh10QTUl02Y+0w2zT3gtUn9mkONFMJ8e0g== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(39850400004)(136003)(376002)(396003)(36840700001)(46966006)(70206006)(36860700001)(336012)(921005)(8936002)(36756003)(356005)(2906002)(5660300002)(82740400003)(107886003)(70586007)(42186006)(8676002)(4326008)(36906005)(110136005)(316002)(6266002)(82310400003)(7416002)(426003)(186003)(2616005)(6666004)(54906003)(7636003)(26005)(83380400001)(478600001)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:18.2728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d59440bf-2869-4611-f276-08d8d70a216c X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4167 Received-SPF: pass client-ip=40.107.236.46; envelope-from=saipava@xilinx.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" switch operation in eMMC card updates the ext_csd register to request changes in card operations. Here we implement similar sequence but requests are mostly dummy and make no change. Implement SWITCH_ERROR if the write operation extends goes beyond length of ext_csd. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias --- hw/sd/sd.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index ae5c5e8..e50d40b 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -515,6 +515,7 @@ static void sd_set_rca(SDState *sd, uint16_t value) FIELD(CSR, AKE_SEQ_ERROR, 3, 1) FIELD(CSR, APP_CMD, 5, 1) FIELD(CSR, FX_EVENT, 6, 1) +FIELD(CSR, SWITCH_ERROR, 7, 1) FIELD(CSR, READY_FOR_DATA, 8, 1) FIELD(CSR, CURRENT_STATE, 9, 4) FIELD(CSR, ERASE_RESET, 13, 1) @@ -878,6 +879,43 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr) return ret; } +enum { + MMC_CMD6_ACCESS_COMMAND_SET = 0, + MMC_CMD6_ACCESS_SET_BITS, + MMC_CMD6_ACCESS_CLEAR_BITS, + MMC_CMD6_ACCESS_WRITE_BYTE, +}; + +static void mmc_function_switch(SDState *sd, uint32_t arg) +{ + uint32_t access = extract32(arg, 24, 2); + uint32_t index = extract32(arg, 16, 8); + uint32_t value = extract32(arg, 8, 8); + uint8_t b = sd->ext_csd[index]; + + switch (access) { + case MMC_CMD6_ACCESS_COMMAND_SET: + qemu_log_mask(LOG_UNIMP, "MMC Command set switching not supported\n"); + return; + case MMC_CMD6_ACCESS_SET_BITS: + b |= value; + break; + case MMC_CMD6_ACCESS_CLEAR_BITS: + b &= ~value; + break; + case MMC_CMD6_ACCESS_WRITE_BYTE: + b = value; + break; + } + + if (index >= 192) { + sd->card_status |= R_CSR_SWITCH_ERROR_MASK; + return; + } + + sd->ext_csd[index] = b; +} + static void sd_function_switch(SDState *sd, uint32_t arg) { int i, mode, new_func; @@ -1097,12 +1135,18 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case 6: /* CMD6: SWITCH_FUNCTION */ switch (sd->mode) { case sd_data_transfer_mode: - sd_function_switch(sd, req.arg); - sd->state = sd_sendingdata_state; - sd->data_start = 0; - sd->data_offset = 0; - return sd_r1; - + if (sd->emmc) { + sd->state = sd_programming_state; + mmc_function_switch(sd, req.arg); + sd->state = sd_transfer_state; + return sd_r1b; + } else { + sd_function_switch(sd, req.arg); + sd->state = sd_sendingdata_state; + sd->data_start = 0; + sd->data_offset = 0; + return sd_r1; + } default: break; } From patchwork Mon Feb 22 08:20:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 434ABC433DB for ; Mon, 22 Feb 2021 08:24:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F0B560C3E for ; Mon, 22 Feb 2021 08:23:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F0B560C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Va-0005n4-JI for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:23:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OH-0004nK-5s; Mon, 22 Feb 2021 03:16:25 -0500 Received: from mail-eopbgr760081.outbound.protection.outlook.com ([40.107.76.81]:59396 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OD-0001oq-C7; Mon, 22 Feb 2021 03:16:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xpj9c3tWS7XG7AU1oTz8n4VkR4Iiugo+ZkR70d8cPa3+x3kqZGjuaML9xkg204IfdzS8ZPFOlBAWDSgxN2E3aalGEocmz6rKtbjVAK/x7q+lB/BNVjjWbvfyeyW9vbK+Mi0+h0pZmowgODV6IDD1usqMYYU3s55tAM/S80WQ6FhMYTcQrAuBc8E9ZW2JOM2DLWlmLnJcyWqxhnaUoobiByYgtFT+yVuQ1O08UQSo3OTb7248EMGmf/ROzbDwiB/XbPHgxHXOTMGl6+BtapJaEknOqju9n1viZJltDe2EkuGVITpiAtp92gIDjHV2bSsNL0E4jt5tOiDwB8SP/NRMqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nIVxXGsVxwnC7SUqsi7fE/rw+hELAEn+5axvjCHb0lg=; b=XeO2MJXJGery/n7sb9FrSTym0pRztbVbAu0VS3b/Z4yrOi+yIuhp8LUGMaLUeJfAhgIB88EZL52Das/8bh7UZV07kDGpGNMnbEfHAX/q5/fkiOARMwL3JvQyyRUdAfueS+2aN2SKdHFoWMXa5Iz+WCU2jx0A+WZQll52szeyiyNB7KlySYUYNHjBbVFtjzxCqKOQ9NzH9XliGQkee1WbkjQCVtJO3hceqH+xBTVfdZRmSMWI/2B6Qk3qROhz2kTDZWJCZ3DiF0MjdzpTn/nd0wZF36Th97LUZsW67wNOt5c72jC5N2qzAHPvCdN5/HxcLPxDSdbIKb59rVhVJT+Y5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nIVxXGsVxwnC7SUqsi7fE/rw+hELAEn+5axvjCHb0lg=; b=aa5QLlh90IasCmHkgLQCHFZeqv1KtnoRShCYzdjJSyNoVgXGklr7ruhJ3I1GUDBBRBwrn39ALXRicMFbyPpTiSB4biLv4Y21dJrHtp42vai78GUrS9xCL+P7Ow8RgD3Vo3TCeDCDtJhHNpq3qxrOULjSw60zFdaDIXsGiAyoRSc= Received: from CY4PR18CA0064.namprd18.prod.outlook.com (2603:10b6:903:13f::26) by BYAPR02MB4248.namprd02.prod.outlook.com (2603:10b6:a02:fe::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:18 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::2e) by CY4PR18CA0064.outlook.office365.com (2603:10b6:903:13f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:17 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59048 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-0004M6-00; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 064CB13C0AA0; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 12/22] sd: emmc: add CMD21 tuning sequence Date: Mon, 22 Feb 2021 13:50:29 +0530 Message-ID: <1613982039-13861-13-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcb33f0b-d340-4a16-3b55-08d8d70a2120 X-MS-TrafficTypeDiagnostic: BYAPR02MB4248: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G3JQU6d6vk91BrkoAm62zOsXL2YE0VeGhoAC4Z5Zz5tXZ5TeHFDBDEK/Nh8494oUwnRiNO8uBzxU8rz3Odn0ydo5vo2w4vbTtdNxpkGNOIhr6L3VDkSsQigmGZ5Xh38gOJKl2nIDfmJ780aBO6W7HWo2cBJp3xf9UhyGV9+ujQEZvWhSZonsD/IVMs8hUTRvo5TYdRaSCGw6zPFMLg3oqGyZ99AXhc2fEkMb8nJ+0lG3yqg9zKNzOZWng6OD9Xlab2iEQZruFKspBujq2MXuHcuVoXRYRNEP8S1F9kGLSs/Jdo0OcsYh+huLDB/wvyHK0V0rYDpckHPVNMMv9FDPTM/zsdbqrq5Y5wDbab4U0j7Z0Y2AMFcIGJ0aI+nb3N3CySwuGOcXSDpAWnr6p56/wHYsqp2n3RiBwscRLLQuIniROrWuL4WsHPtrXHGIB89qKYqBVV7qJDG5ImqdxfGVQpl2WE0yo7kw/TMDPN2Bi5eej1YxV6DnVtnzLmsnjVpX+ccVhVK1FXts0yVtBuUXGRn1LBxXOEONA5ZI18DRYGqedxvQk95ixemlpLr390M9cEC19Z49lX84eNo6J6amSAIMyY0eDphvivmO00I1r7XJYCtxgD2sawIfzTjFh+DArfjYDpe7+MwPPpJ9ni17vDpTkW80eg9lJKXT4j2UIilsGcJflYlJMcCUnzB8hbrTmsR1DVBTQKK4+h8h+houlQ== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(46966006)(36840700001)(82740400003)(7636003)(478600001)(2906002)(6666004)(26005)(70206006)(70586007)(5660300002)(186003)(921005)(36756003)(356005)(336012)(47076005)(54906003)(7416002)(426003)(107886003)(6266002)(36860700001)(2616005)(110136005)(4326008)(8676002)(83380400001)(36906005)(42186006)(82310400003)(316002)(8936002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:17.7700 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcb33f0b-d340-4a16-3b55-08d8d70a2120 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4248 Received-SPF: pass client-ip=40.107.76.81; envelope-from=saipava@xilinx.com; helo=NAM02-CY1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" eMMC cards support tuning sequence for entering HS200 mode. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias --- hw/sd/sd.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index e50d40b..d702027 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1378,6 +1378,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) } break; + case 21: /* CMD21: mmc SEND TUNING_BLOCK */ + if (sd->emmc && (sd->state == sd_transfer_state)) { + sd->state = sd_sendingdata_state; + sd->data_offset = 0; + return sd_r1; + } + break; + case 23: /* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { break; @@ -2112,6 +2120,30 @@ static const uint8_t sd_tuning_block_pattern[SD_TUNING_BLOCK_SIZE] = { 0xbb, 0xff, 0xf7, 0xff, 0xf7, 0x7f, 0x7b, 0xde, }; +#define EXCSD_BUS_WIDTH_OFFSET 183 +#define BUS_WIDTH_8_MASK 0x4 +#define BUS_WIDTH_4_MASK 0x2 +#define MMC_TUNING_BLOCK_SIZE 128 + +static const uint8_t mmc_tunning_block_pattern[128] = { + 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, 0xcc, + 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff, + 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, 0xff, + 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, 0xdd, + 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb, + 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, 0xff, + 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, 0xff, + 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, + 0x00, 0xff, 0xff, 0xcc, 0xcc, 0xcc, 0x33, 0xcc, + 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, + 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xee, 0xee, + 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0xdd, + 0xdd, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, + 0xbb, 0xbb, 0xff, 0xff, 0xff, 0x77, 0xff, 0xff, + 0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee, +}; + uint8_t sd_read_byte(SDState *sd) { /* TODO: Append CRCs */ @@ -2205,6 +2237,21 @@ uint8_t sd_read_byte(SDState *sd) ret = sd_tuning_block_pattern[sd->data_offset++]; break; + case 21: /* CMD21: SEND_TUNNING_BLOCK (MMC) */ + if (sd->data_offset >= MMC_TUNING_BLOCK_SIZE - 1) { + sd->state = sd_transfer_state; + } + if (sd->ext_csd[EXCSD_BUS_WIDTH_OFFSET] & BUS_WIDTH_8_MASK) { + ret = mmc_tunning_block_pattern[sd->data_offset++]; + } else { + /* Return LSB Nibbles of two byte from the 8bit tuning block + * for 4bit mode + */ + ret = mmc_tunning_block_pattern[sd->data_offset++] & 0x0F; + ret |= (mmc_tunning_block_pattern[sd->data_offset++] & 0x0F) << 4; + } + break; + case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */ ret = sd->data[sd->data_offset ++]; From patchwork Mon Feb 22 08:20:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C176BC433E0 for ; Mon, 22 Feb 2021 08:23:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1778760C3E for ; Mon, 22 Feb 2021 08:23:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1778760C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6V7-0005GR-Tp for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:23:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O8-0004Yx-GQ; Mon, 22 Feb 2021 03:16:16 -0500 Received: from mail-eopbgr770055.outbound.protection.outlook.com ([40.107.77.55]:6233 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O5-0001km-BB; Mon, 22 Feb 2021 03:16:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHG4Sns00HnIzsvch6dAjZwuDdZWJYXMi/XzDuLS9K2m5wvhA8Rcx0SGS3d/RsEeLNidp/CXOKwEjQARXZqZwB6RD5T1LgPy/UbLBUUQsMFDJpOmd4WMuX1IVd+bpDCCivcU+VyP+JHobayrCI5o0x+/jol+yOg8K7DiliewwwqWxO8Os66dbqeQo1qdvJBiMwDHGu/4n9qRktMnQ89U9RFXJd4YEf4v4d/f7vps1JCp42c/qtWTSk7Es8Wvob+2kTtdObKp1SLPR/sE3wsH5bVNtK4HyIaINhJazgdSrp7v6BQxAkbQNVFlMflnFW9AeKoMs/9DqSA/dInblUGu9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0NL0dSWRxPmLCDs88BzOyU1QICg06Ag38KcRR2Wkz0Q=; b=Ej5DnsInM1MxVbS68+WMpUw7v5QkwYDB2H9MnqTgo2CgZAWVJDfmtEZCjO466N2APBWWbaotfhBPIVRBdTSh4fmKzj4j8TaZ5LyPg2b513/U5bvB3Bu1deyYh8TT2yuCKStCpEF3IU9xoIMw5KGufImL5ZGKp0njoGAQcttMtFjmeSM37bBgaSVhQCBRgdCizc3y3Zgs8meWO4F2nSo17i4JTHZ5lC81y0Z4LYHnrd/fqkjQF9itQasWQ4O4kIoUKkDyaMvhhQHESjMWp6tpxVj4oFxP2xhnkYhdTZ9uj6hrArR51rnqjYtlA/2f8A+eUwgclf8g7e0O60InEzYIlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0NL0dSWRxPmLCDs88BzOyU1QICg06Ag38KcRR2Wkz0Q=; b=PdGVsiOXpFGRQtbfPOddKEOzyhNg2Zz5t5Zjk1GxW6L77Pvo7UvL4hKaEcgpk+TSRr19/7sSidU2J9HKL9OJaN7wyMUkuRxV2AmBi43QOMvP7+/qxHWO3TozjPk0AEA8P/nVaEIrAgu2h12KDOl9DDQFy+Ldsonvw6T/wfEPlmw= Received: from SN4PR0501CA0094.namprd05.prod.outlook.com (2603:10b6:803:22::32) by BYAPR02MB4805.namprd02.prod.outlook.com (2603:10b6:a03:4a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:10 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::52) by SN4PR0501CA0094.outlook.office365.com (2603:10b6:803:22::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.11 via Frontend Transport; Mon, 22 Feb 2021 08:16:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:10 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59050 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-0004MA-F2; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 0B49013C09D2; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 13/22] sd: emmc: Make ACMD41 illegal for mmc Date: Mon, 22 Feb 2021 13:50:30 +0530 Message-ID: <1613982039-13861-14-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b13a9f0-2359-41b6-879e-08d8d70a1c99 X-MS-TrafficTypeDiagnostic: BYAPR02MB4805: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dOSTh/PyGAlXWhNxn5Qh+hiznFPSVb3cNq8ydCBPcPffmo+DU+HYIYKtcfvBpG8CndBSO+gKEI4z3zvQ1UK0k5CUOFjLagqcza2gm0k0h0LvQIYpy+PHxqu24DibhhVO5Es4VexLxr88J7eK9fVboeqfBxCP3fAEDlNE/mrofK+SVWNvn2lHQDHZvv+qZhS0ImidR1oWNkMH7GZLAt+VXh7bRzMbies+E2knZPZWEURdp38fv1gYuEKD3LsdmirVPzvauZA3Wgl3/dEIUhyGQtyRnoNWWMBjMh9uO3NJbb/ufG+sDZHXg+07tJC+qTQ7RbSh6Sw/aeKzR/qXQ+NJiBzpQpwGF+7VzIJ4lN5pNavjo7NIPRHJ1co+VFViEJ4M4LKBvP19QIri2DTywHhwGF6oEshaRPbOJAdakD0596Ba9gFmmhZXzaopH/HKQscrsnMuLcc7pYW0cNJeAsZ2k7vauk2v/zRDZXYPeIP2XsTWPcEJtQPDmX8il4XmYuo2/c7LSpuE92xj1arxlIlYFYWKBpNXeTKDiiQ6sujsayHGA0O9YaPvy5/CH3hbCmswp35wxHVm/ZIYiZM2zDBCT/qGAzFr60oVqN6ZejThRkF1r8VslcwnDeQaHQBerJ6YQXWr9KVNqrO921+qi0dfb4bMvQsFFpohkXWY40eKsTB+3kL33mZDxuQ7MNC/BXnBtwmzmpPcFLyKVwNh7eCShA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(39850400004)(346002)(46966006)(36840700001)(47076005)(82310400003)(110136005)(70206006)(70586007)(6666004)(82740400003)(336012)(54906003)(316002)(26005)(7416002)(36756003)(426003)(2906002)(2616005)(921005)(356005)(36906005)(8936002)(8676002)(42186006)(186003)(4326008)(478600001)(6266002)(4744005)(5660300002)(107886003)(36860700001)(7636003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:10.1584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b13a9f0-2359-41b6-879e-08d8d70a1c99 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4805 Received-SPF: pass client-ip=40.107.77.55; envelope-from=saipava@xilinx.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" ACMD41 is not applicable for eMMC. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias --- hw/sd/sd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index d702027..df82b61 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1729,6 +1729,9 @@ static sd_rsp_type_t sd_app_command(SDState *sd, break; case 41: /* ACMD41: SD_APP_OP_COND */ + if (sd->emmc) { + break; + } if (sd->spi) { /* SEND_OP_CMD */ sd->state = sd_transfer_state; From patchwork Mon Feb 22 08:20:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89EC3C433E0 for ; Mon, 22 Feb 2021 08:37:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3ED7064DD3 for ; Mon, 22 Feb 2021 08:37:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ED7064DD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6ip-00012o-7D for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:37:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OI-0004r8-Ee; Mon, 22 Feb 2021 03:16:26 -0500 Received: from mail-eopbgr750055.outbound.protection.outlook.com ([40.107.75.55]:12871 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OE-0001pL-N3; Mon, 22 Feb 2021 03:16:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NjSWPUoiOjnEnWP3Q72L8z4ppS/LAaDW8bYjz+BTNCKVOf0v2F1/ySvK9g4eqgdkBO1C5wBNHca5Rbprs2rmSocKZ4lQGFNOyQDnSUHw4djJp8TvebkFEDNKwLok+CxWGL42t75YQf1gBsNRG+Mrxiwp/WdlpzR2iVdNJRIrdLQrS9ZmAZ+HFLiHcH4sWl3HYF8h2HbOrTc5vXF3t8w+r5toPaRCm/FlORDBwOV+KUXkVisj5Eygd7fX7GFJ3isCDGxyMQZR75ggxBPFrSAwbvcVKDKynVW/jpnh23dokw2z9TxFzDizwkuisL4hLtiTjfcgqiZIaHT0eiLmTtBNEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pKSIYvISE4ty4kmLpUX8iLRfjf6XZh4BybAMEcaMb7U=; b=eK1BOg9NdZ8o7RBjOMQarkaNITRJx4/dPKRYTI9zlvoY3qhk6mBGw2m1rddAG4PaCNsEN3g+Sg+4FVA5pJ9JaTdd+nUevbo4BRzjM1sE1mMnioDfPKwkceK4hQZoEdOp6gbpi4HzxTiRAbWOoqT0dhbCxf+YZIPMXW/znsBuWQoDK3bDZdIOGoW7zX6/xkurt/qAP9wIgU4m9EaiX6GXTWE9htcCPXooqbw6fo89LSZys3gB+L89G0jeQV7gfCuhB8XR/CWEt0awFMBwDlxyQL3fyVbjrtYaMQCZY8twlXKxpsF/e3vc1CxO4nYGIWHKg2zb8LwAIiFOzSs0kIY7uQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pKSIYvISE4ty4kmLpUX8iLRfjf6XZh4BybAMEcaMb7U=; b=pabv0foL0UVP343jpwQ2KKia7YUMzAcfYl/xecIJvlslUZkZ1j+VRCSwSf1p2Se8GIrflWi912vVBzllbDX09/HJDnFQ/N9K9PbKBdLpu4nqNLm5PJF61whzdAxsr737RXF4rRcUKrQJ8zko3Yx8pD04wGgjrH8tDu5ySkdKBeI= Received: from CY4PR18CA0057.namprd18.prod.outlook.com (2603:10b6:903:13f::19) by BYAPR02MB5496.namprd02.prod.outlook.com (2603:10b6:a03:a4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:19 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::46) by CY4PR18CA0057.outlook.office365.com (2603:10b6:903:13f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:00 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59052 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-0004MB-FG; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 151F313C0AD2; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 14/22] sd: emmc: Add support for emmc erase Date: Mon, 22 Feb 2021 13:50:31 +0530 Message-ID: <1613982039-13861-15-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05a744dd-7a9e-44bb-67ef-08d8d70a21c5 X-MS-TrafficTypeDiagnostic: BYAPR02MB5496: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:626; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qugq3myo1g4CIDVorBYHQ8l7gY15V2jvfTpHbNIczuiaVk3+j7a9Vi2Y+QiAjVTv9onb0/RWSpVSpg5Ua3VhzFsT4Zm8kxqH1Jku5FsqCkDdjYSsjsPNe63JTSrg4dADL8QVs1MO2Yui3NOuE+2Ojl4QfkFZdMjnAv1zanbX1fgx3eOP/sxA5Xye0rT1iTHujpjOHRAZlw6rWxE6EN5YUTKBnsyz/XKWv7IWHpqgCt3qXrR0w3IMcK8D+Sj322g9Ua8G6fuWFug8LsXuGBCh1i+GmmVnoQWSruRPmXuDQkJ2RGgSIqnjQCpCVreeu7/zfDY+qkdGcnLdV9PbYowgPeILZ+ilmws+BhtSX2Z7J7LXfEwJkM3HhF6RNWYzPY35ub94gPncRYcjXsNsfyX49cHW8lxMPvxhgvsC+YvejUcckzp+9gNNXZbgKZ9r04IJXnukjE1lr4FBWBYfobbBimYJAzWSffDEnbiP+d3VJL7dT4aG8l9naFpfIkmXPciVuMIb7G64mg6i3oV3fVlfsvf00srL3zSNBPc2kQG25TIQeh6Oo2guGUASm+8EIwgNhQxqKUvPaycJGNrU/EdxFakehYOQ5/F8fYtSIBCBdVWogJ/I40iqHxgoXx05bmr8WpwD7+rBEa1mwsWS8RESz1cjSyRZscUKdwLG7nMynutDbEVIB+cO83GFn1moZrB/m7ypoz3hR9sJQjiMiX0+dQ== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(396003)(346002)(39850400004)(136003)(36840700001)(46966006)(6666004)(36756003)(921005)(47076005)(4326008)(7416002)(107886003)(42186006)(316002)(82740400003)(5660300002)(4744005)(186003)(426003)(478600001)(2616005)(336012)(26005)(6266002)(7636003)(110136005)(70586007)(83380400001)(8936002)(82310400003)(8676002)(36906005)(2906002)(356005)(54906003)(70206006)(36860700001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:18.8535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05a744dd-7a9e-44bb-67ef-08d8d70a21c5 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5496 Received-SPF: pass client-ip=40.107.75.55; envelope-from=saipava@xilinx.com; helo=NAM02-BL2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add CMD35 and CMD36 which sets the erase start and end. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias --- hw/sd/sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index df82b61..6d2ef2b 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1544,6 +1544,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) /* Erase commands (Class 5) */ case 32: /* CMD32: ERASE_WR_BLK_START */ + case 35: /* CMD35: ERASE_GROUP_START */ switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; @@ -1555,6 +1556,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) break; case 33: /* CMD33: ERASE_WR_BLK_END */ + case 36: /* CMD36: ERASE_GROUP_END */ switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; From patchwork Mon Feb 22 08:20:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA944C433DB for ; Mon, 22 Feb 2021 08:21:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4224260C3E for ; Mon, 22 Feb 2021 08:21:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4224260C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6T5-0002Xv-Lr for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:21:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OC-0004cS-Ra; Mon, 22 Feb 2021 03:16:20 -0500 Received: from mail-co1nam11on2067.outbound.protection.outlook.com ([40.107.220.67]:7424 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O8-0001n3-PZ; Mon, 22 Feb 2021 03:16:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TA42uDtEXkROnSo05z9pnMfCJFsxchls+1Cwtn7RqM5FjbbaTFjUlLZe77C0nLD4YBKIg2ZLfw6GogqXWy7YFNqQPrwJO+nAWzTDoycWSUyIs/m87TUcR6sNsCh7IWI1OWtHRKxN6WBhuHvhTL5ZPnQ0LqnGl4+LB+PYf2AP1BBl+f4+4zf2bMCHa7YSsQUWtBAKcnCN4c2D3RRMlpwP7erUvp749Hh+zvxy6X3PKzDRT7F7P3RHT5u6wWkuW1dJ2xIn3mrQ1m6sLQJvOh9hkAnNV1zesADViedI1I98XBoBC9ZgTlBiv/8kV5TSVU+tStz9ATs00EVrensp2LdqlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oQEYKZgbFLJYb7UP3r/0/Os+2TpCqx+Ck+8z+FDvzTM=; b=dZDcSIyutLOhR8WV0fOE68SoInPshf0LsBw6ApbtTWFJNZ4GYYQF67nHa+oT1lWkdVZFqtnQgmgWpdM7qC1oeZIj6n/o9T9wOJylvk2HTtdh4Ah7EnY1lM7HnI/NsLReGP3AjbGub64SJw+IKAyvVP5xeEOJ62UgTzUGVyui0Fotp0KJPENYOnLgmu61sTo1bvbtedKWk+Z3liMN0/BkPAj8+NnZMUB7JhKp+s2FTG0MEFPKxzemq8NcCZZxkwFV4i0cy9J4McGVj7Tesz4MNdmQEi5le99o3YJO6YmBvmS3hEzlhedupYEqx1T4AkTKhv284pE0VF1s1jIeCYc18g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oQEYKZgbFLJYb7UP3r/0/Os+2TpCqx+Ck+8z+FDvzTM=; b=Fj/H3Vze7eue/KJFLOTncjJmaPXmbRUvhhBYOG4td1tQpMSA2WUa0upXYjn9hiFFjvLKpeW6AktTrr4w0LFrW/5bxH8AVyi+O1ESxgNC5XJw9otcKgjKj/9/cAwUXd7vuEX10uzglVQO1lmov8M6GA8FxJ/Mli0DK96pLDH4kGw= Received: from SN4PR0501CA0074.namprd05.prod.outlook.com (2603:10b6:803:22::12) by MW2PR02MB3738.namprd02.prod.outlook.com (2603:10b6:907:f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:11 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::f0) by SN4PR0501CA0074.outlook.office365.com (2603:10b6:803:22::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.8 via Frontend Transport; Mon, 22 Feb 2021 08:16:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:11 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59054 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nt-0004ND-2o; Mon, 22 Feb 2021 00:16:01 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 1CA6313C0ADA; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 15/22] sd: emmc: Update CID structure for eMMC Date: Mon, 22 Feb 2021 13:50:32 +0530 Message-ID: <1613982039-13861-16-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb7a7608-6744-4ae1-d480-08d8d70a1d6d X-MS-TrafficTypeDiagnostic: MW2PR02MB3738: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6X0U0a6Wb0ZPi+cQxjTTc7MGZNCZ8Olu2ecnhCui7i+oRn/YCXFgTiy5QgLirVxcDnwxIXQ3FRDvJXtUmN2R1LPDK+FfKaqnft+ibpYkj/KvS91eN2yHqSaRQbZqG4DWc0xGC/VQTQHoL4Icm74NlSk0+NQGAkMyjIxUSXiQQhTHmF9i3q6xTy7wtfcn30WcMbn/nDBtq7xY8qkJgFPOcsuWkIled206QNc7F5zYTwwaDWWD2WKVBbvnxock6DWrn4N3yYOXap+O9wRja5uPn+phVQhVv/2jSZwc+vp4z5g700Fu/Xk56Xcsy8quhCusa9teS0XQxsH0TbJx6fYtR8gamOamoyRxcFPM0OLe0iLXl/jrNh3amkOlUB2YPMVKaoyvfmWx88MgIm4QrAqGIirefSS7ubzQSFnK6E1boNPUinh9EToA15Qd7GBfG+3MvNXihffieEuMMDW6QyQxbRrcR2rOH2Aj5D9Tf3nxj+CdZ6tARjSC5JTuLmxXybtnSvFdu2td8z0rt6Z7TYMx7whUMYKke5N08Gal4JiApkHmWNd7zSziw9gnH5NQryJj3N1ufn5U1QOW0iMUsMsc/6ani24fzR7FWPawY48a97BG+IaWOLQaBAIWhalTsI+RMGoE29uStqAPtr5GnF8J9CirVaC03qxVDDj6szF0cCQblPiMNGMfTIxH9s41CLZMdWED/nZlR2r5cygukW2NYw== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(396003)(136003)(376002)(346002)(36840700001)(46966006)(336012)(107886003)(426003)(36860700001)(2616005)(6266002)(47076005)(7416002)(4326008)(82310400003)(54906003)(42186006)(36906005)(8676002)(110136005)(356005)(83380400001)(7636003)(6666004)(316002)(478600001)(2906002)(8936002)(70206006)(82740400003)(921005)(36756003)(186003)(26005)(5660300002)(70586007)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:11.5487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb7a7608-6744-4ae1-d480-08d8d70a1d6d X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR02MB3738 Received-SPF: pass client-ip=40.107.220.67; envelope-from=saipava@xilinx.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" CID structure is little different for eMMC, w.r.t to product name and manufacturing date. Signed-off-by: Sai Pavan Boddu Signed-off-by: Edgar E. Iglesias --- hw/sd/sd.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 6d2ef2b..3c24810 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -361,23 +361,36 @@ static void sd_set_scr(SDState *sd) static void sd_set_cid(SDState *sd) { - sd->cid[0] = MID; /* Fake card manufacturer ID (MID) */ - sd->cid[1] = OID[0]; /* OEM/Application ID (OID) */ - sd->cid[2] = OID[1]; - sd->cid[3] = PNM[0]; /* Fake product name (PNM) */ - sd->cid[4] = PNM[1]; - sd->cid[5] = PNM[2]; - sd->cid[6] = PNM[3]; - sd->cid[7] = PNM[4]; - sd->cid[8] = PRV; /* Fake product revision (PRV) */ - sd->cid[9] = 0xde; /* Fake serial number (PSN) */ - sd->cid[10] = 0xad; - sd->cid[11] = 0xbe; - sd->cid[12] = 0xef; - sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ - ((MDT_YR - 2000) / 10); - sd->cid[14] = ((MDT_YR % 10) << 4) | MDT_MON; - sd->cid[15] = (sd_crc7(sd->cid, 15) << 1) | 1; + if (sd->emmc) { + sd->cid[0] = MID; + sd->cid[1] = 0x1; /* CBX */ + sd->cid[2] = OID[0]; /* OEM/Application ID (OID) */ + sd->cid[8] = 0x0; + sd->cid[9] = PRV; /* Fake product revision (PRV) */ + sd->cid[10] = 0xde; /* Fake serial number (PSN) */ + sd->cid[11] = 0xad; + sd->cid[12] = 0xbe; + sd->cid[13] = 0xef; + sd->cid[14] = ((MDT_YR - 1997) % 0x10); /* MDT */ + } else { + sd->cid[0] = MID; /* Fake card manufacturer ID (MID) */ + sd->cid[1] = OID[0]; /* OEM/Application ID (OID) */ + sd->cid[2] = OID[1]; + sd->cid[8] = PRV; /* Fake product revision (PRV) */ + sd->cid[9] = 0xde; /* Fake serial number (PSN) */ + sd->cid[10] = 0xad; + sd->cid[11] = 0xbe; + sd->cid[12] = 0xef; + sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ + ((MDT_YR - 2000) / 10); + sd->cid[14] = ((MDT_YR % 10) << 4) | MDT_MON; + } + sd->cid[3] = PNM[0]; /* Fake product name (PNM) 48bit */ + sd->cid[4] = PNM[1]; + sd->cid[5] = PNM[2]; + sd->cid[6] = PNM[3]; + sd->cid[7] = PNM[4]; + sd->cid[15] = (sd_crc7(sd->cid, 15) << 1) | 1; } #define HWBLOCK_SHIFT 9 /* 512 bytes */ From patchwork Mon Feb 22 08:20:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F36CC433DB for ; Mon, 22 Feb 2021 08:28:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2A4B64E77 for ; Mon, 22 Feb 2021 08:28:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2A4B64E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6aM-0002xQ-CA for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:28:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OC-0004b8-EZ; Mon, 22 Feb 2021 03:16:20 -0500 Received: from mail-dm6nam12on2080.outbound.protection.outlook.com ([40.107.243.80]:51424 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O7-0001lM-2W; Mon, 22 Feb 2021 03:16:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wjlncpa2n2YxQiy2RZpovTGrvGRWglZXv2OGRZZ1pBJlO1JoPwhFdBvAacwwFTWTR4eq31CsTy3rZMrpOIZygcgffC4zVHWrFDwKMoRfJ/2LbBMBVAnJ5qqquYUY6I1I60Pw0s8i7npUnou8geCvRk/Gn80+xCEBU4cfKGJ5HZT6o8Q5+F15L3PZM4J3qolZaMGU24Saf8OXIkSWzr1XZ34CfvUpkPPHrCo+RYTy2ShdOOImnbxvWXjOgZHD688P71eWji8pt1ybSFdrsKAopGfWx7RtJynj0cbjGHhCq8P4Gd1+ekW576Qi3E1aVnIVBxzXpjUtS2o1DQ07oTTy2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YQMm632hilFjeSSYZ3K3ZR2y6Qo3HDU6ZYN+c6ieYck=; b=k8M4+AXhJZ3vwFeWArprzNrHvAGJ4fw3I9WDrXJJDKr35Xxb9Ovk22h2xmSjNz7O24/382iqsNjo/FdeeCLpVVItAVyP6bvTkcFKx5U8B+OVxC6yHcNj6jcckomo06lT5DKWyTZsimSecbQRnjFvGkI3fLp0mjf88gc+lemBWVU6AKJg10QQXYJUwrMt854HijsCB41kte01KGHZf9TN2RZk+dPYkszF4wwQIC+9iW2BtHfLLXsEvV/ObvM05NQ3i1uAqKDpKEFxnrMQ+LKdhKdZIBaesrvCyCb0y7fow+2QMMg1Or37dkqrHeHGN1L5L1/KjudWyrSaIQDIalvjjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YQMm632hilFjeSSYZ3K3ZR2y6Qo3HDU6ZYN+c6ieYck=; b=fYxGL4ysbdjeDDbhtYCwQ+7Gm+9H8gvcYMujQODtqsRWQMHTHxqraIfCGrjoF7Kw4X7cMIqh4ZKi7zusH5I3+nt8GuFam8nRhtN+0nY13+Br788w+qzrxNTilHvn4qwCvS3ZsrCKW5uuB3vGzS6cIKuYobwYEvLePPPYIV4QXBc= Received: from SN4PR0501CA0081.namprd05.prod.outlook.com (2603:10b6:803:22::19) by SN6PR02MB4447.namprd02.prod.outlook.com (2603:10b6:805:a7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Mon, 22 Feb 2021 08:16:11 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::97) by SN4PR0501CA0081.outlook.office365.com (2603:10b6:803:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.9 via Frontend Transport; Mon, 22 Feb 2021 08:16:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:11 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59036 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-00036z-KR; Mon, 22 Feb 2021 00:16:01 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 21A5813C0AB5; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 16/22] sd: emmc: Add Extended CSD register definitions Date: Mon, 22 Feb 2021 13:50:33 +0530 Message-ID: <1613982039-13861-17-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3435c39-6814-4c97-6abd-08d8d70a1d33 X-MS-TrafficTypeDiagnostic: SN6PR02MB4447: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:51; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d/mC+QJ9+sTR5Z+OxW2+ZyIB7vpilBpHbOZHvmT7A4TRuzvDtuXzSA218Eqv/IubUR4no/U9YPKXhtUxo3rWGeeh2ZOuotZHLDA5qa1MFJOlvP4Bx3pFLtoPrcRNhTCWQQoj0lYc2lrMN2Eak+QR9spivbhnebwj1yVVA1bsD/2jW/+W8bsHMZW5heIv91Pmmr9c2NEp+PQ2ssldJH2+WYTIOhOvY1Z/0wiLcM3poLVUpHHqNpYrgDsqletaZFvmUArZli9zkay3EkFEEM2YqjWzw/9KCT4Qg2kCTPPNPN2RTHpBrBV8IzkTq0TP773qaQ71HLjqvJT6CIIhqnsfoC99QZAIs59cMvfvUXetln7feL8BXS58yKnrRPv77MaDByoImCSVDFwapKPKLGp8P0fpFqy5hJuNTUrnq48kPNRv7GEwbKl6VinGRfGubfDu35hHnGns/4EF6TnZovR+6f/fpC0pGQF8JEdWLn7o7lmgZucoahFwBKPGHz8R6BcJfW7zChvmpg09ozZWRtfZuy2rjazvyWI7VMLuLO45Sn57Tk6wFuFZYsisVPXrgCsdvxEwyFIVanDFq/CT02qJudB/rT9sywo3KZnnvIqlvxM5Z0HYQ790hxysJHn/mPMWrR7sCqMajjQAWM2X7RSxwk8SEbIs+fwNY75+1oz9I1lTU8q6l01YzJVeGEPnwCvINiZbqpSlBYigg1kQoEMfzg== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(346002)(39850400004)(376002)(396003)(46966006)(36840700001)(4326008)(8676002)(70206006)(26005)(478600001)(186003)(70586007)(8936002)(83380400001)(5660300002)(6266002)(36756003)(2906002)(7636003)(82740400003)(36906005)(356005)(316002)(36860700001)(82310400003)(66574015)(107886003)(2616005)(110136005)(336012)(42186006)(47076005)(921005)(6666004)(7416002)(54906003)(426003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:11.1679 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3435c39-6814-4c97-6abd-08d8d70a1d33 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4447 Received-SPF: pass client-ip=40.107.243.80; envelope-from=saipava@xilinx.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Add user friendly macros for EXT_CSD register. Signed-off-by: Cédric Le Goater [spb: Rebased over versal emmc series, updated commit message] Signed-off-by: Sai Pavan Boddu --- hw/sd/sdmmc-internal.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/sd/sd.c | 54 +++++++++++++++------------- 2 files changed, 126 insertions(+), 25 deletions(-) diff --git a/hw/sd/sdmmc-internal.h b/hw/sd/sdmmc-internal.h index d8bf17d..7ab7b4d 100644 --- a/hw/sd/sdmmc-internal.h +++ b/hw/sd/sdmmc-internal.h @@ -37,4 +37,101 @@ const char *sd_cmd_name(uint8_t cmd); */ const char *sd_acmd_name(uint8_t cmd); +/* + * EXT_CSD fields + */ + +#define EXT_CSD_CMDQ_MODE_EN 15 /* R/W */ +#define EXT_CSD_FLUSH_CACHE 32 /* W */ +#define EXT_CSD_CACHE_CTRL 33 /* R/W */ +#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ +#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */ +#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */ +#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */ +#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ +#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ +#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ +#define EXT_CSD_PARTITION_SETTING_COMPLETED 155 /* R/W */ +#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ +#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ +#define EXT_CSD_HPI_MGMT 161 /* R/W */ +#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ +#define EXT_CSD_BKOPS_EN 163 /* R/W */ +#define EXT_CSD_BKOPS_START 164 /* W */ +#define EXT_CSD_SANITIZE_START 165 /* W */ +#define EXT_CSD_WR_REL_PARAM 166 /* RO */ +#define EXT_CSD_RPMB_MULT 168 /* RO */ +#define EXT_CSD_FW_CONFIG 169 /* R/W */ +#define EXT_CSD_BOOT_WP 173 /* R/W */ +#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ +#define EXT_CSD_PART_CONFIG 179 /* R/W */ +#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ +#define EXT_CSD_BUS_WIDTH 183 /* R/W */ +#define EXT_CSD_STROBE_SUPPORT 184 /* RO */ +#define EXT_CSD_HS_TIMING 185 /* R/W */ +#define EXT_CSD_POWER_CLASS 187 /* R/W */ +#define EXT_CSD_REV 192 /* RO */ +#define EXT_CSD_STRUCTURE 194 /* RO */ +#define EXT_CSD_CARD_TYPE 196 /* RO */ +#define EXT_CSD_DRIVER_STRENGTH 197 /* RO */ +#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */ +#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */ +#define EXT_CSD_PWR_CL_52_195 200 /* RO */ +#define EXT_CSD_PWR_CL_26_195 201 /* RO */ +#define EXT_CSD_PWR_CL_52_360 202 /* RO */ +#define EXT_CSD_PWR_CL_26_360 203 /* RO */ +#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ +#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ +#define EXT_CSD_S_C_VCCQ 219 /* RO */ +#define EXT_CSD_S_C_VCC 220 /* RO */ +#define EXT_CSD_REL_WR_SEC_C 222 /* RO */ +#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */ +#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ +#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ +#define EXT_CSD_ACC_SIZE 225 /* RO */ +#define EXT_CSD_BOOT_MULT 226 /* RO */ +#define EXT_CSD_BOOT_INFO 228 /* RO */ +#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ +#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ +#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ +#define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_PWR_CL_200_195 236 /* RO */ +#define EXT_CSD_PWR_CL_200_360 237 /* RO */ +#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */ +#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */ +#define EXT_CSD_BKOPS_STATUS 246 /* RO */ +#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ +#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ +#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ +#define EXT_CSD_FIRMWARE_VERSION 254 /* RO, 8 bytes */ +#define EXT_CSD_PRE_EOL_INFO 267 /* RO */ +#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A 268 /* RO */ +#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B 269 /* RO */ +#define EXT_CSD_CMDQ_DEPTH 307 /* RO */ +#define EXT_CSD_CMDQ_SUPPORT 308 /* RO */ +#define EXT_CSD_SUPPORTED_MODE 493 /* RO */ +#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ +#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ +#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ +#define EXT_CSD_MAX_PACKED_READS 501 /* RO */ +#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */ +#define EXT_CSD_HPI_FEATURES 503 /* RO */ +#define EXT_CSD_S_CMD_SET 504 /* RO */ + +/* + * EXT_CSD field definitions + */ + +#define EXT_CSD_WR_REL_PARAM_EN (1 << 2) +#define EXT_CSD_WR_REL_PARAM_EN_RPMB_REL_WR (1 << 4) + +#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) +#define EXT_CSD_PART_CONFIG_ACC_DEFAULT (0x0) +#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) + +#define EXT_CSD_PART_CONFIG_EN_MASK (0x7 << 3) +#define EXT_CSD_PART_CONFIG_EN_BOOT0 (0x1 << 3) +#define EXT_CSD_PART_CONFIG_EN_USER (0x7 << 3) + #endif diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 3c24810..60799aa 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -409,41 +409,45 @@ static void mmc_set_ext_csd(SDState *sd, uint64_t size) uint32_t sectcount = size >> HWBLOCK_SHIFT; memset(sd->ext_csd, 0, sizeof(sd->ext_csd)); - sd->ext_csd[504] = 0x1; /* supported command sets */ - sd->ext_csd[503] = 0x1; /* HPI features */ - sd->ext_csd[502] = 0x1; /* Background operations support */ + sd->ext_csd[EXT_CSD_S_CMD_SET] = 0x1; /* supported command sets */ + sd->ext_csd[EXT_CSD_HPI_FEATURES] = 0x3; /* HPI features */ + sd->ext_csd[EXT_CSD_BKOPS_SUPPORT] = 0x1; /* Background operations + support */ sd->ext_csd[241] = 0xA; /* 1st initialization time after partitioning */ - sd->ext_csd[232] = 0x1; /* Trim multiplier */ - sd->ext_csd[231] = 0x15; /* Secure feature support */ - sd->ext_csd[230] = 0x96; /* Secure erase support */ - sd->ext_csd[229] = 0x96; /* Secure TRIM multiplier */ - sd->ext_csd[228] = 0x7; /* Boot information */ - sd->ext_csd[226] = 0x8; /* Boot partition size */ - sd->ext_csd[225] = 0x6; /* Access size */ - sd->ext_csd[224] = 0x4; /* HC Erase unit size */ - sd->ext_csd[223] = 0x1; /* HC erase timeout */ - sd->ext_csd[222] = 0x1; /* Reliable write sector count */ - sd->ext_csd[221] = 0x4; /* HC write protect group size */ - sd->ext_csd[220] = 0x8; /* Sleep current VCC */ - sd->ext_csd[219] = 0x7; /* Sleep current VCCQ */ - sd->ext_csd[217] = 0x11; /* Sleep/Awake timeout */ + sd->ext_csd[EXT_CSD_TRIM_MULT] = 0x1; /* Trim multiplier */ + sd->ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] = 0x15; /* Secure feature + support */ + sd->ext_csd[EXT_CSD_SEC_ERASE_MULT] = 0x96; /* Secure erase support */ + sd->ext_csd[EXT_CSD_SEC_TRIM_MULT] = 0x96; /* Secure TRIM multiplier */ + sd->ext_csd[EXT_CSD_BOOT_INFO] = 0x7; /* Boot information */ + sd->ext_csd[EXT_CSD_BOOT_MULT] = 0x8; /* Boot partition size. 128KB unit */ + sd->ext_csd[EXT_CSD_ACC_SIZE] = 0x6; /* Access size */ + sd->ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] = 0x4; /* HC Erase unit size */ + sd->ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT] = 0x1; /* HC erase timeout */ + sd->ext_csd[EXT_CSD_REL_WR_SEC_C] = 0x1; /* Reliable write sector count */ + sd->ext_csd[EXT_CSD_HC_WP_GRP_SIZE] = 0x4; /* HC write protect group size */ + sd->ext_csd[EXT_CSD_S_C_VCC] = 0x8; /* Sleep current VCC */ + sd->ext_csd[EXT_CSD_S_C_VCCQ] = 0x7; /* Sleep current VCCQ */ + sd->ext_csd[EXT_CSD_S_A_TIMEOUT] = 0x11; /* Sleep/Awake timeout */ sd->ext_csd[215] = (sectcount >> 24) & 0xff; /* Sector count */ sd->ext_csd[214] = (sectcount >> 16) & 0xff; /* ... */ sd->ext_csd[213] = (sectcount >> 8) & 0xff; /* ... */ - sd->ext_csd[212] = (sectcount & 0xff); /* ... */ + sd->ext_csd[EXT_CSD_SEC_CNT] = (sectcount & 0xff); /* ... */ sd->ext_csd[210] = 0xa; /* Min write perf for 8bit@52Mhz */ sd->ext_csd[209] = 0xa; /* Min read perf for 8bit@52Mhz */ sd->ext_csd[208] = 0xa; /* Min write perf for 4bit@52Mhz */ sd->ext_csd[207] = 0xa; /* Min read perf for 4bit@52Mhz */ sd->ext_csd[206] = 0xa; /* Min write perf for 4bit@26Mhz */ sd->ext_csd[205] = 0xa; /* Min read perf for 4bit@26Mhz */ - sd->ext_csd[199] = 0x1; /* Partition switching timing */ - sd->ext_csd[198] = 0x1; /* Out-of-interrupt busy timing */ - sd->ext_csd[196] = 0xFF; /* Card type */ - sd->ext_csd[194] = 0x2; /* CSD Structure version */ - sd->ext_csd[192] = 0x5; /* Extended CSD revision */ - sd->ext_csd[168] = 0x1; /* RPMB size */ - sd->ext_csd[160] = 0x3; /* Partinioning support */ + sd->ext_csd[EXT_CSD_PART_SWITCH_TIME] = 0x1; /* Partition switching + timing */ + sd->ext_csd[EXT_CSD_OUT_OF_INTERRUPT_TIME] = 0x1; /* Out-of-interrupt busy + timing */ + sd->ext_csd[EXT_CSD_CARD_TYPE] = 0xFF; /* Card type */ + sd->ext_csd[EXT_CSD_STRUCTURE] = 0x2; /* CSD Structure version */ + sd->ext_csd[EXT_CSD_REV] = 0x5; /* Extended CSD revision */ + sd->ext_csd[EXT_CSD_RPMB_MULT] = 0x1; /* RPMB size */ + sd->ext_csd[EXT_CSD_PARTITION_SUPPORT] = 0x3; /* Partinioning support */ sd->ext_csd[159] = 0x00; /* Max enhanced area size */ sd->ext_csd[158] = 0x00; /* ... */ sd->ext_csd[157] = 0xEC; /* ... */ From patchwork Mon Feb 22 08:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06265C433E6 for ; Mon, 22 Feb 2021 08:30:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C61D64E77 for ; Mon, 22 Feb 2021 08:30:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C61D64E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6bV-0005JN-Bu for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:30:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OK-0004ue-Ik; Mon, 22 Feb 2021 03:16:28 -0500 Received: from mail-bn8nam12on2070.outbound.protection.outlook.com ([40.107.237.70]:5984 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OE-0001pA-6W; Mon, 22 Feb 2021 03:16:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fx0upN9IwFfnrATOdN09WhfRsoFarqquoe223QWIfxwq9/Wsv+HVvqugh7pSARYuISyy855Lw8tP6jSlzHfv8HhNN/YfNBzhMlNz6a/rLtmlBWmGslR+ogEq7Tt5gV3K36Mho2EDVWHqiR6eqjmbrYP7IODtS67Uh2KzDDKTnVkcasYGtBH8dKMkzBpT/0DnzFAGo9Vg6g7xOGqcNxSB7hRhTfBi/k39m6VMNoczgTFgfiLjNKsCOsc6Td6LDVh/72E9tUEmhHACAQU+cLI0jtlq5Zy4Uv/2DnLWoLEJi9pKoWSEmxqtik7I0kkg/xHaalVRHjBPe5HsqOpMYjQcyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YmAttSmNV4cYbvzomk+tXWtqOZCo6dfJqxdirbK6fH0=; b=gzd6H+EXv43QE2THL4CzHa/seGfzNzSySxZorHnAoAGPG9GpCSLi78GPxJEah95ySexRReJo7UDFwsr4I0C8P3co81Z5/nc1mW9+JKLISSAuFV8pMNp1m1ccJWnd7YUXd9Iw60Zx1aRpZYqoiinLugHSEwaWl6LD7p9aYeuwXvsg3I/ZP1gxeYId8E98y2+mn2aJbeB0cUx8pL1BGR7wAW3lsiRBWtCv+I3C1W491MsJERZ/OgE40caaxnmxQnluLlUJ1Jb/61XU0G1h5LSl1R85iIax1WMNndd3q5pkKUg46hHjiLo5YylNY7Bx+G1RtmLF2mPNsGPhMaqeparMaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YmAttSmNV4cYbvzomk+tXWtqOZCo6dfJqxdirbK6fH0=; b=bHXVGdBoEbLCH6nrOkRmDo5ZJFdesVAwKKSzAoiV+nlAhJbXoNmRZN53Kj8ascckfKLbtzLpIZsqWZeoCD4uWZNOmuyqg23DjdaA0jEFTWY8Lnn3zgRb8UfJ4EbxyuAdtCbQW97j4Z/lDLJ64jufTJijszjl9SxPKLR8/Tvdcr4= Received: from DM3PR14CA0133.namprd14.prod.outlook.com (2603:10b6:0:53::17) by SN6PR02MB5326.namprd02.prod.outlook.com (2603:10b6:805:76::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Mon, 22 Feb 2021 08:16:19 +0000 Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:0:53:cafe::66) by DM3PR14CA0133.outlook.office365.com (2603:10b6:0:53::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:18 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59038 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-000370-Kh; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 2B62813C0ADE; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 17/22] sd: emmc: Support boot area in emmc image Date: Mon, 22 Feb 2021 13:50:34 +0530 Message-ID: <1613982039-13861-18-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc614abc-9cb1-4806-1844-08d8d70a21d1 X-MS-TrafficTypeDiagnostic: SN6PR02MB5326: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:972; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dK4nU9+IJpprNp5ZfD7q1oKUVe9yVjKKtCPrXn3J6z2V1WKIjuqpJvOOX1s4NLkfq2PNdF2iWHxM0k8eYYGRcEuFk3ho6JBMUV+Gz79iu6Cp9Pczo13TjkAeDYWrL4pnGM9VuQZD9OKRYruds5Plc6T4ir7OiISvmyq7jIYdma1L4QaQ2QGJQTvu6olKdE7C0JQt4ETMPweD19y0TxcDonkBw/Kxvw0KCKDV8tE5+jB8S1g95uchUxEVw/gINc5z5zylogti9kj2e2rZ3H2xVWh14IldyE+Uu6iiq39CpUpmDDRcIBPZf/hVfEVlDbbGPwcP/21GaoCsXl50DTzGUdJCwP+GGy7Q3+eyi82cFy1uHoE891jeUAwajOypWjJeGfxfA+e5nDncKXIV/NMpKlgKw0p3JMez/SF1coZPmyUcigNs5eAifYVJaOsbwCg88+80KZmO2IwCHWD3sj2KQ+sUbfiFSLtZEZbYUUEv4Tp9dmwtFe2iszsOYGscC90M4TG7dX8yLicp1iYQ34kdKyLXANYWwWt09lIm+ZI2In8iFfJ3PEdGHNMeoCgA4layP9jnJK1iUBrNoGdy0zcUS0khJIjbl0UycQa7Gntc5KC7DbwMxhFI/brKn0f6S+Z+9zeObiz4FCl4ADDuctwYFzNyTGv86B3gSWD2czHMHR3ncjZ+3UpgSOrNdudNwXrTRsMXzNyLgyUOijqBpQpf7Q== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(39850400004)(136003)(346002)(396003)(36840700001)(46966006)(82740400003)(110136005)(47076005)(356005)(2616005)(36860700001)(4326008)(316002)(5660300002)(336012)(83380400001)(478600001)(54906003)(42186006)(66574015)(426003)(8676002)(7636003)(921005)(186003)(2906002)(6266002)(7416002)(107886003)(8936002)(36906005)(70586007)(26005)(70206006)(6666004)(36756003)(82310400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:18.9291 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc614abc-9cb1-4806-1844-08d8d70a21d1 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5326 Received-SPF: pass client-ip=40.107.237.70; envelope-from=saipava@xilinx.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley This assumes a specially constructued image: dd if=/dev/zero of=mmc-bootarea.img count=2 bs=1M dd if=u-boot-spl.bin of=mmc-bootarea.img conv=notrunc dd if=u-boot.bin of=mmc-bootarea.img conv=notrunc count=64 bs=1K cat mmc-bootarea.img obmc-phosphor-image.wic > mmc.img truncate --size 16GB mmc.img truncate --size 128MB mmc-bootarea.img Signed-off-by: Joel Stanley [clg: - changes on the definition names ] Signed-off-by: Cédric Le Goater [spb: use data_start property to access right emmc partition, Clean up PARTITION_ENABLE support as incomplete, Fix commit message to be generic.] Signed-off-by: Sai Pavan Boddu --- hw/sd/sd.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 60799aa..ab29e54 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1040,6 +1040,34 @@ static void sd_lock_command(SDState *sd) sd->card_status &= ~CARD_IS_LOCKED; } +/* + * This requires a disk image that has two boot partitions inserted at the + * beginning of it. The size of the boot partitions are configured in the + * ext_csd structure, which is hardcoded in qemu. They are currently set to + * 1MB each. + */ +static uint32_t sd_bootpart_offset(SDState *sd) +{ + unsigned int access = sd->ext_csd[EXT_CSD_PART_CONFIG] & + EXT_CSD_PART_CONFIG_ACC_MASK; + unsigned int boot_capacity = sd->ext_csd[EXT_CSD_BOOT_MULT] << 17; + + if (!sd->emmc) { + return 0; + } + + switch (access) { + case EXT_CSD_PART_CONFIG_ACC_DEFAULT: + return boot_capacity * 2; + case EXT_CSD_PART_CONFIG_ACC_BOOT0: + return 0; + case EXT_CSD_PART_CONFIG_ACC_BOOT0 + 1: + return boot_capacity * 1; + default: + g_assert_not_reached(); + } +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; @@ -1355,6 +1383,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_r1; } + if (sd->emmc) { + addr += sd_bootpart_offset(sd); + } sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; @@ -1374,6 +1405,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_r1; } + if (sd->emmc) { + addr += sd_bootpart_offset(sd); + } sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; @@ -1430,6 +1464,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_r1; } + if (sd->emmc) { + addr += sd_bootpart_offset(sd); + } sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; @@ -1460,6 +1497,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) return sd_r1; } + if (sd->emmc) { + addr += sd_bootpart_offset(sd); + } sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; From patchwork Mon Feb 22 08:20:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F63C433E0 for ; Mon, 22 Feb 2021 08:18:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2A8664DA5 for ; Mon, 22 Feb 2021 08:18:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2A8664DA5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Qb-0006vJ-SU for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:18:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O8-0004ZE-O6; Mon, 22 Feb 2021 03:16:18 -0500 Received: from mail-eopbgr700049.outbound.protection.outlook.com ([40.107.70.49]:4167 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6O5-0001lB-US; Mon, 22 Feb 2021 03:16:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I1xXBoA+wxBjwGTxpeuj2Ep2sNDOda2RC7GXM/9fECLS+xuZpsXBtlXjJ8WvSnxNGpg7VboQIKCUC8bSBkwH8u3Anl4FHDHbnTi7DLpN1BEWpmSnMlXEEVtuI6Sxb8OR8ODidt6CsaFVsT0zy5gtwZ7fCAgXR+NY9uax8T2NBarrwqB4j6Ruxrba2vqtqW8YvNIXYKh8nWvh1oSgMKGTqgCGNLSV4fdBCghoqFp84Rucv8Okqz+u5Wi+n/ZoQMFrrrvh2pKj81+Z5KeUGQ++IZb4ElowtE75bOlWlLpGlLKy7niwXuS1ADwY0v9kHusbbsRj+QCqWUpRUaWxQND3EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FmYgjZOz2YY3wvMI+yY8F7lYFDU30x9TPh5GS6x9oA8=; b=bOrjCpt9l70NPTYYAgotNAE0jA/LyqvMDBX9t4Bi2h6SOsDHjBSmRJVneFb41n9CtG9hMSXnmaCRDPIVFNcs53qFIYDbDzd/rgILJnVBXI3wq2Iw9TwbijbSuwYE01jOcjacvZBoY1VsjQ3jRFRpclgqRx8pi1k0XUyYMp+FAEGWa2onTDnNLc2lg+L4Aks7pB4LQZRMkqYQmI97S89lsy+s05vZB/FuQ6h/WpurRIg2Ot1jV4cfe3689hHu4X/1YkFDxjpGlw3Qsv4C808AF/mtzlPi7i/5UCBUPx/TBZoi+9VXElpuo8QMyIzZELJQU9SIBL9tIOIlI7ZNEMBv4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FmYgjZOz2YY3wvMI+yY8F7lYFDU30x9TPh5GS6x9oA8=; b=rGN7BwXErZJzyIBdMKXT+Guumjsxu7JM2CX/EBW4PVt90kZRraHrP5oXN3Twr8v7YQw2o+/XznhEuov2X7Azvkk6+a5EIL6hd+6fhVcLt5xKgwhsNXSsZGoBYTTM6gvnEvywSGf9gfXUpekJ0VMgkUkpYW3R+3fN0YhMUTeuJYo= Received: from SN4PR0501CA0081.namprd05.prod.outlook.com (2603:10b6:803:22::19) by DM6PR02MB6905.namprd02.prod.outlook.com (2603:10b6:5:252::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Mon, 22 Feb 2021 08:16:10 +0000 Received: from SN1NAM02FT046.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::97) by SN4PR0501CA0081.outlook.office365.com (2603:10b6:803:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.9 via Frontend Transport; Mon, 22 Feb 2021 08:16:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT046.mail.protection.outlook.com (10.152.72.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:10 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:00 -0800 Received: from [10.140.6.35] (port=59040 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-0004M3-Ku; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 32E2313C0ADF; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 18/22] sd: emmc: Subtract bootarea size from blk Date: Mon, 22 Feb 2021 13:50:35 +0530 Message-ID: <1613982039-13861-19-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a10f664b-33c7-45ef-2406-08d8d70a1cf2 X-MS-TrafficTypeDiagnostic: DM6PR02MB6905: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VmPJoylYM89Vu/vvacCUfjLSEEsGi7WPIR+VHY07XUtRyELH0/l+K1wyAU/D2Gu0lE5XgpuEsaDraoSQb0buhfUJ6nCGG+No5xIQTeVttjEbx8WdEkSHkYqukKXP49pUJ5oPCR+VizCCMnqonNpo7YLfYBJR4g2SwR7fBkNCsI5q8k1/8t8koiwmcXpW5YMnJt6/E/JdwNcTHDrujPrbiuf7Ji1AUfl/afPcJuwU3fkeX5C9+ratGpt42HixRTGmjer77gBw0kTTnH0Sm4vAZld1uT9gqnq9NyXYvaXi/AsDIhJau5mBvjaVjTug4lvbWaVQESPpTP1jBfIgJxHmSoP9lCkgloGmJL61FpzDQfsWv7Bdh+dXQdN06NKZcnITdjKB7cHbeVBMfXPD6PiH4okuKslWrRr78S9ZMU47jYbDv6zWAMJJ/ccu0Yc034wX2fWtne+I0czm1KCx83Q/TiQOcn+0dtiMw9ufQVMD8vbhBlWli2F8sqil4KC2TXX9y9aflY5LhEf+Hzxpxn667qtlbYUvvKTTRxMWZnACDC3kS00P6eRirKQFXjF3Lkp42yroKmywXiqyoJt+JuHpSjRb7oFsUy3gIzu6Z6g+khrFlZdlIJ2H7mKk80tVuXnsFEbh9cPU92jB9wjCFn4HeASorf1GrR5o3xbQQ/fVdKRq9D1dVEv8oq7ASqPaWgLq/e4d7yZNImheOnR5PPSGdw== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(396003)(136003)(346002)(376002)(46966006)(36840700001)(921005)(426003)(2906002)(6266002)(2616005)(47076005)(336012)(186003)(8676002)(107886003)(36860700001)(478600001)(8936002)(82740400003)(26005)(5660300002)(82310400003)(4326008)(356005)(70586007)(110136005)(70206006)(7636003)(54906003)(42186006)(6666004)(316002)(36906005)(4744005)(66574015)(36756003)(7416002)(83380400001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:10.7401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a10f664b-33c7-45ef-2406-08d8d70a1cf2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT046.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6905 Received-SPF: pass client-ip=40.107.70.49; envelope-from=saipava@xilinx.com; helo=NAM04-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley The userdata size is derived from the file the user passes on the command line, but we must take into account the boot areas. Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- hw/sd/sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index ab29e54..a0b4507 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -653,6 +653,11 @@ static void sd_reset(DeviceState *dev) } size = sect << 9; + if (sd->emmc) { + unsigned int boot_capacity = sd->ext_csd[EXT_CSD_BOOT_MULT] << 17; + size -= boot_capacity * 2; + } + sect = sd_addr_to_wpnum(size) + 1; sd->state = sd_idle_state; From patchwork Mon Feb 22 08:20:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A7F8C433DB for ; Mon, 22 Feb 2021 08:40:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 989F964E61 for ; Mon, 22 Feb 2021 08:40:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 989F964E61 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6l5-0004Jl-MV for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:39:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OK-0004tm-77; Mon, 22 Feb 2021 03:16:28 -0500 Received: from mail-bn7nam10on2051.outbound.protection.outlook.com ([40.107.92.51]:31105 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OF-0001pm-BH; Mon, 22 Feb 2021 03:16:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mh8FM64DA/OVn/3sAA1FnbOGvo86L4lQcxR1dcnuFlB7YbCgYmafoyraXa2ZOCMF8tBbqc366DeypfwAplQflwkOTzgEpNudKZ+az5DYPgGUcRl+V06qVjRcZzFsgDPa6mQeLsIWyrX/U4cguqFNJ7yhMPuJ7pxmwqswTnKJn6a1Cv9YXXx5bkcrd2vQteE5rqBueFsvT/VnRwcSEkUxe9U8g69XdH93oznzCXZRhld6QoTmNOpFukergGfjOunSW8hBcr0Fy1NepYBoMv33oCRuB1cfqe1ske3kU0OIQNtrO/VeRtU+z1A01SFi4Py3E4RuOarN1uGeIrm1E0W+1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YwNf6MLkBbcRRneJqO0oqOP0h3ttUCTSUQYQ7jo9xQ0=; b=gNNnayDBB07Kp2xFIcy99cqQuEr+8X7SaKr7XJGYEI86tK3gvv18FHS12lvY+++ofdOhqMAybH32Kpxtltyv5AKO08auphjTRRIn+5umBNHRAxuZSoJwGHkJINq2znzVARnju0Wq7cj599gmxim5WUoYQpSo63CAt7OCylBmSVFmRaj4KohC4qEg+oHAjgw5vStYUItXiYvLF37d1IF2N4/rItXJ2b3I1B2ibPt0Zeg4lTqaJMNRw4jLai1Mwm2T32Ij+OyhUR+UuFkqAC1NHEiTQ1l6b7cyVrf/MwXn7sPuuPkOUUo/3JsXiozcmLLTX6rRBUpDebhlBCSE2V0jNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YwNf6MLkBbcRRneJqO0oqOP0h3ttUCTSUQYQ7jo9xQ0=; b=XZMydvFXoPcQ2JhBlgUPlott/4tum87YQK+/4OsTNc7bZTMvp4xIudj4FaimLbgB3e8GkPr5oOOOSkejRA4aTlbYWN8Fuvwui8vxHjuy13LGm0lby5PswFZDJg2uGjwUMKGNl4dVbqshN+wXA7ufKLT1+72yYqUe84iyimiIasM= Received: from CY4PR18CA0051.namprd18.prod.outlook.com (2603:10b6:903:13f::13) by MWHPR02MB3343.namprd02.prod.outlook.com (2603:10b6:301:63::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Mon, 22 Feb 2021 08:16:19 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::6f) by CY4PR18CA0051.outlook.office365.com (2603:10b6:903:13f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59042 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Ns-0004M5-L7; Mon, 22 Feb 2021 00:16:00 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 3A6B013C0AE4; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 19/22] sd: sdhci: Support eMMC devices Date: Mon, 22 Feb 2021 13:50:36 +0530 Message-ID: <1613982039-13861-20-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08bf68c7-65cd-48ac-b734-08d8d70a220b X-MS-TrafficTypeDiagnostic: MWHPR02MB3343: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:167; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GQjlqCGm4eowEriMNxeTv3I9SmULBQSzPB5JZTE57mG6WUjGdfF6NahotsIh+lpOqhcQRSS5LRjcqFHv7wvMfa6oqWR/wgsDPy+CwpaSklEADy5W8j3ShOuD+6tqeszkvitxJag9vFe3mAfJet/WE+5zfTCXNNQohSW40K0XSBnr9kxVkSykgbaqLPQvOiTXERHwshQkFu4qBT5rtPfOBifTkEeiOxJL7qfVAkUCt9KFY5+8zGds+bKO8Cc50KNKW/kz0VSJa3d8l3PHlWCoL0hexPVW4Zs/t1JEv1cNbTPolSDXLHzBbSW/gFvsphJVHotQ/AuhA+QJsxcVvOIw6M6z8qfK6ibRwm7sXv++hOQ9reJ8a4or3k2na6N7NwxnvwJdoGNw5YQAqNbjzxQI44im5c/tiDHbGAD82PTTe7jjqLQK70VVCI5WcFMJ6mTOjp6RGZlzH1VEvMkgX/sr5hxPBNDfAuoCDW70UhsWEse6sRodsgHAk2uBufxosrwAhSJh5G1Y71w2sVv7QDUu1/RDVcHBphnb22CmHHlglubU71EZTxRyQLDMDqBPwlg7aQE1OhGWwohgH7/AvMv6ecjB6ymskS6T1W6IWodhvrDmkvSkXsWFleISs6/ph9wYjKAQaxZWXdzaWGvkntQ03Uaa6rr2mUlIZwLlNOmNrx22ofvKxC6QyHPwYiiwvAryjiMywMo1ddEZUcw03/4S/w== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(39850400004)(346002)(136003)(376002)(36840700001)(46966006)(336012)(478600001)(8936002)(7636003)(4326008)(426003)(82740400003)(186003)(5660300002)(4744005)(82310400003)(2616005)(54906003)(6666004)(8676002)(26005)(316002)(36906005)(7416002)(921005)(2906002)(36860700001)(356005)(70586007)(70206006)(36756003)(6266002)(42186006)(83380400001)(47076005)(110136005)(107886003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:19.3143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08bf68c7-65cd-48ac-b734-08d8d70a220b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3343 Received-SPF: pass client-ip=40.107.92.51; envelope-from=saipava@xilinx.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Embedded device slots should be allowed as support of eMMC is available. Signed-off-by: Sai Pavan Boddu --- hw/sd/sdhci.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 8ffa539..771212a 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -99,10 +99,6 @@ static void sdhci_check_capareg(SDHCIState *s, Error **errp) msk = FIELD_DP64(msk, SDHC_CAPAB, ASYNC_INT, 0); val = FIELD_EX64(s->capareg, SDHC_CAPAB, SLOT_TYPE); - if (val) { - error_setg(errp, "slot-type not supported"); - return; - } trace_sdhci_capareg("slot type", val); msk = FIELD_DP64(msk, SDHC_CAPAB, SLOT_TYPE, 0); From patchwork Mon Feb 22 08:20:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3301FC433E0 for ; Mon, 22 Feb 2021 08:21:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7944B60C3E for ; Mon, 22 Feb 2021 08:21:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7944B60C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6Sm-0002B8-Ea for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:21:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OM-0004yI-0h; Mon, 22 Feb 2021 03:16:30 -0500 Received: from mail-dm6nam11on2077.outbound.protection.outlook.com ([40.107.223.77]:21217 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OJ-0001s8-PW; Mon, 22 Feb 2021 03:16:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XVcto/r7kHU94oUb+jTRAYzpDL0NnUSUolu3+8mr6rjd8Y6wQBYYjmkYLUrQtJG99H2rbVAOP8HFj0q1VfBazy8EhHOy9BItC+RXsRue6tRXFYzvUWclxmUZ24knH9ar3etQUex24jPmd0tO/yxKd4eH/absr2TySFQC+osB/ElncCFeaafonVH4bh/SUhNdSuh6wxM4ohowpFC0Hc2K0otjbX6dFpFeLGgKOk5CHoRHwFg4Udnub/zpXNlG3InLCVRJ8PAhTS5AXHjSZjHfBxnxzEq6nxYB6R4RGLAh+zb4FWCw3FIGD9mSY6Y2xwly6sV07H1EwT9nkhXyAC3CQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JMjKasmr2ykH5giV9bXHm41p3CKzSUG7LOw8eO4rVcI=; b=X+mf4T75mYkaUN7bPFY2xvqVNB0XpBnXO75C/SaT4HV6ZAA/tSqqpMZ15xt/HE3ADn17VaqN9FfmsMwhPkahiXGWR2hY7qj95osSsYWXWArkErim3SZO2FXJy3+A4MSQx9hIXY5efo7+EK9AkC0MqYyy/57utzkEOpEFv9Oluq+/zg0jEY0oDs/T5YG2t03k5Kr2NoyT4gp/uMhfoAhkclCe4sHKW/pucxAWvxFBUYvpwXFLNV4cGlYtk68HQVEHdRQkha4j8vxhSH1h7LuDZ1/XjPJhjjUXyaGonbtq7NKG7RYepU+JkRx6PuECaaSiHOpdM9TirMi8aCJHqasYUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JMjKasmr2ykH5giV9bXHm41p3CKzSUG7LOw8eO4rVcI=; b=BzHMzNReODrB4FgVCT8cnzceEvOsOvJzXz4v9mgHTOE/cJX4HjI4BlaTgComlPjVqUnkDgAdfJd7sEvyt1PkCws4sQRVKPhCqVbyCKWdMlxl04fFBYsT7mEN53/TP8Dm7P3G2NSwBjsGaPPJ9YoFSFnh6l7HnYSzv9lda1AyBPY= Received: from DS7PR03CA0268.namprd03.prod.outlook.com (2603:10b6:5:3b3::33) by DM5PR02MB3194.namprd02.prod.outlook.com (2603:10b6:4:6a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17; Mon, 22 Feb 2021 08:16:23 +0000 Received: from CY1NAM02FT053.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b3:cafe::ca) by DS7PR03CA0268.outlook.office365.com (2603:10b6:5:3b3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT053.mail.protection.outlook.com (10.152.74.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:23 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59056 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nt-0004NG-3T; Mon, 22 Feb 2021 00:16:01 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 425D413C0AE6; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 20/22] arm: xlnx-versal: Add emmc to versal Date: Mon, 22 Feb 2021 13:50:37 +0530 Message-ID: <1613982039-13861-21-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4d3e4a4-a352-4bfc-fd82-08d8d70a249b X-MS-TrafficTypeDiagnostic: DM5PR02MB3194: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:162; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZAMHTdTf7C477V+IQeuA6ddMRa4Xvt5ukPOvEub2SWVcAxjbZtSRKOxNWCxSjcXkfL+vUuDPnZIIhu3VC3OfTurDWH3kXWG79FZfG2ymXhTrqFzUjRTWbmOLFCMzHdc3ZEeZQJbGangNNvybh9L1MTSza399QkYnNty4U+qnp4X9f6Boryk0TCGq11t2mtj6//l5ZWfS/x5JgO+8xxOWMaFsPvcIAUKGL9G4ndKwGGQwQw5fnHRhsMDHdaSZdeeErBH4cH7oLnE34OcklMX8xdT67rHmIFbGSECXsN8wor5ftBGZiOOrAG85dDEztmnqselyozVIcMpAlo5otEym+3o0MrvbY8u12QcHoqhWmXlEOe7T3v+rah5RjPs8se8w6HE0nr6KfJtyiW9ArBnE9TqDleVeFcuJYNXVpFFLvuDICFw4yfyhDfaqkNWm64wFc/wB2itD1hLR5NyHQ45yg3BBmgViITkDHRlSBt322RAvS5azWhT1h7RfNkLwL2GF/tuqkzWLmctUIS8bXCjFRVOXYOJjOWEx7jlQ92kxDQU89timJzkajpO3Axh4DbZqEKKX5ONhuYE7wjvcK4wfOU37T6QwzxOaEbgWjSiN9i+JzjMby/B5O1etNA0EQ5bHfgDhfucyBI3YoLzapbXLVuBF8lmuBnsmbj7B/yS331clyxuQLhbQ3H3dJoHNWbxXzNHPiPAgLl12+VFNLn56pQ== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(39850400004)(396003)(376002)(136003)(36840700001)(46966006)(186003)(6666004)(54906003)(7636003)(110136005)(6266002)(921005)(356005)(5660300002)(82740400003)(83380400001)(36860700001)(70586007)(42186006)(2616005)(336012)(82310400003)(8936002)(7416002)(2906002)(70206006)(107886003)(4326008)(478600001)(26005)(426003)(316002)(36756003)(36906005)(8676002)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:23.5963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4d3e4a4-a352-4bfc-fd82-08d8d70a249b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT053.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3194 Received-SPF: pass client-ip=40.107.223.77; envelope-from=saipava@xilinx.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Configuring SDHCI-0 to act as eMMC controller. Signed-off-by: Sai Pavan Boddu --- include/hw/arm/xlnx-versal.h | 1 + hw/arm/xlnx-versal-virt.c | 30 +++++++++++++++++++++++++----- hw/arm/xlnx-versal.c | 13 +++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index 2b76885..440f3b4 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -76,6 +76,7 @@ struct Versal { struct { MemoryRegion *mr_ddr; uint32_t psci_conduit; + bool has_emmc; } cfg; }; diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 8482cd6..273e0c7 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -46,6 +46,7 @@ struct VersalVirt { struct { bool secure; + bool has_emmc; } cfg; }; @@ -333,6 +334,13 @@ static void fdt_add_sd_nodes(VersalVirt *s) qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", 2, addr, 2, MM_PMC_SD0_SIZE); qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); + /* + * eMMC specific properties + */ + if (s->cfg.has_emmc && i == 0) { + qemu_fdt_setprop(s->fdt, name, "non-removable", NULL, 0); + qemu_fdt_setprop_sized_cells(s->fdt, name, "bus-width", 1, 8); + } g_free(name); } } @@ -512,7 +520,7 @@ static void create_virtio_regions(VersalVirt *s) } } -static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di, bool emmc) { BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; DeviceState *card; @@ -520,15 +528,22 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) card = qdev_new(TYPE_SD_CARD); object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card)); qdev_prop_set_drive_err(card, "drive", blk, &error_fatal); + object_property_set_bool(OBJECT(card), "emmc", emmc, &error_fatal); qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sd), "sd-bus"), &error_fatal); } +static void versal_virt_set_emmc(Object *obj, bool value, Error **errp) +{ + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj); + + s->cfg.has_emmc = value; +} + static void versal_virt_init(MachineState *machine) { VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; - int i; /* * If the user provides an Operating System to be loaded, we expect them @@ -560,6 +575,8 @@ static void versal_virt_init(MachineState *machine) &error_abort); object_property_set_int(OBJECT(&s->soc), "psci-conduit", psci_conduit, &error_abort); + object_property_set_bool(OBJECT(&s->soc), "has-emmc", s->cfg.has_emmc, + &error_abort); sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal); fdt_create(s); @@ -581,10 +598,10 @@ static void versal_virt_init(MachineState *machine) memory_region_add_subregion_overlap(get_system_memory(), 0, &s->soc.fpd.apu.mr, 0); + sd_plugin_card(&s->soc.pmc.iou.sd[0], + drive_get_next(s->cfg.has_emmc ? IF_EMMC : IF_SD), s->cfg.has_emmc); /* Plugin SD cards. */ - for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) { - sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD)); - } + sd_plugin_card(&s->soc.pmc.iou.sd[1], drive_get_next(IF_SD), false); s->binfo.ram_size = machine->ram_size; s->binfo.loader_start = 0x0; @@ -621,6 +638,9 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data) mc->default_cpus = XLNX_VERSAL_NR_ACPUS; mc->no_cdrom = true; mc->default_ram_id = "ddr"; + object_class_property_add_bool(oc, "emmc", + NULL, versal_virt_set_emmc); + } static const TypeInfo versal_virt_machine_init_typeinfo = { diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 628e77e..67ed1af 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -230,6 +230,9 @@ static void versal_create_admas(Versal *s, qemu_irq *pic) } #define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ +#define SDHCI_EMMC_CAPS ((SDHCI_CAPABILITIES & ~(3 << 30)) | \ + (1 << 30)) + static void versal_create_sds(Versal *s, qemu_irq *pic) { int i; @@ -244,9 +247,14 @@ static void versal_create_sds(Versal *s, qemu_irq *pic) object_property_set_uint(OBJECT(dev), "sd-spec-version", 3, &error_fatal); - object_property_set_uint(OBJECT(dev), "capareg", SDHCI_CAPABILITIES, + object_property_set_uint(OBJECT(dev), "capareg", SDHCI_EMMC_CAPS, &error_fatal); - object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal); + /* + * UHS is not applicable for eMMC + */ + if (!s->cfg.has_emmc || i == 1) { + object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal); + } sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); @@ -386,6 +394,7 @@ static Property versal_properties[] = { DEFINE_PROP_LINK("ddr", Versal, cfg.mr_ddr, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("psci-conduit", Versal, cfg.psci_conduit, 0), + DEFINE_PROP_BOOL("has-emmc", Versal, cfg.has_emmc, false), DEFINE_PROP_END_OF_LIST() }; From patchwork Mon Feb 22 08:20:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 377A0C433DB for ; Mon, 22 Feb 2021 08:32:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A97A764E5F for ; Mon, 22 Feb 2021 08:32:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A97A764E5F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6dp-0008FX-Dr for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:32:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OL-0004wu-D6; Mon, 22 Feb 2021 03:16:29 -0500 Received: from mail-dm6nam08on2075.outbound.protection.outlook.com ([40.107.102.75]:45295 helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OF-0001pe-BB; Mon, 22 Feb 2021 03:16:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gHSpYjYW/8fCacLZXB22bY5AjBjxeCFnUSXfdJNDt72Ql2x043ZNqsZ0/qxjVITmwrmNoOy9l98mXdsHeoZxAzauQsGc299JaxgEZEw9i/Kepi5+WQ8041rJJj+NdBgV83tHBeJGGq6CVxuXe4VE9nYJhOdMKMJG7gJOrXBXlLB97ny36CEB1435k39eeiNyXY7hM8Uh9RPmh5LPJpSK4MScNZU/pvLpt3PnR+vAe6QIb9YiYDbl8LeaNpJQvSHGs3zusM1FECO6j8xshAzwuvtfV7Eh0U/n/QvtI44pZpiempPGywMukJQwL0XnGFnvGXA2z6blvk7gpJ44pNWKdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hZCRtAFYeCGAH6jbrO1832cRDu6eTw00apG72bJmoLc=; b=OFiBB/q1yT0R0U3HZ/UQJc1a+rIG9ewZnbuEfoJGGovkL3k2JCrgaLeP0OdP8RPlsCbynojH/2cKDp68OM4Ja13Sfx5CnsJnldidsVvwIaI0REQO5IXgLLf00wxNn8tlHb3lUEtQXtf1esHo6aieCZRm1Jeq3uONO0lObaz3661kHEWMqc8kSpHXNuqKslhzytvrvEEpvsE2ZMY8rAJmKH94m4tcE4YMuqn5YpLL31lvOsaiUb66HFDT0cAJfHYiuopV9T8SmoFtDTp0+ye9RZEifhRQ5g0hCH+IrdDih4GPRWC1XEkeV9SNvWACBZRSRGCznq1Cd3LPhuLwuc2HQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hZCRtAFYeCGAH6jbrO1832cRDu6eTw00apG72bJmoLc=; b=MOOddonEyv9Aj+OS0v61k9hjrycnNmjzIYDqn+apRM/vGb4yszZy8DaYZ1r0ZXOIaGfMNId99CPl8bjPSCA91zwUsH7xkSlQYEO9iv7OiPqU1evYoOezH+12BcP0SUOueeYx7w7yq6+UsyKPOrHEu/V//HsRX4DmuYoPsHcSxvA= Received: from DM3PR14CA0133.namprd14.prod.outlook.com (2603:10b6:0:53::17) by BYAPR02MB4885.namprd02.prod.outlook.com (2603:10b6:a03:49::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.30; Mon, 22 Feb 2021 08:16:19 +0000 Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:0:53:cafe::49) by DM3PR14CA0133.outlook.office365.com (2603:10b6:0:53::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT007.mail.protection.outlook.com (10.152.75.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59058 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nt-00037M-3Z; Mon, 22 Feb 2021 00:16:01 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 4759B13C0ADD; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 21/22] docs: devel: emmc: Add a doc for emmc card emulation Date: Mon, 22 Feb 2021 13:50:38 +0530 Message-ID: <1613982039-13861-22-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffa14828-c6a8-4052-6e5a-08d8d70a2237 X-MS-TrafficTypeDiagnostic: BYAPR02MB4885: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lbJzgz9haCcwxP1p8Kty3gElmmR9PXcZEzswotAXt/tTohTLIyb7QkjZUHiColSfon7Bbe0qZfpCyE0eCHCuluZJE+rpwhOH9zJXpbRWRKi/FotMHnaDtFXyOoDoWdVCBp/WCwVfbjWg0nVZ3PknkUPdGpSJYe2F2Ie/1swAMwh6dZAoB/mUvsBrR618z8RXwhIFMicqjPBA49d07T265thCmIpT8/lznmw5MaJ4zcYC4NAB8hduXKFKVCKxL2xpUGXw5KEwIeqY4B7Ayj5zXqLOrcoUjyspSiQMJwwQ9AQDoQZ9O2uN9oj0DyHfIAuNj6aXZqjY55GAuV1aH1jAA+o+LHlWKDI/z/PIOx/sVl66F+t00USiKAgHN8Tpv+VBDKYfEIMULaASK5tPA1mw+RItNFpvvZTpUqVVdYGaXCBZ0kcbbwhCbFXc9dNQSgJuccbzs7hh3ZqgTCXYIU7tKT2e9Ewn1TClG5VO2gDrzFia3NHnZWRv67Ay71tBRD+T6PFqetl3uXQPozK/BMdsAvG4R1XdMiRJ4URCWVtwliJWzdOiNHiDa+9W5x7FXn8x1lFDOK3TB3B4bvVMH2PdJOPdgf3aCKe5cUEIF45mw5fkGR7uQ5J8aDsumCIKd3z+4TTGbGnlDnukgzi8KEoAEdoU7rreoCaemFYstN9tZk7HGR0lT1z5aqr3D6fnXBKBF7y0WHI5suorpANA9K085w== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(376002)(346002)(396003)(136003)(36840700001)(46966006)(47076005)(8936002)(26005)(8676002)(36906005)(316002)(36860700001)(70586007)(478600001)(70206006)(82310400003)(42186006)(7636003)(356005)(110136005)(336012)(83380400001)(426003)(7416002)(2906002)(54906003)(186003)(6666004)(4326008)(2616005)(6266002)(36756003)(107886003)(921005)(82740400003)(5660300002)(4744005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:19.5998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffa14828-c6a8-4052-6e5a-08d8d70a2237 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4885 Received-SPF: pass client-ip=40.107.102.75; envelope-from=saipava@xilinx.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add few simple steps to create emmc card with boot and user data partitions. Signed-off-by: Sai Pavan Boddu --- docs/devel/emmc.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/devel/emmc.txt diff --git a/docs/devel/emmc.txt b/docs/devel/emmc.txt new file mode 100644 index 0000000..2d098fe --- /dev/null +++ b/docs/devel/emmc.txt @@ -0,0 +1,16 @@ +==================== +eMMC block emulation +==================== + +Any eMMC devices has 3 kinds of partitions Boot, RPMB and User data. We +are supporting Boot and User data partitions. Boot area partitions are +expected to be 1MB size as hard coded in EXT_CSD register. + +Below is the example of combining two 1MB bootarea partition and +user data partitions. + + cat mmc-bootarea0.bin mmc-bootarea1.bin image.wic > mmc.img + qemu-img resize mmc.img 4G + +Note: mmc-bootarea0/1 are just raw paritions. User data can have +partition tables. From patchwork Mon Feb 22 08:20:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Pavan Boddu X-Patchwork-Id: 12098071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT, WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0CF3C433DB for ; Mon, 22 Feb 2021 08:29:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB66B64E92 for ; Mon, 22 Feb 2021 08:29:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB66B64E92 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE6bG-0004pe-VF for qemu-devel@archiver.kernel.org; Mon, 22 Feb 2021 03:29:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OK-0004tX-1E; Mon, 22 Feb 2021 03:16:28 -0500 Received: from mail-dm6nam11on2089.outbound.protection.outlook.com ([40.107.223.89]:21088 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE6OE-0001pT-Qz; Mon, 22 Feb 2021 03:16:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QJxGGcfwTqBsgjffpExR/QGfsn48u3afBq/al44RiYnR13der3hhGAWISxR/CCF76A+GH56Tw25O6SZgBmlmGE2Uk9tAQV3RJQyOFVmZTM169lFt14wl0XoaKMkNsp/NxUxOU+oGxdmb4aJhOx2c431ZnedAQzaXCwmlFsg8lQMyrpOqF8LEKyyFANDnww0cNVelRWLXOkZICCMRNdaYO6vUVGANXFoHi2aiH8N/Fme/INfbaIfCYrNaxRUextxw/eSULUM4XC4N70kDVVpI2oEVZMaBpgf2JAkL2667H6ZFeLtUdqfyqyxEFp2sf+KYLWA5H4Gn3Ck7y+FDJVRt4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycOAAxR58NimEpZgH4ohDflLNqwb3PcbKhUthMi5Gtc=; b=G8bgWPLKOIqiLyzEQQ51IOGkn3AYY3Aql1sDtZ7HdigsNSdCEUoVV1gCI/0JA4YMgr2B+WLiOBuTl1RUZrIOdjqm/aMizeb53SEEqmBtSOeAdbNn52bZBnLejBmFd6l13j+P5/PBY4GUsm1GaAKjRBMyvPLXNbf7y2WxjT4lCeoVoKqSkldQiDP+lWm94ox99m9TcokvkjO7o4/cPkZXlqIgn52IGw6UC9zMXSCvubB/glOGI770aEQQvsS3tJMqN4ptDWMoAmFJg1C+bkN2AGoE/NgAZjBrma2ftI+7UBJVHfuhM6GwTHKKRHCbknIs4ZYp6/bnlc5GeTHsIhaO6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycOAAxR58NimEpZgH4ohDflLNqwb3PcbKhUthMi5Gtc=; b=kjfoMmP6Na0tZzJ5HdJv/zqw/7VRj5JcJJrUk8Ir7qzHUkqdnz9WSEDBI8QhbPR6aRGK9HSVzJJHlFL9HO8uipODkjH09U7bjcBkRsGBW8HPF11qjSCg6UghWaoqdhjnBgyCoLzClDSlsccI5Y1rJexkHRMU7wMuAXxTQgrmm+w= Received: from CY4PR18CA0069.namprd18.prod.outlook.com (2603:10b6:903:13f::31) by DM6PR02MB4012.namprd02.prod.outlook.com (2603:10b6:5:9d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Mon, 22 Feb 2021 08:16:20 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::cb) by CY4PR18CA0069.outlook.office365.com (2603:10b6:903:13f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 08:16:19 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 22 Feb 2021 00:16:01 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Mon, 22 Feb 2021 00:16:01 -0800 Received: from [10.140.6.35] (port=59060 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lE6Nt-00037N-3g; Mon, 22 Feb 2021 00:16:01 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 4EDE813C0AE9; Mon, 22 Feb 2021 13:50:58 +0530 (IST) From: Sai Pavan Boddu To: Markus Armbruster , Kevin Wolf , "Max Reitz" , Vladimir Sementsov-Ogievskiy , Eric Blake , Joel Stanley , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Vincent Palatin , "Dr. David Alan Gilbert" , Thomas Huth , Stefan Hajnoczi , Peter Maydell , "Alistair Francis" , "Edgar E. Iglesias" , Luc Michel , "Paolo Bonzini" Subject: [PATCH v2 22/22] docs: arm: xlnx-versal-virt: Add eMMC support documentation Date: Mon, 22 Feb 2021 13:50:39 +0530 Message-ID: <1613982039-13861-23-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613982039-13861-1-git-send-email-sai.pavan.boddu@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef87fbcf-628a-4550-b7fd-08d8d70a225a X-MS-TrafficTypeDiagnostic: DM6PR02MB4012: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oC9zYhuwJXkXvYfMrblvbbNY0eGgI6/+MVZVisaR4VgNCRUL9rEBK5J30giT5OQnA59W9OuFMFgrOIR1g3Ltg7K3w5hfvDceM/I8Gcb5SfDHFDX9QIu/0gZMpjPJgKquq2r2FEgWCtSL4f/SDwQB2c6ILIS8haA4bxgIje0vI0TmU/iLxKqTcC9NfqT3pn1CfvYZUy7v/2M4UY+/4zRl2JvHDHpNj0F/tzL6iFiFVwBQ5Qq1ij/oG6mtZLhXGtwNp6pnjzwNtUlWj33/KfsXTPxSDTWKwcj3wtlo+S8kl37in9dvMlo8eGx68OvB01BVU78yPyMVqLpIkBk1NT4KGs4bmKu/iMOweWTdkQf3aMsfmfAGdK/+Vc1kEqUtLaiWs2twIF+Gt3SCf2fgxrGGoCKlgT/1Qt+tBrGzcvYd4nfglMOrRYBALh999OKeS6pgByvPJgh6xIKm7P+YTwX3Wie/3mOIaj7dtxBYpUcY7tbda/AkcTGwbaheoj+qjI3Tg/WpxvcGoeJQPopP9Bc0ldWvkKcLvyN8cJhZZUodos9hCe5ysziwDKUHKkczy3XHaVvLarBWDCov40zsmA+j08Ce9reErXnof2fOMNfXHqVCXpGxeYyrDIcA/oVgwe2+WeWqIXY4Y0D2DPlhJfGSwavcAEFLaJUNdCvWsbzP7D+6dOtT8M15ESY9LxoBYChE X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(396003)(136003)(376002)(39850400004)(36840700001)(46966006)(7636003)(36756003)(26005)(82310400003)(6266002)(36860700001)(70206006)(356005)(54906003)(2906002)(8936002)(70586007)(82740400003)(7416002)(5660300002)(921005)(42186006)(478600001)(316002)(107886003)(83380400001)(336012)(186003)(47076005)(110136005)(8676002)(426003)(36906005)(2616005)(4326008)(6666004)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 08:16:19.8320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef87fbcf-628a-4550-b7fd-08d8d70a225a X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT017.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4012 Received-SPF: pass client-ip=40.107.223.89; envelope-from=saipava@xilinx.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: saipava@xilinx.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add details of eMMC specific machine property. Signed-off-by: Sai Pavan Boddu --- docs/system/arm/xlnx-versal-virt.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/system/arm/xlnx-versal-virt.rst b/docs/system/arm/xlnx-versal-virt.rst index 2602d0f..a48a88d 100644 --- a/docs/system/arm/xlnx-versal-virt.rst +++ b/docs/system/arm/xlnx-versal-virt.rst @@ -29,6 +29,7 @@ Implemented devices: - 2 GEMs (Cadence MACB Ethernet MACs) - 8 ADMA (Xilinx zDMA) channels - 2 SD Controllers + * SDHCI0 can be configured as eMMC - OCM (256KB of On Chip Memory) - DDR memory @@ -43,6 +44,15 @@ Other differences between the hardware and the QEMU model: - QEMU provides 8 virtio-mmio virtio transports; these start at address ``0xa0000000`` and have IRQs from 111 and upwards. +Enabling eMMC +""""""""""""" +In order to enable eMMC pass the following machine property "emmc=on". +ex: + "-M xlnx-versal-virt,emmc=on" + +Above switch would configure SDHCI0 to accept eMMC card. More details on eMMC +emulation can be found in docs/devel/emmc.txt. + Running """"""" If the user provides an Operating System to be loaded, we expect users