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: 28737 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 544502032B for ; Mon, 21 Apr 2014 21:48:41 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf30485416oac.3 for ; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=kE/TNcuFhsv15rab/p5x/DdRD9BRDcmyqzpwUydIyyE=; b=LXaSWgo/Kx4z/wANnGv3lBOl4jn7g8MZKzZdfwZWimSDU3Uk2LpuyJR1gZie2zGPu8 t0VXX0nRHadYO/HvxsrI/Y6pCbjipvveawrOBfNMb5M2RCAZjuaurKwd7e0I3D0Xe7gO KpyyDlPJjzkfcrsrVBcedQR88SpKrWAlBlk/kU/xwD9PvUloCtegi6/AL2GrIof/f2IV 2fQnaSvOwNP63+aOTf+Bevr0efJ7Mxot7tyk+gk93X+avOT4OhVNjbh+COLucOqHRprc rBsZXYvM15I2bXWdvUNsyqOKHPyimmiofLGrRgYKc2tkqYK7M/dJHNPxcvvedsgeAL5b 3xiQ== X-Gm-Message-State: ALoCoQmxD5u+8zOKfPZKqiZRfaG3we7FMEqXFYB5dUaV2j3da/eQ13attJm14k7YWRMflCt5aZ/r X-Received: by 10.42.123.66 with SMTP id q2mr15263862icr.16.1398116920605; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.71 with SMTP id k65ls642711qgf.28.gmail; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) X-Received: by 10.220.249.6 with SMTP id mi6mr2115793vcb.33.1398116920491; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id dy7si6475791vec.72.2014.04.21.14.48.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 14:48:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so1599129vcb.20 for ; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) X-Received: by 10.220.161.8 with SMTP id p8mr32817065vcx.4.1398116920423; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp320780vcb; Mon, 21 Apr 2014 14:48:40 -0700 (PDT) X-Received: by 10.66.251.233 with SMTP id zn9mr40763742pac.67.1398116916117; Mon, 21 Apr 2014 14:48:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id as3si21539325pbc.264.2014.04.21.14.48.35; Mon, 21 Apr 2014 14:48:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754562AbaDUVsd (ORCPT + 7 others); 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-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: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)