projects/linux·commit 15d8ffc9

Merge tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

15d8ffc9 · Linus Torvalds <[email protected]> · 2017-09-07 12:24:50 -07:00

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Continue to refactor the mmc block code to prepare for blkmq
   - Move mmc block debugfs into block module
   - Next step for eMMC CMDQ by adding a new mmc host interface for it
   - Move Kconfig option MMC_DEBUG from core to host
   - Some additional minor improvements

  MMC host:
   - Declare structs as const when applicable
   - Explicitly request exclusive reset control when applicable
   - Improve some error paths and other various cleanups
   - sdhci: Preparations to support SDHCI OMAP
   - sdhci: Improve some PM related code
   - sdhci: Re-factoring and modernizations
   - sdhci-xenon: Add runtime PM and system sleep support
   - sdhci-xenon: Add support for eMMC HS400 Enhanced Strobe
   - sdhci-cadence: Add system sleep support
   - sdhci-of-at91: Improve system sleep support
   - dw_mmc: Add support for Hisilicon hi3660
   - sunxi: Add support for A83T eMMC
   - sunxi: Add support for DDR52 mode
   - meson-gx: Add support for UHS-I SD-cards
   - meson-gx: Cleanups and improvements
   - tmio: Fix CMD12 (STOP) handling
   - tmio: Cleanups and improvements
   - renesas_sdhi: Add r8a7743/5 support
   - renesas-sdhi: Add support for R-Car Gen3 SDHI DMAC
   - renesas_sdhi: Cleanups and improvements"

* tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (145 commits)
  mmc: renesas_sdhi: Add r8a7743/5 support
  mmc: meson-gx: fix __ffsdi2 undefined on arm32
  mmc: sdhci-xenon: add runtime pm support and reimplement standby
  mmc: core: Move mmc_start_areq() declaration
  mmc: mmci: stop building qcom dml as module
  mmc: sunxi: Reset the device at probe time
  clk: sunxi-ng: Provide a default reset hook
  mmc: meson-gx: rework tuning function
  mmc: meson-gx: change default tx phase
  mmc: meson-gx: implement voltage switch callback
  mmc: meson-gx: use CCF to handle the clock phases
  mmc: meson-gx: implement card_busy callback
  mmc: meson-gx: simplify interrupt handler
  mmc: meson-gx: work around clk-stop issue
  mmc: meson-gx: fix dual data rate mode frequencies
  mmc: meson-gx: rework clock init function
  mmc: meson-gx: rework clk_set function
  mmc: meson-gx: rework set_ios function
  mmc: meson-gx: cfg init overwrite values
  mmc: meson-gx: initialize sane clk default before clock register
  ...
Commit
15d8ffc96464f6571ecf22043c45fad659f11bdd
Parents
a0725ab0 · c16a854e

Merge commit. Changes below are compared with the first parent: a0725ab0.

Changes

91 files changed · +2559 −997

