Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp763092rdb; Thu, 30 Nov 2023 19:06:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTTFsVKXhVRw9N79V4LZx7jwdwClWoapfsGeRhahgmlRsPR1IO1D2ZhNoQ/s0Nak11K6jT X-Received: by 2002:a05:6a00:2e8e:b0:6cb:bc85:1bed with SMTP id fd14-20020a056a002e8e00b006cbbc851bedmr26266915pfb.33.1701399966418; Thu, 30 Nov 2023 19:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701399966; cv=none; d=google.com; s=arc-20160816; b=SLLPtlPR++a2SNGH4lgHacehyeB5GvgLmYCG1zeg30uZZxvWW1VMMCNQg+zSQSmLPI F2HuXY9/pSAxzi5H5fB9ss/EwHz8/+u9ySW4Nq72svNA1yMeN+PFfnkM7hxifth7gyxK 0l9f1g27RSfO+4qNaxndB9nELsvCfu/67UqXixi3wZUnoY4fVJazd6MgBxI9BIxhqnka n5y38dOyP5OLBeBuZJte/yApR9tg6Sby8vb6GyjvGi0Hq+GH9d/3xsxo/eEZRdHiooa2 Z44hMwPyjA/sH2cypDIwwOc2Ink8lDbXUiVE6gLSwHqsmsdXGDEQld7O6d4qxHZDUvOF vMfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=V6tB0+EPwP58rkLDk+28AFubYUauyeii7M29/hehUYs=; fh=HZjn//rz9SXI9E5CRrEWSuh7Qu3P+mr0GJfzJ1Ctbsg=; b=Cm7ha/ROukulVpYyUrVOa4RR5LYh1sLdgKJnyixTakvCgQrfdKaAJrsFtpXU5pK+0P +Bz/i9ijd5dkZnzN5W8PYhpMoiljr7xJYZ9JcifPQEOHOadhLlEPhi62ncaq7calsT/V F048oyUe51OggL408RLm/RTI8tQmAeGvGM1RzPCzIjriOXMx9OACQcTaP06WzGLJqPCa wt5KyDuoK1+bGzSxNXrPa0vglbCxu/oz8Sb2RFi38m6pYHkpOlbQIXeDcZiDltwn26EJ wjnpiPFdzhVIJwEB2045AGqWepd3jbi703tHZL9+XTc8sKJ0OhEID6RgPwuotA9SCdo+ 0yDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EUXqhj3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id do11-20020a056a004a0b00b006cd853221easi2229753pfb.362.2023.11.30.19.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 19:06:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EUXqhj3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B732880DF24C; Thu, 30 Nov 2023 19:06:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376882AbjLADFz (ORCPT + 99 others); Thu, 30 Nov 2023 22:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjLADFy (ORCPT ); Thu, 30 Nov 2023 22:05:54 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12FCA1715; Thu, 30 Nov 2023 19:05:59 -0800 (PST) X-UUID: 8a19255c8ff611eea33bb35ae8d461a2-20231201 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=V6tB0+EPwP58rkLDk+28AFubYUauyeii7M29/hehUYs=; b=EUXqhj3uGctZF3i91gdn8mOboWsOnN6J6tyIByRU+WKNYkL4ecVR+03r4CFLodOSgzyoBY1aSL3fCI4NQvAtxJbi+sZ/+qj47FRlmGkSKno1ZpdaHHSy4iNnRBLuo7br753QWL9t2aUqLwTaxmfE7fndrBHEftMlxM/sBeGuHBU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.34,REQID:f00c2943-cb6d-4268-8306-ef309c913e9e,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:abefa75,CLOUDID:72b228fd-4a48-46e2-b946-12f04f20af8c,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 8a19255c8ff611eea33bb35ae8d461a2-20231201 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 110085834; Fri, 01 Dec 2023 11:05:53 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 1 Dec 2023 11:05:51 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 1 Dec 2023 11:05:51 +0800 From: Mengqi Zhang To: , , , , CC: , , , , , , , Subject: [v1,1/1] mmc: core: Add HS400es support in retune and initialization flow Date: Fri, 1 Dec 2023 11:05:47 +0800 Message-ID: <20231201030547.11553-1-mengqi.zhang@mediatek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--1.374400-8.000000 X-TMASE-MatchedRID: u+tUW9pLem+E9zgVMk3pXlz+axQLnAVBesw8RnBRGwos/uUAk6xP7COq qvcT7F2IzPzCmwZdi63lN7ZYHc5mSoHcC7KYYAdE4pdq9sdj8LW6hgVvSdGKo9+SMh5eC/5eX9O /HRQux9fi8zVgXoAltsIJ+4gwXrEtwrbXMGDYqV+i5u/VvsFaHVKff8AdaJ4QWCFsQ87yaDPHOM 6xNrBNq9wOJnkbFuha6cT8eWH2891TL0wCs6Mukdps4qxiIeUJBloh3ZuLeBtvBeUWxunLtaMnT JRI0XInfXwUEm1ouDzLDYxFC1/7rn6GdNk4NWmA X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.374400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 55110CD927814B2C0F23ADD29D1383873685FB918AEEA5574DE1D7E2BCFF1A092000:8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 19:06:04 -0800 (PST) In HS400es mode, when we enter mmc_retune(), we will be forced to the HS400 mode instead of HS400es mode. So we decided to add support for HS400es in the mmc_retune() process. Additionally, during the initialization to the HS400es stage, add hs400 tuning as an optional process. Signed-off-by: Mengqi Zhang --- drivers/mmc/core/host.c | 11 ++++++++++- drivers/mmc/core/mmc.c | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 096093f7be00..4bddbbb3d539 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -179,7 +179,7 @@ EXPORT_SYMBOL(mmc_retune_release); int mmc_retune(struct mmc_host *host) { bool return_to_hs400 = false; - int err; + int err = 0; if (host->retune_now) host->retune_now = 0; @@ -194,6 +194,15 @@ int mmc_retune(struct mmc_host *host) host->doing_retune = 1; if (host->ios.timing == MMC_TIMING_MMC_HS400) { + if (host->ios.enhanced_strobe) { + if (host->ops->execute_hs400_tuning) { + mmc_retune_disable(host); + err = host->ops->execute_hs400_tuning(host, host->card); + mmc_retune_enable(host); + } + goto out; + } + err = mmc_hs400_to_hs200(host->card); if (err) goto out; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 705942edacc6..9760eea2c104 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1823,7 +1823,15 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if (err) goto free_card; - } else if (!mmc_card_hs400es(card)) { + } else if (mmc_card_hs400es(card)) { + if (host->ops->execute_hs400_tuning) { + mmc_retune_disable(host); + err = host->ops->execute_hs400_tuning(host, card); + mmc_retune_enable(host); + if (err) + goto free_card; + } + } else { /* Select the desired bus width optionally */ err = mmc_select_bus_width(card); if (err > 0 && mmc_card_hs(card)) { -- 2.25.1