From patchwork Fri Mar 3 20:00:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9603433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73CE0604E2 for ; Fri, 3 Mar 2017 20:00:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6586828631 for ; Fri, 3 Mar 2017 20:00:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6B028633; Fri, 3 Mar 2017 20:00:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6D9628632 for ; Fri, 3 Mar 2017 20:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752082AbdCCUAy (ORCPT ); Fri, 3 Mar 2017 15:00:54 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34825 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdCCUAx (ORCPT ); Fri, 3 Mar 2017 15:00:53 -0500 Received: by mail-wr0-f195.google.com with SMTP id u108so10557374wrb.2 for ; Fri, 03 Mar 2017 12:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=wjh8QhMaU4pqJYlvI3yuRfEyr/RYmXxCsU+hZ0OCV+Q=; b=Zzlf1hZwhrAJPIYwQ6S7bdX6XIjqfSnrH475m8/iNpxVqJy/sAVyYMMbVfn9BBQ6P1 xi46gZfb2xrvJxEoglPYHZWfs/hCCfB5CloPS0lUC8rKcUZtx8/PoQJLhEJcWsUUJwuw FhgAyNkEVy0IVltvygMxkW/TXtadGpwCWBcb5H/y0tGIXqWdJSWujINrIVKeDTDjNjbW ubZfgkx9MXWuT23aTDzZlmuvzfs/hb/rV4AkJ8G9AyXLCHyOEhvYgjB7zMEMNdkpW/Zs VuCinlfPX0qsosYioQrvY/sencyotDa6mjFZW/LdV3zQFRXbhC1Lfwi+jv15CUlWYBeF 3HOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=wjh8QhMaU4pqJYlvI3yuRfEyr/RYmXxCsU+hZ0OCV+Q=; b=WhdsnNviEzz1QlGu4K6yNOAmogAqVwIg5Bn7yzaoQAzRXhrtD2+AaJt5PrZszM+Q9S GHIP2n6EceiE5ljAobhqFWISisZZPaNkHKIJcNceWqGwaYBLEVrqAxH7CRaWtSN46qUV 7WcNZN1XALMkcPKmJyUj8WEM+N8l7qHXMKR+xWnpw9tNkEo8fl2rXVQ4pLVDZxCgtVf4 D5/1bRoE0sqHmEMM9fmVJgixrZw8yR9orlVFcOLt9Qdbq2RchxhtpYUJk4e7JbfV5zX/ upNj1aocqx8ZvIze6IaKEnALG5f2vzJ298C2XiAyeGXiOxnvevmbGMYHg+YeSZ6VapKk KAew== X-Gm-Message-State: AMke39kOED/oAx3Myema11qoXb4uuWzYiF7HfSFwaKxqtrhLYwnJphu6Dmlokt1/H/TvVA== X-Received: by 10.223.168.80 with SMTP id l74mr4229651wrc.184.1488571251294; Fri, 03 Mar 2017 12:00:51 -0800 (PST) Received: from ?IPv6:2003:c6:ebdc:4000:f903:fe11:afad:80a0? (p200300C6EBDC4000F903FE11AFAD80A0.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:f903:fe11:afad:80a0]) by smtp.googlemail.com with ESMTPSA id w125sm4235898wme.27.2017.03.03.12.00.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Mar 2017 12:00:50 -0800 (PST) Subject: [PATCH v4 10/10] mmc: meson-gx: replace magic timeout numbers with constants To: Ulf Hansson , Kevin Hilman References: <62912f3d-2307-cfff-3c69-c8b8ffaeb474@gmail.com> Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org From: Heiner Kallweit Message-ID: Date: Fri, 3 Mar 2017 21:00:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <62912f3d-2307-cfff-3c69-c8b8ffaeb474@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace timeout magic numbers with proper constants. Signed-off-by: Heiner Kallweit Acked-by: Kevin Hilman --- v3: - added to patch series v4: - added acked-by --- drivers/mmc/host/meson-gx-mmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 5281014e..f244fcf9 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -116,6 +116,8 @@ #define SD_EMMC_CFG_BLK_SIZE 512 /* internal buffer max: 512 bytes */ #define SD_EMMC_CFG_RESP_TIMEOUT 256 /* in clock cycles */ +#define SD_EMMC_CMD_TIMEOUT 1024 /* in ms */ +#define SD_EMMC_CMD_TIMEOUT_DATA 4096 /* in ms */ #define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */ #define MUX_CLK_NUM_PARENTS 2 @@ -498,10 +500,10 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) desc->cmd_data = host->bounce_dma_addr & CMD_DATA_MASK; - cmd_cfg_timeout = 12; + cmd_cfg_timeout = ilog2(SD_EMMC_CMD_TIMEOUT_DATA); } else { desc->cmd_cfg &= ~CMD_CFG_DATA_IO; - cmd_cfg_timeout = 10; + cmd_cfg_timeout = ilog2(SD_EMMC_CMD_TIMEOUT); } desc->cmd_cfg |= (cmd_cfg_timeout & CMD_CFG_TIMEOUT_MASK) << CMD_CFG_TIMEOUT_SHIFT;