From: "Diogo Ivo (Schneider Electric)" <diogo.ivo@bootlin.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulfh@kernel.org>, Faiz Abbas <faiz_abbas@ti.com>,
Judith Mendez <jm@ti.com>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Pascal EBERHARD <pascal.eberhard@se.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
"Diogo Ivo (Schneider Electric)" <diogo.ivo@bootlin.com>
Subject: [PATCH v2 1/4] mmc: sdhci_am654: Move tuning_loop to local variable
Date: Mon, 03 Aug 2026 15:47:31 +0200 [thread overview]
Message-ID: <20260803-am654-sdhci-v2-1-a5ee5be86133@bootlin.com> (raw)
In-Reply-To: <20260803-am654-sdhci-v2-0-a5ee5be86133@bootlin.com>
The tuning_loop field in struct sdhci_am654_data is only used within
sdhci_am654_platform_execute_tuning() as a loop counter that is
initialized to 0 in sdhci_am654_init(). Since it shouldn't persist across
function calls, otherwise every failure expends its "budget", move it to a
local variable and remove the struct field along with the now-unnecessary
initialization.
Signed-off-by: Diogo Ivo (Schneider Electric) <diogo.ivo@bootlin.com>
---
Changes in v2:
- New patch suggested by Sashiko
---
drivers/mmc/host/sdhci_am654.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index d235b0aecfdb..35c3efd92112 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -151,7 +151,6 @@ struct sdhci_am654_data {
u32 flags;
u32 quirks;
bool dll_enable;
- u32 tuning_loop;
#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
#define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1)
@@ -576,13 +575,14 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
unsigned char timing = host->mmc->ios.timing;
struct device *dev = mmc_dev(host->mmc);
+ unsigned int tuning_loop = 0;
int itapdly;
do {
itapdly = sdhci_am654_do_tuning(host, opcode);
if (itapdly >= 0)
break;
- } while (++sdhci_am654->tuning_loop < RETRY_TUNING_MAX);
+ } while (++tuning_loop < RETRY_TUNING_MAX);
if (itapdly < 0) {
dev_err(dev, "Failed to find itapdly, fail tuning\n");
@@ -806,9 +806,6 @@ static int sdhci_am654_init(struct sdhci_host *host)
regmap_update_bits(sdhci_am654->base, CTL_CFG_3, TUNINGFORSDR50_MASK,
TUNINGFORSDR50_MASK);
- /* Use to re-execute tuning */
- sdhci_am654->tuning_loop = 0;
-
ret = sdhci_setup_host(host);
if (ret)
return ret;
--
2.55.0
next prev parent reply other threads:[~2026-08-03 13:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:47 [PATCH v2 0/4] mmc: sdhci_am654: Fix DDR50 mode for cards without tuning support Diogo Ivo (Schneider Electric)
2026-08-03 13:47 ` Diogo Ivo (Schneider Electric) [this message]
2026-08-03 19:19 ` [PATCH v2 1/4] mmc: sdhci_am654: Move tuning_loop to local variable Mendez, Judith
2026-08-03 13:47 ` [PATCH v2 2/4] mmc: sdhci_am654: Reset command and data lines on failed tuning Diogo Ivo (Schneider Electric)
2026-08-03 19:28 ` Mendez, Judith
2026-08-03 13:47 ` [PATCH v2 3/4] mmc: sdhci_am654: Clear ITAPDLY on tuning failure Diogo Ivo (Schneider Electric)
2026-08-03 19:40 ` Mendez, Judith
2026-08-03 13:47 ` [PATCH v2 4/4] mmc: sdhci_am654: Fallback to DT-provided itap delay on DDR50 " Diogo Ivo (Schneider Electric)
2026-08-03 19:59 ` Mendez, Judith
2026-08-04 8:45 ` Diogo Ivo
2026-08-05 23:13 ` Mendez, Judith
2026-08-07 6:35 ` Adrian Hunter
2026-08-07 10:52 ` Diogo Ivo
2026-08-07 8:16 ` [PATCH v2 0/4] mmc: sdhci_am654: Fix DDR50 mode for cards without tuning support Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803-am654-sdhci-v2-1-a5ee5be86133@bootlin.com \
--to=diogo.ivo@bootlin.com \
--cc=adrian.hunter@intel.com \
--cc=faiz_abbas@ti.com \
--cc=jm@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=pascal.eberhard@se.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=ulfh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®