aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-05-15 15:48:23 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-05-22 19:09:15 -0400
commit9cc639a20fdc0b935e55d4992f93963f95233ca4 (patch)
treeb1a48ccf64e34f86f23d6ce944d6cfafbbb4723d
parent0f3ed7f75cf1a16df9309f3a9ffaf62a3fc1f0bb (diff)
ARM: 7725/1: mmc: mmci: Cache MMCIDATACTRL register
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 <ulf.hansson@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/mmc/host/mmci.c17
-rw-r--r--drivers/mmc/host/mmci.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index cb9e562b3571..ccfe0bc62f78 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)
191/* 191/*
192 * This must be called with host->lock held 192 * This must be called with host->lock held
193 */ 193 */
194static void mmci_write_datactrlreg(struct mmci_host *host, u32 datactrl)
195{
196 if (host->datactrl_reg != datactrl) {
197 host->datactrl_reg = datactrl;
198 writel(datactrl, host->base + MMCIDATACTRL);
199 }
200}
201
202/*
203 * This must be called with host->lock held
204 */
194static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) 205static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
195{ 206{
196 struct variant_data *variant = host->variant; 207 struct variant_data *variant = host->variant;
@@ -281,7 +292,7 @@ static void mmci_set_mask1(struct mmci_host *host, unsigned int mask)
281 292
282static void mmci_stop_data(struct mmci_host *host) 293static void mmci_stop_data(struct mmci_host *host)
283{ 294{
284 writel(0, host->base + MMCIDATACTRL); 295 mmci_write_datactrlreg(host, 0);
285 mmci_set_mask1(host, 0); 296 mmci_set_mask1(host, 0);
286 host->data = NULL; 297 host->data = NULL;
287} 298}
@@ -559,7 +570,7 @@ static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl)
559 datactrl |= MCI_DPSM_DMAENABLE; 570 datactrl |= MCI_DPSM_DMAENABLE;
560 571
561 /* Trigger the DMA transfer */ 572 /* Trigger the DMA transfer */
562 writel(datactrl, host->base + MMCIDATACTRL); 573 mmci_write_datactrlreg(host, datactrl);
563 574
564 /* 575 /*
565 * Let the MMCI say when the data is ended and it's time 576 * Let the MMCI say when the data is ended and it's time
@@ -757,7 +768,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
757 irqmask = MCI_TXFIFOHALFEMPTYMASK; 768 irqmask = MCI_TXFIFOHALFEMPTYMASK;
758 } 769 }
759 770
760 writel(datactrl, base + MMCIDATACTRL); 771 mmci_write_datactrlreg(host, datactrl);
761 writel(readl(base + MMCIMASK0) & ~MCI_DATAENDMASK, base + MMCIMASK0); 772 writel(readl(base + MMCIMASK0) & ~MCI_DATAENDMASK, base + MMCIMASK0);
762 mmci_set_mask1(host, irqmask); 773 mmci_set_mask1(host, irqmask);
763} 774}
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 1383c9ce2646..0b6cc54be966 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -183,6 +183,7 @@ struct mmci_host {
183 unsigned int cclk; 183 unsigned int cclk;
184 u32 pwr_reg; 184 u32 pwr_reg;
185 u32 clk_reg; 185 u32 clk_reg;
186 u32 datactrl_reg;
186 bool vqmmc_enabled; 187 bool vqmmc_enabled;
187 struct mmci_platform_data *plat; 188 struct mmci_platform_data *plat;
188 struct variant_data *variant; 189 struct variant_data *variant;