FileStatusAddDelContent
Documentation/devicetree/bindings/mmc/renesas,mmcif.txtmodified+3−1View file
Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txtmodified+1−0View file
Documentation/devicetree/bindings/mmc/sunxi-mmc.txtmodified+1−0View file
Documentation/devicetree/bindings/mmc/tmio_mmc.txtmodified+4−4View file
arch/arc/boot/dts/axs10x_mb.dtsimodified+0−1View file
arch/arc/boot/dts/vdk_axs10x_mb.dtsimodified+0−1View file
drivers/clk/sunxi-ng/Makefilemodified+1−0View file
drivers/clk/sunxi-ng/ccu-sun8i-a83t.cmodified+2−8View file
drivers/clk/sunxi-ng/ccu_common.hmodified+4−0View file
drivers/clk/sunxi-ng/ccu_mmc_timing.cadded+70−0View file
drivers/clk/sunxi-ng/ccu_mp.cmodified+80−0View file
drivers/clk/sunxi-ng/ccu_mp.hmodified+30−0View file
drivers/clk/sunxi-ng/ccu_reset.cmodified+12−0View file
drivers/mmc/Kconfigmodified+0−7View file
drivers/mmc/Makefilemodified+0−2View file
drivers/mmc/core/block.cmodified+212−59View file
drivers/mmc/core/core.cmodified+28−40View file
drivers/mmc/core/core.hmodified+6−0View file
drivers/mmc/core/debugfs.cmodified+0−89View file
drivers/mmc/core/host.cmodified+6−0View file
drivers/mmc/core/host.hmodified+1−0View file
drivers/mmc/core/mmc.cmodified+4−27View file
drivers/mmc/core/mmc_ops.cmodified+2−1View file
drivers/mmc/core/mmc_test.cmodified+41−56View file
drivers/mmc/core/queue.hmodified+5−1View file
drivers/mmc/core/sd.cmodified+6−6View file
drivers/mmc/host/Kconfigmodified+31−3View file
drivers/mmc/host/Makefilemodified+10−3View file
drivers/mmc/host/android-goldfish.cmodified+2−6View file
drivers/mmc/host/atmel-mci.cmodified+5−5View file
drivers/mmc/host/bcm2835.cmodified+1−1View file
drivers/mmc/host/cavium-octeon.cmodified+1−12View file
drivers/mmc/host/cavium.cmodified+2−4View file
drivers/mmc/host/davinci_mmc.cmodified+1−1View file
drivers/mmc/host/dw_mmc-k3.cmodified+298−0View file
drivers/mmc/host/dw_mmc.cmodified+55−7View file
drivers/mmc/host/dw_mmc.hmodified+4−0View file
drivers/mmc/host/meson-gx-mmc.cmodified+494−220View file
drivers/mmc/host/mmci.cmodified+1−1View file
drivers/mmc/host/moxart-mmc.cmodified+1−1View file
drivers/mmc/host/mtk-sd.cmodified+2−1View file
drivers/mmc/host/mxcmmc.cmodified+26−8View file
drivers/mmc/host/of_mmc_spi.cmodified+1−1View file
drivers/mmc/host/omap_hsmmc.cmodified+4−4View file
drivers/mmc/host/renesas_sdhi.hmodified+2−0View file
drivers/mmc/host/renesas_sdhi_core.cmodified+23−8View file
drivers/mmc/host/renesas_sdhi_internal_dmac.cadded+287−0View file
drivers/mmc/host/renesas_sdhi_sys_dmac.cmodified+30−4View file
drivers/mmc/host/rtsx_usb_sdmmc.cmodified+1−1View file
drivers/mmc/host/s3cmci.cmodified+1−1View file
drivers/mmc/host/sdhci-acpi.cmodified+2−5View file
drivers/mmc/host/sdhci-bcm-kona.cmodified+2−2View file
drivers/mmc/host/sdhci-brcmstb.cmodified+2−37View file
drivers/mmc/host/sdhci-cadence.cmodified+79−9View file
drivers/mmc/host/sdhci-esdhc.hmodified+3−0View file
drivers/mmc/host/sdhci-msm.cmodified+3−2View file
drivers/mmc/host/sdhci-of-arasan.cmodified+4−4View file
drivers/mmc/host/sdhci-of-at91.cmodified+111−66View file
drivers/mmc/host/sdhci-of-esdhc.cmodified+21−2View file
drivers/mmc/host/sdhci-pci-core.cmodified+23−27View file
drivers/mmc/host/sdhci-pic32.cmodified+1−1View file
drivers/mmc/host/sdhci-pltfm.cmodified+24−4View file
drivers/mmc/host/sdhci-pltfm.hmodified+2−0View file
drivers/mmc/host/sdhci-pxav2.cmodified+7−23View file
drivers/mmc/host/sdhci-pxav3.cmodified+1−1View file
drivers/mmc/host/sdhci-s3c.cmodified+1−33View file
drivers/mmc/host/sdhci-sirf.cmodified+3−40View file
drivers/mmc/host/sdhci-st.cmodified+23−5View file
drivers/mmc/host/sdhci-tegra.cmodified+4−22View file
drivers/mmc/host/sdhci-xenon-phy.cmodified+28−6View file
drivers/mmc/host/sdhci-xenon.cmodified+98−4View file
drivers/mmc/host/sdhci-xenon.hmodified+2−0View file
drivers/mmc/host/sdhci.cmodified+54−40View file
drivers/mmc/host/sdhci.hmodified+5−0View file
drivers/mmc/host/sdricoh_cs.cmodified+1−1View file
drivers/mmc/host/sh_mmcif.cmodified+1−1View file
drivers/mmc/host/sunxi-mmc.cmodified+80−15View file
drivers/mmc/host/tmio_mmc.hmodified+7−2View file
drivers/mmc/host/tmio_mmc_core.cmodified+19−13View file
drivers/mmc/host/toshsd.cmodified+1−1View file
drivers/mmc/host/usdhi6rol0.cmodified+1−1View file
drivers/mmc/host/via-sdmmc.cmodified+1−1View file
drivers/mmc/host/vub300.cmodified+2−2View file
drivers/mmc/host/wbsd.cmodified+0−2View file
drivers/mmc/host/wmt-sdmmc.cmodified+6−2View file
include/linux/clk/sunxi-ng.hadded+35−0View file
include/linux/mfd/tmio.hmodified+5−0View file
include/linux/mmc/card.hmodified+2−2View file
include/linux/mmc/core.hmodified+17−6View file
include/linux/mmc/host.hmodified+53−7View file
include/trace/events/mmc.hmodified+23−13View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/devicetree/bindings/mmc/renesas,mmcif.txt

