From patchwork Wed May 15 09:40:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 16916 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A138E2396C for ; Wed, 15 May 2013 09:42:33 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m13sf1904764yen.9 for ; Wed, 15 May 2013 02:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=rLeMl4x0DBsk4T0sGduxvatI5baUQzc4VFtwrt8q8sg=; b=K0YXcQL7mWi5k73B4XR4Diig5DSJNGGxyqnzFxyN+uugCgPPCSsVVD0p3gOgy0pROm I7qlBGvpwETyBzN1w3XLsaS5cuzKK+0e3/bvP48NExb+r0rX2S711v3kyYDB3TT+jOIU 1jye78Tyqjw4ARgMdkP66plaKc4/iPwoXRYvwFTosz0fWNEKGjZMuS4n+I27Au0LKTS/ tbBsivWbk5p47pY0viBbpxvxjgPcohJVAu3fqYAgnXpUTiOGLg8HCeR8vTOz4/Hm+7jd WEUCGIIARIps30DU87m8iCkCZAQSxYvyOv1nObt/Pg4ljA37BLw23dUKAAKaZYqSSEtd J0Bw== X-Received: by 10.224.42.141 with SMTP id s13mr23042024qae.3.1368610917113; Wed, 15 May 2013 02:41:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.83.36 with SMTP id n4ls609755qey.76.gmail; Wed, 15 May 2013 02:41:57 -0700 (PDT) X-Received: by 10.59.9.39 with SMTP id dp7mr24263232ved.36.1368610916965; Wed, 15 May 2013 02:41:56 -0700 (PDT) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [2607:f8b0:400c:c02::229]) by mx.google.com with ESMTPS id o16si1005547vcw.79.2013.05.15.02.41.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 02:41:56 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::229; Received: by mail-vb0-f41.google.com with SMTP id w8so276911vbf.0 for ; Wed, 15 May 2013 02:41:56 -0700 (PDT) X-Received: by 10.52.175.200 with SMTP id cc8mr20634418vdc.94.1368610916707; Wed, 15 May 2013 02:41:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.217.15 with SMTP id hk15csp10996vcb; Wed, 15 May 2013 02:41:56 -0700 (PDT) X-Received: by 10.194.88.7 with SMTP id bc7mr2713158wjb.48.1368610915783; Wed, 15 May 2013 02:41:55 -0700 (PDT) Received: from eu1sys200aog124.obsmtp.com (eu1sys200aog124.obsmtp.com [207.126.144.157]) by mx.google.com with SMTP id x48si2585031eey.82.2013.05.15.02.41.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 02:41:55 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.157 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.157; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob124.postini.com ([207.126.147.11]) with SMTP ID DSNKUZNYRuwBXPeYjApVS7x95UfJgw+d+AeK@postini.com; Wed, 15 May 2013 09:41:55 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 2B8FE9C; Wed, 15 May 2013 09:39:40 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id D3DF262; Wed, 15 May 2013 09:40:37 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 63EA8A8065; Wed, 15 May 2013 11:40:33 +0200 (CEST) Received: from steludxu1397.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Wed, 15 May 2013 11:40:37 +0200 From: Ulf Hansson To: , Russell King Cc: , Chris Ball , Linus Walleij , Ulf Hansson Subject: [PATCH 3/4] mmc: mmci: Cache MMCIDATACTRL register Date: Wed, 15 May 2013 11:40:21 +0200 Message-ID: <1368610823-14113-4-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1368610823-14113-1-git-send-email-ulf.hansson@stericsson.com> References: <1368610823-14113-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlQLio+0S68U1+czc5ZeuG0RzzMdMVR3Ai1Fe51CUSdj0HrraUuuCNjJ9/5Tx0uU3CYpN/V X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::229 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Ulf Hansson Add a cache variable in the host struct that reflects the current data in the MMCIDATACTRL register. This patch will not introduce any functional change but instead provide an easy option to keep specific bits in the register between each data transfer. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 17 ++++++++++++++--- drivers/mmc/host/mmci.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 8d4ceb8..4530217 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -191,6 +191,17 @@ static void mmci_write_pwrreg(struct mmci_host *host, u32 pwr) /* * This must be called with host->lock held */ +static void mmci_write_datactrlreg(struct mmci_host *host, u32 datactrl) +{ + if (host->datactrl_reg != datactrl) { + host->datactrl_reg = datactrl; + writel(datactrl, host->base + MMCIDATACTRL); + } +} + +/* + * This must be called with host->lock held + */ static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) { struct variant_data *variant = host->variant; @@ -275,7 +286,7 @@ static void mmci_set_mask1(struct mmci_host *host, unsigned int mask) static void mmci_stop_data(struct mmci_host *host) { - writel(0, host->base + MMCIDATACTRL); + mmci_write_datactrlreg(host, 0); mmci_set_mask1(host, 0); host->data = NULL; } @@ -552,7 +563,7 @@ static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl) datactrl |= MCI_DPSM_DMAENABLE; /* Trigger the DMA transfer */ - writel(datactrl, host->base + MMCIDATACTRL); + mmci_write_datactrlreg(host, datactrl); /* * Let the MMCI say when the data is ended and it's time @@ -750,7 +761,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) irqmask = MCI_TXFIFOHALFEMPTYMASK; } - writel(datactrl, base + MMCIDATACTRL); + mmci_write_datactrlreg(host, datactrl); writel(readl(base + MMCIMASK0) & ~MCI_DATAENDMASK, base + MMCIMASK0); mmci_set_mask1(host, irqmask); } diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 1383c9c..0b6cc54 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -183,6 +183,7 @@ struct mmci_host { unsigned int cclk; u32 pwr_reg; u32 clk_reg; + u32 datactrl_reg; bool vqmmc_enabled; struct mmci_platform_data *plat; struct variant_data *variant;