From patchwork Sat Feb 18 13:26:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9581091 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 94DD160589 for ; Sat, 18 Feb 2017 13:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85B65283EC for ; Sat, 18 Feb 2017 13:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 762B6283CA; Sat, 18 Feb 2017 13:27:21 +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 2E42F283CA for ; Sat, 18 Feb 2017 13:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752824AbdBRN1T (ORCPT ); Sat, 18 Feb 2017 08:27:19 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36786 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbdBRN1O (ORCPT ); Sat, 18 Feb 2017 08:27:14 -0500 Received: by mail-wm0-f65.google.com with SMTP id r18so6864401wmd.3 for ; Sat, 18 Feb 2017 05:26:45 -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=zDiY8y9KR3mA3l5sFdC5ILNlcfaN7VVMqWszTWJAbeI=; b=lJ4h0IJ+Ef4LzkH71+S+mjM9re4MDLYDYSl2AwkEJaVGG2+4BJojBg72rphtdAkFLk U5KHdVJXctXlMfCC0h8RKyQXTxPu03JXIlX/1k3YNquTkTbIQDojS5cA+MBeqdgkv0p5 OOSzdWobtD2KvTT5AubVIvuIHfZaL+XducsT0nts+9z1Rc9zRxT739eGnMP25OtfojfO sxdwJMKsK+DOj3G0txjk+dNbNRvdvo99Ve4vTPGWA/pLOVE02EH3dEdOoqtsYYrlG7A5 vrSAZgvv/LK4RDBrHkkcHyNAtpOjhPIn+hME7a7vQZUE+c2SATUb8fncePBcz1H0eUv6 NkwA== 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=zDiY8y9KR3mA3l5sFdC5ILNlcfaN7VVMqWszTWJAbeI=; b=dSBVno1B3NEzt/S6uUSWoT23SkAvHG/udy9Lx0GdgGVzTvOL3rL6sBc0sxv3kIjdQX s0jG284LZ+kqHJnJUf4aYneO9slP1Z6juLQs9fxBoJvGxB/vab/WpGgC7GCyTBgXz1D5 lQgMAmcL9TeSpahPuuIi0cg6dQ52c071jVLRoah6iZHdX1DAziJG0TMXXD1w+l3myBWS PSmGY5yX2ZgSdL7XZOl5Obk53eTsuBjr4GeO1xS18CgpAyeFSlNi6bfqA133ka1pfSRD zYwcp0AotgvHkDhcqz12PWvPXIDVOF3XnK819lzU1pubFdHSvvfHXCPDMgV/OZfhGiJS OSyw== X-Gm-Message-State: AMke39lmHJnwI2uOF9yOGAqxD8LH1ThFqGEbZ+TmQ7Pbcg3+saYOn+j0Go8eJzse7gVdnw== X-Received: by 10.28.97.2 with SMTP id v2mr9510899wmb.3.1487424404830; Sat, 18 Feb 2017 05:26:44 -0800 (PST) Received: from ?IPv6:2003:c6:ebdc:4000:7c19:f774:dabe:f95d? (p200300C6EBDC40007C19F774DABEF95D.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:7c19:f774:dabe:f95d]) by smtp.googlemail.com with ESMTPSA id 198sm5681154wmn.11.2017.02.18.05.26.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 05:26:44 -0800 (PST) Subject: [PATCH v3 10/10] mmc: meson-gx: replace magic timeout numbers with constants To: Ulf Hansson , Kevin Hilman References: <583f6496-68a9-b8e1-6b25-1f073f819a3c@gmail.com> Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org From: Heiner Kallweit Message-ID: <8dadc1fd-2612-48d4-f265-95501c83a124@gmail.com> Date: Sat, 18 Feb 2017 14:26:04 +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: <583f6496-68a9-b8e1-6b25-1f073f819a3c@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 --- 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;