Skip to content

Commit cf6444b

Browse files
jmentistorulf
authored andcommitted
mmc: sdhci_am654: Add prints to tuning algorithm
Add debug prints to tuning algorithm for debugging. Also add error print if we fail tuning. Signed-off-by: Judith Mendez <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 901d16e commit cf6444b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/mmc/host/sdhci_am654.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,20 @@ static int sdhci_am654_calculate_itap(struct sdhci_host *host, struct window
450450
{
451451
u8 itap = 0, start_fail = 0, end_fail = 0, pass_length = 0;
452452
u8 first_fail_start = 0, last_fail_end = 0;
453+
struct device *dev = mmc_dev(host->mmc);
453454
struct window pass_window = {0, 0, 0};
454455
int prev_fail_end = -1;
455456
u8 i;
456457

457458
if (!num_fails) {
458459
/* Retry tuning */
460+
dev_dbg(dev, "No failing region found, retry tuning\n");
459461
return -1;
460462
}
461463

462464
if (fail_window->length == ITAPDLY_LENGTH) {
463465
/* Retry tuning */
466+
dev_dbg(dev, "No passing itapdly, retry tuning\n");
464467
return -1;
465468
}
466469

@@ -504,6 +507,7 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
504507
struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
505508
unsigned char timing = host->mmc->ios.timing;
506509
struct window fail_window[ITAPDLY_LENGTH];
510+
struct device *dev = mmc_dev(host->mmc);
507511
u8 curr_pass, itap;
508512
u8 fail_index = 0;
509513
u8 prev_pass = 1;
@@ -524,6 +528,7 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
524528
if (!curr_pass) {
525529
fail_window[fail_index].end = itap;
526530
fail_window[fail_index].length++;
531+
dev_dbg(dev, "Failed itapdly=%d\n", itap);
527532
}
528533

529534
if (curr_pass && !prev_pass)
@@ -545,6 +550,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
545550
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
546551
struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
547552
unsigned char timing = host->mmc->ios.timing;
553+
struct device *dev = mmc_dev(host->mmc);
548554
int itapdly;
549555

550556
do {
@@ -553,9 +559,12 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
553559
break;
554560
} while (++sdhci_am654->tuning_loop < RETRY_TUNING_MAX);
555561

556-
if (itapdly < 0)
562+
if (itapdly < 0) {
563+
dev_err(dev, "Failed to find itapdly, fail tuning\n");
557564
return -1;
565+
}
558566

567+
dev_dbg(dev, "Passed tuning, final itapdly=%d\n", itapdly);
559568
sdhci_am654_write_itapdly(sdhci_am654, itapdly, sdhci_am654->itap_del_ena[timing]);
560569
/* Save ITAPDLY */
561570
sdhci_am654->itap_del_sel[timing] = itapdly;

0 commit comments

Comments
 (0)