]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mmc: sdhci_am654: Add prints to tuning algorithm
authorJudith Mendez <jm@ti.com>
Wed, 4 Sep 2024 23:25:12 +0000 (18:25 -0500)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 5 Sep 2024 10:17:25 +0000 (12:17 +0200)
Add debug prints to tuning algorithm for debugging.
Also add error print if we fail tuning.

Signed-off-by: Judith Mendez <jm@ti.com>
Link: https://lore.kernel.org/r/20240904232512.830778-3-jm@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci_am654.c

index 8eb6ce9f3b173cd415f7d9377a425570b7ebdfb9..0aa3c40ea6ed8e39c802cdc1528248b2b57ce6dd 100644 (file)
@@ -450,17 +450,20 @@ static int sdhci_am654_calculate_itap(struct sdhci_host *host, struct window
 {
        u8 itap = 0, start_fail = 0, end_fail = 0, pass_length = 0;
        u8 first_fail_start = 0, last_fail_end = 0;
+       struct device *dev = mmc_dev(host->mmc);
        struct window pass_window = {0, 0, 0};
        int prev_fail_end = -1;
        u8 i;
 
        if (!num_fails) {
                /* Retry tuning */
+               dev_dbg(dev, "No failing region found, retry tuning\n");
                return -1;
        }
 
        if (fail_window->length == ITAPDLY_LENGTH) {
                /* Retry tuning */
+               dev_dbg(dev, "No passing itapdly, retry tuning\n");
                return -1;
        }
 
@@ -504,6 +507,7 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
        struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
        unsigned char timing = host->mmc->ios.timing;
        struct window fail_window[ITAPDLY_LENGTH];
+       struct device *dev = mmc_dev(host->mmc);
        u8 curr_pass, itap;
        u8 fail_index = 0;
        u8 prev_pass = 1;
@@ -524,6 +528,7 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
                if (!curr_pass) {
                        fail_window[fail_index].end = itap;
                        fail_window[fail_index].length++;
+                       dev_dbg(dev, "Failed itapdly=%d\n", itap);
                }
 
                if (curr_pass && !prev_pass)
@@ -545,6 +550,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(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);
        int itapdly;
 
        do {
@@ -553,9 +559,12 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
                        break;
        } while (++sdhci_am654->tuning_loop < RETRY_TUNING_MAX);
 
-       if (itapdly < 0)
+       if (itapdly < 0) {
+               dev_err(dev, "Failed to find itapdly, fail tuning\n");
                return -1;
+       }
 
+       dev_dbg(dev, "Passed tuning, final itapdly=%d\n", itapdly);
        sdhci_am654_write_itapdly(sdhci_am654, itapdly, sdhci_am654->itap_del_ena[timing]);
        /* Save ITAPDLY */
        sdhci_am654->itap_del_sel[timing] = itapdly;