View file
diff --git a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
index c32dc5a..5ff1e12 100644
--- a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
+++ b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
@@ -11,6 +11,8 @@ Required properties:
- "renesas,mmcif-r7s72100" for the MMCIF found in r7s72100 SoCs
- "renesas,mmcif-r8a73a4" for the MMCIF found in r8a73a4 SoCs
- "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs
+ - "renesas,mmcif-r8a7743" for the MMCIF found in r8a7743 SoCs
+ - "renesas,mmcif-r8a7745" for the MMCIF found in r8a7745 SoCs
- "renesas,mmcif-r8a7778" for the MMCIF found in r8a7778 SoCs
- "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs
- "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs
@@ -21,7 +23,7 @@ Required properties:
- interrupts: Some SoCs have only 1 shared interrupt, while others have either
2 or 3 individual interrupts (error, int, card detect). Below is the number
of interrupts for each SoC:
- 1: r8a73a4, r8a7778, r8a7790, r8a7791, r8a7793, r8a7794
+ 1: r8a73a4, r8a7743, r8a7745, r8a7778, r8a7790, r8a7791, r8a7793, r8a7794
2: r8a7740, sh73a0
3: r7s72100

Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt

View file
diff --git a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
index 49ed3ad..c655878 100644
--- a/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
@@ -15,6 +15,7 @@ Required Properties:
- "rockchip,rk3288-dw-mshc": for Rockchip RK3288
- "rockchip,rv1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RV1108
- "rockchip,rk3036-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3036
+ - "rockchip,rk3228-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK322x
- "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3328
- "rockchip,rk3368-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3368
- "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3399

Documentation/devicetree/bindings/mmc/sunxi-mmc.txt

View file
diff --git a/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
index 7d53a79..63b57e2 100644
--- a/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
@@ -12,6 +12,7 @@ Required properties:
* "allwinner,sun4i-a10-mmc"
* "allwinner,sun5i-a13-mmc"
* "allwinner,sun7i-a20-mmc"
+ * "allwinner,sun8i-a83t-emmc"
* "allwinner,sun9i-a80-mmc"
* "allwinner,sun50i-a64-emmc"
* "allwinner,sun50i-a64-mmc"

Documentation/devicetree/bindings/mmc/tmio_mmc.txt

