From patchwork Thu Feb 11 08:17:12 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: 12082455 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 39DD6C433E0 for ; Thu, 11 Feb 2021 08:15:45 +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 C591E64DE2 for ; Thu, 11 Feb 2021 08:15:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C591E64DE2 Authentication-Results: mail.kernel.org; dmarc=none (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]:39464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA78Z-0004Rs-Rl for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:15:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA75o-0002bA-Ic; Thu, 11 Feb 2021 03:12:52 -0500 Received: from mail-eopbgr750057.outbound.protection.outlook.com ([40.107.75.57]:39657 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 1lA75m-0004Vl-RU; Thu, 11 Feb 2021 03:12:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCuY2lrY3ipN0B9K9gSp64EH2haDcizpyR0VBjiA6jEH3OBukZi6dLklwLZ/XoHX10LjrMAu2N9HmHKCeHNDaUmXvycu2VlpfNZam0NjyGjHGeGjySoeShy0GxVOIHxTAbuOHIVl3boQzUBA2WC33DG7uqQ1qQaNda2e2PhDtxvbQNl0T3hUGtDRSr91cunwTFC6Ec9N6mmpYpls/JIv9V52XSYFJ+szLjuZRQ7uI7RbQl9BZ5p0QTPPyeJ1bVMyRQ9+zYst5wZUufuz+pGvYabKPYUgFxrfm30MXkPKMbCIZz4nX6fVhymDBjexrceDgMwVdbHXgRVNzzmqieI/4A== 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=MpQvWGoHUm3/ueLU1b2jbgj76C+Z8U4TERYyWoKgGZk=; b=Ems/9qi6YIUiJTaCMPzTXM6kYMZvjKHf3zNdcLntGVtE2RhXBZl+q2uv/Kmfd0MRmTdxTHSYqgchH252/6hqxR2yW7YEFxlKTZ+S2ZkLUzKnP9QnLdfsTn8U1zt0rLav4OuEmz95X5cC1N+CJzD5mXWiRanNhNfLBhF+RL7Az2bEP5n0WLvVtnLyfrSPlu/Be7wkIREGKuhtLzU7CYhxiyIztYNZNTg2U2cGOavaTaE2f4AKNfoFoFBPsHX3q3MgAzxhbgSYGOR5o0UatIWuOFk8e3YdQz6pdsWwjCZp3rXKRiEBWGJovlBamp4EBI6EEq50qDEQt5SlVzAGq2dFgA== 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=bestguesspass 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=MpQvWGoHUm3/ueLU1b2jbgj76C+Z8U4TERYyWoKgGZk=; b=kpFgNOrpy0oBFWm3HoqfaKUinzQ3+ZAJaCuRX2QOpjHzDRdsqJ7ukJbaiJcCX8C3VLw+mYo6tW48rPWTlk0yiXDQxhz5Qk4pgQ7buM6/9VApM0FHqZ16J926R77UYH4mU/IlDS8n68qayd7/uA1x/6kvv3L1RcU0WETDxLaThFg= Received: from MN2PR12CA0028.namprd12.prod.outlook.com (2603:10b6:208:a8::41) by CY4PR02MB2470.namprd02.prod.outlook.com (2603:10b6:903:69::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.19; Thu, 11 Feb 2021 08:12:47 +0000 Received: from BL2NAM02FT042.eop-nam02.prod.protection.outlook.com (2603:10b6:208:a8:cafe::5a) by MN2PR12CA0028.outlook.office365.com (2603:10b6:208:a8::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:47 +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=bestguesspass 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 BL2NAM02FT042.mail.protection.outlook.com (10.152.76.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:47 +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; Thu, 11 Feb 2021 00:12:46 -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; Thu, 11 Feb 2021 00:12:46 -0800 Received: from [10.140.6.35] (port=49668 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75i-0000Go-8W; Thu, 11 Feb 2021 00:12:46 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id CC69513C063C; Thu, 11 Feb 2021 13:48:08 +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: [RFC PATCH 01/15] block: add eMMC block device type Date: Thu, 11 Feb 2021 13:47:12 +0530 Message-ID: <1613031446-22154-2-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 054674b7-4f9b-44bd-c709-08d8ce64d11c X-MS-TrafficTypeDiagnostic: CY4PR02MB2470: 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: MR/S1EkH8XenrzBJWOcx4scSxiLWW9DY8GdlWuaMEt0rfmHauDp6shkm0IBNAFirYbFgLO+cFI3A2adPHtnTPuNGN3RoPOQCxROW9WjNvzcaDbTWjsRBccWiu0LppO3Mg9NAi/oRId1hbotrVytVs/mngTbpp8eJ+f3gkWXIftwRrqMTtAUrJjKMqkv4Jx2ffBr+1iOMvTtg6Tn/YjRMsTKN0rd+xJdkAzmM3iLgmHY2DsLevOMXW34P/QRjHYEmnVm5lItxAKX+nyUzT68A8UihGgiX5W2mjTBHEsRkjCAlVWkFBoFjnQ/6wI+8Bc49WcYYGruvvALEChxOzv7czPWqqnxlz6o8lv8o2KMU1o+li3dPZUvfkpnOaolC/Kyl/KaHWfJ6jx99EmFxCA4UUh2x5krioAAhvG4+ao8ShJe9FhMf4w/9Y+xJTX5gYO0CaiMtpstDvEInYSAAPpXcc7hSWPQ1nb247HQpXAefR4LkiaMP+yhskYGkpmA14ckTZPtY0vENI0AlxxsiPfDrHw9v705NOThJ6D7N6Nr+ff8QlAXIksYOObCPVOmxC05k9ydamtjZ4lykUTBlKkSq5CMMelrtoW2o12midntPwaKwuaNqL3XgdHVb0qsbP3iWnuPSdRoq+FuX7lB1zHs+NYUdvfRaOBLNkDON4WMLYqdp1hyyrUR1SNDQw84S3BQS9lkAWO/nyjKX9odN6o4DhQ== 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)(136003)(39860400002)(376002)(346002)(36840700001)(46966006)(478600001)(5660300002)(26005)(2616005)(36860700001)(336012)(36906005)(426003)(186003)(36756003)(82310400003)(8936002)(42186006)(316002)(7636003)(70586007)(7416002)(47076005)(6266002)(8676002)(2906002)(4326008)(107886003)(6666004)(921005)(82740400003)(54906003)(356005)(110136005)(83380400001)(70206006)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:47.1881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 054674b7-4f9b-44bd-c709-08d8ce64d11c 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: BL2NAM02FT042.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2470 Received-SPF: pass client-ip=40.107.75.57; 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" 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 --- blockdev.c | 1 + include/sysemu/blockdev.h | 1 + 2 files changed, 2 insertions(+) diff --git a/blockdev.c b/blockdev.c index b250b9b..593ce44 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] = { 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; From patchwork Thu Feb 11 08:17:13 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: 12082487 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 5CC98C433E0 for ; Thu, 11 Feb 2021 08:19:12 +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 DA7CC64EB9 for ; Thu, 11 Feb 2021 08:19:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA7CC64EB9 Authentication-Results: mail.kernel.org; dmarc=none (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]:49084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Bv-00006S-0Y for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:19:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA75t-0002iD-Bp; Thu, 11 Feb 2021 03:12:57 -0500 Received: from mail-dm6nam10on2049.outbound.protection.outlook.com ([40.107.93.49]:23521 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 1lA75r-0004XW-2U; Thu, 11 Feb 2021 03:12:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B9EtxWLsQMyEa81zNPVRFSAsdfBKEwm5fnVxLAp21JXuOuGSNgXNpDEyXjHOudM7+xiZSFGuO2j+bTDbXx/YMAi/i2+YuBHYVAalu2/Dj2m73Rus54gmPs8E2FPLjujL2V2MBhUC0l31q09ucrfbPtHLqgLSfeRaCENMvm0V4d++nwkEJal5baYAZannHaaSC8lRfmKOBdqQ86gcztvEbBYuqgAQAa4RNyy1ip0XhYtoU+zu99SCNrHrLEgH+UR+0cn8QDMcZDSRPWrcNhr+mCPGgxlIIvLdkx99YKtuFksnj9eeNzinVXuj07j2iCOHUnjMafq/QiSSVlOTiPL80g== 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=R7/cQ5x+ps4bkVyR+oGubwEAe6PptOehwO18lju7sZA=; b=MCTabZeZ2slFPAOlvLGf2dQNgLzrVabs4tglaU8dF9gCu78VJKvrG+vK56zho4rxyac2Uh3oxDEGQknP/ngpB4AejusUdMvMQfZmIHT+COKVSukGhhAX2JUjRagk2nqqMtvBO/12T22lNOvU7vFgQGs3x8QNVnI6R4ShvnvZ1yMjBLJ/nKTObDBujEvN0fYDwLupkmzEwPzY8rE3Z6Xy4OBichNNlDz/nPiJyebYGNbbwz3Am0kZa5VlbbQMPpWX519vlg1o3GuJlvpMxIk4fSxa6X+CAu6aBx1OCB7sBw38jhzxdcj1fjee87E3LpgrT5qaFcKgmCuVTYxZA8oKUw== 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=bestguesspass 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=R7/cQ5x+ps4bkVyR+oGubwEAe6PptOehwO18lju7sZA=; b=CzI4DTQvlRyaxg2mXXL/4hgYIYxYe9jGa+Oj/xPcjUoVDkcZCPx7ol2WtxVQ8jyPyjb1I3wV4tYN/NjVRFBq6BjyZuLxaTfATpvE+PHQjwThqYxkpXwZF+NbRoj1F80pmEHQfoCB7lmoJ2uFkIXTuCJy9HucAQpst/0IGGnButs= Received: from MN2PR15CA0026.namprd15.prod.outlook.com (2603:10b6:208:1b4::39) by DM6PR02MB6666.namprd02.prod.outlook.com (2603:10b6:5:215::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 11 Feb 2021 08:12:52 +0000 Received: from BL2NAM02FT063.eop-nam02.prod.protection.outlook.com (2603:10b6:208:1b4:cafe::4b) by MN2PR15CA0026.outlook.office365.com (2603:10b6:208:1b4::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Thu, 11 Feb 2021 08:12:52 +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=bestguesspass 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 BL2NAM02FT063.mail.protection.outlook.com (10.152.77.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:51 +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; Thu, 11 Feb 2021 00:12:48 -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; Thu, 11 Feb 2021 00:12:48 -0800 Received: from [10.140.6.35] (port=49670 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75j-0000QA-Fw; Thu, 11 Feb 2021 00:12:48 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 0B56F13C0653; Thu, 11 Feb 2021 13:48:10 +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: [RFC PATCH 02/15] sd: add eMMC support Date: Thu, 11 Feb 2021 13:47:13 +0530 Message-ID: <1613031446-22154-3-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 97cbde26-b25d-4321-dada-08d8ce64d3e4 X-MS-TrafficTypeDiagnostic: DM6PR02MB6666: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tZefAbYwfOjbWt/T39xhOySiaw7XSpkOVhwxrGV9WMOTRlHKwPWH+DGKdmtgAsjr52hGQKv61cPq7ExVY/lF8eMFEK68McV1yb7RLit27NLK9HUry+xKZxeDd/ksyuHmcVqv0g7fSGR3STbYllJRghrIWdF8TfIRNPonlnuhJevf86mfIMrrl5EJxGTZ2YHcj9QPOLqOtiMSqbYySwUZ2QP9r9pEhawT8otSpYUwNt6UHUWgqB0k5pQP0OVEcs2C8rnj4RJa5Epc6Va24ZSNyHMzNmRse2KQ2911PYUB5uDh6qE+n3WmbLjXExewii7UALPn9mKNDXd82oAjAtvrw3QlnQsg1x6nZ/Kc7W33XDQECzdt6XSJOOJcABD+DAA1cft1tR8f+b1rGRjklgrPocuos82ATafBCshzBnotuPqO94A67TY3AeW57HqmRoWwVD34jS6LTWC75tHTy8Vv+JOdxAiNaPYa2oNzNYXHO56SA+EB/h5PJyg2vlJUmhbHhWVbKz/0MFq+0aUiY+G2q/BrET+W8fBvtseCP4Cq5BHrfnAdw3XfZsp0VkSCovRib6IwDiG41RwEYxW5ejsGsAB3OkpTr86UzjqYNAVGjv+USn53dv6I1uvb8BUEBInjGDDNG6tcFzSaucpQJdytmtoxCNGK4tPmWOHralkXwSOgtx4aP+6fvvT/RqBN+OuJINMKoce03xpBrweH5tAa61M1U9elpXMyXalyvsIWhMA= 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)(39860400002)(136003)(396003)(346002)(376002)(46966006)(36840700001)(70586007)(70206006)(42186006)(316002)(5660300002)(36906005)(54906003)(8676002)(110136005)(4326008)(107886003)(2906002)(6266002)(7416002)(47076005)(66574015)(83380400001)(82740400003)(2616005)(921005)(478600001)(36756003)(8936002)(36860700001)(336012)(356005)(426003)(7636003)(82310400003)(26005)(186003)(102446001)(357404004); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:51.8548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97cbde26-b25d-4321-dada-08d8ce64d3e4 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: BL2NAM02FT063.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6666 Received-SPF: pass client-ip=40.107.93.49; 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 The parameters mimick a real 4GB eMMC, but it can be set to various sizes. Signed-off-by: Vincent Palatin [SPB: Rebased the patch over qemu 5.1, Mark eMMC to support all timing modes] Signed-off-by: Sai Pavan Boddu Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- hw/sd/sd.c | 143 +++++++++++++++++++++++++++++++++++++++++-------- hw/sd/sdmmc-internal.c | 2 +- 2 files changed, 122 insertions(+), 23 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 8517dbc..a75fa1c 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 */ @@ -134,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; @@ -287,7 +289,8 @@ FIELD(OCR, CARD_POWER_UP, 31, 1) | R_OCR_ACCEPT_SWITCH_1V8_MASK \ | R_OCR_UHS_II_CARD_MASK \ | R_OCR_CARD_CAPACITY_MASK \ - | R_OCR_CARD_POWER_UP_MASK) + | R_OCR_CARD_POWER_UP_MASK \ + | R_OCR_DUAL_VOLTAGE_CARD_MASK) static void sd_set_ocr(SDState *sd) { @@ -371,6 +374,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, 512); + 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; @@ -384,7 +432,34 @@ 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 */ + if (sd->emmc) { /* eMMC */ + sd->csd[0] = 0xd0; + sd->csd[1] = 0x0f; + sd->csd[2] = 0x00; + sd->csd[3] = 0x32; + sd->csd[4] = 0x0f; + if (size <= 0x80000000ULL) { + /* use 1k blocks */ + uint32_t csize1k = (size >> (CMULT_SHIFT + 10)) - 1; + sd->csd[5] = 0x5a; + sd->csd[6] = 0x80 | ((csize1k >> 10) & 0xf); + sd->csd[7] = (csize1k >> 2) & 0xff; + } else { /* >= 2GB : size stored in ext CSD, block addressing */ + sd->csd[5] = 0x59; + sd->csd[6] = 0x8f; + sd->csd[7] = 0xff; + sd->ocr |= 1 << 30; + } + sd->csd[8] = 0xff; + sd->csd[9] = 0xff; + sd->csd[10] = 0xf7; + sd->csd[11] = 0xfe; + sd->csd[12] = 0x49; + sd->csd[13] = 0x10; + sd->csd[14] = 0x00; + sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1; + mmc_set_ext_csd(sd, size); + } else 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 */ @@ -431,9 +506,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 +1058,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; @@ -1054,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, 512); + 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: @@ -1993,7 +2085,13 @@ uint8_t sd_read_byte(SDState *sd) if (sd->data_offset >= 64) sd->state = sd_transfer_state; break; + case 8: /* CMD8: SEND_EXT_CSD on MMC */ + ret = sd->data[sd->data_offset++]; + if (sd->data_offset >= 512) { + sd->state = sd_transfer_state; + } + break; case 9: /* CMD9: SEND_CSD */ case 10: /* CMD10: SEND_CID */ ret = sd->data[sd->data_offset ++]; @@ -2176,6 +2274,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() }; 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 Thu Feb 11 08:17:14 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: 12082511 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 7607BC433E0 for ; Thu, 11 Feb 2021 08:24:11 +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 F39AA64E16 for ; Thu, 11 Feb 2021 08:24:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F39AA64E16 Authentication-Results: mail.kernel.org; dmarc=none (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]:58818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Gk-0004Lh-0H for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:24:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76B-0002o5-9r; Thu, 11 Feb 2021 03:13:15 -0500 Received: from mail-dm6nam10on2056.outbound.protection.outlook.com ([40.107.93.56]:29025 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 1lA761-0004b6-7g; Thu, 11 Feb 2021 03:13:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2aggZu63WclOjleOkexrzunmZyWtj1PnSn84gduVHGVP3Ef15hScS2q1bwXdWx4AJgAGRM2fLVhEG9+eLm9EG/a1n211CFFy/MUnWcUJhHLQSdpiDTWPPxMZT9EJR81XlDB8QexnuYr7l//aurlm5kKF+zREQ9+98COUY7zK3SXrwklhK5zdXEKYRCmaQ/JvVLlzFIrEr1X2cyFTAlHhqAEeoqyNFY3BU3pMTYzVrAG32tWr/9YpCojM4AIvE5sLWPKqPpkNzzaOhDHAroGxuZPHpAUDHsVlMS8EjnbHPTCkal8xwsM4rmcoeCxcDh1pvdPSZ6COZTFPUKfax014Q== 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=0+DogOLxCf3TJttx/Rg+l42AmtN6qDwoB09Rl8eBiaY=; b=DXpM+CKTiuKrZpaxS6tSFfjZaRM9g4jxuAnNsIyjnkXWz2yGFxtSC+mqMGgCJ8U4rf/R/q4kB9lM/IMCMg3j5GvZdFKDytA8U7wk0q/ENva3aRuDVKs735Mkg15opPaMvZ/YKZwuRtPNDppBP4bmvsEGJGxIyTGKc+8hymL6BlWvXnm0u0ICG5D5fbjB2auyQ4m7ffk26EJ2AvHSICRd6vICzsu+YlsDu9fQwkpxiS57DfnYOtGduh4vxPVosAW3OushREw58t9HQgDEZf2MF2PZ+BqzgZA+IYkhm6hJM4166u7jT/dBf1X89DeRC1an4fPoe3vSniWg0LjaMrEkBg== 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=bestguesspass 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=0+DogOLxCf3TJttx/Rg+l42AmtN6qDwoB09Rl8eBiaY=; b=gTbUj7CRngAZPV+11FF+1ZcsmlCcOhJpCiwjAXTPNQiA8DGMfYsatSMQ149EsZY8qTU6QJW/9eUwvu1zWdqESyF+IAO/3iFb59MRyF0x5ydwI9opnRVuGIGliU5R9lSxRba1gnWCRG/GJ8JqQhiIHWdxS0gQkJt8Oe/ahH4q9v0= Received: from BLAPR03CA0054.namprd03.prod.outlook.com (2603:10b6:208:32d::29) by DM6PR02MB5193.namprd02.prod.outlook.com (2603:10b6:5:49::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 11 Feb 2021 08:13:01 +0000 Received: from BL2NAM02FT028.eop-nam02.prod.protection.outlook.com (2603:10b6:208:32d:cafe::3c) by BLAPR03CA0054.outlook.office365.com (2603:10b6:208:32d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Thu, 11 Feb 2021 08:13:01 +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=bestguesspass 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 BL2NAM02FT028.mail.protection.outlook.com (10.152.77.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13:01 +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; Thu, 11 Feb 2021 00:12:48 -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; Thu, 11 Feb 2021 00:12:48 -0800 Received: from [10.140.6.35] (port=49672 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75k-0000QC-7t; Thu, 11 Feb 2021 00:12:48 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id C26E613C063C; Thu, 11 Feb 2021 13:48:10 +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: [RFC PATCH 03/15] sd: emmc: Dont not update CARD_CAPACITY for eMMC cards Date: Thu, 11 Feb 2021 13:47:14 +0530 Message-ID: <1613031446-22154-4-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 85cf6946-f76d-4253-1e7d-08d8ce64d96f X-MS-TrafficTypeDiagnostic: DM6PR02MB5193: 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: 7M3XDel9Mt7Tl5SVgeZOraO9B7octnwSyatQ5Aiq+veYP5xfipVF9Lg2s2GJlJEV0ruQi5xUZzkaaaPbH12QlbdAFXOm+M3Rojwi0opCNdxGpG2hIjtdKeW9kIZkBWfcADcFyqvMsTQAFMSLaq/mgYqmyxF5K8Uy056DzEIea0AlUEFvPoXLIKtyW9Cytsozklo5JANBNn/FIOM5qyK33sf8oKyQqZOR/ngCf8PNv/L0Cgk9iaKIWxRwAyA2lx5bWDtoqcrQ8++k7XhZgX6G4JxkkrHAeG1G556LmgRY08Ttp0fvf+xtwRhyQ9U1PiOOzjAlUq4LGxbfx2l3i20N8hJVetNyQMmDV3MDUVkQS7R2GYnJ5i8OeKexRu2srOUcSR9+Aqq1DJby1zeqPCqAhfOvoCiiIIFbZENs4XkqrRXZSvDaAT0eNkIsAMaLJKDI00nbXGc/jT0m7GQY3xqbsA974+8nRB+56IL0ZqeW0XGn10KmvxRdfE2kgql8WtGrvIVVz4OQkGY+WSVQ3MN8XfBblJdgrto2OkoPMOJkPlvq7DOf+x9WODld51+WqBpCaEP7+b7IiVtx8OOBTv+AN3+alVI3rqFJNPTc49wqdZp8iPAue2KOpsYA936jONC2pMalWCr77WGFL4MuKTp7WhF3zV0lEcowZnjpoKMKiAAP7m41ANACU3sPgR8cq0Jj0BOT8AQ8WxfLX6W23h3cMqgP9+gaFL/zUeENAwPfu18= 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)(39860400002)(396003)(136003)(376002)(36840700001)(46966006)(8936002)(82310400003)(5660300002)(921005)(4744005)(36906005)(356005)(36860700001)(83380400001)(7636003)(186003)(26005)(82740400003)(110136005)(54906003)(2906002)(42186006)(316002)(2616005)(4326008)(6266002)(107886003)(336012)(7416002)(426003)(36756003)(47076005)(8676002)(70586007)(478600001)(70206006)(102446001)(192303002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:01.1505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85cf6946-f76d-4253-1e7d-08d8ce64d96f 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: BL2NAM02FT028.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5193 Received-SPF: pass client-ip=40.107.93.56; 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 a75fa1c..57fff89 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -308,7 +308,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 Thu Feb 11 08:17:15 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: 12082483 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 9F458C433DB for ; Thu, 11 Feb 2021 08:18:27 +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 174C964DFF for ; Thu, 11 Feb 2021 08:18:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 174C964DFF Authentication-Results: mail.kernel.org; dmarc=none (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]:46606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7BB-0007Wy-Sm for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:18:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA760-0002kt-JT; Thu, 11 Feb 2021 03:13:06 -0500 Received: from mail-mw2nam08on2043.outbound.protection.outlook.com ([40.107.101.43]:54395 helo=NAM04-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 1lA75t-0004YX-HZ; Thu, 11 Feb 2021 03:13:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jRu6y+6yqYsQRVhW9/kL5260goAtU5tmXLYCH5pDszNi8SPzBtVg3GSjffzwpnlap69OjFOIrJH9nJLJl/fTrMNVZLngSarjCYtG0LHdeKCM7Xm2vePP00skRIEB/A73FNYeY1VdOx0NxMSArrrltAeOF/vJcUamD8eTyzNMZwBAQHpaWKlwzR5+zI4Bf1r3Xto8RIYQKfKtm/Bbjb9yIFqvMoyzNoIunjdRJXAW0XyaPw8Mix/L7lV+QL7ZAUJjodjfN2+h0SMs1YwJPg+oP4yUSrR0rF4ZxIHWe5CxT4p5NhUHrH0YGnek0a3T5uCObAZs5ZXNRO08a4A61oanqw== 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=olQ+KWaTOdmYYxZqvp+1A8/OSAbMC4nU3TGGkseZmZo=; b=fi4Sc6Hcx6NvX8vVIFTeZ9vR5BS6IK3Pap3wlzDZnSaTi/xP/dId4d7LM9QlZPOvVhaW0jTHCtzqqN1xoBrG25Y6NVpkEfaRqZNk13DFsyHmDeUnsoc8QmMmplpaJrfKvUCxIbVZfPxLmh7d85J5Pr2yjAWmXrwdLYeYZK/Qb5bZ/8jDXztpTvbTh9+UqkHfAJ0C4LjC7KlQoMnyApKiFCm1cu6kZ4YxTBPlfrauBz31zAd0EnYbYabcl1wZp0PjentCu2ANVxLaAwcV1T1gIa6RycfYby+AmW3VHg+GY3r5lSi5p3JUauz/H/qxIBnViGycEBTgq6lIij4Pw8tYjQ== 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=bestguesspass 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=olQ+KWaTOdmYYxZqvp+1A8/OSAbMC4nU3TGGkseZmZo=; b=Kjre3pxagnTuF5OZIlp3bB2miVPTRlnGZyegnM457YDMkox5fikNUTQMuKuaBPAb2gywmvFYNYC3HatOrZUKm2cN0Wt3+i4HerrlLBMY45FNdx4Wdo10PwUcRqy+ivghCqfiLeiHXPZnCkUr6ZzSSsNjTfZg0/PxLcfvl+jkbVA= Received: from MN2PR15CA0020.namprd15.prod.outlook.com (2603:10b6:208:1b4::33) by DM6PR02MB4233.namprd02.prod.outlook.com (2603:10b6:5:a3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Thu, 11 Feb 2021 08:12:54 +0000 Received: from BL2NAM02FT063.eop-nam02.prod.protection.outlook.com (2603:10b6:208:1b4:cafe::8d) by MN2PR15CA0020.outlook.office365.com (2603:10b6:208:1b4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:54 +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=bestguesspass 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 BL2NAM02FT063.mail.protection.outlook.com (10.152.77.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:53 +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; Thu, 11 Feb 2021 00:12:49 -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; Thu, 11 Feb 2021 00:12:49 -0800 Received: from [10.140.6.35] (port=49674 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75l-0000Gw-2q; Thu, 11 Feb 2021 00:12:49 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 9EBC713C0653; Thu, 11 Feb 2021 13:48:11 +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: [RFC PATCH 04/15] sd: emmc: Update CMD1 definition for eMMC Date: Thu, 11 Feb 2021 13:47:15 +0530 Message-ID: <1613031446-22154-5-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 1a16bba2-cbeb-4819-7fe2-08d8ce64d50d X-MS-TrafficTypeDiagnostic: DM6PR02MB4233: 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: a+dInpWSSsTGP89w0pPxr3oI2uubqlUNORu7ZiXzqqdqrtwtIsbFtyUsU7inK5iW31AKOr38mALhhmqp0BasvLMyUHpXsEMCnpbIAm30WE4hfyvNiKC6OviCFzieP4VjMqFXYgudEMztr3yZLkdpc/3GtU2z7cXSCCBr5GwGCGiHernMmmzbv0HVkjv0p7xGFeClNV6MS/SX7gMc4v7q5NaKdgnX0e99drAqT9iRDh3v4YISuJKfN1T5iYEa98FBfgfPXvNqgch1akUNMFwpUpEFjFeZYwKK4ki4fgOxXrr/7fKAAQN02YXN7ifFf811sWVmaawX0KC44co7pYuP9biS8uHpaZENeEcLoyeYt5XKOjXSGpRFhx9sJ5Iq01HZ/nkXtR1whQq1GBh60BP7hjHPwcdg62MobAT9ZVvNrSjqnw6TYc8fFTtaBV/VZ6S89WctNCUyHwCqBPepr1xhhrAcqGX8InQRUR5rcaXpZMAVfmFFwraMibfTLWAiNMWc2TbMReaJcgCqd6yCSTXX1ADITRbeuiJ+DxWsdVSXkIh5lNqiWPBeO22PQbKR8Y8RaVmbQc9ImPziPa5ZmoINERZCZVoPhnbxKf0UqoZ3nQBaMB7PeUhvwcVVgRMr3imQ+e5Quq3nDG4n9t9KUsJ3/ot1gyH2i18VzlUFdiAYDG/8SAmk29ce74IPBY4+4/yBHl7oQS2wTFe0KxCPHg5/gA== 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)(39860400002)(396003)(346002)(376002)(36840700001)(46966006)(107886003)(4744005)(316002)(42186006)(6266002)(26005)(8936002)(2616005)(7416002)(426003)(336012)(186003)(8676002)(36906005)(5660300002)(2906002)(54906003)(4326008)(110136005)(82740400003)(70586007)(70206006)(36756003)(921005)(7636003)(47076005)(478600001)(356005)(82310400003)(83380400001)(36860700001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:53.7989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a16bba2-cbeb-4819-7fe2-08d8ce64d50d 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: BL2NAM02FT063.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4233 Received-SPF: pass client-ip=40.107.101.43; envelope-from=saipava@xilinx.com; helo=NAM04-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_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 Acked-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 57fff89..e3738b2 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 Thu Feb 11 08:17:16 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: 12082485 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 9D88CC433DB for ; Thu, 11 Feb 2021 08:18:36 +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 F20F964E7D for ; Thu, 11 Feb 2021 08:18:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F20F964E7D Authentication-Results: mail.kernel.org; dmarc=none (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]:47340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7BL-0007pG-0p for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:18:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76E-0002q0-Of; Thu, 11 Feb 2021 03:13:19 -0500 Received: from mail-bn8nam12on2066.outbound.protection.outlook.com ([40.107.237.66]:9402 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 1lA76C-0004e9-Kr; Thu, 11 Feb 2021 03:13:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5bGjGwoAlwHIgTxsni8+YuDKmmAlMPMGSD+zYGIWRBJGlF2BEH5XpekVOekA1aXxYin6ZNiqcYQpkHjluOlFM5rro2rF3bmkuNdkPm0kI3twX4717/QR8qLxTZ5JUQhR+AuPU/tg3NY8LQTjtdKgy6oijWEZ8O4eCPSOgpuW4NXwvO0RgD1uMJSVoefNkarHMwu8aXC7q6q+G+GnKWen028yArL3caWvKaGhagNhEULFCniNMpNgNV8R/T+9N95u/Aoq3Cv7ih7ljLFb01agqAz/OL3Wph1XTGQxWSazha7LMCdTkvcaV1HHwJqazrFdMIo/ZUP+j6b7dmbG2D7zA== 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=dvmZRIujVJxZWrSkLjQLkhTpXdpAeDzz6e5Vz2ef9vs=; b=VpvHL40XdWQjOQlFkLhroVMMA8eZbdA2OARWBNofIXWb3g6Cj+JzA7RTOS3wpIRFRY9J6GYoxgyQyPohbPI1jJXVNq7VfrXqizyPEl12e9y/0Pj39/BAIy3Mc9bymSyDSskEVsNNK0bD1iyR+4qZS5YdEUIoN+/VA/MrUJQ4snQMkn5JhyvLUjy/GrmpBGVOMJWGfhaBR0FyQb29cJ29Y9XUkKwxoOtnT6sRjj08eF9Bf1SzFxyk8QpwDBeh9gRNl+dwpgnRPCwEy7em1zONJLu0kgvMgxXl0BRottF8/J8ij3rHPEKQtcleT2yZMwncMXtP96XrKQR8nAFVWj0rBw== 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=bestguesspass 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=dvmZRIujVJxZWrSkLjQLkhTpXdpAeDzz6e5Vz2ef9vs=; b=IvkkOQhOFSbgBhdfVKm8fztWXERU3tV+SyfzwyB52dFUtznyYHiUMUKqGBcKocNjDscJwLGDQgbp/BJM/aF3HEmy/R6jgORHuu1L9gOIK/6T6u+rQieVEqXOGVSbUHdawRXFqp7HIv4ruZfuLELfKtvmDMbr7Jd3xQ9qfcFUlYk= Received: from BL0PR0102CA0022.prod.exchangelabs.com (2603:10b6:207:18::35) by DM6PR02MB5289.namprd02.prod.outlook.com (2603:10b6:5:43::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20; Thu, 11 Feb 2021 08:13:12 +0000 Received: from BL2NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:207:18:cafe::1b) by BL0PR0102CA0022.outlook.office365.com (2603:10b6:207:18::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.28 via Frontend Transport; Thu, 11 Feb 2021 08:13:12 +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=bestguesspass 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 BL2NAM02FT034.mail.protection.outlook.com (10.152.77.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13:12 +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; Thu, 11 Feb 2021 00:12:49 -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; Thu, 11 Feb 2021 00:12:49 -0800 Received: from [10.140.6.35] (port=49672 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75l-0000QC-AS; Thu, 11 Feb 2021 00:12:49 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 59B5813C063C; Thu, 11 Feb 2021 13:48:12 +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: [RFC PATCH 05/15] sd: emmc: support idle state in CMD2 Date: Thu, 11 Feb 2021 13:47:16 +0530 Message-ID: <1613031446-22154-6-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 574ad00b-ddc0-47d6-ec98-08d8ce64dffd X-MS-TrafficTypeDiagnostic: DM6PR02MB5289: 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: GHVgiUXa30NXcu4O69QnowUIF7Qnh8k9spgnvg+QFHGEIAnmfd4pOqOHxQxckoUuC7ENwgJTLXIquff/FScIKsecyKRd/A3rZKZL56KPdN42tukrf+dHbV2EeYB9u9HnHZCh64e1jEyTziccZ50WzsmErX3wQIOArZ0I4KutMYQFOfxh0n+x45f/mvkrpPUf9jHcMlX3Ci2zQF/1xBsQz9LdESqBzm72+msktleMmFgH0aPCb0OaOyQ/bFmBNIcUcJ2S0cGCsGrbLkGwKDbxs73gdqXBpWm9i+S+nqI8YHbnMGmT9Gmyq4WcKa+Xc3EE8JReLE86ztUJaACSD9/jFNvLQ0JCnv2om+wd7PwyrXg3yoNEklwizaNkjeWBFn7kFA+6j3ziUkUGveNB9ZxvpxSv7247qXOlbXzmBT6vQzv37kUvG0HwuvCBaAQOMJa0gHs6hcKnKS02LJzI82LL2UDE/Q8HbA2lPl6ZZ81PPOSzGCClG4h90v/JDN26DOFsW0lzZ28BRoIYENB5e1AtELXgVjyoAkjsV2bUahcwMS0bYa2FlRLxbslwLQNC5MBryUigy+V4zZUF86dsHDpLCcliCLhp3t5zd0tYmFVivM0tCpES3ZYxQmAFknSpreaL0bbyUZ/sFCZAOwGq361sSpvuLrkueBdG3CtgTJBU/19CGRF4RRG3LQ8TdZ1bN0dnwlBZ7VLKaHtHUudCp2XMhA== 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)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(316002)(5660300002)(36756003)(42186006)(36860700001)(336012)(7416002)(83380400001)(36906005)(186003)(8936002)(26005)(47076005)(82740400003)(426003)(2906002)(478600001)(107886003)(4326008)(82310400003)(110136005)(7636003)(921005)(8676002)(70586007)(4744005)(356005)(6266002)(54906003)(70206006)(2616005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:12.1537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 574ad00b-ddc0-47d6-ec98-08d8ce64dffd 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: BL2NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5289 Received-SPF: pass client-ip=40.107.237.66; 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" 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 Acked-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 e3738b2..69289e0 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 Thu Feb 11 08:17:17 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: 12082489 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 CFF0EC433DB for ; Thu, 11 Feb 2021 08:21: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 303E764EB9 for ; Thu, 11 Feb 2021 08:21:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 303E764EB9 Authentication-Results: mail.kernel.org; dmarc=none (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]:52890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Dm-0001iT-3A for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:21:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76H-0002tJ-0u; Thu, 11 Feb 2021 03:13:21 -0500 Received: from mail-dm6nam10on2086.outbound.protection.outlook.com ([40.107.93.86]:59335 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 1lA76F-0004fZ-4L; Thu, 11 Feb 2021 03:13:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aiYBNkuVpHRWMc+UgYR4H/GexFukhEcze+H8puzgDThU/zRgVHtJ8rzpDo53mXhDqBs97B3Z0ZVy0t4SLR/ExCH2UEbHd4tqx3bX0YSktXfRmt1AJhBYxGJIqKT9WLP5LjsrOSLLFUnqrtP3dwjox0zzixO8bH+64WNpeHFDE81PkceuJXaluf9kHhvGztYLz2GCNWdG/ORomw5buOm56aMls2vkYqZ+TB72/G5FxZHRROMAR2fJR7XbGUlA5l1RCUpLfZX6SU3brd5fXZp4MyV9F9IUOsyzV0db5a6a8FrLtKqB+FX+DCcj79MpsTSkMrNOBadZ0CqXRoGLFUoFzQ== 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=K2WX94tSM8uvqZIAR/41G0wh2sl1F6e/7ROJCFsAqIE=; b=dIvl2Wb2werrZyIOfTi6QQvf7nQF1TD66VuLb5tDsMsM52gDFULUUpUC+e4StQxBOpTIpEflKr1EP91vP7k2SCFrK2NPteh1HX2JZM5x2b0DUg3eb+R9dOjTAhs8rVTPwkOEcwmd12AaltWKbe4CtGztJ8Hcfgl8A7IamNdf8zrk6NP678mry05K7S4dejICEDZNQw7JNnkmyoe1YgYHjbgNr9HjkUvVz0jHzWzRp/2dvJuyiEjxGWVYBGIv3pXgk+HPaPIzTB4kq4DuZaEFgtnuyEGz/cBuSa6D4GKdNxUKBaWjdhV9Pwfj9hgTnQV0GaJtfNbqx8xyKmyplVko9A== 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=bestguesspass 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=K2WX94tSM8uvqZIAR/41G0wh2sl1F6e/7ROJCFsAqIE=; b=Tp0fxSFJ54WRtLHeB9gtB9FRSPUvz3zMPA7c1ChenR+NlFSOXdEp2zzoZXPmpkvuQgETnCDhJSbD6xBpub++/2KM+EzeiI89ONtMzGSxPZ0n2+ew6k+dabeb1N0gOsazkJLibHAvc/C+jQ42aW0ApdGfT3OD/tb23qSFF8Ds4Ig= Received: from BL0PR0102CA0020.prod.exchangelabs.com (2603:10b6:207:18::33) by DM6PR02MB4523.namprd02.prod.outlook.com (2603:10b6:5:2b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 11 Feb 2021 08:13:15 +0000 Received: from BL2NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:207:18:cafe::1c) by BL0PR0102CA0020.outlook.office365.com (2603:10b6:207:18::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.28 via Frontend Transport; Thu, 11 Feb 2021 08:13:15 +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=bestguesspass 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 BL2NAM02FT034.mail.protection.outlook.com (10.152.77.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13:15 +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; Thu, 11 Feb 2021 00:12:50 -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; Thu, 11 Feb 2021 00:12:50 -0800 Received: from [10.140.6.35] (port=49674 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75m-0000Gw-0N; Thu, 11 Feb 2021 00:12:50 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 1005213C0653; Thu, 11 Feb 2021 13:48:13 +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: [RFC PATCH 06/15] sd: emmc: Add mmc switch function support Date: Thu, 11 Feb 2021 13:47:17 +0530 Message-ID: <1613031446-22154-7-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 754fa72c-667e-48ac-4934-08d8ce64e208 X-MS-TrafficTypeDiagnostic: DM6PR02MB4523: 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: 9PHgKt+atTfaMlaN5nZbFH/knmsh9JHQDI/b7ApFYJssgTL83QvYP+qd5xnSA6ZpjCzEToeyPvsfSzYnfUlsrG+pP1MehPm+cgNwUwjCsStMiWm8t1ciZyjuGMWNxHVq3nUspoEcOY2Q8riFyWNoOBDtTPX/GRk7HTRdBArwazHhb7k/EASapDHF9xfD0Th4BkQxecDoaUbDaHZFYLayW/gcxLG/EEcSFF+6I9NhzItKgY75qfXHeIbs3PRFTQZpZW7aE614sj48GhQCq/OIfV9EML2v7LbOA1qgGBloQIhnKLISGRfQm99/ZkNzPuXt2Qx1MFpwQ0S9k3NsZVqZrHjNkjVzCBzuOa0CtRMlWKFvwn7suac+5UnS5PCZbNynEWWTmGZ0/dny7yCnU+/SG1cxz2LM2OpfQ4I0M1oqvlEi7lmcnLt+/2HsnW23IExAvDBPr13lOSFV27LYTM9grsf9Uj0/5fpsQkVkJ1rEyueni19w6g7jFg5lFhWuvM5gpyDzIvlp1Bd4KdmY4oAXglxY37Sr37bZctyg1MmvLTT+nyjxJuSLZW9snZUpLrMztFQpR+pE00Pue1yyVuTOEzWLnZb5n5ylRh2xh5pvFMR0DvSJOe/OaRhVHhkcZ0WIf7v5C869J0Hkv0Jg4wcQzHP3pvLMJarnBxwpZTXRypIX1EtbrU3tu9aNeZJ7R5wqLaoAxjnARybSWNzhgHTyZQ== 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)(39860400002)(376002)(346002)(136003)(396003)(36840700001)(46966006)(82310400003)(921005)(4326008)(83380400001)(47076005)(36860700001)(107886003)(2906002)(8676002)(7416002)(82740400003)(6266002)(36756003)(478600001)(54906003)(316002)(70206006)(26005)(2616005)(336012)(70586007)(42186006)(426003)(36906005)(5660300002)(356005)(7636003)(110136005)(186003)(8936002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:15.5771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 754fa72c-667e-48ac-4934-08d8ce64e208 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: BL2NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4523 Received-SPF: pass client-ip=40.107.93.86; 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" 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 69289e0..7925174 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -519,6 +519,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 Thu Feb 11 08:17:18 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: 12082519 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 47112C433E0 for ; Thu, 11 Feb 2021 08:28:16 +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 9F40E64E00 for ; Thu, 11 Feb 2021 08:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F40E64E00 Authentication-Results: mail.kernel.org; dmarc=none (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]:38046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Kg-0007pU-Mf for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:28:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76H-0002vW-QU; Thu, 11 Feb 2021 03:13:21 -0500 Received: from mail-dm6nam11on2088.outbound.protection.outlook.com ([40.107.223.88]:52064 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 1lA76G-0004fh-1A; Thu, 11 Feb 2021 03:13:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hYVTdj8cli77uTm7/XcYShf7SSh5Cu+PCg3Fd/xBdHFv3s9MU1NAyhhLOdeHS21IatxF/GlWujB6m6UERv1rGY60x4nPgiBTDJuX2dM5a3VEwycVDnhi6sqJwA8dvrVitQaYRYXwl/CY5hrO78LoMEsQOfTJokzSu760aI6LsFLNx81al1cdPPH65dxbuAYe+8ELAKVGzQORPtdI8cioBe2xmchpYA3CTquuFJJmumFeM4Jz791i0jIzqjlK76rZphf8LJpO4nbuoMn0OKUmRxqjur8Nys868B1usKQQxfwUqJK5JmL9M9FQ9+qsdqURICRYa2JNLl1vKTUnQimHsg== 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=Ak9KvnwmKqQ81VZ46sj6vnn+oCPC+/qsR820m+rHY68=; b=GRrZhiPtTvuQpWJ9C645SLg9k5SjBk7mcsMJgKvA40u6VQDfmCc7V8xlZeOm7o+CgxknEQ+zHW5YNRoG4XnakVs9wd/kqXrYeoPUkbr/EPyPF0APW9pb9HkTqmLb8Niy+uyRhNA6U9fFWPMLmJGD6sug4OJqUH6xVpl3taBoGvIiuHph6d2XNuTyv8Si9ml5CjDK4tU1O+jH9D1bDj0VJhOpji+dCwA4XX+2DNpsoMwl9saksvM64IwSKHsvCLPI1RVmhuZsp5z6zER/Xngoe4DfQnhDZzGoN936vq4YVWcqTXycLvb2vOkWEXWHQ/4/Rb6P8XyehCWl3vPIl0UZMQ== 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=bestguesspass 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=Ak9KvnwmKqQ81VZ46sj6vnn+oCPC+/qsR820m+rHY68=; b=hcR7JPfp4wiowyvod+5C3GsvwRTpAcM84GTM7omdV+J3PnzQ5ZLu0ECXrg0ZPWRePiS3b2VrEzudn10b8qAQ704L5Nlu1RCgKizLI3FGL4MgHbswPOdUkQ3ImLB2NDLrNTDJUgJS0as3OWTYBT8VCfAQlgrcEJq77Gr9SdIUAqo= Received: from BL0PR02CA0126.namprd02.prod.outlook.com (2603:10b6:208:35::31) by DM6PR02MB6857.namprd02.prod.outlook.com (2603:10b6:5:21e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 11 Feb 2021 08:13:16 +0000 Received: from BL2NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:208:35:cafe::ba) by BL0PR02CA0126.outlook.office365.com (2603:10b6:208:35::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT009.mail.protection.outlook.com (10.152.77.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13:16 +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; Thu, 11 Feb 2021 00:12:51 -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; Thu, 11 Feb 2021 00:12:51 -0800 Received: from [10.140.6.35] (port=49672 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75m-0000QC-PE; Thu, 11 Feb 2021 00:12:51 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id CB4A313C063C; Thu, 11 Feb 2021 13:48:13 +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: [RFC PATCH 07/15] sd: emmc: add CMD21 tuning sequence Date: Thu, 11 Feb 2021 13:47:18 +0530 Message-ID: <1613031446-22154-8-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: d7ac4683-7687-486b-de0b-08d8ce64e24a X-MS-TrafficTypeDiagnostic: DM6PR02MB6857: 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: UTmRf/pBItcKbtPeIOmd29JJ6G9CK4W5xmJIg86YaDKwB2c2b/x5rsSZ0gR2Fsh23aQMq6XsxJUi5ILRTFpU0OVaWyLTh32ktqbxfdISTEWHM66PovhOHCjwJfhcgM1mbQF6APyGi3ZxCX4MEQgPLb+1vYy7JVjKx+Wy4yiia+K6MZESAY5drNkeDv3PTGUEd6EP/7tgH7lU7vEf07Sv9ygS0p0w5N0v0t8UMO4kX4H0RoTohgnd+jReOOcde7e/1oD3uRz/qeadDrQko7D6GS9KHyQ6lHbp5T6V0twgBYv/jNRIBjFZyyiXH4AeF4gQrXxl7bvT4cAVV6bKPFnNWvXoZS5k4Bbh0PZhOFOLnWJ/eN1M7RE+7459qUn7ziFGdlcY8aRKvn4NfvScN+UDC0vB1XwJ7pGWwSESKWs8pz29am5hxl/NUYyo/1i3xXwas4jHf/BRQHJPgwK/1MtDZXlJQVH1gkMjWmNmVckV3zSBKC+Y3fDI1TMnYAX3ZNB35LY5yyaIM3g+G5h9U48k8RbXlhepMW6OxSUdCK1vbC+ALBNKOk3XuP/b4IwhyTtqxA6/LzVsPp46/LKYXA4o1yxCCWee8+l/J086N8sKW/MBB0J26lrRmyxzL89HIZxe2bf+g8+EzbDJId+bea/p5SEGcs26kKB0jnHaUDeZSH+Iw/OXa6Y0xVWqdFon/lg+XsYN82aqbCwvjAfJlWIr/Q== 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)(39860400002)(376002)(46966006)(36840700001)(921005)(82310400003)(2616005)(478600001)(83380400001)(26005)(7416002)(186003)(36860700001)(336012)(426003)(8936002)(356005)(36756003)(7636003)(107886003)(36906005)(82740400003)(8676002)(70586007)(70206006)(110136005)(316002)(5660300002)(42186006)(54906003)(6266002)(4326008)(2906002)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:16.0124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7ac4683-7687-486b-de0b-08d8ce64e24a 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: BL2NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6857 Received-SPF: pass client-ip=40.107.223.88; 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" 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 7925174..90359f6 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 */ @@ -2204,6 +2236,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 Thu Feb 11 08:17: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: 12082509 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 83367C433E0 for ; Thu, 11 Feb 2021 08:23:10 +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 1353A64EC5 for ; Thu, 11 Feb 2021 08:23:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1353A64EC5 Authentication-Results: mail.kernel.org; dmarc=none (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]:57528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Fl-0003mo-2x for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:23:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76N-0002zC-7R; Thu, 11 Feb 2021 03:13:27 -0500 Received: from mail-dm6nam10on2068.outbound.protection.outlook.com ([40.107.93.68]:39904 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 1lA76G-0004fj-4q; Thu, 11 Feb 2021 03:13:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QauPFGgsY1hjHaA+fjL067mYt8SKT1aKvIncuSgvpNHSS4uoul0jDDNpEOAfe6xsdEx6rZTbEfMr8UejjyXA2vEf1SowMwwn6QPvG3xalSWBF824ngvlPoZLKdnktQ58P1MuTsSc176BqMBVrvSq6vZmXEj563GY6ba1o/WSV1JL0x/GGnnDgkHLO+BkMd1vWj6aM/CBVVjBObZ6RsfMa0eZqVwcvFyNZflVNO2r5RoPyRZtoTa29klV+uQeMYf2FRYMZ4Ftws1JMAmKYj/efqrtU+SdOC4ikNT0h1srhyqH8RNUxkzC3x8fsyI2kvqkKVx78Ga2DxUcFiqOtPfw4w== 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=bzN8vwLYNSmXs52aOhtqWWanGDIxUnCAfRCbyHwNLp0=; b=oagOTAuwTTNANT1YeKmFsassbw03c5t0CTi2umXdFBsQZji+PB5ta3FzXMAdq0kq4MjnHjGFrZ54LWv3hiOzBKsIxunU6n7Bm84jjLowOC0CFVFmK7vV0ZWLpO6c2vLrqhtUBBjzMHndISTe64UVRtoX9YoU/Kg3J2S11FG6e/SMoZPNwTDFnRGBxu9c9ktl0YztOEHeKLehZDAHpaKh0pcFd3QNngGwXe1aKi3ZXyn0Sdv/iIpsPOgBesYPG3sx9Y/iH1lxaLV3wVwmJdJRGDBtRcJlbcI87/WvpI+1edBsplHds9wlI6ZnxPzUq75eL59O2+uqatl/LbRqp26UtQ== 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=bestguesspass 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=bzN8vwLYNSmXs52aOhtqWWanGDIxUnCAfRCbyHwNLp0=; b=ZupcTYNnv0pRcoM01bDRok5U7YDwz9399QZAG3AY9Z5s1PXDjFFrOccIJRVG0ITXlHXzo5K/q8xJAFaPl9KyI4HAwfZ4hDcspSb2K0ayLIOab6/AmVFHLPsDASpkD9+jnjCOYPX04pySnabsHGA1ze+YHgIGQh2/YI0277PI7hU= Received: from BL0PR02CA0121.namprd02.prod.outlook.com (2603:10b6:208:35::26) by BYAPR02MB5704.namprd02.prod.outlook.com (2603:10b6:a03:9c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 11 Feb 2021 08:13:17 +0000 Received: from BL2NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:208:35:cafe::da) by BL0PR02CA0121.outlook.office365.com (2603:10b6:208:35::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT009.mail.protection.outlook.com (10.152.77.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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; Thu, 11 Feb 2021 00:12:53 -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; Thu, 11 Feb 2021 00:12:53 -0800 Received: from [10.140.6.35] (port=49678 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75o-0000QS-7M; Thu, 11 Feb 2021 00:12:53 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id C298413C063C; Thu, 11 Feb 2021 13:48:14 +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: [RFC PATCH 08/15] sd: emmc: Make ACMD41 illegal for mmc Date: Thu, 11 Feb 2021 13:47:19 +0530 Message-ID: <1613031446-22154-9-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: b7115eb0-0404-4139-6926-08d8ce64e2ab X-MS-TrafficTypeDiagnostic: BYAPR02MB5704: 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: wdRH5pokLEfRM+EXZaWCATGlRKbDONNptnfPLE3Fwpcg6eXMZsg4VNItNt1f+kGwgcbH2lqYo6GqMfMdPXUCfa1qiN2LHVnPfwAjXdmyX1jCZGC19w7tdEr4bYHdhato0lalxJb3/CoxLszsVPL1HPBgYv5byYkaJ2rV9POXZGom+Iz4eDo3mBhTmdaHECILYFG2aIAmqEiPSY+jJyGmNF5h6jcSb7zpbUvvi2hadAgr/kiD20jn8opvVFzUHvvbnJOHQLGOPDvX5LkVjgdg1cdCkvsQ9Gj5ykWfLR3E9vmKG2c3A2Ut3IXDCqYgEPPl/ke7qXrc5jCWh1bQLeFEEROqzoB6HE4Ln8Ldtf0bebi94ii4yneCNJiTi8QA1h0MGNXRqQ4BxRu6PQwDEaptU4HHlQOQukbeTTHPD3s7M4qSVYtPq5KG1B7nknu5x8DUyZfAcSUY2qAnSeyTzSrKaowTZlE7meEPp8+II5IIAWgI/EC08+KLTI43qPI0dPV3pz+vOZUeTHFVDHi7HGtfTDJk0aYS4XoSCdekHWoTFhStfMIQorZeLgfv+GSCxtHs9j9k2kKmb3H89POeSrUEiYoxXt+8CYEX3pil7VeL3NMFCfxjuO/HavXrzX/UuhgnZqjFvRwiAoZ3h0+1Q0ifN2rH1pBIpYi3RtMsryZpGorM8U21wXcSDz/Z1/bYQhe1eVmv8NX4/BurbPSdpRe3Bw== 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)(376002)(39860400002)(136003)(396003)(36840700001)(46966006)(6266002)(47076005)(4326008)(107886003)(8676002)(2906002)(82310400003)(7416002)(54906003)(356005)(70206006)(921005)(82740400003)(7636003)(110136005)(36860700001)(2616005)(5660300002)(26005)(478600001)(336012)(8936002)(70586007)(36906005)(4744005)(42186006)(186003)(426003)(316002)(36756003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:16.6451 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7115eb0-0404-4139-6926-08d8ce64e2ab 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: BL2NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5704 Received-SPF: pass client-ip=40.107.93.68; 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" 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 90359f6..236f2b8 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 Thu Feb 11 08:17:20 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: 12082491 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 60234C433E0 for ; Thu, 11 Feb 2021 08:21: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 D4C0964EAA for ; Thu, 11 Feb 2021 08:21:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4C0964EAA Authentication-Results: mail.kernel.org; dmarc=none (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]:54112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7EI-0002Kc-QT for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:21:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA762-0002lx-CF; Thu, 11 Feb 2021 03:13:06 -0500 Received: from mail-dm6nam08on2076.outbound.protection.outlook.com ([40.107.102.76]:7137 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 1lA75z-0004Zz-CL; Thu, 11 Feb 2021 03:13:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eS48Jtm0hN2E9oQkijzMcK63kNnc7RWbDX94/SIUAFW6cF98zEawepe4nZ5SASCWETbS1CFD1S+gPn8OKIcty+cAFlcWEg34ZGb+u7rnKnhCrVkFmeNXfOOnXiowjhxUKcSeKpZlGRf/zHs1Mhp/J/WBM3zd7565/GUjoPHSvoYUEBoOrpBlMYNfw2J+WOEn//ttq7nBvmCXLMLcBHPKmsKR50tkOxkJm0lhMCNy8VAFuhFROT+6vZ94sLL3hixvbuyiCOyoeRtnq6tnxIXBbkXb/Myw6DjSLpHM8qCF+SK4WeXFMLmHZUCL4VP1CSCOdnYgUS7umkYWqlowZuQAFQ== 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=5nSCq4vZoR6UEJmvCLlEkfDmJT650EGVvrhw6DKpmy8=; b=A3qEF/ukkhsdbBO6+0Aw8UfgxXLRBZ3yYVj5G2CRCHtMmhrFHZZsRa+A4hUvoNDc/GW/gB1q19n09ED/tNmjC/PKCFCebi1tgO7SCbNKPFD6jmsv8z6Xya/CoftnKs8fBVdgitn6OOprAuTbwz0wRUTDwK0e66zY6WNPaHO2Wiq3HdNJy/hRXm3TLMj5uiqDvKXxLtQwe+VvPogPsPWEataP7URQcYeLiajKDEMA2cetSXjQ+WvOOnnOSc1qLRzH3nsVsWPDKvaB+w/QjHXeRwlz+gbYM8XlZgqzMEJKS3t0vQG3yeufl+UAmbYAaLjIbFG/EI57y86VnbCye3XHNw== 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=bestguesspass 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=5nSCq4vZoR6UEJmvCLlEkfDmJT650EGVvrhw6DKpmy8=; b=Z+A27ftHPfv1Bn0WM4BcpkzsHdfRkgnhs51/7277L2Ho3hP0Qd/RPZGZPVy3Me4dOdrKKDpGf8sOuD0Kt84HLglsTuM5vBSm+m2gV66EnPM1l/scaspw7gvd3FJQ46XZytiItK1N6CYnJA0xN0KyAMlj8e/2yeT3EQkX2s+Q63M= Received: from MN2PR15CA0020.namprd15.prod.outlook.com (2603:10b6:208:1b4::33) by DM5PR02MB2601.namprd02.prod.outlook.com (2603:10b6:3:3f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.25; Thu, 11 Feb 2021 08:12:55 +0000 Received: from BL2NAM02FT063.eop-nam02.prod.protection.outlook.com (2603:10b6:208:1b4:cafe::8d) by MN2PR15CA0020.outlook.office365.com (2603:10b6:208:1b4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:55 +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=bestguesspass 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 BL2NAM02FT063.mail.protection.outlook.com (10.152.77.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:55 +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; Thu, 11 Feb 2021 00:12:53 -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; Thu, 11 Feb 2021 00:12:53 -0800 Received: from [10.140.6.35] (port=49680 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75p-0000HA-1y; Thu, 11 Feb 2021 00:12:53 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 97B5E13C0653; Thu, 11 Feb 2021 13:48:15 +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: [RFC PATCH 09/15] sd: emmc: Add support for emmc erase Date: Thu, 11 Feb 2021 13:47:20 +0530 Message-ID: <1613031446-22154-10-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: c6c3441d-664e-4ecf-a07b-08d8ce64d607 X-MS-TrafficTypeDiagnostic: DM5PR02MB2601: 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: z+/goeABbUXFCzFBz3EAjDAOEL/Ra0w0SlEt98iwSGhjKws4uucXfzehJDkcgzpL4nvgTbagJga+dWl+Ru1EaNw3+yx0rhTp8fQU9kNxdLqRZ8qcQ7ByyIQi1yY2dydLbyhBHOqvE9O9qYSo+NbAHsRa9hHYwFvW0eaD+jsC2vKiEGRNQ+r1CETxUabo5JlFK1h6ewnGIIT+ErxS72ShCz/f6S8kd11YF3HYbFYhfyzGeGbDV8+1DUoX3H6ah7mAUIzNkY48sVEUGxEl4uIN8nQ5h58PTBMUxWcPjN4GdvGA62ZK09ZdJuPyXD15oxOa7cVYAxOlVI2wRz5rAAk0qssAu8g9YkOXzX+xnCFglQx1LDtL1of+lwkYpd/nWihUKy/ErX8n7RnJO6Ne3HyLL145BPjWKWoqo5xeOwoc2l6X5ehAYQpQujV+094m8XDCj+QopoHdWtIyYCaKsr7F9L2QJjUAL3jb7p5iDyBjVMcOpmk+yuAXJxgm+ou4tfxRCyeMDaWgHXpyV8oLStdfA79TkoG0piV3nRY6aTdi0YH0SoOTcJMApwQ78MpqmJ8HFC6OSzDNcLrRFD0odJTCdQhvpOXWsp+Ji3mM+KgLXZ3WZu14dchgEkZB5xdWTMIPjSBYqnws1DiAdWUWp088hFTAWtDMaCwe7RWLXNsShz9IwkxW2WSUPMz59ADrl2Ek2RlPJU7Xmh6zUidwg6mN/Q== 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)(346002)(136003)(376002)(39860400002)(396003)(36840700001)(46966006)(107886003)(42186006)(4744005)(26005)(316002)(6266002)(8936002)(54906003)(36906005)(2616005)(7416002)(426003)(336012)(186003)(8676002)(6666004)(2906002)(4326008)(5660300002)(110136005)(70586007)(70206006)(36756003)(82740400003)(921005)(7636003)(47076005)(478600001)(82310400003)(83380400001)(36860700001)(356005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:55.4381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6c3441d-664e-4ecf-a07b-08d8ce64d607 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: BL2NAM02FT063.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2601 Received-SPF: pass client-ip=40.107.102.76; 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 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 236f2b8..7aab647 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: 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: switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; From patchwork Thu Feb 11 08:17: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: 12082521 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 1B017C433DB for ; Thu, 11 Feb 2021 08:31: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 6EF0364DDF for ; Thu, 11 Feb 2021 08:31:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EF0364DDF Authentication-Results: mail.kernel.org; dmarc=none (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]:41980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7NQ-00017t-C5 for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:31:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76N-0002zh-EW; Thu, 11 Feb 2021 03:13:27 -0500 Received: from mail-mw2nam12on2075.outbound.protection.outlook.com ([40.107.244.75]:63553 helo=NAM12-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 1lA76H-0004gr-KO; Thu, 11 Feb 2021 03:13:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vm2Jdpb8kQaMdWzNzNiGhTnda4ETGPDsjmmftEuIh3dcMO7fgG9558qfApaKEqBTpqzET6sYgmkVYfIu3cdCMB0ZqSdnEnAMbngt3E4q8kphPEORTvr9dCUHjKT9cEI3rSlsReqgqN2tM9EIp0ntb8cMwS18yaW7sU72yryxXVAoErBHgarRWswqoulCuCjillSPv5/6zUgkYiDyinkrQVd7Fkanh0D108NgiPph/nc0k85nRfVc7TLK4cFLPP6SCLtrGHmAivcJzsCEmUUqON+MBxYlyICppBwxx2Y/kbooyifINANsJfwjugqqiHCfPMqBReWPNc0xg3ldn/U6tA== 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=oyABf3eDMNEkDY1iB+BhJEthHtM8IVaih+J7OynGKc0=; b=WcATplag9dJN2Qy1LjtfVN1YPEu7te6TFe3KXql10va1B6TlOgVaRDz0P07wm73eNMDg42DQSXV3oYXwcSDwIsRq1EQYfflXrNLbS2luX3ZCV7f0Szt0OCTvebZCHO1DdiLjAdo+r1IFdkajIfCDHh0ULUuW3yghFONXvesSFo47qIk/OiLviYhaz1nHyv7vAT3wJ67bns9MCc4dHoHtAPGMUz788vafy7JfPfrEWX8goI/9W15JVMGEOpJ8qCndAS62iYvyMBziyvgK9HNnBtViIJZABwuNjFbTv60q5iUTFeSAKlBm7L8mTXCtjdNeMIyH+AX5zPpv4SdAvsNuYw== 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=bestguesspass 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=oyABf3eDMNEkDY1iB+BhJEthHtM8IVaih+J7OynGKc0=; b=ZnBkjIom+mIiE4xNDD99Lo7A/Hex72yHfi+xWrOwQ3TS+so+SaXoEGEh6LfRtDf2KjlvKZ2Gs8s+Vr54hoVyXExSmp7bxBsZmHNU8NA1s9yTROKyB1GQE7tavO5IKrAR3mWcuDVXVpIjssUBFoFDHMpuqzDK6yAfpXmW4SdcBiY= Received: from BL0PR0102CA0003.prod.exchangelabs.com (2603:10b6:207:18::16) by SN6PR02MB4080.namprd02.prod.outlook.com (2603:10b6:805:2c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 11 Feb 2021 08:13:17 +0000 Received: from BL2NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:207:18:cafe::40) by BL0PR0102CA0003.outlook.office365.com (2603:10b6:207:18::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT034.mail.protection.outlook.com (10.152.77.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13:17 +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; Thu, 11 Feb 2021 00:12:54 -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; Thu, 11 Feb 2021 00:12:54 -0800 Received: from [10.140.6.35] (port=49682 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75q-0000HE-8r; Thu, 11 Feb 2021 00:12:54 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 3A7F913C06B8; Thu, 11 Feb 2021 13:48:16 +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: [RFC PATCH 10/15] sd: emmc: Update CID structure for eMMC Date: Thu, 11 Feb 2021 13:47:21 +0530 Message-ID: <1613031446-22154-11-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: b7e3dc53-9ee7-466b-d4af-08d8ce64e30f X-MS-TrafficTypeDiagnostic: SN6PR02MB4080: 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: vWhW2Sy1maBbyUp5GuYSru5A/kvq8mPDaVd/CTsdHFoJAUbpPt/GoPLqwGjH3S4h8BMEzENXUjad/yYs0BcsvBdwVY59OChutjOMGlqcTdQY0+u1hTQ/pXQ7BTyJx90qvcBROSerEQdpWWdq+lcvFpsnGPpe+3q4K+O6oQ7sBIE0W097vpCj/eLOdWit5sXcPh1ubSvEEKzLkLGAnwXaLWqfVmireZ+Me2YGwlb8HZZ4KVEbWNBAsdUy/XwXdtp11EMM0nezsG/DU4DLSyK7dLvewx0dSqOwWyqBsvplwrNf9YFKR+sK1NbhuOZW1CqBHNHcH3ACoNM5Vo4RYDBAzkivuFM909YaVUVc+9dhmY4GmAWOhOCwi9+B36jGRGTvAeLkH9U+nvJKx3bQKax5Z/cHcv+wv5LcMppZuZ9zhSFCO+TNjxyFPlRokwhwUnjEYEEvqwBrC9pLf9an7xSe9jhZp3npDqi88mnZ1bXAaeZNUbifELZUgUnWN1akDlyaUYidXVy3DlJFpm4C7FwQDXVj5M43nppU84Cpm0dDkWiDPa6byOt2+6yKD0qJD3r9Yw+iUGUI3mmq93/mnUjr+YIoNWls6ycVEPTwkoiekx1h2k40qFFyxhMSKRVQ8PNFOIW+0AHKaEvfpynFEYxDo1470/3cGhw78Rm4A/x4o4Gzq5VS5t9ugYGkx27gvnDCDjSXj5JUSi7W3LXLydXZrw== 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)(39860400002)(376002)(36840700001)(46966006)(426003)(70586007)(70206006)(336012)(107886003)(316002)(47076005)(5660300002)(7416002)(82310400003)(83380400001)(2616005)(2906002)(36860700001)(921005)(7636003)(26005)(356005)(54906003)(110136005)(186003)(8936002)(82740400003)(6666004)(478600001)(36756003)(36906005)(6266002)(42186006)(8676002)(4326008)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:17.3032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7e3dc53-9ee7-466b-d4af-08d8ce64e30f 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: BL2NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4080 Received-SPF: pass client-ip=40.107.244.75; envelope-from=saipava@xilinx.com; helo=NAM12-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" 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 | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7aab647..45311fa 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -345,23 +345,41 @@ 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[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[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[3] = PNM[0]; /* Fake product name (PNM) 40bit */ + 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; } #define HWBLOCK_SHIFT 9 /* 512 bytes */ From patchwork Thu Feb 11 08:17:22 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: 12082525 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 29D5AC433DB for ; Thu, 11 Feb 2021 08:33:24 +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 A5CF264DE1 for ; Thu, 11 Feb 2021 08:33:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5CF264DE1 Authentication-Results: mail.kernel.org; dmarc=none (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]:48182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Pe-00040I-RM for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:33:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76P-00032G-8I; Thu, 11 Feb 2021 03:13:29 -0500 Received: from mail-eopbgr770047.outbound.protection.outlook.com ([40.107.77.47]:22156 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 1lA76H-0004gW-4W; Thu, 11 Feb 2021 03:13:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LPunsD055RAqHMQLNYFSHbpTUOshf0EN2ZkG++i1ql8f+j+RG3hYYMng5XInj3p2xBH/30sZ/wp07lep1ThThrbScYqgXrvZJ7VaiHNwJD5trQk7/Q7vScl1OXf0XSpXrHkkK2ysFhTSrOU6pZV40FlaHn7D+opCvnn6fKHDJjsrNHe4LHFYDXHO8GqHPVCdnu1kEPnhLK+UDSxrWX7CJJ8Engs7cxzaN7AeiFBAakdCsgIHOzDjEPBj7yIrslkh4wrSjESpPeR4zhFYVifWEt3298+HrdjfxRtzmHA+Pahr1fvNXHPj6e5b2CNVjq8AaB8JQ6tjcstvT0ICw2nLgg== 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=WwMX+B+ldEDNouPhg6PkaCR7CacbusezLsdQYtjibgY=; b=Og+kleXe7LiaMq/0R2dNnQAehxfVJ5TLxpuXP9STI2MKphcg0ArCQNkAv41RXJ0cqYEWWF2XTPUWQbhW+mMCzfubDy6hKKZE71w1xZgqGTHN/8kwC3xA6+efJE09jmftRnfcVRFm5Dk/qudhkvjf7bndNXoDeu5a8fJWzTPUMjFyBVw/DrP0k/TUuQiN5E9Du5T7YKVUh+So3VYWCpgJmCehehBgvarUmQAizQ77bFViDJqipCSVOJyAMrp1CoPgVX2o3z2X23meU1TucIePqo9pBV5mlkPnKFMRCYSoz3keOAJuywJScKHtVqyf+unEj798f7lFbK4QYtPrOmC7oQ== 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=bestguesspass 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=WwMX+B+ldEDNouPhg6PkaCR7CacbusezLsdQYtjibgY=; b=FXuH1+yxcQ+noXMLT+5CEDF7CiX9lkSiYrlb4zzliON7NOGsNhoEABeZ1UAfF6OGA0oWHQNf1UeJo+c5Zvj3v8DyNlI5wpg6LFiuTnRNlGRfx7ktWHv/4lJTNhuvZarApSZLQl6ggvzIr9+Gi6Ypoc5pHlUeGSW1672G+zDJ8VU= Received: from BL0PR0102CA0019.prod.exchangelabs.com (2603:10b6:207:18::32) by BN8PR02MB5939.namprd02.prod.outlook.com (2603:10b6:408:b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 11 Feb 2021 08:13:18 +0000 Received: from BL2NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:207:18:cafe::12) by BL0PR0102CA0019.outlook.office365.com (2603:10b6:207:18::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT034.mail.protection.outlook.com (10.152.77.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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; Thu, 11 Feb 2021 00:12:55 -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; Thu, 11 Feb 2021 00:12:55 -0800 Received: from [10.140.6.35] (port=49684 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75q-0000QZ-OS; Thu, 11 Feb 2021 00:12:55 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 4CA6C13C063C; Thu, 11 Feb 2021 13:48:17 +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: [RFC PATCH 11/15] sd: emmc: Add Extended CSD register definitions Date: Thu, 11 Feb 2021 13:47:22 +0530 Message-ID: <1613031446-22154-12-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: f4370838-b2c7-4177-ea9f-08d8ce64e366 X-MS-TrafficTypeDiagnostic: BN8PR02MB5939: 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: Eu6BM1F5NvLCnhEV6mu7rNppmPibV9dyaJ+uz7OKoe7QysiTDEaoUzlu49sFoQepr1kpDAbaEODEEeohOUhjIP2XG1clHPX7mPj80bS90NZtax3LaEiAAGKZ0TQwYd+/mXiuzW1i0lh7TiGkPsICnZ9MAIBQzyBB+WW7gtc+uqmOvD+vvpMIBRfgKXBn85+ET+jnmHH7Wl8uG/FH95rgUaWvUy48e7IYNcPdocdM/FfvcVouz/AREGgWxBfNe3qah52Jr8kx9Z5R5H7lTf7dzhaJ95sdmJqmC8kJja88/Xy2TFJ6hk3EpIqa/YdD9PuxXquQG8oBdEtkT0f0bANTUKAlx7iEUHWmGOFPYbdFPpKT2H3e2w35t06BrkmxczMQStTc2Zq/Q8Ln85QbqQe12iuawSinpumeLB0KCcyatrkl7re9u5dnj+yLPLV5UbZMZX4+1/Xsds5Ip1251rIMf5W3+yGxdcfhD3hgOKKiMrvC12pmoWidjavTS7sfiy6tz1pwT1j7PVRxp+jIXlvHk6UnIEq+FalFZW3sJpXMY9EpEJ13nGsiZ3ZhgWnbbNExAumVX37NsY5iCPCD0okmTuUaVNFhD53kRVYWZrFHtMOMXdOoIJMWCC4UJWm0utPNOEARfXNVtPZUCI1AQXRSs/VDo2Nw4rtCbd2qdPGCOuWBVmSAH+Q5oEs4Oly5esT6BHBMIwM6h+bUbio6+wC5dg== 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)(39860400002)(396003)(46966006)(36840700001)(66574015)(83380400001)(82740400003)(36860700001)(70586007)(6266002)(5660300002)(82310400003)(8676002)(70206006)(107886003)(478600001)(4326008)(7636003)(356005)(6666004)(186003)(26005)(8936002)(2616005)(36756003)(336012)(426003)(47076005)(921005)(54906003)(2906002)(36906005)(316002)(7416002)(110136005)(42186006)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:17.8740 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4370838-b2c7-4177-ea9f-08d8ce64e366 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: BL2NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR02MB5939 Received-SPF: pass client-ip=40.107.77.47; 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" 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/sd.c | 54 +++++++++++++++------------- hw/sd/sdmmc-internal.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 25 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 45311fa..54fba7b 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -398,41 +398,45 @@ static void mmc_set_ext_csd(SDState *sd, uint64_t size) uint32_t sectcount = size >> HWBLOCK_SHIFT; memset(sd->ext_csd, 0, 512); - 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; /* ... */ 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 From patchwork Thu Feb 11 08:17:23 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: 12082459 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 DB659C433DB for ; Thu, 11 Feb 2021 08:16:03 +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 7DCDE64DD7 for ; Thu, 11 Feb 2021 08:16:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DCDE64DD7 Authentication-Results: mail.kernel.org; dmarc=none (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]:40206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA78s-0004ma-H3 for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:16:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA764-0002n3-W9; Thu, 11 Feb 2021 03:13:09 -0500 Received: from mail-bn8nam11on2073.outbound.protection.outlook.com ([40.107.236.73]:64865 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 1lA75z-0004ao-BC; Thu, 11 Feb 2021 03:13:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iTB43+Oremp1vFPWezWislsyq7s9HGZsp82R6B+lZuMJohZSFniHV+wM2b4IsDNxpZAaWatzKPqvbYwE21mWNhW3aT0EA0AoU3YcPoyTTQE9cYCXtsgB/KTJIFUz/meZaBXO51JyGqcYBAKYVdSHLXS+DlE+LHgNkp1C/jE2mwkru1u++/PIsq1PY4qSGPRLQ+PlFirvJyTQpLSL/Q4E6SoyYV9nZ+aOx2U5VgTErSs5/A3oYxpzGABiDdstxOeXrkegzPow/bJGPNh0fSAqMz7ZqZmth/v8+TPYlKthgyp7k7x+6Xe15WGCiN1i6CBig192nKccDlOByprV9NHfeA== 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=aY506UkXxsO6EhPc+amcUwLCZ5ww9snMvhTZt8m/+Xo=; b=BC3vPTw5jP0CdhXRJBo1TXYfnmxW8px6WTD9xR/nx81t224J+EsQuwg0bF5FnaSrZVsgQvJuYDd4/yyKgRYuu7dk9KdMkOP/gRO1ORlcRiyD2Kf2ydPJqbUW8lnuzorAT+UTTjrPRftN58TVVjYzhKX5PbIYUngIiJzat54Su0SlCWai5Ae89GuHQU/MDQ/nxPr0JYCir0VXfyDQHiW/mmMVjAm+fcZm03SBePzNUvXKa3HVHj8l4vi8x8OPLHQdjp6nt93VQLjaWWTk9MG99VLtq3ISw/BwmCiLFqy3cH5VsB0gJGNVtCevWsBueZqg75mQ3m0xMd8Ddt0CS+oZWA== 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=bestguesspass 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=aY506UkXxsO6EhPc+amcUwLCZ5ww9snMvhTZt8m/+Xo=; b=nALp9WhImpHeAXWe+erbIQKm0RKdOiSuB9125FKG78Dvzj6O/Mfd2QBW/2wpdYbDYtEGnIaKNIqghJSGEnUB2xK+fEywLtWytIdUlKcksikht11Hhs8QLSGDtH9ayKT1fswFlHjmph+6IpbX7JtdV/X7zR7uZc8+Eit0gifNLbs= Received: from MN2PR19CA0057.namprd19.prod.outlook.com (2603:10b6:208:19b::34) by DM5PR02MB3161.namprd02.prod.outlook.com (2603:10b6:4:61::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.20; Thu, 11 Feb 2021 08:12:58 +0000 Received: from BL2NAM02FT016.eop-nam02.prod.protection.outlook.com (2603:10b6:208:19b:cafe::ab) by MN2PR19CA0057.outlook.office365.com (2603:10b6:208:19b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:58 +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=bestguesspass 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 BL2NAM02FT016.mail.protection.outlook.com (10.152.77.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:58 +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; Thu, 11 Feb 2021 00:12:55 -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; Thu, 11 Feb 2021 00:12:55 -0800 Received: from [10.140.6.35] (port=49686 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75r-0000Qa-EH; Thu, 11 Feb 2021 00:12:55 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id F3D0C13C0653; Thu, 11 Feb 2021 13:48:17 +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: [RFC PATCH 12/15] sd: emmc: Support boot area in emmc image Date: Thu, 11 Feb 2021 13:47:23 +0530 Message-ID: <1613031446-22154-13-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: c060275b-e3c7-4321-ceb7-08d8ce64d790 X-MS-TrafficTypeDiagnostic: DM5PR02MB3161: 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: r9keHFVamQ5gfQDzBRqZ/WOkgKU+0eBZXAL+XJi8ocNpz5yucKeDx3Oq9QnLBNwBUEYSCIVLzN6TjQeUH0x3yo+Qe18HNVcG81RBWgEtLk/pOuefias+iJS2y8Vhol0xk3+brhqx4DNIrxgs3xXt7vwAfqLddOthHZR1IMqu+H651NTu5FnHN4F3QtByjqfg/u4ap3vukZNrMExxSOewIbF3aGcwydZ3r/coC2gh9KIUTa0wzCuqKLa9x+4CfZ5x782EC/aiO4JQ2YQlXfTrnFWWrEOxGpRJ21qKdCPjnAon0P0wzACsomHAS0UeOs6HSk1ahqtW/qB2gOjE84k6dN01EZAhr0hjHeEXniJpfMYLWmWFYgHXeur0xGXwGV32b2hUUikVKdtPQN9NxvbTXLcN584G6CQSUH6R165yOqCpcQIzGghU4XMdvL3SwogzJAOo96ctD33bvWYu3p5TrOiWdRZid1HZbz6JU8dAJN2Y9lGi8N0/fL0Pqw7gRU0VFPVvNkbTMf2yfNZt0WnOcL+EHB7pNCEGHdYuZ2xyPd2RtIio85VHfQZ66GNPhRgOiL+3Y4N/U3Gp0CI8iGsvXhv4KU4LAeMbGi1/l+oYEKoaPTiQ60F3HX9x8a43TYUTT8gq1FjSTW79mXH9oP6nA3FwBgorVkjp8H9LUKeQBBlIcK56VN/lEy+lYi4GbNT8WD70g5Caees6qF8qD5RklQ== 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)(346002)(39860400002)(396003)(376002)(136003)(36840700001)(46966006)(921005)(54906003)(66574015)(2906002)(8676002)(110136005)(478600001)(6266002)(36860700001)(336012)(107886003)(426003)(2616005)(7416002)(36906005)(5660300002)(7636003)(82740400003)(42186006)(26005)(47076005)(83380400001)(82310400003)(70586007)(6666004)(70206006)(8936002)(4326008)(186003)(356005)(316002)(36756003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:58.0150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c060275b-e3c7-4321-ceb7-08d8ce64d790 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: BL2NAM02FT016.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3161 Received-SPF: pass client-ip=40.107.236.73; 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" 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 54fba7b..55c1104 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1045,6 +1045,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; @@ -1360,6 +1388,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; @@ -1379,6 +1410,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; @@ -1435,6 +1469,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; @@ -1465,6 +1502,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 Thu Feb 11 08:17: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: 12082513 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 3A54EC433E0 for ; Thu, 11 Feb 2021 08:26:14 +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 88DE164E16 for ; Thu, 11 Feb 2021 08:26:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88DE164E16 Authentication-Results: mail.kernel.org; dmarc=none (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]:35018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Ii-0006Q5-KU for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:26:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76B-0002ok-Uv; Thu, 11 Feb 2021 03:13:17 -0500 Received: from mail-dm6nam11on2060.outbound.protection.outlook.com ([40.107.223.60]:9056 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 1lA760-0004ae-02; Thu, 11 Feb 2021 03:13:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KuEvxg339yxtfldiM5TKNRqkYYT0oeTjUdLykGhc3vQA/2xlmtTJY4mhRyLgYRTUsjVaHN5nmMP6cKXZAzQREt8vV2iBnXv3PxRc6EJWLoKZsbxHxGN7OeJfY3Omu/jBAYu0cnwLH1lBNTPO8Hg0SS8VrCgtNYlWR39mvOSr8VABlEiT2CY74vgX51u4lnOmRDM6+gU5gJ1GNL3jUd0q4zNDkVcwPBgRkYbU5celNeOlXo8D3S8/FVi9k8Fau7gE5vVl3ylW64FOdX7R8o+9ZUoC+gAHPXr5EyJJaLisDiQlb3YZ/amV3URA7kT/2VFDM2ZBY4ieHruHVAk3IbDRjg== 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=nKLtoy5Cea4YOUvmMGCSoB/a1H4rcNhMKmCTZfHfQa8=; b=Ief1okCPpmQgyOmhhE5PRMl3KgcpQFf3O4WQAzV/spBW/a2eJpFo9oFz+LeXxbE8+xOBD6Sx5oZRryAuVAgyvjCgjGp7ZkQM5rmm44Styvpr9p0+pgOMctt83/FYujp7bPs0dnnfMjpu1eJT/P/mjyxfrhDSoM1f/gN+Yb26mZoYwOeQ2ZOmPwKJkFguY7tdd+smOowBtl1dnmD0zHGdSvr+cPCpcJa/WHnC6nIs29DbbbryITwtE5h2xVjV26ZKeIL7GhhUFuUO/BBNwKdfe2ZPExUfvGGup0qYhz4PpSj2H5Z9aR9BnEXmdweJS+L1ii/n130W36lHrmT6xa3k0w== 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=bestguesspass 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=nKLtoy5Cea4YOUvmMGCSoB/a1H4rcNhMKmCTZfHfQa8=; b=atfuC7fALTZRVKBtbJYQMrt133tQS1zslT7To9ONjA8jmF1u8j1aUo2Po+AH6aMPch4L91hHdXCMpjfQ7Pctxox31jE9Y+8uwqEdN9vXQDL0yZhmKlCq5GmdqQXS/uV6UHt+asGmTA9x7TsAfcV/PcVBdglh6DStkrKV5/tJ6ZI= Received: from MN2PR19CA0062.namprd19.prod.outlook.com (2603:10b6:208:19b::39) by DM6PR02MB3993.namprd02.prod.outlook.com (2603:10b6:5:9f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.24; Thu, 11 Feb 2021 08:12:59 +0000 Received: from BL2NAM02FT016.eop-nam02.prod.protection.outlook.com (2603:10b6:208:19b:cafe::b3) by MN2PR19CA0062.outlook.office365.com (2603:10b6:208:19b::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:59 +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=bestguesspass 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 BL2NAM02FT016.mail.protection.outlook.com (10.152.77.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:12:58 +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; Thu, 11 Feb 2021 00:12:56 -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; Thu, 11 Feb 2021 00:12:56 -0800 Received: from [10.140.6.35] (port=49688 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75s-0000HJ-3G; Thu, 11 Feb 2021 00:12:56 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id A454E13C06B8; Thu, 11 Feb 2021 13:48:18 +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: [RFC PATCH 13/15] sd: emmc: Subtract bootarea size from blk Date: Thu, 11 Feb 2021 13:47:24 +0530 Message-ID: <1613031446-22154-14-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 0bdbc18a-68dd-42e3-187c-08d8ce64d815 X-MS-TrafficTypeDiagnostic: DM6PR02MB3993: 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: HqHDQU4R73abaAyZo19YhVFiBbKBs9ENI26jGVDtD/jne3Hy4JYsLcGWD4AxAUTHBOsFrVSoljsaU/0OaRY/t6ZWtlQmVg8vIzKtx+MOA3Z5yWu7aMUuncLA67ja1qqXHEsNOG2UCx6/TtX8d/ODq8fv3Ptsd/uB49tTI36C+fqEnkAO70zRS+2IIaJ1Q9Uq9C7Vff3tllOvKwElwpo1z5UZcCbBXs9glIhTPIKR9pB0LMkkZx78LJp+adaQ/wTQLlMvOLNKHkxj0vkU/nS1HIQo276cr81jisRZagD0Mi5hDjFu6BFXHNNMscTVIBUw7eooMaW79/cBSVW1+uD2CsVRSp+VpLPFGydSNG5rxT09UsSQXXGW8vtdUD94p3Uxr2O9BhVbUKvZqJ7N4LuN1O4vNFSQxNFnwFxpwS2mtYXIw4iWANsi3N2w/UwY05Z0gMG599BlGMoOIdxEIK9NyC40Dlvr1WGvEVlqzqhFiR7bpeI44qJ+XrbUwDy/30VHv9264BLVwAMHltKynlt2/A33qcauCqH4bHaku71y+WuM2IHI7Ib/W6x0p/2GcxXqZ27pjcTqEphopQo7FJY+eDPFgxjXUcvhEPo/3r1dvbN8Gt24vSK8HhkVDv0YWgIjXgEp+CHxDdMwx6wQH2QpA5oR9Ajruf7tDUw9swDytGxNt45d8+z4dVHubiocKq0W53QOewXhuv1+jGraNjkgqw== 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)(39860400002)(346002)(396003)(136003)(36840700001)(46966006)(6266002)(47076005)(6666004)(4326008)(8676002)(2906002)(107886003)(7636003)(82310400003)(7416002)(356005)(54906003)(83380400001)(110136005)(70206006)(921005)(82740400003)(66574015)(336012)(36860700001)(2616005)(5660300002)(26005)(478600001)(8936002)(36906005)(316002)(70586007)(42186006)(186003)(426003)(4744005)(36756003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:12:58.8820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bdbc18a-68dd-42e3-187c-08d8ce64d815 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: BL2NAM02FT016.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB3993 Received-SPF: pass client-ip=40.107.223.60; 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" 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 Acked-by: Alistair Francis --- hw/sd/sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 55c1104..a2f39c9 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -658,6 +658,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 Thu Feb 11 08:17: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: 12082527 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 7715EC433E0 for ; Thu, 11 Feb 2021 08:36:09 +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 E95AC64DE1 for ; Thu, 11 Feb 2021 08:36:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E95AC64DE1 Authentication-Results: mail.kernel.org; dmarc=none (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]:50776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7SK-0005Iy-0g for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:36:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76P-00033Z-Eo; Thu, 11 Feb 2021 03:13:29 -0500 Received: from mail-dm6nam10on2068.outbound.protection.outlook.com ([40.107.93.68]:39904 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 1lA76N-0004fj-S0; Thu, 11 Feb 2021 03:13:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T0g6Ap+dbzL092h7U90JxXAAz5+ekGUhI63dtbovzhMXNlUDcaLzbz7sUZfubCW3JABIdUPjPv3qt63a80PaSIjUpFGrEzsiuurbyBl0hJmPyrx1U2PAK68wA0FUu5y/QQmJP8ftunUgKmps+IldZC136XdHZtSWhpU3YKiCHENpEX90Arl3yUiZsAm1gfDwPmF6dJhIIXwT//TW2HpW3fcLqiJKyeN7/pCGmyH2lissFUev9J66O3wgj43tQTC8iu9bPuohMui+6Ac60InqoyDOoWroU371G8tmJxCQVQyudb7mVVnpqFq0JZHlpdV06cheHSWIWNeWY9K8saWPWA== 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=FpR9AJIfJU+SzZHt5JYBkRqJTEUWZ4wdttD2RZ9j2aMHCXjNoCeo0jRUX20u4KkfWO+XFyrtz5UX9JDOrDdV3PG/bzUpaLTXYKD0oWszs1xnxvv+d+RIe+6u+dZjpAhzjbA1kGWVSFWyFmsO619e5C+Ic1+/WQsYKXAuDYM6LwPkFCTH7CFeqP/opPvUl9UU7+c5NFjbp/bs8hOfVMDF7mykfvxq6JXrX84xcD52QcfDPR2rbKkzTUWkPVgrM7fQ803+OrUVi+7JkgyG+eJVu6pjuCYDk7NOCwlOI7ebq8c4lZNn0uC993zSxbtjh7+qMN4mJbBRxuopwidhdZJShw== 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=bestguesspass 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=tbpXLJrJtf5r6b/V95U8bCaUx1KXT+o/iqSinGy7pD4TsGSKrZz6spsJlhViZsrRr5DXXxPHYnkldsa0BUH4uYdzP3WkGeqMKpRbDp2u3LXkuxS8U4zaoj6FkSqvnZT6xgzNW9R73ct+caJmySiwPVtaJN6vmCXbIwLEf8y2RUw= Received: from BL0PR02CA0121.namprd02.prod.outlook.com (2603:10b6:208:35::26) by BYAPR02MB5704.namprd02.prod.outlook.com (2603:10b6:a03:9c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 11 Feb 2021 08:13:18 +0000 Received: from BL2NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:208:35:cafe::e) by BL0PR02CA0121.outlook.office365.com (2603:10b6:208:35::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT009.mail.protection.outlook.com (10.152.77.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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; Thu, 11 Feb 2021 00:12:57 -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; Thu, 11 Feb 2021 00:12:57 -0800 Received: from [10.140.6.35] (port=49690 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75t-0000HN-Kj; Thu, 11 Feb 2021 00:12:57 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 318F513C063C; Thu, 11 Feb 2021 13:48:20 +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: [RFC PATCH 14/15] sd: sdhci: Support eMMC devices Date: Thu, 11 Feb 2021 13:47:25 +0530 Message-ID: <1613031446-22154-15-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: e4b0e87b-4e38-43bb-1067-08d8ce64e3a7 X-MS-TrafficTypeDiagnostic: BYAPR02MB5704: 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: XEjzbrmf5oJmGHogfvuHQSnXeEhKJDqsivsmrRZkKlEU2huDvAfNr/PHkA9GdatICcNLtJV7scmlkJrTDxrSWkJzeJD9zZdCJEOXqDWHQz1Xavgbt7KOYzBg3Tbo3bIBBuoR+vk6ohLzKc/bB6INda5De72K/jd5b2ZrRbchJmyib4VtSBltCkfFzMsKzEgfRpzJIea4AXBx0I+o1xsTR1uAam2NmotygeOuZEFcr1k7tljK9j7aAK+ddbsX+dcnfNJrHiMsgUh+o4eH+/TIdctGnOEgbxHZbx2ZTZR2kYkwS8xU95rNKr+Lksf7KQ9GtjJrua+3WiujtA7GNvUfDsit/OujPTn/VezM6wSzfPiLJwkC8CgSl9CG6L44McgID7iwO5nrl6tlw9BUu4oRC1gs71bCgsgD5NHwO6gPsGxBP1lk9+DC4yyiHWTiwStiSaERy394Kfveh0NoIM4UeH/0e0FVPq7ekvrD2PZlc6A5+lq7M0L5G2xYSV+51TT32il9Chp0y+z2AaaSVbMrv2WjEnTOieg6PjOJnjjUqAYn554HqvA4mg4EVuIKBTrzFOBqkVQzH5Qi3uwHgqHf8Dw1noDbc1PHJO9cSC5MmuuLvKOqitLpcqTjA1iU5Rjr3xVCyJq7fPxNMA+L1jOs62+GZDn4XS5M1irTT7Zzmi6fCSl5Dx36Y8Px7wJuI19zMrQNXfSoYEPr14eXDvxkYA== 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)(376002)(39860400002)(136003)(396003)(36840700001)(46966006)(6266002)(47076005)(4326008)(107886003)(8676002)(2906002)(83380400001)(82310400003)(7416002)(54906003)(356005)(70206006)(921005)(82740400003)(7636003)(110136005)(36860700001)(2616005)(5660300002)(26005)(478600001)(336012)(8936002)(70586007)(36906005)(4744005)(42186006)(186003)(426003)(316002)(36756003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:18.2924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4b0e87b-4e38-43bb-1067-08d8ce64e3a7 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: BL2NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5704 Received-SPF: pass client-ip=40.107.93.68; 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" Embedded device slots should be allowed as support of eMMC is available. Signed-off-by: Sai Pavan Boddu Reviewed-by: Alistair Francis --- 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 Thu Feb 11 08:17: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: 12082533 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 23130C433DB for ; Thu, 11 Feb 2021 08:37:32 +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 9EB0764E01 for ; Thu, 11 Feb 2021 08:37:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EB0764E01 Authentication-Results: mail.kernel.org; dmarc=none (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]:54834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Te-0007Jp-Ng for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 03:37:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA76Q-00033H-Cp; Thu, 11 Feb 2021 03:13:30 -0500 Received: from mail-bn7nam10on2067.outbound.protection.outlook.com ([40.107.92.67]:36963 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 1lA76N-0004hQ-8R; Thu, 11 Feb 2021 03:13:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHXdG96LjxNIvFOX0vy5Bh0z+Oh/8/urQ/F9mEYy6r0zCaUIZd3gf0VEeHfD/xiXIowFIiBjfliIHI8Lx6r6FTCiD+eifTAMdgiyh0fUqAb7zzJD+iCmc8A/ABJdzsnqSYGhyAGIW1weRgsqoUP44dibBCPmdwiWr6iDy7Wx5GSQanWSZr9n8yfSbprhNhFMuSOWWVycq/zt28X1fZLPtLmvrHWMxZ1MII71YAVku7Khjs/1ChzsEw0CdASy54PnU1u7KkSl79TnKObFr+rdtMW1RmMq9SXeZXzHgt3/fTUPTHtzwUdekLEp/VuMSRZzbAh8jFq2EAOTHrji9lIYJA== 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=Cun2MBT2kdQVFs0ptFeEVksMmQ5I1SLRtIMvocuE3eI=; b=ErTdG4Y8R9ohzdf3uqT86nIVv5b0fNrt9ihRNGC37pLap7RnkAfW7L+1gr4IpIR4HKmDWordETfaiA1nSGUIU0fA8jsKKKcb5+wu7ev3/6SAFci80eVogg0gkBUyUE2CvQh67W0WlMEcSVzrRV7xBp2sdXYQkGy/LZlL9rWpHNtUeuXTBVLupGZ34Indf36cklx1l+4mFMG8zOhPhl1DproFyktZikKpJx4kru/DepqFkldJyMQo8YJvPt1M9gpP3s6/Vag7H6LvaqxaL0xHOyWou57SCqBYdom8sY9ZRBEl0fq+7pWV9oDmX6TQ/i1PRfRhstu4jdKX9qA2qNTGaA== 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=bestguesspass 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=Cun2MBT2kdQVFs0ptFeEVksMmQ5I1SLRtIMvocuE3eI=; b=j6LJzx8PzJKVRTqKVb2TDCqCA3OQpXlGWfhIzNvO3hMMve6X3b1hl0xEnp8B6rdVgnHe/X2ZOtWJSq7vo5orIGkviGibWrCFNFjPnPQ30BafSu3A2d53Y50S6ViratPCkD/noKHy/NqvZpt/KHiCI/Aa0L3IjUoZTt29OUsf3Ss= Received: from BL0PR0102CA0023.prod.exchangelabs.com (2603:10b6:207:18::36) by BY5PR02MB6486.namprd02.prod.outlook.com (2603:10b6:a03:1d6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 11 Feb 2021 08:13:19 +0000 Received: from BL2NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:207:18:cafe::57) by BL0PR0102CA0023.outlook.office365.com (2603:10b6:207:18::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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=bestguesspass 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 BL2NAM02FT034.mail.protection.outlook.com (10.152.77.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3846.25 via Frontend Transport; Thu, 11 Feb 2021 08:13: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; Thu, 11 Feb 2021 00:12:59 -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; Thu, 11 Feb 2021 00:12:59 -0800 Received: from [10.140.6.35] (port=49692 helo=xhdsaipava40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lA75u-0000Qi-HQ; Thu, 11 Feb 2021 00:12:59 -0800 Received: by xhdsaipava40.xilinx.com (Postfix, from userid 14131) id 1569C13C0653; Thu, 11 Feb 2021 13:48:21 +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: [RFC PATCH 15/15] arm: xlnx-versal: Add emmc to versal Date: Thu, 11 Feb 2021 13:47:26 +0530 Message-ID: <1613031446-22154-16-git-send-email-sai.pavan.boddu@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613031446-22154-1-git-send-email-sai.pavan.boddu@xilinx.com> References: <1613031446-22154-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: 2a3e72f2-1f98-4aa6-fcf5-08d8ce64e466 X-MS-TrafficTypeDiagnostic: BY5PR02MB6486: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vCsLIJ2umCiheQKGuNoR3bTJtboMILrsdc5ULe/3RV1KtnkbEnvKVzkqbRzr+fpMl+rtkyFMslWMPgHSr/8riS6ycH5X1th1sAfAKEu5fhjqPMn7DGkbISpIBj1H1IMzF9CRcDUQM2VNF7bZmtXvGCJnNdzkBc9ZSSh42QzD3hEaAFG0gvZbcNEY+253gkTMmnYDKsip/qsbHLdkfA7Vhz5PZFFZc2GrfnaWtJFiSw/uFCKLJfB+C7tyZ6uk5qqCWDhkNU67pgtkIhL4inZ5b5RdSUFvV9+qm6pxd901rTSG2Tk2A2Q8831+KPIpZKPcM5jovHCHHW2CXq/yfOFlQjhJbtaXZB4wsmPrPX/ZKeU2TS8S1Vve8rCypERoAOpWIbrc4kj5MfyHJRRrWYRY/UIWwObwPcEnwaip1zTDOROTu42SPq9N7W6/I4+a67Ul8QRxw15nTnVqotiN/ZyHG4eeAW2lrwjzQz9M1VM3buSZBtGagHM6byEJI1KNLnxc/B/EVGFyL6QeLJDeODWKC+kVcW6mpikfm6Q7gvWfI80l2jn4WyX8vEqfiMpfikdoSJAN4BEBfpZ+aJ2nt3QKtPt9WczPeMnZroWmbsDu9F0+pWma6Z/n4xpZKJ6LCO3fVK/LG0mrCjZClR/pMAO0A78511wc5kC0RMiKrmSldxlnDeKMSNWDOPvD+sVMeZc6sSfsvOsiaPpUWxLiuwGnCQ== 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)(39860400002)(396003)(346002)(136003)(376002)(36840700001)(46966006)(5660300002)(107886003)(7636003)(82310400003)(2906002)(2616005)(36756003)(70586007)(70206006)(336012)(82740400003)(83380400001)(426003)(36860700001)(4326008)(186003)(8676002)(6266002)(26005)(54906003)(36906005)(921005)(110136005)(316002)(8936002)(42186006)(47076005)(478600001)(356005)(7416002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2021 08:13:19.5521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3e72f2-1f98-4aa6-fcf5-08d8ce64e466 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: BL2NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6486 Received-SPF: pass client-ip=40.107.92.67; 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" Configuring SDHCI-0 to act as eMMC controller. Signed-off-by: Sai Pavan Boddu Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- hw/arm/xlnx-versal-virt.c | 16 +++++++++++----- hw/arm/xlnx-versal.c | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 8482cd6..18489e4 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -333,6 +333,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 (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 +519,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,6 +527,7 @@ 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); } @@ -528,7 +536,6 @@ 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 @@ -581,10 +588,9 @@ 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(IF_EMMC), true); /* 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; diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index b077716..3498dd9 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -230,9 +230,14 @@ static void versal_create_admas(Versal *s, qemu_irq *pic) } #define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */ +#define SDHCI0_CAPS ((SDHCI_CAPABILITIES & ~(3 << 30)) | \ + (1 << 30)) +#define SDHCI1_CAPS SDHCI_CAPABILITIES + static void versal_create_sds(Versal *s, qemu_irq *pic) { int i; + uint64_t caps[] = {SDHCI0_CAPS, SDHCI1_CAPS}; for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) { DeviceState *dev; @@ -244,9 +249,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", caps[i], &error_fatal); - object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal); + /* + * UHS is not applicable for eMMC + */ + if (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);