From patchwork Tue Aug 3 05:20:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Reddy Soma X-Patchwork-Id: 1512740 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=IrD4IZlo; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gf3CX146Cz9sRR for ; Tue, 3 Aug 2021 15:22:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BFAF83213; Tue, 3 Aug 2021 07:21:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="IrD4IZlo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB5AE82D9B; Tue, 3 Aug 2021 07:21:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::60c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 845FD82D94 for ; Tue, 3 Aug 2021 07:21:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ashokred@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ejIFvg/rzdaYg8WhsiLEoJfvXpIfYDQynFg5qgLCEDkDsd6zZI/zfFtjHkMRi/BlWVe8iJoHWQ824PNV27qA103k3n28fhLtvt4040WqXFJLXyBS1F6jbLFUBLbCYSHi/VynpRIea0WRnevAtZJw6wceeiU5cvZZ42hzceRbAgtrLJYpn3nVN6054ba+aPZnKso4qnpfh41aky9YwXFJKTyksXBfjOv9gTbUovaqUgemfYcZWDsVK7H9k+V6EjXcZCcW3npCbcNdMEPdmublUu13CNcY23P/TfzLT41g5HdoGVXqcniUHNlHh6wQ+ZNJVF2oHinpBrLcvhLRFgoUew== 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=TfZUDrM8VGd+0qzHIJuaIcGFSmx4Gx0aiVjOM3awk5U=; b=T2b2Xh82JVnpbNPx99PJtb5SaORwrwij7/Qpor4AS+pBQ9YKRwUD7DPNYfHKYlx8IRpoCNKBW8+scvMpjjwjroVm6HZqyu7xq91GD4+bLYpzEV8jfR6NUfKKMZ+f+l2Q76t+rITYAWQ2QrOffTRvIzOMPZmjgVXNjSwX3kqjTkNwFMCiSaFhza5Jn4RH6s8dU7talZAd/Gbaxcat+vrwQlG3U1nJk7zM9wFH6gQIXod0YunnmiiMzzLjnSfK/lrohUX9P/6HH7ZscEAMf/GRG5vMqHNytKDVjJDxMBmrmrGRJvzWuuRYSlfi6v+JE62iptdhFYVl7KE3RBuHgnOR8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=chromium.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TfZUDrM8VGd+0qzHIJuaIcGFSmx4Gx0aiVjOM3awk5U=; b=IrD4IZloKAIwD65Je0DOGcreSxBJ1IoLBvcgSjgXXwqF5tDneT26Ek5UXIikzJ8eq1ghZt9iN7BZYtpJ6G8WAB300TL5FhO9ZW6u4ptRSYI/w7/LMcQYe6Bmt1hkWX23WE45LsELRNJVkoOU6ZDPSQmEX7lHsw0+GbDTHr5WuYc= Received: from SA9PR11CA0004.namprd11.prod.outlook.com (2603:10b6:806:6e::9) by BN7PR02MB5090.namprd02.prod.outlook.com (2603:10b6:408:23::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Tue, 3 Aug 2021 05:21:09 +0000 Received: from SN1NAM02FT0018.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::49) by SA9PR11CA0004.outlook.office365.com (2603:10b6:806:6e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Tue, 3 Aug 2021 05:21:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; chromium.org; dkim=none (message not signed) header.d=none;chromium.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0018.mail.protection.outlook.com (10.97.5.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4373.18 via Frontend Transport; Tue, 3 Aug 2021 05:21:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 2 Aug 2021 22:20:52 -0700 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.2176.2 via Frontend Transport; Mon, 2 Aug 2021 22:20:52 -0700 Envelope-to: git@xilinx.com, sjg@chromium.org, somaashokreddy@gmail.com, u-boot@lists.denx.de, monstr@monstr.eu, peng.fan@nxp.com, jh80.chung@samsung.com, faiz_abbas@ti.com, michael@walle.cc Received: from [10.140.6.65] (port=42666 helo=xhdashokred41.localdomain) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mAmrD-0006fG-51; Mon, 02 Aug 2021 22:20:51 -0700 Received: by xhdashokred41.localdomain (Postfix, from userid 2896) id 648211025DE; Mon, 2 Aug 2021 23:20:49 -0600 (MDT) From: Ashok Reddy Soma To: CC: , , , , , , , , T Karthik Reddy , Ashok Reddy Soma Subject: [PATCH v5 6/7] mmc: zynq_sdhci: Wait till sd card detect state is stable Date: Mon, 2 Aug 2021 23:20:45 -0600 Message-ID: <20210803052046.16165-7-ashok.reddy.soma@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210803052046.16165-1-ashok.reddy.soma@xilinx.com> References: <20210803052046.16165-1-ashok.reddy.soma@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b3d3c2e-d047-4627-6a19-08d9563e809a X-MS-TrafficTypeDiagnostic: BN7PR02MB5090: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WumhjJyB47LdeWYKCSiXiBD2SdJHBExkZiqgzAMaXcgM70K3p2TXymJGExt21JSugTUT8Rq3UguEQKQ4XY3WH0fNe5/boY1V/QB4rqlqFhU0E1OGvOcw0knPVhRkwxgsFLYVOx25AJ22AoZHVuhxQHgikEcBj4cIEqiNdCi0U73TWvZAFMN5kVLK67iPxeqOmv1KKZKkQnoqje76jO0z0cKC+8OWn+BHx4X1wUFDBfJ+QUwqyUCR8MU63eHWFvSfTE4n9Yo3d24ueIsV7GKai4Gg3PTu2ishoZ/GqFf/W4yoNGzkTTQ2dJPIO7HNzTjA2GsgBEDVCL4XO3Qg8zwfdlnBpAQvF1TtDZkQMJ7T/+RHUMUKg3QPSriIoMQMw5HIbVFFkUCm3aEReXybrjDNefn6FcvANFANxPyof9Um2VHMn3ifq7xLgfBA3Ez11rSJRJ+6eZQmhmmDabsKMFZXWFok68ju5bYRSZNpZ2t2keQhedV00tGqzMDQYNtyIqUalkJBIwmehTPVJb2rnaXJB3SLBxWb48WmaMBBqWRPyyflvb4+ArEN7qW6CY2b7sJfqkS+ay3cMttQJhuoMTcm1rnw2pDdbVoi9pkJbnI5knXbnjJV04Aj5eV8lsk5ArTFM5ZaY7czEqL+aCrErJJrBNAlDEC184CRov3ILG6P8sPNg2vaNhsF8TrYTXs8+wc240NKzfBPWJ0BT9jGP9Tz+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)(396003)(376002)(136003)(39860400002)(346002)(36840700001)(46966006)(70586007)(47076005)(103116003)(2616005)(107886003)(82310400003)(478600001)(6916009)(4326008)(6266002)(36756003)(70206006)(336012)(186003)(356005)(7636003)(83380400001)(2906002)(8676002)(82740400003)(26005)(8936002)(36860700001)(5660300002)(316002)(42186006)(6666004)(54906003)(36906005)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2021 05:21:09.4390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b3d3c2e-d047-4627-6a19-08d9563e809a 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: SN1NAM02FT0018.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB5090 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: T Karthik Reddy As per SD spec when SD host controller is reset, it takes 1000msec to detect the card state. In case, if we enable the sd bus voltage & card detect state is not stable, then host controller will disable the sd bus voltage. In case of warm/subsystem reboot, due to unstable card detect state host controller is disabling the sd bus voltage to sd card causing sd card timeout error. So we wait for a maximum of 1000msec to get the card detect state stable before we enable the sd bus voltage. This current fix is workaround for now, this needs to be analysed further. Zynqmp platform should behave the same as Versal, but we did not encounter this issue as of now. So we are fixing it for Versal only. Signed-off-by: T Karthik Reddy Signed-off-by: Ashok Reddy Soma Reviewed-by: Jaehoon Chung --- Changes in v5: - Added WORKAROUND in comment and elaborated the comment about issue. Changes in v2: - Changed return error from -EIO to -ETIMEDOUT in arasan_sdhci_probe() in card detect state stable workaround drivers/mmc/zynq_sdhci.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 9a1693940a..4a877b4ce8 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -776,6 +776,25 @@ static int arasan_sdhci_probe(struct udevice *dev) return ret; upriv->mmc = host->mmc; + /* + * WORKAROUND: Versal platforms have an issue with card detect state. + * Due to this, host controller is switching off voltage to sd card + * causing sd card timeout error. Workaround this by adding a wait for + * 1000msec till the card detect state gets stable. + */ + if (IS_ENABLED(CONFIG_ARCH_VERSAL)) { + u32 timeout = 1000; + + while (((sdhci_readl(host, SDHCI_PRESENT_STATE) & + SDHCI_CARD_STATE_STABLE) == 0) && timeout--) { + mdelay(1); + } + if (!timeout) { + dev_err(dev, "Sdhci card detect state not stable\n"); + return -ETIMEDOUT; + } + } + return sdhci_probe(dev); }