lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201208061839.21163-4-chris.ruehl@gtsys.com.hk>
Date:   Tue,  8 Dec 2020 14:18:36 +0800
From:   Chris Ruehl <chris.ruehl@...ys.com.hk>
To:     linux-mmc@...r.kernel.org
Cc:     Ulf Hansson <ulf.hansson@...aro.org>,
        Chris Ruehl <chris.ruehl@...ys.com.hk>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
        Ludovic Barre <ludovic.barre@...com>,
        Krishna Konda <kkonda@...eaurora.org>,
        linux-kernel@...r.kernel.org, Jack <jack.lo@...ys.com.hk>
Subject: [PATCH 3/6] mmc: core: add enhanced strobe to mmc_select_hs400()

Function mmc_select_hs400() and mmc_select_hs400es have almost
identical code it seems okay to merge them.
Add the function calls for enhanced strobe to mmc_select_hs400 and
add  a bool variable to the function call to enable them if HS400ES
is selected.
mmc_select_hs400es() becomes obsolate and can be removed.

Signed-off-by: Chris Ruehl <chris.ruehl@...ys.com.hk>
---
 drivers/mmc/core/mmc.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e7b4de3d4f47..84c09d9e0317 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1333,7 +1333,7 @@ static int mmc_select_hs400es(struct mmc_card *card)
 	return err;
 }
 
-static int mmc_select_hs400(struct mmc_card *card)
+static int mmc_select_hs400(struct mmc_card *card, bool enhancedstrobe)
 {
 	struct mmc_host *host = card->host;
 	unsigned int max_dtr;
@@ -1409,9 +1409,12 @@ static int mmc_select_hs400(struct mmc_card *card)
 		host->ops->hs400_prepare_ddr(host);
 
 	/* Switch card to DDR */
+	val = EXT_CSD_DDR_BUS_WIDTH_8;
+	if (enhancedstrobe)
+		val |= EXT_CSD_BUS_WIDTH_STROBE;
 	err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 			 EXT_CSD_BUS_WIDTH,
-			 EXT_CSD_DDR_BUS_WIDTH_8,
+			 val,
 			 card->ext_csd.generic_cmd6_time);
 	if (err) {
 		pr_err("%s: switch to bus width for hs400 failed, err:%d\n",
@@ -1451,6 +1454,13 @@ static int mmc_select_hs400(struct mmc_card *card)
 	if (host->ops->hs400_complete)
 		host->ops->hs400_complete(host);
 
+	if (enhancedstrobe) {
+		/* Controller enable enhanced strobe function */
+		host->ios.enhanced_strobe = true;
+		if (host->ops->hs400_enhanced_strobe)
+			host->ops->hs400_enhanced_strobe(host, &host->ios);
+	}
+
 	err = mmc_switch_status(card, true);
 	if (err)
 		goto out_err;
@@ -1465,7 +1475,7 @@ static int mmc_select_hs400(struct mmc_card *card)
 
 int mmc_hs200_to_hs400(struct mmc_card *card)
 {
-	return mmc_select_hs400(card);
+	return mmc_select_hs400(card, false);
 }
 
 /*
@@ -1549,9 +1559,9 @@ static int mmc_select_timing(struct mmc_card *card)
 		goto bus_speed;
 
 	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
-		err = mmc_select_hs400es(card);
+		err = mmc_select_hs400(card, true);
 	else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400)
-		err = mmc_select_hs400(card);
+		err = mmc_select_hs400(card, false);
 	else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
 		err = mmc_select_hs200(card);
 	else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