View file
diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
index 4fd8b7a..54ef642 100644
--- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
@@ -15,6 +15,8 @@ Required properties:
"renesas,sdhi-r7s72100" - SDHI IP on R7S72100 SoC
"renesas,sdhi-r8a73a4" - SDHI IP on R8A73A4 SoC
"renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
+ "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
+ "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
"renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
"renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
"renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
@@ -33,10 +35,8 @@ Required properties:
If 2 clocks are specified by the hardware, you must name them as
"core" and "cd". If the controller only has 1 clock, naming is not
required.
- Below is the number clocks for each supported SoC:
- 1: SH73A0, R8A73A4, R8A7740, R8A7778, R8A7779, R8A7790
- R8A7791, R8A7792, R8A7793, R8A7794, R8A7795, R8A7796
- 2: R7S72100
+ Devices which have more than 1 clock are listed below:
+ 2: R7S72100
Optional properties:
- toshiba,mmc-wrprotect-disable: write-protect detection is unavailable

arch/arc/boot/dts/axs10x_mb.dtsi

View file
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 0ff7e07..2367a67 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -101,7 +101,6 @@
mmc@0x15000 {
compatible = "altr,socfpga-dw-mshc";
reg = < 0x15000 0x400 >;
- num-slots = < 1 >;
fifo-depth = < 16 >;
card-detect-delay = < 200 >;
clocks = <&apbclk>, <&mmcclk>;

arch/arc/boot/dts/vdk_axs10x_mb.dtsi

View file
diff --git a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
index 459fc65..48bb4b4 100644
--- a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
@@ -104,7 +104,6 @@
mmc@0x15000 {
compatible = "snps,dw-mshc";
reg = <0x15000 0x400>;
- num-slots = <1>;
fifo-depth = <1024>;
card-detect-delay = <200>;
clocks = <&apbclk>, <&mmcclk>;

drivers/clk/sunxi-ng/Makefile

View file
diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
index 0c45fa5..45a5910 100644
--- a/drivers/clk/sunxi-ng/Makefile
+++ b/drivers/clk/sunxi-ng/Makefile
@@ -1,5 +1,6 @@
# Common objects
lib-$(CONFIG_SUNXI_CCU) += ccu_common.o
+lib-$(CONFIG_SUNXI_CCU) += ccu_mmc_timing.o
lib-$(CONFIG_SUNXI_CCU) += ccu_reset.o
# Base clock types

drivers/clk/sunxi-ng/ccu-sun8i-a83t.c

View file
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
index 947f9f6..e43aceb 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
@@ -418,14 +418,8 @@ static SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1-sample", "mmc1",
static SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1-output", "mmc1",
0x08c, 8, 3, 0);
-/* TODO Support MMC2 clock's new timing mode. */
-static SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents,
- 0x090,
- 0, 4, /* M */
- 16, 2, /* P */
- 24, 2, /* mux */
- BIT(31), /* gate */
- 0);
+static SUNXI_CCU_MP_MMC_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents,
+ 0x090, 0);
static SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2-sample", "mmc2",
0x090, 20, 3, 0);

drivers/clk/sunxi-ng/ccu_common.h

View file
diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h
index d6fdd7a..cadd1a9 100644
--- a/drivers/clk/sunxi-ng/ccu_common.h
+++ b/drivers/clk/sunxi-ng/ccu_common.h
@@ -23,6 +23,10 @@
#define CCU_FEATURE_FIXED_POSTDIV BIT(3)
#define CCU_FEATURE_ALL_PREDIV BIT(4)
#define CCU_FEATURE_LOCK_REG BIT(5)
+#define CCU_FEATURE_MMC_TIMING_SWITCH BIT(6)
+
+/* MMC timing mode switch bit */
+#define CCU_MMC_NEW_TIMING_MODE BIT(30)
struct device_node;

drivers/clk/sunxi-ng/ccu_mmc_timing.c

