From patchwork Mon Apr 27 08:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 6278651 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD3F5BF4A6 for ; Mon, 27 Apr 2015 08:12:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B56F203A9 for ; Mon, 27 Apr 2015 08:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE22B2040F for ; Mon, 27 Apr 2015 08:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932160AbbD0IMC (ORCPT ); Mon, 27 Apr 2015 04:12:02 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:35192 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932339AbbD0IL4 (ORCPT ); Mon, 27 Apr 2015 04:11:56 -0400 Received: by pdbqd1 with SMTP id qd1so120676549pdb.2 for ; Mon, 27 Apr 2015 01:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=j+SOrdl85GBLFaJFswNpk4MGJ7lmRDurm82+qfvl2nM=; b=W+tACPCZt1i+vK6XEf/XizvOrhf3Gm0pvGzkGzMIFdq3Kg0CGujpei5fPp3adLVsmb l911nscJzIcXZ6DRxzP6WvzbXsblJpUxScLgDgK8cpP4fLWIu9jBDbgGPB0lVrZhgzzV vQZ3UMa4WHN7dfoYHwFQppkxOV2qV+ufVrPGucCsjiV23Z5izJ9XnCZCqEh3UvU8NfmH pGFBffBSmu3eCYsMyStRJd8qND01HdUhwdkokRRVvz2LtI5t+YL9pEhHq9tyX4YLrPGb 3Sgzotepuc1+Jr5DfssMb8Fv4rSEXhV5kvsiiXU+UdHIU7nevzt4SXXw2OOM+xWoc1Hn 3/iA== X-Received: by 10.70.56.98 with SMTP id z2mr19734256pdp.120.1430122316052; Mon, 27 Apr 2015 01:11:56 -0700 (PDT) Received: from ip-172-31-29-47.ap-northeast-1.compute.internal (ec2-54-65-106-64.ap-northeast-1.compute.amazonaws.com. [54.65.106.64]) by mx.google.com with ESMTPSA id bn4sm18619142pad.2.2015.04.27.01.11.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Apr 2015 01:11:55 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, workgroup.linux@csr.com, Weijun Yang , Barry Song Subject: [PATCH 1/2] mmc: sdhci-sirf: fix the tuning count in platform_execute_tuning Date: Mon, 27 Apr 2015 08:15:13 +0000 Message-Id: <1430122514-6541-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Weijun Yang hardware has 16bit to record the tuning count, so fix it to 16384. at the same time, tuned_phases[SIRF_TUNING_COUNT] is useless as the array is never used, so move it to a variant. Signed-off-by: Weijun Yang Signed-off-by: Barry Song --- drivers/mmc/host/sdhci-sirf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c index 32848eb..2201f76 100644 --- a/drivers/mmc/host/sdhci-sirf.c +++ b/drivers/mmc/host/sdhci-sirf.c @@ -17,7 +17,7 @@ #define SDHCI_CLK_DELAY_SETTING 0x4C #define SDHCI_SIRF_8BITBUS BIT(3) -#define SIRF_TUNING_COUNT 128 +#define SIRF_TUNING_COUNT 16384 struct sdhci_sirf_priv { int gpio_cd; @@ -46,7 +46,7 @@ static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width) static int sdhci_sirf_execute_tuning(struct sdhci_host *host, u32 opcode) { int tuning_seq_cnt = 3; - u8 phase, tuned_phases[SIRF_TUNING_COUNT]; + int phase; u8 tuned_phase_cnt = 0; int rc = 0, longest_range = 0; int start = -1, end = 0, tuning_value = -1, range = 0; @@ -58,6 +58,7 @@ static int sdhci_sirf_execute_tuning(struct sdhci_host *host, u32 opcode) retry: phase = 0; + tuned_phase_cnt = 0; do { sdhci_writel(host, clock_setting | phase, @@ -65,7 +66,7 @@ retry: if (!mmc_send_tuning(mmc)) { /* Tuning is successful at this tuning point */ - tuned_phases[tuned_phase_cnt++] = phase; + tuned_phase_cnt++; dev_dbg(mmc_dev(mmc), "%s: Found good phase = %d\n", mmc_hostname(mmc), phase); if (start == -1) @@ -85,7 +86,7 @@ retry: start = -1; end = range = 0; } - } while (++phase < ARRAY_SIZE(tuned_phases)); + } while (++phase < SIRF_TUNING_COUNT); if (tuned_phase_cnt && tuning_value > 0) { /*