From a5c3731f5d46f4104876b8c7ddf84f7a1b6ba071 Mon Sep 17 00:00:00 2001 From: Nan Li Date: Sat, 12 Oct 2019 21:14:53 +0800 Subject: [PATCH] sdio: optimize sdio tuning print [1/1] PD#SWPL-14443 Problem: sdio tuning print info is too much. Solution: optimize tuning print. Verify: tl1 Change-Id: Ia0a0315eb30480b0014aa1e35d12b50576221f2e Signed-off-by: Nan Li --- drivers/amlogic/mmc/aml_sd_emmc.c | 20 ++++++++++++++++++-- drivers/amlogic/mmc/aml_sd_emmc_v3.c | 29 +++++++++++++++++++++++------ include/linux/amlogic/sd.h | 2 ++ 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/drivers/amlogic/mmc/aml_sd_emmc.c b/drivers/amlogic/mmc/aml_sd_emmc.c index 32e6f58..e8ec284 100644 --- a/drivers/amlogic/mmc/aml_sd_emmc.c +++ b/drivers/amlogic/mmc/aml_sd_emmc.c @@ -596,7 +596,7 @@ u32 aml_sd_emmc_tuning_transfer(struct mmc_host *mmc, break; } } else { - pr_err("Tuning transfer error: nmatch=%d tuning_err:0x%x\n", + pr_debug("Tuning transfer error: nmatch=%d tuning_err:0x%x\n", nmatch, tuning_err); break; } @@ -617,6 +617,8 @@ static int aml_tuning_adj(struct mmc_host *mmc, u32 opcode, u32 vctrl; struct sd_emmc_config *ctrl = (struct sd_emmc_config *)&vctrl; u32 clk_rate = 1000000000, clock, clk_div, nmatch = 0; + u8 *adj_print = host->adj_win; + u32 len = 0; int adj_delay = 0; const u8 *blk_pattern = tuning_data->blk_pattern; unsigned int blksz = tuning_data->blksz; @@ -638,6 +640,8 @@ static int aml_tuning_adj(struct mmc_host *mmc, u32 opcode, pr_info("%s: clk %d %s tuning start\n", mmc_hostname(mmc), (ctrl->ddr ? (clock / 2) : clock), (ctrl->ddr ? "DDR mode" : "SDR mode")); + memset(adj_print, 0, sizeof(u8) * ADJ_WIN_PRINT_MAXLEN); + len += sprintf(adj_print + len, "%s: adj_win: < ", pdata->pinname); for (adj_delay = 0; adj_delay < clk_div; adj_delay++) { adjust = readl(host->base + SD_EMMC_ADJUST); gadjust->adj_delay = adj_delay; @@ -656,7 +660,9 @@ static int aml_tuning_adj(struct mmc_host *mmc, u32 opcode, if (curr_win_start < 0) curr_win_start = adj_delay; curr_win_size++; - pr_info("%s: rx_tuning_result[%d] = %d\n", + len += sprintf(adj_print + len, + "%d ", adj_delay); + pr_debug("%s: rx_tuning_result[%d] = %d\n", mmc_hostname(host->mmc), adj_delay, nmatch); } else { if (curr_win_start >= 0) { @@ -675,6 +681,9 @@ static int aml_tuning_adj(struct mmc_host *mmc, u32 opcode, } } } + len += sprintf(adj_print + len, ">\n"); + pr_info("%s", host->adj_win); + /* last point is ok! */ if (curr_win_start >= 0) { if (best_win_start < 0) { @@ -3118,6 +3127,11 @@ static int meson_mmc_probe(struct platform_device *pdev) ret = -ENOMEM; goto fail_init_host; } + host->adj_win = kzalloc(sizeof(u8) * ADJ_WIN_PRINT_MAXLEN, GFP_KERNEL); + if (host->adj_win == NULL) { + ret = -ENOMEM; + goto fail_init_host; + } spin_lock_init(&host->mrq_lock); mutex_init(&host->pinmux_lock); @@ -3354,6 +3368,7 @@ free_cali: kfree(host->desc_bn); #endif kfree(host->blk_test); + kfree(host->adj_win); fail_init_host: kfree(host); pr_err("%s() fail!\n", __func__); @@ -3385,6 +3400,7 @@ static int meson_mmc_remove(struct platform_device *pdev) clk_disable_unprepare(host->core_clk); kfree(host->blk_test); + kfree(host->adj_win); mmc_free_host(host->mmc); kfree(pdata); kfree(host); diff --git a/drivers/amlogic/mmc/aml_sd_emmc_v3.c b/drivers/amlogic/mmc/aml_sd_emmc_v3.c index 264da6a..1965f12 100644 --- a/drivers/amlogic/mmc/aml_sd_emmc_v3.c +++ b/drivers/amlogic/mmc/aml_sd_emmc_v3.c @@ -1555,10 +1555,10 @@ static void pr_adj_info(char *name, { int i; - pr_info("[%s] fixed_adj_win_map:%lu\n", + pr_debug("[%s] fixed_adj_win_map:%lu\n", name, x); for (i = 0; i < div; i++) - pr_info("[%d]=%d\n", (fir_adj + i) % div, + pr_debug("[%d]=%d\n", (fir_adj + i) % div, ((x >> i) & 0x1) ? 1 : 0); } @@ -1568,6 +1568,8 @@ static unsigned long _test_fixed_adj(struct amlsd_platform *pdata, { struct amlsd_host *host = pdata->host; int i = 0; + u8 *adj_print = host->adj_win; + u32 len = 0; u32 nmatch = 0; u32 adjust = readl(host->base + SD_EMMC_ADJUST_V3); struct sd_emmc_adjust_v3 *gadjust = @@ -1576,6 +1578,8 @@ static unsigned long _test_fixed_adj(struct amlsd_platform *pdata, unsigned int blksz = tuning_data->blksz; DECLARE_BITMAP(fixed_adj_map, div); + memset(adj_print, 0, sizeof(u8) * ADJ_WIN_PRINT_MAXLEN); + len += sprintf(adj_print + len, "%s: adj_win: < ", pdata->pinname); bitmap_zero(fixed_adj_map, div); for (i = 0; i < div; i++) { gadjust->adj_delay = adj + i; @@ -1589,10 +1593,15 @@ static unsigned long _test_fixed_adj(struct amlsd_platform *pdata, /*get a ok adjust point!*/ if (nmatch == TUNING_NUM_PER_POINT) { set_bit(adj+i, fixed_adj_map); - pr_info("%s: rx_tuning_result[%d] = %d\n", + len += sprintf(adj_print + len, + "%d ", gadjust->adj_delay); + pr_debug("%s: rx_tuning_result[%d] = %d\n", mmc_hostname(host->mmc), adj+i, nmatch); } } + len += sprintf(adj_print + len, ">\n"); + pr_info("%s", host->adj_win); + return *fixed_adj_map; } @@ -1660,7 +1669,7 @@ static u32 _find_fixed_adj_valid_win(struct amlsd_platform *pdata, *prev_map = *fixed_adj_map; pr_adj_info("prev_map", *prev_map, 0, div); for (; step <= 63;) { - pr_info("[%s]retry test fixed adj...\n", __func__); + pr_debug("[%s]retry test fixed adj...\n", __func__); step += AML_FIXED_ADJ_STEP; set_fixed_adj_line_delay(step, pdata); *cur_map = _test_fixed_adj(pdata, tuning_data, opcode, 0, div); @@ -1670,7 +1679,7 @@ static u32 _find_fixed_adj_valid_win(struct amlsd_platform *pdata, if (*dst != 0) { fir_adj = find_first_bit(dst, div); pr_adj_info(">>>>>>>>bitmap_xor_dst", *dst, 0, div); - pr_info("[%s] fir_adj:%u\n", __func__, fir_adj); + pr_debug("[%s] fir_adj:%u\n", __func__, fir_adj); *prev_map = _swap_fixed_adj_win(*prev_map, fir_adj, div); @@ -1726,6 +1735,8 @@ static int _aml_sd_emmc_execute_tuning(struct mmc_host *mmc, u32 opcode, u32 old_dly, d1_dly, dly; unsigned long fixed_adj_map[1]; bool all_flag = false; + u8 *adj_print = host->adj_win; + u32 len = 0; if ((host->mem->start == host->data->port_b_base) && host->data->tdma_f) @@ -1745,6 +1756,8 @@ tunning: curr_win_start = -1; curr_win_size = 0; + memset(adj_print, 0, sizeof(u8) * ADJ_WIN_PRINT_MAXLEN); + len += sprintf(adj_print + len, "%s: adj_win: < ", pdata->pinname); spin_lock_irqsave(&host->mrq_lock, flags); pdata->need_retuning = false; spin_unlock_irqrestore(&host->mrq_lock, flags); @@ -1778,7 +1791,8 @@ tunning: curr_win_start = adj_delay; curr_win_size++; - pr_info("%s: rx_tuning_result[%d] = %d\n", + len += sprintf(adj_print + len, "%d ", adj_delay); + pr_debug("%s: rx_tuning_result[%d] = %d\n", mmc_hostname(host->mmc), adj_delay, nmatch); if (clk_div <= AML_FIXED_ADJ_MAX) set_bit(adj_delay, fixed_adj_map); @@ -1800,6 +1814,9 @@ tunning: } } } + len += sprintf(adj_print + len, ">\n"); + pr_info("%s", host->adj_win); + /* last point is ok! */ if (curr_win_start >= 0) { if (best_win_start < 0) { diff --git a/include/linux/amlogic/sd.h b/include/linux/amlogic/sd.h index 3a4ee34..960d5ff 100644 --- a/include/linux/amlogic/sd.h +++ b/include/linux/amlogic/sd.h @@ -45,6 +45,7 @@ #define SD_EMMC_MANUAL_CMD23 #define MAX_TUNING_RETRY 4 #define TUNING_NUM_PER_POINT 40 +#define ADJ_WIN_PRINT_MAXLEN 256 #define CALI_PATTERN_OFFSET ((SZ_1M * (36 + 3)) / 512) /* #define AML_RESP_WR_EXT */ /* pio to transfer data */ @@ -478,6 +479,7 @@ struct amlsd_host { unsigned long clk_rate; u8 *blk_test; + u8 *adj_win; char *desc_buf; #ifdef CFG_SDEMMC_PIO /* bounce buffer to accomplish 32bit apb access */ -- 2.7.4