View file
diff --git a/drivers/clk/sunxi-ng/ccu_mmc_timing.c b/drivers/clk/sunxi-ng/ccu_mmc_timing.c
new file mode 100644
index 0000000..f9869f7
--- /dev/null
+++ b/drivers/clk/sunxi-ng/ccu_mmc_timing.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 Chen-Yu Tsai. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clk/sunxi-ng.h>
+
+#include "ccu_common.h"
+
+/**
+ * sunxi_ccu_set_mmc_timing_mode: Configure the MMC clock timing mode
+ * @clk: clock to be configured
+ * @new_mode: true for new timing mode introduced in A83T and later
+ *
+ * Returns 0 on success, -ENOTSUPP if the clock does not support
+ * switching modes.
+ */
+int sunxi_ccu_set_mmc_timing_mode(struct clk *clk, bool new_mode)
+{
+ struct clk_hw *hw = __clk_get_hw(clk);
+ struct ccu_common *cm = hw_to_ccu_common(hw);
+ unsigned long flags;
+ u32 val;
+
+ if (!(cm->features & CCU_FEATURE_MMC_TIMING_SWITCH))
+ return -ENOTSUPP;
+
+ spin_lock_irqsave(cm->lock, flags);
+
+ val = readl(cm->base + cm->reg);
+ if (new_mode)
+ val |= CCU_MMC_NEW_TIMING_MODE;
+ else
+ val &= ~CCU_MMC_NEW_TIMING_MODE;
+ writel(val, cm->base + cm->reg);
+
+ spin_unlock_irqrestore(cm->lock, flags);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(sunxi_ccu_set_mmc_timing_mode);
+
+/**
+ * sunxi_ccu_set_mmc_timing_mode: Get the current MMC clock timing mode
+ * @clk: clock to query
+ *
+ * Returns 0 if the clock is in old timing mode, > 0 if it is in
+ * new timing mode, and -ENOTSUPP if the clock does not support
+ * this function.
+ */
+int sunxi_ccu_get_mmc_timing_mode(struct clk *clk)
+{
+ struct clk_hw *hw = __clk_get_hw(clk);
+ struct ccu_common *cm = hw_to_ccu_common(hw);
+
+ if (!(cm->features & CCU_FEATURE_MMC_TIMING_SWITCH))
+ return -ENOTSUPP;
+
+ return !!(readl(cm->base + cm->reg) & CCU_MMC_NEW_TIMING_MODE);
+}
+EXPORT_SYMBOL_GPL(sunxi_ccu_get_mmc_timing_mode);

drivers/clk/sunxi-ng/ccu_mp.c

View file
diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
index b917ad7..688855e 100644
--- a/drivers/clk/sunxi-ng/ccu_mp.c
+++ b/drivers/clk/sunxi-ng/ccu_mp.c
@@ -172,3 +172,83 @@ const struct clk_ops ccu_mp_ops = {
.recalc_rate = ccu_mp_recalc_rate,
.set_rate = ccu_mp_set_rate,
};
+
+/*
+ * Support for MMC timing mode switching
+ *
+ * The MMC clocks on some SoCs support switching between old and
+ * new timing modes. A platform specific API is provided to query
+ * and set the timing mode on supported SoCs.
+ *
+ * In addition, a special class of ccu_mp_ops is provided, which
+ * takes in to account the timing mode switch. When the new timing
+ * mode is active, the clock output rate is halved. This new class
+ * is a wrapper around the generic ccu_mp_ops. When clock rates
+ * are passed through to ccu_mp_ops callbacks, they are doubled
+ * if the new timing mode bit is set, to account for the post
+ * divider. Conversely, when clock rates are passed back, they
+ * are halved if the mode bit is set.
+ */
+
+static unsigned long ccu_mp_mmc_recalc_rate(struct clk_hw *hw,
+ unsigned long parent_rate)
+{
+ unsigned long rate = ccu_mp_recalc_rate(hw, parent_rate);
+ struct ccu_common *cm = hw_to_ccu_common(hw);
+ u32 val = readl(cm->base + cm->reg);
+
+ if (val & CCU_MMC_NEW_TIMING_MODE)
+ return rate / 2;
+ return rate;
+}
+
+static int ccu_mp_mmc_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
+{
+ struct ccu_common *cm = hw_to_ccu_common(hw);
+ u32 val = readl(cm->base + cm->reg);
+ int ret;
+
+ /* adjust the requested clock rate */
+ if (val & CCU_MMC_NEW_TIMING_MODE) {
+ req->rate *= 2;
+ req->min_rate *= 2;
+ req->max_rate *= 2;
+ }
+
+ ret = ccu_mp_determine_rate(hw, req);
+
+ /* re-adjust the requested clock rate back */
+ if (val & CCU_MMC_NEW_TIMING_MODE) {
+ req->rate /= 2;
+ req->min_rate /= 2;
+ req->max_rate /= 2;
+ }
+
+ return ret;
+}
+
+static int ccu_mp_mmc_set_rate(struct clk_hw *hw, unsigned long rate,
+ unsigned long parent_rate)
+{
+ struct ccu_common *cm = hw_to_ccu_common(hw);
+ u32 val = readl(cm->base + cm->reg);
+
+ if (val & CCU_MMC_NEW_TIMING_MODE)
+ rate *= 2;
+
+ return ccu_mp_set_rate(hw, rate, parent_rate);
+}
+
+const struct clk_ops ccu_mp_mmc_ops = {
+ .disable = ccu_mp_disable,
+ .enable = ccu_mp_enable,
+ .is_enabled = ccu_mp_is_enabled,
+
+ .get_parent = ccu_mp_get_parent,
+ .set_parent = ccu_mp_set_parent,
+
+ .determine_rate = ccu_mp_mmc_determine_rate,
+ .recalc_rate = ccu_mp_mmc_recalc_rate,
+ .set_rate = ccu_mp_mmc_set_rate,
+};

drivers/clk/sunxi-ng/ccu_mp.h

View file
diff --git a/drivers/clk/sunxi-ng/ccu_mp.h b/drivers/clk/sunxi-ng/ccu_mp.h
index 915625e..aaef11d 100644
--- a/drivers/clk/sunxi-ng/ccu_mp.h
+++ b/drivers/clk/sunxi-ng/ccu_mp.h
@@ -14,6 +14,7 @@
#ifndef _CCU_MP_H_
#define _CCU_MP_H_
+#include <linux/bitops.h>
#include <linux/clk-provider.h>
#include "ccu_common.h"
@@ -74,4 +75,33 @@ static inline struct ccu_mp *hw_to_ccu_mp(struct clk_hw *hw)
extern const struct clk_ops ccu_mp_ops;
+/*
+ * Special class of M-P clock that supports MMC timing modes
+ *
+ * Since the MMC clock registers all follow the same layout, we can
+ * simplify the macro for this particular case. In addition, as
+ * switching modes also affects the output clock rate, we need to
+ * have CLK_GET_RATE_NOCACHE for all these types of clocks.
+ */
+
+#define SUNXI_CCU_MP_MMC_WITH_MUX_GATE(_struct, _name, _parents, _reg, \
+ _flags) \
+ struct ccu_mp _struct = { \
+ .enable = BIT(31), \
+ .m = _SUNXI_CCU_DIV(0, 4), \
+ .p = _SUNXI_CCU_DIV(16, 2), \
+ .mux = _SUNXI_CCU_MUX(24, 2), \
+ .common = { \
+ .reg = _reg, \
+ .features = CCU_FEATURE_MMC_TIMING_SWITCH, \
+ .hw.init = CLK_HW_INIT_PARENTS(_name, \
+ _parents, \
+ &ccu_mp_mmc_ops, \
+ CLK_GET_RATE_NOCACHE | \
+ _flags), \
+ } \
+ }
+
+extern const struct clk_ops ccu_mp_mmc_ops;
+
#endif /* _CCU_MP_H_ */

