From patchwork Mon Apr 21 21:48:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 4026481 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2DBD0BFF02 for ; Mon, 21 Apr 2014 21:48:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 502A62035E for ; Mon, 21 Apr 2014 21:48:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79D1220357 for ; Mon, 21 Apr 2014 21:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754562AbaDUVsd (ORCPT ); Mon, 21 Apr 2014 17:48:33 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:45207 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754863AbaDUVsZ (ORCPT ); Mon, 21 Apr 2014 17:48:25 -0400 Received: by mail-wi0-f178.google.com with SMTP id bs8so2358463wib.17 for ; Mon, 21 Apr 2014 14:48:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6FlLQ31fY7Au88ImLKrqBTZh/WNb6shM8bD5SlyhyBo=; b=doomwAgmmb0nGZ9TSWZETt6+kciVnmTWZM7oEaDTX+1Ai/WGD1GkoV09eUSqWOq8O2 MmvDbFYo+w+lh1UvV9soPsDi02kvlLdD23Fgr3XUnTxkePnfZPjMH7ms61Z8Myv0K/Fl tLxysymLdyAfuS5vwd0vt03as31hRLSh7ZCXBFROqzAziYxcDhkBWlpczXeiWDIS4kQS 6xXSKqiW/JuYmetxn2SUyzcquQXl1r5BTrQ97MaHKygCRpPyk7wLLOHbG6NyV+Jo0UAp BuTFE7cFSMheZMf6OKctdgksE5WDu9tQ/+Ljg7k/JtXFBefADCvoMB1d6YnWFidU7y+b rXLw== X-Gm-Message-State: ALoCoQnv8E4d/1q5VSwiH92XA7xtPi2sU+nSY6h5jZER/ML7Oe0MoGwZ5QuFYZlqUcR2iOy9GnXf X-Received: by 10.194.118.163 with SMTP id kn3mr233878wjb.77.1398116904478; Mon, 21 Apr 2014 14:48:24 -0700 (PDT) Received: from srinivas-Inspiron-N5050.dlink.com (host-78-149-8-254.as13285.net. [78.149.8.254]) by mx.google.com with ESMTPSA id xm20sm18420947wib.19.2014.04.21.14.48.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 14:48:24 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: linux-mmc@vger.kernel.org Cc: Russell King , Chris Ball , Ulf Hansson , linux-kernel@vger.kernel.org, agross@quicinc.com, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH RFC 06/12] mmc: mmci: Add write delay to variant structure. Date: Mon, 21 Apr 2014 22:48:18 +0100 Message-Id: <1398116898-31478-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398116624-31052-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1398116624-31052-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Srinivas Kandagatla This patch adds write delay parameter required after each write to controller registers on some of the SOCs like Qualcomm ones. The delay parameter will provide information on how many clock cycle delay required after each write. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 4f8d0ba..86bf330 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -55,6 +55,8 @@ static unsigned int fmax = 515633; * is asserted (likewise for RX) * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY * is asserted (likewise for RX) + * @reg_write_delay: delay in number of clock cycles required after each write + * to controller registers. * @sdio: variant supports SDIO * @st_clkdiv: true if using a ST-specific clock divider algorithm * @blksz_datactrl16: true if Block size is at b16..b30 position in datactrl register @@ -72,6 +74,7 @@ struct variant_data { unsigned int datalength_bits; unsigned int fifosize; unsigned int fifohalfsize; + unsigned int reg_write_delay; bool sdio; bool st_clkdiv; bool blksz_datactrl16; @@ -178,7 +181,12 @@ static inline u32 mmci_readl(struct mmci_host *host, u32 off) static inline void mmci_writel(struct mmci_host *host, u32 data, u32 off) { + struct variant_data *var = host->variant; + writel(data, host->base + off); + + if (var->reg_write_delay && host->mclk) + udelay(1 + ((var->reg_write_delay * USEC_PER_SEC)/host->mclk)); } static int mmci_card_busy(struct mmc_host *mmc)