aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:30:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:30:02 -0500
commitb1286f4e9ac14c8973140b338b4d3c5691264d3b (patch)
tree5a67788bb2276cd67230d24b5a6994ddafb10707 /drivers/mmc
parent6facac1ab68fbf9cbad31a9d521f3a0d6aa9470e (diff)
parent0fa5d3996dbda1ee9653c43d39b7ef159fb57ee7 (diff)
Merge branch 'for-linus' of git://git.linaro.org/people/rmk/linux-arm
Pull ARM updates from Russell King: "Here's the updates for ARM for this merge window, which cover quite a variety of areas. There's a bunch of patch series from Will tackling various bugs like the PROT_NONE handling, ASID allocation, cluster boot protocol and ASID TLB tagging updates. We move to a build-time sorted exception table rather than doing the sorting at run-time, add support for the secure computing filter, and some updates to the perf code. We also have sorted out the placement of some headers, fixed some build warnings, fixed some hotplug problems with the per-cpu TWD code." * 'for-linus' of git://git.linaro.org/people/rmk/linux-arm: (73 commits) ARM: 7594/1: Add .smp entry for REALVIEW_EB ARM: 7599/1: head: Remove boot-time HYP mode check for v5 and below ARM: 7598/1: net: bpf_jit_32: fix sp-relative load/stores offsets. ARM: 7595/1: syscall: rework ordering in syscall_trace_exit ARM: 7596/1: mmci: replace readsl/writesl with ioread32_rep/iowrite32_rep ARM: 7597/1: net: bpf_jit_32: fix kzalloc gfp/size mismatch. ARM: 7593/1: nommu: do not enable DCACHE_WORD_ACCESS when !CONFIG_MMU ARM: 7592/1: nommu: prevent generation of kernel unaligned memory accesses ARM: 7591/1: nommu: Enable the strict alignment (CR_A) bit only if ARCH < v6 ARM: 7590/1: /proc/interrupts: limit the display of IPIs to online CPUs only ARM: 7587/1: implement optimized percpu variable access ARM: 7589/1: integrator: pass the lm resource to amba ARM: 7588/1: amba: create a resource parent registrator ARM: 7582/2: rename kvm_seq to vmalloc_seq so to avoid confusion with KVM ARM: 7585/1: kernel: fix nr_cpu_ids check in DT logical map init ARM: 7584/1: perf: fix link error when CONFIG_HW_PERF_EVENTS is not selected ARM: gic: use a private mapping for CPU target interfaces ARM: kernel: add logical mappings look-up ARM: kernel: add cpu logical map DT init in setup_arch ARM: kernel: add device tree init map function ...
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c66
-rw-r--r--drivers/mmc/host/mmci.h4
2 files changed, 49 insertions, 21 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index ec28d175d9c8..150772395cc6 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -33,6 +33,7 @@
33#include <linux/amba/mmci.h> 33#include <linux/amba/mmci.h>
34#include <linux/pm_runtime.h> 34#include <linux/pm_runtime.h>
35#include <linux/types.h> 35#include <linux/types.h>
36#include <linux/pinctrl/consumer.h>
36 37
37#include <asm/div64.h> 38#include <asm/div64.h>
38#include <asm/io.h> 39#include <asm/io.h>
@@ -654,9 +655,31 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
654 655
655 /* The ST Micro variants has a special bit to enable SDIO */ 656 /* The ST Micro variants has a special bit to enable SDIO */
656 if (variant->sdio && host->mmc->card) 657 if (variant->sdio && host->mmc->card)
657 if (mmc_card_sdio(host->mmc->card)) 658 if (mmc_card_sdio(host->mmc->card)) {
659 /*
660 * The ST Micro variants has a special bit
661 * to enable SDIO.
662 */
663 u32 clk;
664
658 datactrl |= MCI_ST_DPSM_SDIOEN; 665 datactrl |= MCI_ST_DPSM_SDIOEN;
659 666
667 /*
668 * The ST Micro variant for SDIO small write transfers
669 * needs to have clock H/W flow control disabled,
670 * otherwise the transfer will not start. The threshold
671 * depends on the rate of MCLK.
672 */
673 if (data->flags & MMC_DATA_WRITE &&
674 (host->size < 8 ||
675 (host->size <= 8 && host->mclk > 50000000)))
676 clk = host->clk_reg & ~variant->clkreg_enable;
677 else
678 clk = host->clk_reg | variant->clkreg_enable;
679
680 mmci_write_clkreg(host, clk);
681 }
682
660 /* 683 /*
661 * Attempt to use DMA operation mode, if this 684 * Attempt to use DMA operation mode, if this
662 * should fail, fall back to PIO mode 685 * should fail, fall back to PIO mode
@@ -840,14 +863,14 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema
840 if (unlikely(count & 0x3)) { 863 if (unlikely(count & 0x3)) {
841 if (count < 4) { 864 if (count < 4) {
842 unsigned char buf[4]; 865 unsigned char buf[4];
843 readsl(base + MMCIFIFO, buf, 1); 866 ioread32_rep(base + MMCIFIFO, buf, 1);
844 memcpy(ptr, buf, count); 867 memcpy(ptr, buf, count);
845 } else { 868 } else {
846 readsl(base + MMCIFIFO, ptr, count >> 2); 869 ioread32_rep(base + MMCIFIFO, ptr, count >> 2);
847 count &= ~0x3; 870 count &= ~0x3;
848 } 871 }
849 } else { 872 } else {
850 readsl(base + MMCIFIFO, ptr, count >> 2); 873 ioread32_rep(base + MMCIFIFO, ptr, count >> 2);
851 } 874 }
852 875
853 ptr += count; 876 ptr += count;
@@ -877,22 +900,6 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
877 count = min(remain, maxcnt); 900 count = min(remain, maxcnt);
878 901
879 /* 902 /*
880 * The ST Micro variant for SDIO transfer sizes
881 * less then 8 bytes should have clock H/W flow
882 * control disabled.
883 */
884 if (variant->sdio &&
885 mmc_card_sdio(host->mmc->card)) {
886 u32 clk;
887 if (count < 8)
888 clk = host->clk_reg & ~variant->clkreg_enable;
889 else
890 clk = host->clk_reg | variant->clkreg_enable;
891
892 mmci_write_clkreg(host, clk);
893 }
894
895 /*
896 * SDIO especially may want to send something that is 903 * SDIO especially may want to send something that is
897 * not divisible by 4 (as opposed to card sectors 904 * not divisible by 4 (as opposed to card sectors
898 * etc), and the FIFO only accept full 32-bit writes. 905 * etc), and the FIFO only accept full 32-bit writes.
@@ -900,7 +907,7 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
900 * byte become a 32bit write, 7 bytes will be two 907 * byte become a 32bit write, 7 bytes will be two
901 * 32bit writes etc. 908 * 32bit writes etc.
902 */ 909 */
903 writesl(base + MMCIFIFO, ptr, (count + 3) >> 2); 910 iowrite32_rep(base + MMCIFIFO, ptr, (count + 3) >> 2);
904 911
905 ptr += count; 912 ptr += count;
906 remain -= count; 913 remain -= count;
@@ -1360,6 +1367,23 @@ static int mmci_probe(struct amba_device *dev,
1360 mmc->f_max = min(host->mclk, fmax); 1367 mmc->f_max = min(host->mclk, fmax);
1361 dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); 1368 dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
1362 1369
1370 host->pinctrl = devm_pinctrl_get(&dev->dev);
1371 if (IS_ERR(host->pinctrl)) {
1372 ret = PTR_ERR(host->pinctrl);
1373 goto clk_disable;
1374 }
1375
1376 host->pins_default = pinctrl_lookup_state(host->pinctrl,
1377 PINCTRL_STATE_DEFAULT);
1378
1379 /* enable pins to be muxed in and configured */
1380 if (!IS_ERR(host->pins_default)) {
1381 ret = pinctrl_select_state(host->pinctrl, host->pins_default);
1382 if (ret)
1383 dev_warn(&dev->dev, "could not set default pins\n");
1384 } else
1385 dev_warn(&dev->dev, "could not get default pinstate\n");
1386
1363#ifdef CONFIG_REGULATOR 1387#ifdef CONFIG_REGULATOR
1364 /* If we're using the regulator framework, try to fetch a regulator */ 1388 /* If we're using the regulator framework, try to fetch a regulator */
1365 host->vcc = regulator_get(&dev->dev, "vmmc"); 1389 host->vcc = regulator_get(&dev->dev, "vmmc");
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index d437ccf62d6b..d34d8c0add8e 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -195,6 +195,10 @@ struct mmci_host {
195 unsigned int size; 195 unsigned int size;
196 struct regulator *vcc; 196 struct regulator *vcc;
197 197
198 /* pinctrl handles */
199 struct pinctrl *pinctrl;
200 struct pinctrl_state *pins_default;
201
198#ifdef CONFIG_DMA_ENGINE 202#ifdef CONFIG_DMA_ENGINE
199 /* DMA stuff */ 203 /* DMA stuff */
200 struct dma_chan *dma_current; 204 struct dma_chan *dma_current;