drivers/clk/sunxi-ng/ccu_reset.c

View file
diff --git a/drivers/clk/sunxi-ng/ccu_reset.c b/drivers/clk/sunxi-ng/ccu_reset.c
index 6c31d48..1dc4e98 100644
--- a/drivers/clk/sunxi-ng/ccu_reset.c
+++ b/drivers/clk/sunxi-ng/ccu_reset.c
@@ -8,6 +8,7 @@
* the License, or (at your option) any later version.
*/
+#include <linux/delay.h>
#include <linux/io.h>
#include <linux/reset-controller.h>
@@ -49,7 +50,18 @@ static int ccu_reset_deassert(struct reset_controller_dev *rcdev,
return 0;
}
+static int ccu_reset_reset(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ ccu_reset_assert(rcdev, id);
+ udelay(10);
+ ccu_reset_deassert(rcdev, id);
+
+ return 0;
+}
+
const struct reset_control_ops ccu_reset_ops = {
.assert = ccu_reset_assert,
.deassert = ccu_reset_deassert,
+ .reset = ccu_reset_reset,
};

drivers/mmc/Kconfig

View file
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 7e803fc..ec21388 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -12,13 +12,6 @@ menuconfig MMC
If you want MMC/SD/SDIO support, you should say Y here and
also to your specific host controller driver.
-config MMC_DEBUG
- bool "MMC debugging"
- depends on MMC != n
- help
- This is an option for use by developers; most people should
- say N here. This enables MMC core and driver debugging.
-
if MMC
source "drivers/mmc/core/Kconfig"

drivers/mmc/Makefile

View file
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 416b6d1..26ab7af 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -2,7 +2,5 @@
# Makefile for the kernel mmc device drivers.
#
-subdir-ccflags-$(CONFIG_MMC_DEBUG) := -DDEBUG
-
obj-$(CONFIG_MMC) += core/
obj-$(subst m,y,$(CONFIG_MMC)) += host/

drivers/mmc/core/block.c

View file
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 8bd7aba..29fc1e6 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -36,6 +36,7 @@
#include <linux/compat.h>
#include <linux/pm_runtime.h>
#include <linux/idr.h>
+#include <linux/debugfs.h>
#include <linux/mmc/ioctl.h>
#include <linux/mmc/card.h>
@@ -126,7 +127,7 @@ module_param(perdev_minors, int, 0444);
MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device");
static inline int mmc_blk_part_switch(struct mmc_card *card,
- struct mmc_blk_data *md);
+ unsigned int part_type);
static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
{
@@ -188,7 +189,6 @@ static ssize_t power_ro_lock_store(struct device *dev,
{
int ret;
struct mmc_blk_data *md, *part_md;
- struct mmc_card *card;
struct mmc_queue *mq;
struct request *req;
unsigned long set;
@@ -201,7 +201,6 @@ static ssize_t power_ro_lock_store(struct device *dev,
md = mmc_blk_get(dev_to_disk(dev));
mq = &md->queue;
- card = md->queue.card;
/* Dispatch locking to the block layer */
req = blk_get_request(mq->queue, REQ_OP_DRV_OUT, __GFP_RECLAIM);
@@ -489,7 +488,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
mrq.cmd = &cmd;
- err = mmc_blk_part_switch(card, md);
+ err = mmc_blk_part_switch(card, md->part_type);
if (err)
return err;
@@ -554,35 +553,20 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
return err;
}
-static int mmc_blk_ioctl_cmd(struct block_device *bdev,
+static int mmc_blk_ioctl_cmd(struct mmc_blk_data *md,
struct mmc_ioc_cmd __user *ic_ptr)
{
struct mmc_blk_ioc_data *idata;
struct mmc_blk_ioc_data *idatas[1];
- struct mmc_blk_data *md;
struct mmc_queue *mq;
struct mmc_card *card;
int err = 0, ioc_err = 0;
struct request *req;
- /*
- * The caller must have CAP_SYS_RAWIO, and must be calling this on the
- * whole block device, not on a partition. This prevents overspray
- * between sibling partitions.
- */
- if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
- return -EPERM;
-
idata = mmc_blk_ioctl_copy_from_user(ic_ptr);
if (IS_ERR(idata))
return PTR_ERR(idata);
- md = mmc_blk_get(bdev->bd_disk);
- if (!md) {
- err = -EINVAL;
- goto cmd_err;
- }
-
card = md->queue.card;
if (IS_ERR(card)) {
err = PTR_ERR(card);
@@ -598,7 +582,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
__GFP_RECLAIM);
idatas[0] = idata;
req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_IOCTL;
- req_to_mmc_queue_req(req)->idata = idatas;
+ req_to_mmc_queue_req(req)->drv_op_data = idatas;
req_to_mmc_queue_req(req)->ioc_count = 1;
blk_execute_rq(mq->queue, NULL, req, 0);
ioc_err = req_to_mmc_queue_req(req)->drv_op_result;
@@ -606,33 +590,22 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
blk_put_request(req);
cmd_done:
- mmc_blk_put(md);
-cmd_err:
kfree(idata->buf);
kfree(idata);
return ioc_err ? ioc_err : err;
}
-static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev,
+static int mmc_blk_ioctl_multi_cmd(struct mmc_blk_data *md,
struct mmc_ioc_multi_cmd __user *user)
{
struct mmc_blk_ioc_data **idata = NULL;
struct mmc_ioc_cmd __user *cmds = user->cmds;
struct mmc_card *card;
- struct mmc_blk_data *md;
struct mmc_queue *mq;
int i, err = 0, ioc_err = 0;
__u64 num_of_cmds;
struct request *req;
- /*
- * The caller must have CAP_SYS_RAWIO, and must be calling this on the
- * whole block device, not on a partition. This prevents overspray
- * between sibling partitions.
- */
- if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
- return -EPERM;
-
if (copy_from_user(&num_of_cmds, &user->num_of_cmds,
sizeof(num_of_cmds)))
return -EFAULT;
@@ -656,16 +629,10 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev,
}
}
- md = mmc_blk_get(bdev->bd_disk);
- if (!md) {
- err = -EINVAL;
- goto cmd_err;
- }
-
card = md->queue.card;
if (IS_ERR(card)) {
err = PTR_ERR(card);
- goto cmd_done;
+ goto cmd_err;
}
@@ -677,7 +644,7 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev,
idata[0]->ic.write_flag ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN,
__GFP_RECLAIM);
req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_IOCTL;
- req_to_mmc_queue_req(req)->idata = idata;
+ req_to_mmc_queue_req(req)->drv_op_data = idata;
req_to_mmc_queue_req(req)->ioc_count = num_of_cmds;
blk_execute_rq(mq->queue, NULL, req, 0);
ioc_err = req_to_mmc_queue_req(req)->drv_op_result;
@@ -688,8 +655,6 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev,
blk_put_request(req);
-cmd_done:
- mmc_blk_put(md);
cmd_err:
for (i = 0; i < num_of_cmds; i++) {
kfree(idata[i]->buf);
@@ -699,16 +664,47 @@ cmd_err:
return ioc_err ? ioc_err : err;
}
+static int mmc_blk_check_blkdev(struct block_device *bdev)
+{
+ /*
+ * The caller must have CAP_SYS_RAWIO, and must be calling this on the
+ * whole block device, not on a partition. This prevents overspray
+ * between sibling partitions.
+ */
+ if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
+ return -EPERM;
+ return 0;
+}
+
static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
+ struct mmc_blk_data *md;
+ int ret;
+
switch (cmd) {

This diff is incomplete. Download the complete patch.

drivers/mmc/core/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/core.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/debugfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/host.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/host.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc_ops.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc_test.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/queue.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/android-goldfish.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/atmel-mci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/bcm2835.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/cavium-octeon.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/cavium.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/davinci_mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/dw_mmc-k3.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/dw_mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/dw_mmc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/meson-gx-mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mmci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/moxart-mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mtk-sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mxcmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/of_mmc_spi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/omap_hsmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/renesas_sdhi.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/renesas_sdhi_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/renesas_sdhi_internal_dmac.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/renesas_sdhi_sys_dmac.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/rtsx_usb_sdmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/s3cmci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-acpi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-bcm-kona.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-brcmstb.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-cadence.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-esdhc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-msm.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-of-arasan.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-of-at91.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-of-esdhc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pci-core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pic32.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pltfm.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pltfm.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pxav2.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pxav3.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-s3c.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-sirf.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-st.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-tegra.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-xenon-phy.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-xenon.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-xenon.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdricoh_cs.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sh_mmcif.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sunxi-mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tmio_mmc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tmio_mmc_core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/toshsd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/usdhi6rol0.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/via-sdmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/vub300.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/wbsd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/wmt-sdmmc.c

View file

This diff is incomplete. Download the complete patch.

include/linux/clk/sunxi-ng.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mfd/tmio.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/card.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/core.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/host.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/mmc.h

View file

This diff is incomplete. Download the complete patch.