History

Merge tag 'mmc-v3.17-1' of git://git.linaro.org/people/ulf.hansson/mmc

Pull MMC updates from Ulf Hansson: "Me and Chris Ball decided to try out using my MMC tree as the primary one, to simplify handling of patches. This pull does thus contains all the MMC patches for 3.17 rc1, no pull from Chris this time. Details: MMC core: - forward compatibility for eMMC - fix some blacklisted cards with broken secure discard MMC host: - mmci: Add support for Qualcomm variant - mmci: Fix regression for arm_variant - sdhci: Various fixes and cleanups - sdhci: Improve external VDD regulator support - sdhci: Support for DDR50 1.8V mode for BayTrail - sdhci-st: Add driver for ST SDHCI controller - sh-mmcif: DMA fixes - omap_hsmmc: Add support for SDIO interrupts - sdhci-pci: Add support for Intel Quark X1000 - dw_mmc: Update the reset sequence - s3cmci: port DMA code to dmaengine API" * tag 'mmc-v3.17-1' of git://git.linaro.org/people/ulf.hansson/mmc: (67 commits) mmc: dw_mmc: modify the dt-binding for removing slot-node and supports-highspeed mmc: dw_mmc: Slot quirk "disable-wp" is deprecated. mmc: mmci: Reverse IRQ handling for the arm_variant mmc: mmci: Move all CMD irq handling to mmci_cmd_irq() mmc: mmci: Remove redundant check of status for DATA irq mmc: dw_mmc: change to use recommended reset procedure mmc: sdhci-pxav3: Use devm_* managed helpers mmc: tmio: Configure DMA slave bus width mmc: sh_mmcif: Configure DMA slave bus width mmc: sh_mmcif: Fix DMA slave address configuration mmc: sh_mmcif: Document DT bindings mmc: sdhci-pci: remove PCI PM functions in suspend/resume callback mmc: Do not advertise secure discard if it is blacklisted mmc: sdhci-msm: Get COMPILE_TEST support mmc: sdhci-msm: Remove unnecessary header file inclusion mmc: sdhci-msm: Fix the binding example mmc: sdhci: add DDR50 1.8V mode support for BayTrail eMMC Controller mmc: sdhci: Preset value not supported in Baytrail eMMC mmc: MMC_USDHI6ROL0 should depend on HAS_DMA mmc: MMC_SH_MMCIF should depend on HAS_DMA ...

Linus Torvalds committed 12 years ago

Commit a8e4def2 parents d429a36 c83c87340 files · +1050 −471Browse files

Unified · Split

40 files
  1. Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt +5 −12
  2. Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt +5 −7
  3. Documentation/devicetree/bindings/mmc/mmc.txt +2 −2
  4. Documentation/devicetree/bindings/mmc/renesas,mmcif.txt +32 −0
  5. Documentation/devicetree/bindings/mmc/sdhci-msm.txt +4 −4
  6. Documentation/devicetree/bindings/mmc/sdhci-st.txt +33 −0
  7. Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt +5 −7
  8. Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +54 −0
  9. Documentation/devicetree/bindings/mmc/tmio_mmc.txt +1 −0
  10. drivers/mmc/card/block.c +3 −3
  11. drivers/mmc/core/bus.c +1 −9
  12. drivers/mmc/core/core.c +2 −1
  13. drivers/mmc/core/mmc.c +5 −6
  14. drivers/mmc/core/quirks.c +1 −1
  15. drivers/mmc/core/sd_ops.c +3 −0
  16. drivers/mmc/host/Kconfig +17 −11
  17. drivers/mmc/host/Makefile +1 −0
  18. drivers/mmc/host/dw_mmc.c +73 −25
  19. drivers/mmc/host/dw_mmc.h +5 −0
  20. drivers/mmc/host/mmci.c +140 −28
  21. drivers/mmc/host/mmci.h +20 −0
  22. drivers/mmc/host/moxart-mmc.c +0 −1
  23. drivers/mmc/host/mxs-mmc.c +2 −1
  24. drivers/mmc/host/omap_hsmmc.c +262 −21
  25. drivers/mmc/host/s3cmci.c +53 −133
  26. drivers/mmc/host/s3cmci.h +1 −3
  27. drivers/mmc/host/sdhci-acpi.c +3 −1
  28. drivers/mmc/host/sdhci-msm.c +0 −1
  29. drivers/mmc/host/sdhci-pci.c +20 −18
  30. drivers/mmc/host/sdhci-pci.h +1 −0
  31. drivers/mmc/host/sdhci-pxav3.c +3 −10
  32. drivers/mmc/host/sdhci-st.c +176 −0
  33. drivers/mmc/host/sdhci-tegra.c +0 −2
  34. drivers/mmc/host/sdhci.c +58 −86
  35. drivers/mmc/host/sh_mmcif.c +38 −58
  36. drivers/mmc/host/tmio_mmc_dma.c +2 −0
  37. drivers/mmc/host/wmt-sdmmc.c +16 −17
  38. include/linux/mmc/dw_mmc.h +2 −0
  39. include/linux/mmc/sdhci.h +0 −3
  40. include/linux/platform_data/mmc-omap.h +1 −0
Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt+5−12
@@ -46,13 +46,14 @@ Required Properties: · 45 unmodified lines
4646 - if CIU clock divider value is 0 (that is divide by 1), both tx and rx
4747 phase shift clocks should be 0.
4848
49−Required properties for a slot:
49+Required properties for a slot (Deprecated - Recommend to use one slot per host):
5050
5151 * gpios: specifies a list of gpios used for command, clock and data bus. The
5252 first gpio is the command line and the second gpio is the clock line. The
5353 rest of the gpios (depending on the bus-width property) are the data lines in
5454 no particular order. The format of the gpio specifier depends on the gpio
5555 controller.
56+(Deprecated - Refer to Documentation/devicetree/binding/pinctrl/samsung-pinctrl.txt)
5657
5758 Example:
5859
@@ -69,21 +70,13 @@ Example: · 10 unmodified lines
6970
7071 dwmmc0@12200000 {
7172 num-slots = <1>;
72− supports-highspeed;
73+ cap-mmc-highspeed;
74+ cap-sd-highspeed;
7375 broken-cd;
7476 fifo-depth = <0x80>;
7577 card-detect-delay = <200>;
7678 samsung,dw-mshc-ciu-div = <3>;
7779 samsung,dw-mshc-sdr-timing = <2 3>;
7880 samsung,dw-mshc-ddr-timing = <1 2>;
79−
80− slot@0 {
81− reg = <0>;
82− bus-width = <8>;
83− gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>,
84− <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>,
85− <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>,
86− <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>,
87− <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>;
88− };
81+ bus-width = <8>;
8982 };
Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt+5−7
@@ -34,13 +34,11 @@ Example: · 33 unmodified lines
3434 num-slots = <1>;
3535 vmmc-supply = <&ldo12>;
3636 fifo-depth = <0x100>;
37− supports-highspeed;
3837 pinctrl-names = "default";
3938 pinctrl-0 = <&sd_pmx_pins &sd_cfg_func1 &sd_cfg_func2>;
40− slot@0 {
41− reg = <0>;
42− bus-width = <4>;
43− disable-wp;
44− cd-gpios = <&gpio10 3 0>;
45− };
39+ bus-width = <4>;
40+ disable-wp;
41+ cd-gpios = <&gpio10 3 0>;
42+ cap-mmc-highspeed;
43+ cap-sd-highspeed;
4644 };
Documentation/devicetree/bindings/mmc/mmc.txt+2−2
@@ -34,8 +34,8 @@ Optional properties: · 33 unmodified lines
3434 - cap-power-off-card: powering off the card is safe
3535 - cap-sdio-irq: enable SDIO IRQ signalling on this interface
3636 - full-pwr-cycle: full power cycle of the card is supported
37−- mmc-highspeed-ddr-1_8v: eMMC high-speed DDR mode(1.8V I/O) is supported
38−- mmc-highspeed-ddr-1_2v: eMMC high-speed DDR mode(1.2V I/O) is supported
37+- mmc-ddr-1_8v: eMMC high-speed DDR mode(1.8V I/O) is supported
38+- mmc-ddr-1_2v: eMMC high-speed DDR mode(1.2V I/O) is supported
3939 - mmc-hs200-1_8v: eMMC HS200 mode(1.8V I/O) is supported
4040 - mmc-hs200-1_2v: eMMC HS200 mode(1.2V I/O) is supported
4141 - mmc-hs400-1_8v: eMMC HS400 mode(1.8V I/O) is supported
Documentation/devicetree/bindings/mmc/renesas,mmcif.txt+32−0
@@ -0,0 +1,32 @@
1+* Renesas Multi Media Card Interface (MMCIF) Controller
2+
3+This file documents differences between the core properties in mmc.txt
4+and the properties used by the MMCIF device.
5+
6+
7+Required properties:
8+
9+- compatible: must contain one of the following
10+ - "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs
11+ - "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs
12+ - "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs
13+ - "renesas,sh-mmcif" for the generic MMCIF
14+
15+- clocks: reference to the functional clock
16+
17+- dmas: reference to the DMA channels, one per channel name listed in the
18+ dma-names property.
19+- dma-names: must contain "tx" for the transmit DMA channel and "rx" for the
20+ receive DMA channel.
21+
22+
23+Example: R8A7790 (R-Car H2) MMCIF0
24+
25+ mmcif0: mmc@ee200000 {
26+ compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
27+ reg = <0 0xee200000 0 0x80>;
28+ interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
29+ clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
30+ dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
31+ dma-names = "tx", "rx";
32+ };
Documentation/devicetree/bindings/mmc/sdhci-msm.txt+4−4
@@ -27,8 +27,8 @@ Example: · 26 unmodified lines
2727 bus-width = <8>;
2828 non-removable;
2929
30− vmmc = <&pm8941_l20>;
31− vqmmc = <&pm8941_s3>;
30+ vmmc-supply = <&pm8941_l20>;
31+ vqmmc-supply = <&pm8941_s3>;
3232
3333 pinctrl-names = "default";
3434 pinctrl-0 = <&sdc1_clk &sdc1_cmd &sdc1_data>;
@@ -44,8 +44,8 @@ Example: · 9 unmodified lines
4444 bus-width = <4>;
4545 cd-gpios = <&msmgpio 62 0x1>;
4646
47− vmmc = <&pm8941_l21>;
48− vqmmc = <&pm8941_l13>;
47+ vmmc-supply = <&pm8941_l21>;
48+ vqmmc-supply = <&pm8941_l13>;
4949
5050 pinctrl-names = "default";
5151 pinctrl-0 = <&sdc2_clk &sdc2_cmd &sdc2_data>;
Documentation/devicetree/bindings/mmc/sdhci-st.txt+33−0
@@ -0,0 +1,33 @@
1+* STMicroelectronics sdhci-st MMC/SD controller
2+
3+This file documents the differences between the core properties in
4+Documentation/devicetree/bindings/mmc/mmc.txt and the properties
5+used by the sdhci-st driver.
6+
7+Required properties:
8+- compatible : Must be "st,sdhci"
9+- clock-names : Should be "mmc"
10+ See: Documentation/devicetree/bindings/resource-names.txt
11+- clocks : Phandle of the clock used by the sdhci controler
12+ See: Documentation/devicetree/bindings/clock/clock-bindings.txt
13+
14+Optional properties:
15+- non-removable: non-removable slot
16+ See: Documentation/devicetree/bindings/mmc/mmc.txt
17+- bus-width: Number of data lines
18+ See: Documentation/devicetree/bindings/mmc/mmc.txt
19+
20+Example:
21+
22+mmc0: sdhci@fe81e000 {
23+ compatible = "st,sdhci";
24+ status = "disabled";
25+ reg = <0xfe81e000 0x1000>;
26+ interrupts = <GIC_SPI 127 IRQ_TYPE_NONE>;
27+ interrupt-names = "mmcirq";
28+ pinctrl-names = "default";
29+ pinctrl-0 = <&pinctrl_mmc0>;
30+ clock-names = "mmc";
31+ clocks = <&clk_s_a1_ls 1>;
32+ bus-width = <8>
33+};
Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt+5−7
@@ -67,7 +67,8 @@ Optional properties: · 66 unmodified lines
6767 * card-detect-delay: Delay in milli-seconds before detecting card after card
6868 insert event. The default value is 0.
6969
70−* supports-highspeed: Enables support for high speed cards (up to 50MHz)
70+* supports-highspeed (DEPRECATED): Enables support for high speed cards (up to 50MHz)
71+ (use "cap-mmc-highspeed" or "cap-sd-highspeed" instead)
7172
7273 * broken-cd: as documented in mmc core bindings.
7374
@@ -98,14 +99,11 @@ board specific portions as listed below. · 24 unmodified lines
9899 clock-frequency = <400000000>;
99100 clock-freq-min-max = <400000 200000000>;
100101 num-slots = <1>;
101− supports-highspeed;
102102 broken-cd;
103103 fifo-depth = <0x80>;
104104 card-detect-delay = <200>;
105105 vmmc-supply = <&buck8>;
106−
107− slot@0 {
108− reg = <0>;
109− bus-width = <8>;
110− };
106+ bus-width = <8>;
107+ cap-mmc-highspeed;
108+ cap-sd-highspeed;
111109 };
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt+54−0
@@ -12,6 +12,7 @@ Required properties: · 11 unmodified lines
1212 Should be "ti,omap3-hsmmc", for OMAP3 controllers
1313 Should be "ti,omap3-pre-es3-hsmmc" for OMAP3 controllers pre ES3.0
1414 Should be "ti,omap4-hsmmc", for OMAP4 controllers
15+ Should be "ti,am33xx-hsmmc", for AM335x controllers
1516 - ti,hwmods: Must be "mmc<n>", n is controller instance starting 1
1617
1718 Optional properties:
@@ -56,3 +57,56 @@ Examples: · 38 unmodified lines
5657 &edma 25>;
5758 dma-names = "tx", "rx";
5859 };
60+
61+[workaround for missing swakeup on am33xx]
62+
63+This SOC is missing the swakeup line, it will not detect SDIO irq
64+while in suspend.
65+
66+ ------
67+ | PRCM |
68+ ------
69+ ^ |
70+ swakeup | | fclk
71+ | v
72+ ------ ------- -----
73+ | card | -- CIRQ --> | hsmmc | -- IRQ --> | CPU |
74+ ------ ------- -----
75+
76+In suspend the fclk is off and the module is disfunctional. Even register reads
77+will fail. A small logic in the host will request fclk restore, when an
78+external event is detected. Once the clock is restored, the host detects the
79+event normally. Since am33xx doesn't have this line it never wakes from
80+suspend.
81+
82+The workaround is to reconfigure the dat1 line as a GPIO upon suspend. To make
83+this work, we need to set the named pinctrl states "default" and "idle".
84+Prepare idle to remux dat1 as a gpio, and default to remux it back as sdio
85+dat1. The MMC driver will then toggle between idle and default state during
86+runtime.
87+
88+In summary:
89+1. select matching 'compatible' section, see example below.
90+2. specify pinctrl states "default" and "idle", "sleep" is optional.
91+3. specify the gpio irq used for detecting sdio irq in suspend
92+
93+If configuration is incomplete, a warning message is emitted "falling back to
94+polling". Also check the "sdio irq mode" in /sys/kernel/debug/mmc0/regs. Mind
95+not every application needs SDIO irq, e.g. MMC cards.
96+
97+ mmc1: mmc@48060100 {
98+ compatible = "ti,am33xx-hsmmc";
99+ ...
100+ pinctrl-names = "default", "idle", "sleep"
101+ pinctrl-0 = <&mmc1_pins>;
102+ pinctrl-1 = <&mmc1_idle>;
103+ pinctrl-2 = <&mmc1_sleep>;
104+ ...
105+ interrupts-extended = <&intc 64 &gpio2 28 0>;
106+ };
107+
108+ mmc1_idle : pinmux_cirq_pin {
109+ pinctrl-single,pins = <
110+ 0x0f8 0x3f /* GPIO2_28 */
111+ >;
112+ };
Documentation/devicetree/bindings/mmc/tmio_mmc.txt+1−0
@@ -18,6 +18,7 @@ Required properties: · 17 unmodified lines
1818 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
1919 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
2020 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
21+ "renesas,sdhi-r8a7791" - SDHI IP on R8A7791 SoC
2122
2223 Optional properties:
2324 - toshiba,mmc-wrprotect-disable: write-protect detection is unavailable
drivers/mmc/card/block.c+3−3
@@ -2028,8 +2028,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) · 2027 unmodified lines
20282028 /* complete ongoing async transfer before issuing discard */
20292029 if (card->host->areq)
20302030 mmc_blk_issue_rw_rq(mq, NULL);
2031− if (req->cmd_flags & REQ_SECURE &&
2032− !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN))
2031+ if (req->cmd_flags & REQ_SECURE)
20332032 ret = mmc_blk_issue_secdiscard_rq(mq, req);
20342033 else
20352034 ret = mmc_blk_issue_discard_rq(mq, req);
@@ -2432,6 +2431,8 @@ static int mmc_blk_probe(struct mmc_card *card) · 396 unmodified lines
24322431 if (!(card->csd.cmdclass & CCC_BLOCK_READ))
24332432 return -ENODEV;
24342433
2434+ mmc_fixup_device(card, blk_fixups);
2435+
24352436 md = mmc_blk_alloc(card);
24362437 if (IS_ERR(md))
24372438 return PTR_ERR(md);
@@ -2446,7 +2447,6 @@ static int mmc_blk_probe(struct mmc_card *card) · 8 unmodified lines
24462447 goto out;
24472448
24482449 mmc_set_drvdata(card, md);
2449− mmc_fixup_device(card, blk_fixups);
24502450
24512451 if (mmc_add_disk(md))
24522452 goto out;
drivers/mmc/core/bus.c+1−9
@@ -180,7 +180,6 @@ static int mmc_bus_resume(struct device *dev) · 179 unmodified lines
180180 #endif
181181
182182 #ifdef CONFIG_PM_RUNTIME
183−
184183 static int mmc_runtime_suspend(struct device *dev)
185184 {
186185 struct mmc_card *card = mmc_dev_to_card(dev);
@@ -196,17 +195,10 @@ static int mmc_runtime_resume(struct device *dev) · 9 unmodified lines
196195
197196 return host->bus_ops->runtime_resume(host);
198197 }
199−
200−static int mmc_runtime_idle(struct device *dev)
201−{
202− return 0;
203−}
204−
205198 #endif /* !CONFIG_PM_RUNTIME */
206199
207200 static const struct dev_pm_ops mmc_bus_pm_ops = {
208− SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume,
209− mmc_runtime_idle)
201+ SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, NULL)
210202 SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
211203 };
212204
drivers/mmc/core/core.c+2−1
@@ -2102,7 +2102,8 @@ EXPORT_SYMBOL(mmc_can_sanitize); · 2101 unmodified lines
21022102
21032103 int mmc_can_secure_erase_trim(struct mmc_card *card)
21042104 {
2105− if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN)
2105+ if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) &&
2106+ !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN))
21062107 return 1;
21072108 return 0;
21082109 }
drivers/mmc/core/mmc.c+5−6
@@ -324,13 +324,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) · 323 unmodified lines
324324 }
325325 }
326326
327+ /*
328+ * The EXT_CSD format is meant to be forward compatible. As long
329+ * as CSD_STRUCTURE does not change, all values for EXT_CSD_REV
330+ * are authorized, see JEDEC JESD84-B50 section B.8.
331+ */
327332 card->ext_csd.rev = ext_csd[EXT_CSD_REV];
328− if (card->ext_csd.rev > 7) {
329− pr_err("%s: unrecognised EXT_CSD revision %d\n",
330− mmc_hostname(card->host), card->ext_csd.rev);
331− err = -EINVAL;
332− goto out;
333− }
334333
335334 card->ext_csd.raw_sectors[0] = ext_csd[EXT_CSD_SEC_CNT + 0];
336335 card->ext_csd.raw_sectors[1] = ext_csd[EXT_CSD_SEC_CNT + 1];
drivers/mmc/core/quirks.c+1−1
@@ -91,7 +91,7 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) · 90 unmodified lines
9191 (f->cis_device == card->cis.device ||
9292 f->cis_device == (u16) SDIO_ANY_ID) &&
9393 rev >= f->rev_start && rev <= f->rev_end) {
94− dev_dbg(&card->dev, "calling %pF\n", f->vendor_fixup);
94+ dev_dbg(&card->dev, "calling %pf\n", f->vendor_fixup);
9595 f->vendor_fixup(card, f->data);
9696 }
9797 }
drivers/mmc/core/sd_ops.c+3−0
@@ -184,6 +184,9 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) · 183 unmodified lines
184184 mmc_delay(10);
185185 }
186186
187+ if (!i)
188+ pr_err("%s: card never left busy state\n", mmc_hostname(host));
189+
187190 if (rocr && !mmc_host_is_spi(host))
188191 *rocr = cmd.resp[0];
189192
drivers/mmc/host/Kconfig+17−11
@@ -290,6 +290,18 @@ config MMC_MOXART · 289 unmodified lines
290290 be found on some embedded hardware such as UC-7112-LX.
291291 If you have a controller with this interface, say Y here.
292292
293+config MMC_SDHCI_ST
294+ tristate "SDHCI support on STMicroelectronics SoC"
295+ depends on ARCH_STI
296+ depends on MMC_SDHCI_PLTFM
297+ select MMC_SDHCI_IO_ACCESSORS
298+ help
299+ This selects the Secure Digital Host Controller Interface in
300+ STMicroelectronics SoCs.
301+
302+ If you have a controller with this interface, say Y or M here.
303+ If unsure, say N.
304+
293305 config MMC_OMAP
294306 tristate "TI OMAP Multimedia Card Interface support"
295307 depends on ARCH_OMAP
@@ -303,6 +315,7 @@ config MMC_OMAP · 7 unmodified lines
303315
304316 config MMC_OMAP_HS
305317 tristate "TI OMAP High Speed Multimedia Card Interface support"
318+ depends on HAS_DMA
306319 depends on ARCH_OMAP2PLUS || COMPILE_TEST
307320 help
308321 This selects the TI OMAP High Speed Multimedia card Interface.
@@ -343,7 +356,7 @@ config MMC_ATMELMCI · 34 unmodified lines
343356
344357 config MMC_SDHCI_MSM
345358 tristate "Qualcomm SDHCI Controller Support"
346− depends on ARCH_QCOM
359+ depends on ARCH_QCOM || (ARM && COMPILE_TEST)
347360 depends on MMC_SDHCI_PLTFM
348361 help
349362 This selects the Secure Digital Host Controller Interface (SDHCI)
@@ -440,6 +453,7 @@ config MMC_SPI · 90 unmodified lines
440453 config MMC_S3C
441454 tristate "Samsung S3C SD/MMC Card Interface support"
442455 depends on ARCH_S3C24XX
456+ depends on S3C24XX_DMAC
443457 help
444458 This selects a driver for the MCI interface found in
445459 Samsung's S3C2410, S3C2412, S3C2440, S3C2442 CPUs.
@@ -477,15 +491,6 @@ config MMC_S3C_DMA · 31 unmodified lines
477491 working properly and needs to be debugged before this
478492 option is useful.
479493
480−config MMC_S3C_PIODMA
481− bool "Support for both PIO and DMA"
482− help
483− Compile both the PIO and DMA transfer routines into the
484− driver and let the platform select at run-time which one
485− is best.
486−
487− See notes for the DMA option.
488−
489494 endchoice
490495
491496 config MMC_SDRICOH_CS
@@ -623,7 +628,7 @@ config MMC_DW_PCI · 131 unmodified lines
623628
624629 config MMC_SH_MMCIF
625630 tristate "SuperH Internal MMCIF support"
626− depends on MMC_BLOCK
631+ depends on MMC_BLOCK && HAS_DMA
627632 depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
628633 help
629634 This selects the MMC Host Interface controller (MMCIF).
@@ -697,6 +702,7 @@ config MMC_WMT · 67 unmodified lines
697702
698703 config MMC_USDHI6ROL0
699704 tristate "Renesas USDHI6ROL0 SD/SDIO Host Controller support"
705+ depends on HAS_DMA
700706 help
701707 This selects support for the Renesas USDHI6ROL0 SD/SDIO
702708 Host Controller
drivers/mmc/host/Makefile+1−0
@@ -68,6 +68,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o · 67 unmodified lines
6868 obj-$(CONFIG_MMC_SDHCI_BCM_KONA) += sdhci-bcm-kona.o
6969 obj-$(CONFIG_MMC_SDHCI_BCM2835) += sdhci-bcm2835.o
7070 obj-$(CONFIG_MMC_SDHCI_MSM) += sdhci-msm.o
71+obj-$(CONFIG_MMC_SDHCI_ST) += sdhci-st.o
7172
7273 ifeq ($(CONFIG_CB710_DEBUG),y)
7374 CFLAGS-cb710-mmc += -DDEBUG
drivers/mmc/host/dw_mmc.c+73−25
@@ -111,8 +111,7 @@ static const u8 tuning_blk_pattern_8bit[] = { · 110 unmodified lines
111111 0xff, 0x77, 0x77, 0xff, 0x77, 0xbb, 0xdd, 0xee,
112112 };
113113
114−static inline bool dw_mci_fifo_reset(struct dw_mci *host);
115−static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host);
114+static bool dw_mci_reset(struct dw_mci *host);
116115
117116 #if defined(CONFIG_DEBUG_FS)
118117 static int dw_mci_req_show(struct seq_file *s, void *v)
@@ -997,7 +996,8 @@ static int dw_mci_get_ro(struct mmc_host *mmc) · 878 unmodified lines
997996 int gpio_ro = mmc_gpio_get_ro(mmc);
998997
999998 /* Use platform get_ro function, else try on board write protect */
1000− if (slot->quirks & DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT)
999+ if ((slot->quirks & DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT) ||
1000+ (slot->host->quirks & DW_MCI_QUIRK_NO_WRITE_PROTECT))
10011001 read_only = 0;
10021002 else if (!IS_ERR_VALUE(gpio_ro))
10031003 read_only = gpio_ro;
@@ -1235,7 +1235,7 @@ static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data) · 231 unmodified lines
12351235 * After an error, there may be data lingering
12361236 * in the FIFO
12371237 */
1238− dw_mci_fifo_reset(host);
1238+ dw_mci_reset(host);
12391239 } else {
12401240 data->bytes_xfered = data->blocks * data->blksz;
12411241 data->error = 0;
@@ -1352,7 +1352,7 @@ static void dw_mci_tasklet_func(unsigned long priv) · 110 unmodified lines
13521352
13531353 /* CMD error in data command */
13541354 if (mrq->cmd->error && mrq->data)
1355− dw_mci_fifo_reset(host);
1355+ dw_mci_reset(host);
13561356
13571357 host->cmd = NULL;
13581358 host->data = NULL;
@@ -1963,14 +1963,8 @@ static void dw_mci_work_routine_card(struct work_struct *work) · 604 unmodified lines
19631963 }
19641964
19651965 /* Power down slot */
1966− if (present == 0) {
1967− /* Clear down the FIFO */
1968− dw_mci_fifo_reset(host);
1969−#ifdef CONFIG_MMC_DW_IDMAC
1970− dw_mci_idmac_reset(host);
1971−#endif
1972−
1973− }
1966+ if (present == 0)
1967+ dw_mci_reset(host);
19741968
19751969 spin_unlock_bh(&host->lock);
19761970
@@ -2021,8 +2015,11 @@ static int dw_mci_of_get_slot_quirks(struct device *dev, u8 slot) · 44 unmodified lines
20212015
20222016 /* get quirks */
20232017 for (idx = 0; idx < ARRAY_SIZE(of_slot_quirks); idx++)
2024− if (of_get_property(np, of_slot_quirks[idx].quirk, NULL))
2018+ if (of_get_property(np, of_slot_quirks[idx].quirk, NULL)) {
2019+ dev_warn(dev, "Slot quirk %s is deprecated\n",
2020+ of_slot_quirks[idx].quirk);
20252021 quirks |= of_slot_quirks[idx].id;
2022+ }
20262023
20272024 return quirks;
20282025 }
@@ -2208,8 +2205,11 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset) · 179 unmodified lines
22082205 return false;
22092206 }
22102207
2211−static inline bool dw_mci_fifo_reset(struct dw_mci *host)
2208+static bool dw_mci_reset(struct dw_mci *host)
22122209 {
2210+ u32 flags = SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET;
2211+ bool ret = false;
2212+
22132213 /*
22142214 * Reseting generates a block interrupt, hence setting
22152215 * the scatter-gather pointer to NULL.
@@ -2219,15 +2219,60 @@ static inline bool dw_mci_fifo_reset(struct dw_mci *host) · 3 unmodified lines
22192219 host->sg = NULL;
22202220 }
22212221
2222− return dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET);
2223−}
2222+ if (host->use_dma)
2223+ flags |= SDMMC_CTRL_DMA_RESET;
22242224
2225−static inline bool dw_mci_ctrl_all_reset(struct dw_mci *host)
2226−{
2227− return dw_mci_ctrl_reset(host,
2228− SDMMC_CTRL_FIFO_RESET |
2229− SDMMC_CTRL_RESET |
2230− SDMMC_CTRL_DMA_RESET);
2225+ if (dw_mci_ctrl_reset(host, flags)) {
2226+ /*
2227+ * In all cases we clear the RAWINTS register to clear any
2228+ * interrupts.
2229+ */
2230+ mci_writel(host, RINTSTS, 0xFFFFFFFF);
2231+
2232+ /* if using dma we wait for dma_req to clear */
2233+ if (host->use_dma) {
2234+ unsigned long timeout = jiffies + msecs_to_jiffies(500);
2235+ u32 status;
2236+ do {
2237+ status = mci_readl(host, STATUS);
2238+ if (!(status & SDMMC_STATUS_DMA_REQ))
2239+ break;
2240+ cpu_relax();
2241+ } while (time_before(jiffies, timeout));
2242+
2243+ if (status & SDMMC_STATUS_DMA_REQ) {
2244+ dev_err(host->dev,
2245+ "%s: Timeout waiting for dma_req to "
2246+ "clear during reset\n", __func__);
2247+ goto ciu_out;
2248+ }
2249+
2250+ /* when using DMA next we reset the fifo again */
2251+ if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_FIFO_RESET))
2252+ goto ciu_out;
2253+ }
2254+ } else {
2255+ /* if the controller reset bit did clear, then set clock regs */
2256+ if (!(mci_readl(host, CTRL) & SDMMC_CTRL_RESET)) {
2257+ dev_err(host->dev, "%s: fifo/dma reset bits didn't "
2258+ "clear but ciu was reset, doing clock update\n",
2259+ __func__);
2260+ goto ciu_out;
2261+ }
2262+ }
2263+
2264+#if IS_ENABLED(CONFIG_MMC_DW_IDMAC)
2265+ /* It is also recommended that we reset and reprogram idmac */
2266+ dw_mci_idmac_reset(host);
2267+#endif
2268+
2269+ ret = true;
2270+
2271+ciu_out:
2272+ /* After a CTRL reset we need to have CIU set clock registers */
2273+ mci_send_cmd(host->cur_slot, SDMMC_CMD_UPD_CLK, 0);
2274+
2275+ return ret;
22312276 }
22322277
22332278 #ifdef CONFIG_OF
@@ -2238,6 +2283,9 @@ static struct dw_mci_of_quirks { · 4 unmodified lines
22382283 {
22392284 .quirk = "broken-cd",
22402285 .id = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
2286+ }, {
2287+ .quirk = "disable-wp",
2288+ .id = DW_MCI_QUIRK_NO_WRITE_PROTECT,
22412289 },
22422290 };
22432291
@@ -2425,7 +2473,7 @@ int dw_mci_probe(struct dw_mci *host) · 181 unmodified lines
24252473 }
24262474
24272475 /* Reset all blocks */
2428− if (!dw_mci_ctrl_all_reset(host))
2476+ if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS))
24292477 return -ENODEV;
24302478
24312479 host->dma_ops = host->pdata->dma_ops;
@@ -2612,7 +2660,7 @@ int dw_mci_resume(struct dw_mci *host) · 180 unmodified lines
26122660 }
26132661 }
26142662
2615− if (!dw_mci_ctrl_all_reset(host)) {
2663+ if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
26162664 ret = -ENODEV;
26172665 return ret;
26182666 }
drivers/mmc/host/dw_mmc.h+5−0
@@ -129,6 +129,7 @@ · 128 unmodified lines
129129 #define SDMMC_CMD_INDX(n) ((n) & 0x1F)
130130 /* Status register defines */
131131 #define SDMMC_GET_FCNT(x) (((x)>>17) & 0x1FFF)
132+#define SDMMC_STATUS_DMA_REQ BIT(31)
132133 /* FIFOTH register defines */
133134 #define SDMMC_SET_FIFOTH(m, r, t) (((m) & 0x7) << 28 | \
134135 ((r) & 0xFFF) << 16 | \
@@ -150,6 +151,10 @@ · 15 unmodified lines
150151 /* Card read threshold */
151152 #define SDMMC_SET_RD_THLD(v, x) (((v) & 0x1FFF) << 16 | (x))
152153
154+/* All ctrl reset bits */
155+#define SDMMC_CTRL_ALL_RESET_FLAGS \
156+ (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
157+
153158 /* Register access macros */
154159 #define mci_readl(dev, reg) \
155160 __raw_readl((dev)->regs + SDMMC_##reg)
drivers/mmc/host/mmci.c+140−28
@@ -52,34 +52,53 @@ static unsigned int fmax = 515633; · 51 unmodified lines
5252 * struct variant_data - MMCI variant-specific quirks
5353 * @clkreg: default value for MCICLOCK register
5454 * @clkreg_enable: enable value for MMCICLOCK register
55+ * @clkreg_8bit_bus_enable: enable value for 8 bit bus
56+ * @clkreg_neg_edge_enable: enable value for inverted data/cmd output
5557 * @datalength_bits: number of bits in the MMCIDATALENGTH register
5658 * @fifosize: number of bytes that can be written when MMCI_TXFIFOEMPTY
5759 * is asserted (likewise for RX)
5860 * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY
5961 * is asserted (likewise for RX)
62+ * @data_cmd_enable: enable value for data commands.
6063 * @sdio: variant supports SDIO
6164 * @st_clkdiv: true if using a ST-specific clock divider algorithm
65+ * @datactrl_mask_ddrmode: ddr mode mask in datactrl register.
6266 * @blksz_datactrl16: true if Block size is at b16..b30 position in datactrl register
67+ * @blksz_datactrl4: true if Block size is at b4..b16 position in datactrl
68+ * register
6369 * @pwrreg_powerup: power up value for MMCIPOWER register
70+ * @f_max: maximum clk frequency supported by the controller.
6471 * @signal_direction: input/out direction of bus signals can be indicated
6572 * @pwrreg_clkgate: MMCIPOWER register must be used to gate the clock
6673 * @busy_detect: true if busy detection on dat0 is supported
6774 * @pwrreg_nopower: bits in MMCIPOWER don't controls ext. power supply
75+ * @explicit_mclk_control: enable explicit mclk control in driver.
76+ * @qcom_fifo: enables qcom specific fifo pio read logic.
77+ * @reversed_irq_handling: handle data irq before cmd irq.
6878 */
6979 struct variant_data {
7080 unsigned int clkreg;
7181 unsigned int clkreg_enable;
82+ unsigned int clkreg_8bit_bus_enable;
83+ unsigned int clkreg_neg_edge_enable;
7284 unsigned int datalength_bits;
7385 unsigned int fifosize;
7486 unsigned int fifohalfsize;
87+ unsigned int data_cmd_enable;
88+ unsigned int datactrl_mask_ddrmode;
7589 bool sdio;
7690 bool st_clkdiv;
7791 bool blksz_datactrl16;
92+ bool blksz_datactrl4;
7893 u32 pwrreg_powerup;
94+ u32 f_max;
7995 bool signal_direction;
8096 bool pwrreg_clkgate;
8197 bool busy_detect;
8298 bool pwrreg_nopower;
99+ bool explicit_mclk_control;
100+ bool qcom_fifo;
101+ bool reversed_irq_handling;
83102 };
84103
85104 static struct variant_data variant_arm = {
@@ -87,6 +106,8 @@ static struct variant_data variant_arm = { · 1 unmodified line
87106 .fifohalfsize = 8 * 4,
88107 .datalength_bits = 16,
89108 .pwrreg_powerup = MCI_PWR_UP,
109+ .f_max = 100000000,
110+ .reversed_irq_handling = true,
90111 };
91112
92113 static struct variant_data variant_arm_extended_fifo = {
@@ -94,6 +115,7 @@ static struct variant_data variant_arm_extended_fifo = { · 1 unmodified line
94115 .fifohalfsize = 64 * 4,
95116 .datalength_bits = 16,
96117 .pwrreg_powerup = MCI_PWR_UP,
118+ .f_max = 100000000,
97119 };
98120
99121 static struct variant_data variant_arm_extended_fifo_hwfc = {
@@ -102,15 +124,18 @@ static struct variant_data variant_arm_extended_fifo_hwfc = { · 2 unmodified lines
102124 .clkreg_enable = MCI_ARM_HWFCEN,
103125 .datalength_bits = 16,
104126 .pwrreg_powerup = MCI_PWR_UP,
127+ .f_max = 100000000,
105128 };
106129
107130 static struct variant_data variant_u300 = {
108131 .fifosize = 16 * 4,
109132 .fifohalfsize = 8 * 4,
110133 .clkreg_enable = MCI_ST_U300_HWFCEN,
134+ .clkreg_8bit_bus_enable = MCI_ST_8BIT_BUS,
111135 .datalength_bits = 16,
112136 .sdio = true,
113137 .pwrreg_powerup = MCI_PWR_ON,
138+ .f_max = 100000000,
114139 .signal_direction = true,
115140 .pwrreg_clkgate = true,
116141 .pwrreg_nopower = true,
@@ -124,6 +149,7 @@ static struct variant_data variant_nomadik = { · 7 unmodified lines
124149 .sdio = true,
125150 .st_clkdiv = true,
126151 .pwrreg_powerup = MCI_PWR_ON,
152+ .f_max = 100000000,
127153 .signal_direction = true,
128154 .pwrreg_clkgate = true,
129155 .pwrreg_nopower = true,
@@ -134,10 +160,13 @@ static struct variant_data variant_ux500 = { · 4 unmodified lines
134160 .fifohalfsize = 8 * 4,
135161 .clkreg = MCI_CLK_ENABLE,
136162 .clkreg_enable = MCI_ST_UX500_HWFCEN,
163+ .clkreg_8bit_bus_enable = MCI_ST_8BIT_BUS,
164+ .clkreg_neg_edge_enable = MCI_ST_UX500_NEG_EDGE,
137165 .datalength_bits = 24,
138166 .sdio = true,
139167 .st_clkdiv = true,
140168 .pwrreg_powerup = MCI_PWR_ON,
169+ .f_max = 100000000,
141170 .signal_direction = true,
142171 .pwrreg_clkgate = true,
143172 .busy_detect = true,
@@ -149,17 +178,38 @@ static struct variant_data variant_ux500v2 = { · 5 unmodified lines
149178 .fifohalfsize = 8 * 4,
150179 .clkreg = MCI_CLK_ENABLE,
151180 .clkreg_enable = MCI_ST_UX500_HWFCEN,
181+ .clkreg_8bit_bus_enable = MCI_ST_8BIT_BUS,
182+ .clkreg_neg_edge_enable = MCI_ST_UX500_NEG_EDGE,
183+ .datactrl_mask_ddrmode = MCI_ST_DPSM_DDRMODE,
152184 .datalength_bits = 24,
153185 .sdio = true,
154186 .st_clkdiv = true,
155187 .blksz_datactrl16 = true,
156188 .pwrreg_powerup = MCI_PWR_ON,
189+ .f_max = 100000000,
157190 .signal_direction = true,
158191 .pwrreg_clkgate = true,
159192 .busy_detect = true,
160193 .pwrreg_nopower = true,
161194 };
162195
196+static struct variant_data variant_qcom = {
197+ .fifosize = 16 * 4,
198+ .fifohalfsize = 8 * 4,
199+ .clkreg = MCI_CLK_ENABLE,
200+ .clkreg_enable = MCI_QCOM_CLK_FLOWENA |
201+ MCI_QCOM_CLK_SELECT_IN_FBCLK,
202+ .clkreg_8bit_bus_enable = MCI_QCOM_CLK_WIDEBUS_8,
203+ .datactrl_mask_ddrmode = MCI_QCOM_CLK_SELECT_IN_DDR_MODE,
204+ .data_cmd_enable = MCI_QCOM_CSPM_DATCMD,
205+ .blksz_datactrl4 = true,
206+ .datalength_bits = 24,
207+ .pwrreg_powerup = MCI_PWR_UP,
208+ .f_max = 208000000,
209+ .explicit_mclk_control = true,
210+ .qcom_fifo = true,
211+};
212+
163213 static int mmci_card_busy(struct mmc_host *mmc)
164214 {
165215 struct mmci_host *host = mmc_priv(mmc);
@@ -260,7 +310,9 @@ static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) · 94 unmodified lines
260310 host->cclk = 0;
261311
262312 if (desired) {
263− if (desired >= host->mclk) {
313+ if (variant->explicit_mclk_control) {
314+ host->cclk = host->mclk;
315+ } else if (desired >= host->mclk) {
264316 clk = MCI_CLK_BYPASS;
265317 if (variant->st_clkdiv)
266318 clk |= MCI_ST_UX500_NEG_EDGE;
@@ -299,11 +351,11 @@ static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) · 32 unmodified lines
299351 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4)
300352 clk |= MCI_4BIT_BUS;
301353 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8)
302− clk |= MCI_ST_8BIT_BUS;
354+ clk |= variant->clkreg_8bit_bus_enable;
303355
304356 if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50 ||
305357 host->mmc->ios.timing == MMC_TIMING_MMC_DDR52)
306− clk |= MCI_ST_UX500_NEG_EDGE;
358+ clk |= variant->clkreg_neg_edge_enable;
307359
308360 mmci_write_clkreg(host, clk);
309361 }
@@ -719,7 +771,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) · 409 unmodified lines
719771 data->bytes_xfered = 0;
720772
721773 clks = (unsigned long long)data->timeout_ns * host->cclk;
722− do_div(clks, 1000000000UL);
774+ do_div(clks, NSEC_PER_SEC);
723775
724776 timeout = data->timeout_clks + (unsigned int)clks;
725777
@@ -732,6 +784,8 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) · 6 unmodified lines
732784
733785 if (variant->blksz_datactrl16)
734786 datactrl = MCI_DPSM_ENABLE | (data->blksz << 16);
787+ else if (variant->blksz_datactrl4)
788+ datactrl = MCI_DPSM_ENABLE | (data->blksz << 4);
735789 else
736790 datactrl = MCI_DPSM_ENABLE | blksz_bits << 4;
737791
@@ -767,7 +821,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) · 29 unmodified lines
767821
768822 if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50 ||
769823 host->mmc->ios.timing == MMC_TIMING_MMC_DDR52)
770− datactrl |= MCI_ST_DPSM_DDRMODE;
824+ datactrl |= variant->datactrl_mask_ddrmode;
771825
772826 /*
773827 * Attempt to use DMA operation mode, if this
@@ -812,7 +866,7 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) · 38 unmodified lines
812866
813867 if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) {
814868 writel(0, base + MMCICOMMAND);
815− udelay(1);
869+ mmci_reg_delay(host);
816870 }
817871
818872 c |= cmd->opcode | MCI_CPSM_ENABLE;
@@ -824,6 +878,9 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) · 5 unmodified lines
824878 if (/*interrupt*/0)
825879 c |= MCI_CPSM_INTERRUPT;
826880
881+ if (mmc_cmd_type(cmd) == MMC_CMD_ADTC)
882+ c |= host->variant->data_cmd_enable;
883+
827884 host->cmd = cmd;
828885
829886 writel(cmd->arg, base + MMCIARGUMENT);
@@ -834,6 +891,10 @@ static void · 4 unmodified lines
834891 mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
835892 unsigned int status)
836893 {
894+ /* Make sure we have data to handle */
895+ if (!data)
896+ return;
897+
837898 /* First check for errors */
838899 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
839900 MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
@@ -902,9 +963,17 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, · 62 unmodified lines
902963 unsigned int status)
903964 {
904965 void __iomem *base = host->base;
905− bool sbc = (cmd == host->mrq->sbc);
906− bool busy_resp = host->variant->busy_detect &&
907− (cmd->flags & MMC_RSP_BUSY);
966+ bool sbc, busy_resp;
967+
968+ if (!cmd)
969+ return;
970+
971+ sbc = (cmd == host->mrq->sbc);
972+ busy_resp = host->variant->busy_detect && (cmd->flags & MMC_RSP_BUSY);
973+
974+ if (!((status|host->busy_status) & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT|
975+ MCI_CMDSENT|MCI_CMDRESPEND)))
976+ return;
908977
909978 /* Check if we need to wait for busy completion. */
910979 if (host->busy_status && (status & MCI_ST_CARDBUSY))
@@ -957,15 +1026,34 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, · 46 unmodified lines
9571026 }
9581027 }
9591028
1029+static int mmci_get_rx_fifocnt(struct mmci_host *host, u32 status, int remain)
1030+{
1031+ return remain - (readl(host->base + MMCIFIFOCNT) << 2);
1032+}
1033+
1034+static int mmci_qcom_get_rx_fifocnt(struct mmci_host *host, u32 status, int r)
1035+{
1036+ /*
1037+ * on qcom SDCC4 only 8 words are used in each burst so only 8 addresses
1038+ * from the fifo range should be used
1039+ */
1040+ if (status & MCI_RXFIFOHALFFULL)
1041+ return host->variant->fifohalfsize;
1042+ else if (status & MCI_RXDATAAVLBL)
1043+ return 4;
1044+
1045+ return 0;
1046+}
1047+
9601048 static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int remain)
9611049 {
9621050 void __iomem *base = host->base;
9631051 char *ptr = buffer;
964− u32 status;
1052+ u32 status = readl(host->base + MMCISTATUS);
9651053 int host_remain = host->size;
9661054
9671055 do {
968− int count = host_remain - (readl(base + MMCIFIFOCNT) << 2);
1056+ int count = host->get_rx_fifocnt(host, status, host_remain);
9691057
9701058 if (count > remain)
9711059 count = remain;
@@ -1132,9 +1220,6 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) · 160 unmodified lines
11321220 spin_lock(&host->lock);
11331221
11341222 do {
1135− struct mmc_command *cmd;
1136− struct mmc_data *data;
1137−
11381223 status = readl(host->base + MMCISTATUS);
11391224
11401225 if (host->singleirq) {
@@ -1154,16 +1239,13 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) · 13 unmodified lines
11541239
11551240 dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);
11561241
1157− cmd = host->cmd;
1158− if ((status|host->busy_status) & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT|
1159− MCI_CMDSENT|MCI_CMDRESPEND) && cmd)
1160− mmci_cmd_irq(host, cmd, status);
1161−
1162− data = host->data;
1163− if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
1164− MCI_TXUNDERRUN|MCI_RXOVERRUN|MCI_DATAEND|
1165− MCI_DATABLOCKEND) && data)
1166− mmci_data_irq(host, data, status);
1242+ if (host->variant->reversed_irq_handling) {
1243+ mmci_data_irq(host, host->data, status);
1244+ mmci_cmd_irq(host, host->cmd, status);
1245+ } else {
1246+ mmci_cmd_irq(host, host->cmd, status);
1247+ mmci_data_irq(host, host->data, status);
1248+ }
11671249
11681250 /* Don't poll for busy completion in irq context. */
11691251 if (host->busy_status)
@@ -1296,6 +1378,17 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 126 unmodified lines
12961378 if (!ios->clock && variant->pwrreg_clkgate)
12971379 pwr &= ~MCI_PWR_ON;
12981380
1381+ if (host->variant->explicit_mclk_control &&
1382+ ios->clock != host->clock_cache) {
1383+ ret = clk_set_rate(host->clk, ios->clock);
1384+ if (ret < 0)
1385+ dev_err(mmc_dev(host->mmc),
1386+ "Error setting clock rate (%d)\n", ret);
1387+ else
1388+ host->mclk = clk_get_rate(host->clk);
1389+ }
1390+ host->clock_cache = ios->clock;
1391+
12991392 spin_lock_irqsave(&host->lock, flags);
13001393
13011394 mmci_set_clkreg(host, ios->clock);
@@ -1443,6 +1536,11 @@ static int mmci_probe(struct amba_device *dev, · 141 unmodified lines
14431536 if (ret)
14441537 goto host_free;
14451538
1539+ if (variant->qcom_fifo)
1540+ host->get_rx_fifocnt = mmci_qcom_get_rx_fifocnt;
1541+ else
1542+ host->get_rx_fifocnt = mmci_get_rx_fifocnt;
1543+
14461544 host->plat = plat;
14471545 host->variant = variant;
14481546 host->mclk = clk_get_rate(host->clk);
@@ -1451,8 +1549,8 @@ static int mmci_probe(struct amba_device *dev, · 2 unmodified lines
14511549 * so we try to adjust the clock down to this,
14521550 * (if possible).
14531551 */
1454− if (host->mclk > 100000000) {
1455− ret = clk_set_rate(host->clk, 100000000);
1552+ if (host->mclk > variant->f_max) {
1553+ ret = clk_set_rate(host->clk, variant->f_max);
14561554 if (ret < 0)
14571555 goto clk_disable;
14581556 host->mclk = clk_get_rate(host->clk);
@@ -1471,9 +1569,12 @@ static int mmci_probe(struct amba_device *dev, · 12 unmodified lines
14711569 * The ARM and ST versions of the block have slightly different
14721570 * clock divider equations which means that the minimum divider
14731571 * differs too.
1572+ * on Qualcomm like controllers get the nearest minimum clock to 100Khz
14741573 */
14751574 if (variant->st_clkdiv)
14761575 mmc->f_min = DIV_ROUND_UP(host->mclk, 257);
1576+ else if (variant->explicit_mclk_control)
1577+ mmc->f_min = clk_round_rate(host->clk, 100000);
14771578 else
14781579 mmc->f_min = DIV_ROUND_UP(host->mclk, 512);
14791580 /*
@@ -1483,9 +1584,14 @@ static int mmci_probe(struct amba_device *dev, · 3 unmodified lines
14831584 * the block, of course.
14841585 */
14851586 if (mmc->f_max)
1486− mmc->f_max = min(host->mclk, mmc->f_max);
1587+ mmc->f_max = variant->explicit_mclk_control ?
1588+ min(variant->f_max, mmc->f_max) :
1589+ min(host->mclk, mmc->f_max);
14871590 else
1488− mmc->f_max = min(host->mclk, fmax);
1591+ mmc->f_max = variant->explicit_mclk_control ?
1592+ fmax : min(host->mclk, fmax);
1593+
1594+
14891595 dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
14901596
14911597 /* Get regulators and the supported OCR mask */
@@ -1752,6 +1858,12 @@ static struct amba_id mmci_ids[] = { · 260 unmodified lines
17521858 .mask = 0xf0ffffff,
17531859 .data = &variant_ux500v2,
17541860 },
1861+ /* Qualcomm variants */
1862+ {
1863+ .id = 0x00051180,
1864+ .mask = 0x000fffff,
1865+ .data = &variant_qcom,
1866+ },
17551867 { 0, 0 },
17561868 };
17571869
drivers/mmc/host/mmci.h+20−0
@@ -41,6 +41,15 @@ · 40 unmodified lines
4141 /* Modified PL180 on Versatile Express platform */
4242 #define MCI_ARM_HWFCEN (1 << 12)
4343
44+/* Modified on Qualcomm Integrations */
45+#define MCI_QCOM_CLK_WIDEBUS_8 (BIT(10) | BIT(11))
46+#define MCI_QCOM_CLK_FLOWENA BIT(12)
47+#define MCI_QCOM_CLK_INVERTOUT BIT(13)
48+
49+/* select in latch data and command in */
50+#define MCI_QCOM_CLK_SELECT_IN_FBCLK BIT(15)
51+#define MCI_QCOM_CLK_SELECT_IN_DDR_MODE (BIT(14) | BIT(15))
52+
4453 #define MMCIARGUMENT 0x008
4554 #define MMCICOMMAND 0x00c
4655 #define MCI_CPSM_RESPONSE (1 << 6)
@@ -54,6 +63,14 @@ · 7 unmodified lines
5463 #define MCI_ST_NIEN (1 << 13)
5564 #define MCI_ST_CE_ATACMD (1 << 14)
5665
66+/* Modified on Qualcomm Integrations */
67+#define MCI_QCOM_CSPM_DATCMD BIT(12)
68+#define MCI_QCOM_CSPM_MCIABORT BIT(13)
69+#define MCI_QCOM_CSPM_CCSENABLE BIT(14)
70+#define MCI_QCOM_CSPM_CCSDISABLE BIT(15)
71+#define MCI_QCOM_CSPM_AUTO_CMD19 BIT(16)
72+#define MCI_QCOM_CSPM_AUTO_CMD21 BIT(21)
73+
5774 #define MMCIRESPCMD 0x010
5875 #define MMCIRESPONSE0 0x014
5976 #define MMCIRESPONSE1 0x018
@@ -191,6 +208,8 @@ struct mmci_host { · 131 unmodified lines
191208 spinlock_t lock;
192209
193210 unsigned int mclk;
211+ /* cached value of requested clk in set_ios */
212+ unsigned int clock_cache;
194213 unsigned int cclk;
195214 u32 pwr_reg;
196215 u32 pwr_reg_add;
@@ -210,6 +229,7 @@ struct mmci_host { · 13 unmodified lines
210229 /* pio stuff */
211230 struct sg_mapping_iter sg_miter;
212231 unsigned int size;
232+ int (*get_rx_fifocnt)(struct mmci_host *h, u32 status, int remain);
213233
214234 #ifdef CONFIG_DMA_ENGINE
215235 /* DMA stuff */
drivers/mmc/host/moxart-mmc.c+0−1
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 * warranty of any kind, whether express or implied.
1414 */
1515
16−#include <linux/version.h>
1716 #include <linux/module.h>
1817 #include <linux/init.h>
1918 #include <linux/platform_device.h>
drivers/mmc/host/mxs-mmc.c+2−1
@@ -86,7 +86,8 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc) · 85 unmodified lines
8686 if (ret >= 0)
8787 return ret;
8888
89− present = !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
89+ present = mmc->caps & MMC_CAP_NEEDS_POLL ||
90+ !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
9091 BM_SSP_STATUS_CARD_DETECT);
9192
9293 if (mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH)
drivers/mmc/host/omap_hsmmc.c+262−21
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/timer.h>
3030 #include <linux/clk.h>
3131 #include <linux/of.h>
32+#include <linux/of_irq.h>
3233 #include <linux/of_gpio.h>
3334 #include <linux/of_device.h>
3435 #include <linux/omap-dmaengine.h>
@@ -36,6 +37,7 @@ · 1 unmodified line
3637 #include <linux/mmc/core.h>
3738 #include <linux/mmc/mmc.h>
3839 #include <linux/io.h>
40+#include <linux/irq.h>
3941 #include <linux/gpio.h>
4042 #include <linux/regulator/consumer.h>
4143 #include <linux/pinctrl/consumer.h>
@@ -54,6 +56,7 @@ · 12 unmodified lines
5456 #define OMAP_HSMMC_RSP54 0x0118
5557 #define OMAP_HSMMC_RSP76 0x011C
5658 #define OMAP_HSMMC_DATA 0x0120
59+#define OMAP_HSMMC_PSTATE 0x0124
5760 #define OMAP_HSMMC_HCTL 0x0128
5861 #define OMAP_HSMMC_SYSCTL 0x012C
5962 #define OMAP_HSMMC_STAT 0x0130
@@ -91,7 +94,10 @@ · 31 unmodified lines
9194 #define BCE (1 << 1)
9295 #define FOUR_BIT (1 << 1)
9396 #define HSPE (1 << 2)
97+#define IWE (1 << 24)
9498 #define DDR (1 << 19)
99+#define CLKEXTFREE (1 << 16)
100+#define CTPL (1 << 11)
95101 #define DW8 (1 << 5)
96102 #define OD 0x1
97103 #define STAT_CLEAR 0xFFFFFFFF
@@ -101,11 +107,15 @@ · 3 unmodified lines
101107 #define SRD (1 << 26)
102108 #define SOFTRESET (1 << 1)
103109
110+/* PSTATE */
111+#define DLEV_DAT(x) (1 << (20 + (x)))
112+
104113 /* Interrupt masks for IE and ISE register */
105114 #define CC_EN (1 << 0)
106115 #define TC_EN (1 << 1)
107116 #define BWR_EN (1 << 4)
108117 #define BRR_EN (1 << 5)
118+#define CIRQ_EN (1 << 8)
109119 #define ERR_EN (1 << 15)
110120 #define CTO_EN (1 << 16)
111121 #define CCRC_EN (1 << 17)
@@ -140,7 +150,6 @@ · 28 unmodified lines
140150 #define VDD_3V0 3000000 /* 300000 uV */
141151 #define VDD_165_195 (ffs(MMC_VDD_165_195) - 1)
142152
143−#define AUTO_CMD23 (1 << 1) /* Auto CMD23 support */
144153 /*
145154 * One controller can have multiple slots, like on some omap boards using
146155 * omap.c controller driver. Luckily this is not currently done on any known
@@ -194,6 +203,7 @@ struct omap_hsmmc_host { · 47 unmodified lines
194203 u32 sysctl;
195204 u32 capa;
196205 int irq;
206+ int wake_irq;
197207 int use_dma, dma_ch;
198208 struct dma_chan *tx_chan;
199209 struct dma_chan *rx_chan;
@@ -206,6 +216,9 @@ struct omap_hsmmc_host { · 6 unmodified lines
206216 int req_in_progress;
207217 unsigned long clk_rate;
208218 unsigned int flags;
219+#define AUTO_CMD23 (1 << 0) /* Auto CMD23 support */
220+#define HSMMC_SDIO_IRQ_ENABLED (1 << 1) /* SDIO irq enabled */
221+#define HSMMC_WAKE_IRQ_ENABLED (1 << 2)
209222 struct omap_hsmmc_next next_data;
210223 struct omap_mmc_platform_data *pdata;
211224 };
@@ -510,27 +523,40 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host *host) · 298 unmodified lines
510523 static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
511524 struct mmc_command *cmd)
512525 {
513− unsigned int irq_mask;
526+ u32 irq_mask = INT_EN_MASK;
527+ unsigned long flags;
514528
515529 if (host->use_dma)
516− irq_mask = INT_EN_MASK & ~(BRR_EN | BWR_EN);
517− else
518− irq_mask = INT_EN_MASK;
530+ irq_mask &= ~(BRR_EN | BWR_EN);
519531
520532 /* Disable timeout for erases */
521533 if (cmd->opcode == MMC_ERASE)
522534 irq_mask &= ~DTO_EN;
523535
536+ spin_lock_irqsave(&host->irq_lock, flags);
524537 OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
525538 OMAP_HSMMC_WRITE(host->base, ISE, irq_mask);
539+
540+ /* latch pending CIRQ, but don't signal MMC core */
541+ if (host->flags & HSMMC_SDIO_IRQ_ENABLED)
542+ irq_mask |= CIRQ_EN;
526543 OMAP_HSMMC_WRITE(host->base, IE, irq_mask);
544+ spin_unlock_irqrestore(&host->irq_lock, flags);
527545 }
528546
529547 static void omap_hsmmc_disable_irq(struct omap_hsmmc_host *host)
530548 {
531− OMAP_HSMMC_WRITE(host->base, ISE, 0);
532− OMAP_HSMMC_WRITE(host->base, IE, 0);
549+ u32 irq_mask = 0;
550+ unsigned long flags;
551+
552+ spin_lock_irqsave(&host->irq_lock, flags);
553+ /* no transfer running but need to keep cirq if enabled */
554+ if (host->flags & HSMMC_SDIO_IRQ_ENABLED)
555+ irq_mask |= CIRQ_EN;
556+ OMAP_HSMMC_WRITE(host->base, ISE, irq_mask);
557+ OMAP_HSMMC_WRITE(host->base, IE, irq_mask);
533558 OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
559+ spin_unlock_irqrestore(&host->irq_lock, flags);
534560 }
535561
536562 /* Calculate divisor for the given clock frequency */
@@ -667,6 +693,9 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) · 130 unmodified lines
667693 capa = VS18;
668694 }
669695
696+ if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
697+ hctl |= IWE;
698+
670699 OMAP_HSMMC_WRITE(host->base, HCTL,
671700 OMAP_HSMMC_READ(host->base, HCTL) | hctl);
672701
@@ -681,7 +710,9 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) · 8 unmodified lines
681710 && time_before(jiffies, timeout))
682711 ;
683712
684− omap_hsmmc_disable_irq(host);
713+ OMAP_HSMMC_WRITE(host->base, ISE, 0);
714+ OMAP_HSMMC_WRITE(host->base, IE, 0);
715+ OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
685716
686717 /* Do not initialize card-specific things if the power is off */
687718 if (host->power_mode == MMC_POWER_OFF)
@@ -1118,8 +1149,12 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) · 430 unmodified lines
11181149 int status;
11191150
11201151 status = OMAP_HSMMC_READ(host->base, STAT);
1121− while (status & INT_EN_MASK && host->req_in_progress) {
1122− omap_hsmmc_do_irq(host, status);
1152+ while (status & (INT_EN_MASK | CIRQ_EN)) {
1153+ if (host->req_in_progress)
1154+ omap_hsmmc_do_irq(host, status);
1155+
1156+ if (status & CIRQ_EN)
1157+ mmc_signal_sdio_irq(host->mmc);
11231158
11241159 /* Flush posted write */
11251160 status = OMAP_HSMMC_READ(host->base, STAT);
@@ -1128,6 +1163,22 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) · 2 unmodified lines
11281163 return IRQ_HANDLED;
11291164 }
11301165
1166+static irqreturn_t omap_hsmmc_wake_irq(int irq, void *dev_id)
1167+{
1168+ struct omap_hsmmc_host *host = dev_id;
1169+
1170+ /* cirq is level triggered, disable to avoid infinite loop */
1171+ spin_lock(&host->irq_lock);
1172+ if (host->flags & HSMMC_WAKE_IRQ_ENABLED) {
1173+ disable_irq_nosync(host->wake_irq);
1174+ host->flags &= ~HSMMC_WAKE_IRQ_ENABLED;
1175+ }
1176+ spin_unlock(&host->irq_lock);
1177+ pm_request_resume(host->dev); /* no use counter */
1178+
1179+ return IRQ_HANDLED;
1180+}
1181+
11311182 static void set_sd_bus_power(struct omap_hsmmc_host *host)
11321183 {
11331184 unsigned long i;
@@ -1639,6 +1690,103 @@ static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card) · 505 unmodified lines
16391690 mmc_slot(host).init_card(card);
16401691 }
16411692
1693+static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
1694+{
1695+ struct omap_hsmmc_host *host = mmc_priv(mmc);
1696+ u32 irq_mask, con;
1697+ unsigned long flags;
1698+
1699+ spin_lock_irqsave(&host->irq_lock, flags);
1700+
1701+ con = OMAP_HSMMC_READ(host->base, CON);
1702+ irq_mask = OMAP_HSMMC_READ(host->base, ISE);
1703+ if (enable) {
1704+ host->flags |= HSMMC_SDIO_IRQ_ENABLED;
1705+ irq_mask |= CIRQ_EN;
1706+ con |= CTPL | CLKEXTFREE;
1707+ } else {
1708+ host->flags &= ~HSMMC_SDIO_IRQ_ENABLED;
1709+ irq_mask &= ~CIRQ_EN;
1710+ con &= ~(CTPL | CLKEXTFREE);
1711+ }
1712+ OMAP_HSMMC_WRITE(host->base, CON, con);
1713+ OMAP_HSMMC_WRITE(host->base, IE, irq_mask);
1714+
1715+ /*
1716+ * if enable, piggy back detection on current request
1717+ * but always disable immediately
1718+ */
1719+ if (!host->req_in_progress || !enable)
1720+ OMAP_HSMMC_WRITE(host->base, ISE, irq_mask);
1721+
1722+ /* flush posted write */
1723+ OMAP_HSMMC_READ(host->base, IE);
1724+
1725+ spin_unlock_irqrestore(&host->irq_lock, flags);
1726+}
1727+
1728+static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
1729+{
1730+ struct mmc_host *mmc = host->mmc;
1731+ int ret;
1732+
1733+ /*
1734+ * For omaps with wake-up path, wakeirq will be irq from pinctrl and
1735+ * for other omaps, wakeirq will be from GPIO (dat line remuxed to
1736+ * gpio). wakeirq is needed to detect sdio irq in runtime suspend state
1737+ * with functional clock disabled.
1738+ */
1739+ if (!host->dev->of_node || !host->wake_irq)
1740+ return -ENODEV;
1741+
1742+ /* Prevent auto-enabling of IRQ */
1743+ irq_set_status_flags(host->wake_irq, IRQ_NOAUTOEN);
1744+ ret = devm_request_irq(host->dev, host->wake_irq, omap_hsmmc_wake_irq,
1745+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
1746+ mmc_hostname(mmc), host);
1747+ if (ret) {
1748+ dev_err(mmc_dev(host->mmc), "Unable to request wake IRQ\n");
1749+ goto err;
1750+ }
1751+
1752+ /*
1753+ * Some omaps don't have wake-up path from deeper idle states
1754+ * and need to remux SDIO DAT1 to GPIO for wake-up from idle.
1755+ */
1756+ if (host->pdata->controller_flags & OMAP_HSMMC_SWAKEUP_MISSING) {
1757+ struct pinctrl *p = devm_pinctrl_get(host->dev);
1758+ if (!p) {
1759+ ret = -ENODEV;
1760+ goto err_free_irq;
1761+ }
1762+ if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_DEFAULT))) {
1763+ dev_info(host->dev, "missing default pinctrl state\n");
1764+ devm_pinctrl_put(p);
1765+ ret = -EINVAL;
1766+ goto err_free_irq;
1767+ }
1768+
1769+ if (IS_ERR(pinctrl_lookup_state(p, PINCTRL_STATE_IDLE))) {
1770+ dev_info(host->dev, "missing idle pinctrl state\n");
1771+ devm_pinctrl_put(p);
1772+ ret = -EINVAL;
1773+ goto err_free_irq;
1774+ }
1775+ devm_pinctrl_put(p);
1776+ }
1777+
1778+ OMAP_HSMMC_WRITE(host->base, HCTL,
1779+ OMAP_HSMMC_READ(host->base, HCTL) | IWE);
1780+ return 0;
1781+
1782+err_free_irq:
1783+ devm_free_irq(host->dev, host->wake_irq, host);
1784+err:
1785+ dev_warn(host->dev, "no SDIO IRQ support, falling back to polling\n");
1786+ host->wake_irq = 0;
1787+ return ret;
1788+}
1789+
16421790 static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
16431791 {
16441792 u32 hctl, capa, value;
@@ -1691,7 +1839,7 @@ static const struct mmc_host_ops omap_hsmmc_ops = { · 46 unmodified lines
16911839 .get_cd = omap_hsmmc_get_cd,
16921840 .get_ro = omap_hsmmc_get_ro,
16931841 .init_card = omap_hsmmc_init_card,
1694− /* NYET -- enable_sdio_irq */
1842+ .enable_sdio_irq = omap_hsmmc_enable_sdio_irq,
16951843 };
16961844
16971845 #ifdef CONFIG_DEBUG_FS
@@ -1701,13 +1849,23 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data) · 3 unmodified lines
17011849 struct mmc_host *mmc = s->private;
17021850 struct omap_hsmmc_host *host = mmc_priv(mmc);
17031851
1704− seq_printf(s, "mmc%d:\n ctx_loss:\t%d\n\nregs:\n",
1705− mmc->index, host->context_loss);
1852+ seq_printf(s, "mmc%d:\n", mmc->index);
1853+ seq_printf(s, "sdio irq mode\t%s\n",
1854+ (mmc->caps & MMC_CAP_SDIO_IRQ) ? "interrupt" : "polling");
17061855
1707− pm_runtime_get_sync(host->dev);
1856+ if (mmc->caps & MMC_CAP_SDIO_IRQ) {
1857+ seq_printf(s, "sdio irq \t%s\n",
1858+ (host->flags & HSMMC_SDIO_IRQ_ENABLED) ? "enabled"
1859+ : "disabled");
1860+ }
1861+ seq_printf(s, "ctx_loss:\t%d\n", host->context_loss);
17081862
1863+ pm_runtime_get_sync(host->dev);
1864+ seq_puts(s, "\nregs:\n");
17091865 seq_printf(s, "CON:\t\t0x%08x\n",
17101866 OMAP_HSMMC_READ(host->base, CON));
1867+ seq_printf(s, "PSTATE:\t\t0x%08x\n",
1868+ OMAP_HSMMC_READ(host->base, PSTATE));
17111869 seq_printf(s, "HCTL:\t\t0x%08x\n",
17121870 OMAP_HSMMC_READ(host->base, HCTL));
17131871 seq_printf(s, "SYSCTL:\t\t0x%08x\n",
@@ -1761,6 +1919,10 @@ static const struct omap_mmc_of_data omap3_pre_es3_mmc_of_data = { · 47 unmodified lines
17611919 static const struct omap_mmc_of_data omap4_mmc_of_data = {
17621920 .reg_offset = 0x100,
17631921 };
1922+static const struct omap_mmc_of_data am33xx_mmc_of_data = {
1923+ .reg_offset = 0x100,
1924+ .controller_flags = OMAP_HSMMC_SWAKEUP_MISSING,
1925+};
17641926
17651927 static const struct of_device_id omap_mmc_of_match[] = {
17661928 {
@@ -1777,6 +1939,10 @@ static const struct of_device_id omap_mmc_of_match[] = { · 10 unmodified lines
17771939 .compatible = "ti,omap4-hsmmc",
17781940 .data = &omap4_mmc_of_data,
17791941 },
1942+ {
1943+ .compatible = "ti,am33xx-hsmmc",
1944+ .data = &am33xx_mmc_of_data,
1945+ },
17801946 {},
17811947 };
17821948 MODULE_DEVICE_TABLE(of, omap_mmc_of_match);
@@ -1850,7 +2016,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) · 67 unmodified lines
18502016 const struct of_device_id *match;
18512017 dma_cap_mask_t mask;
18522018 unsigned tx_req, rx_req;
1853− struct pinctrl *pinctrl;
18542019 const struct omap_mmc_of_data *data;
18552020 void __iomem *base;
18562021
@@ -1913,6 +2078,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev) · 56 unmodified lines
19132078
19142079 platform_set_drvdata(pdev, host);
19152080
2081+ if (pdev->dev.of_node)
2082+ host->wake_irq = irq_of_parse_and_map(pdev->dev.of_node, 1);
2083+
19162084 mmc->ops = &omap_hsmmc_ops;
19172085
19182086 mmc->f_min = OMAP_MMC_MIN_CLOCK;
@@ -2061,10 +2229,17 @@ static int omap_hsmmc_probe(struct platform_device *pdev) · 142 unmodified lines
20612229
20622230 omap_hsmmc_disable_irq(host);
20632231
2064− pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
2065− if (IS_ERR(pinctrl))
2066− dev_warn(&pdev->dev,
2067− "pins are not configured from the driver\n");
2232+ /*
2233+ * For now, only support SDIO interrupt if we have a separate
2234+ * wake-up interrupt configured from device tree. This is because
2235+ * the wake-up interrupt is needed for idle state and some
2236+ * platforms need special quirks. And we don't want to add new
2237+ * legacy mux platform init code callbacks any longer as we
2238+ * are moving to DT based booting anyways.
2239+ */
2240+ ret = omap_hsmmc_configure_wake_irq(host);
2241+ if (!ret)
2242+ mmc->caps |= MMC_CAP_SDIO_IRQ;
20682243
20692244 omap_hsmmc_protect_card(host);
20702245
@@ -2170,11 +2345,18 @@ static int omap_hsmmc_suspend(struct device *dev) · 99 unmodified lines
21702345 pm_runtime_get_sync(host->dev);
21712346
21722347 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
2173− omap_hsmmc_disable_irq(host);
2348+ OMAP_HSMMC_WRITE(host->base, ISE, 0);
2349+ OMAP_HSMMC_WRITE(host->base, IE, 0);
2350+ OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
21742351 OMAP_HSMMC_WRITE(host->base, HCTL,
21752352 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
21762353 }
21772354
2355+ /* do not wake up due to sdio irq */
2356+ if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
2357+ !(host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ))
2358+ disable_irq(host->wake_irq);
2359+
21782360 if (host->dbclk)
21792361 clk_disable_unprepare(host->dbclk);
21802362
@@ -2200,6 +2382,10 @@ static int omap_hsmmc_resume(struct device *dev) · 19 unmodified lines
22002382
22012383 omap_hsmmc_protect_card(host);
22022384
2385+ if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
2386+ !(host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ))
2387+ enable_irq(host->wake_irq);
2388+
22032389 pm_runtime_mark_last_busy(host->dev);
22042390 pm_runtime_put_autosuspend(host->dev);
22052391 return 0;
@@ -2215,22 +2401,77 @@ static int omap_hsmmc_resume(struct device *dev) · 9 unmodified lines
22152401 static int omap_hsmmc_runtime_suspend(struct device *dev)
22162402 {
22172403 struct omap_hsmmc_host *host;
2404+ unsigned long flags;
2405+ int ret = 0;
22182406
22192407 host = platform_get_drvdata(to_platform_device(dev));
22202408 omap_hsmmc_context_save(host);
22212409 dev_dbg(dev, "disabled\n");
22222410
2223− return 0;
2411+ spin_lock_irqsave(&host->irq_lock, flags);
2412+ if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
2413+ (host->flags & HSMMC_SDIO_IRQ_ENABLED)) {
2414+ /* disable sdio irq handling to prevent race */
2415+ OMAP_HSMMC_WRITE(host->base, ISE, 0);
2416+ OMAP_HSMMC_WRITE(host->base, IE, 0);
2417+
2418+ if (!(OMAP_HSMMC_READ(host->base, PSTATE) & DLEV_DAT(1))) {
2419+ /*
2420+ * dat1 line low, pending sdio irq
2421+ * race condition: possible irq handler running on
2422+ * multi-core, abort
2423+ */
2424+ dev_dbg(dev, "pending sdio irq, abort suspend\n");
2425+ OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
2426+ OMAP_HSMMC_WRITE(host->base, ISE, CIRQ_EN);
2427+ OMAP_HSMMC_WRITE(host->base, IE, CIRQ_EN);
2428+ pm_runtime_mark_last_busy(dev);
2429+ ret = -EBUSY;
2430+ goto abort;
2431+ }
2432+
2433+ pinctrl_pm_select_idle_state(dev);
2434+
2435+ WARN_ON(host->flags & HSMMC_WAKE_IRQ_ENABLED);
2436+ enable_irq(host->wake_irq);
2437+ host->flags |= HSMMC_WAKE_IRQ_ENABLED;
2438+ } else {
2439+ pinctrl_pm_select_idle_state(dev);
2440+ }
2441+
2442+abort:
2443+ spin_unlock_irqrestore(&host->irq_lock, flags);
2444+ return ret;
22242445 }
22252446
22262447 static int omap_hsmmc_runtime_resume(struct device *dev)
22272448 {
22282449 struct omap_hsmmc_host *host;
2450+ unsigned long flags;
22292451
22302452 host = platform_get_drvdata(to_platform_device(dev));
22312453 omap_hsmmc_context_restore(host);
22322454 dev_dbg(dev, "enabled\n");
22332455
2456+ spin_lock_irqsave(&host->irq_lock, flags);
2457+ if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
2458+ (host->flags & HSMMC_SDIO_IRQ_ENABLED)) {
2459+ /* sdio irq flag can't change while in runtime suspend */
2460+ if (host->flags & HSMMC_WAKE_IRQ_ENABLED) {
2461+ disable_irq_nosync(host->wake_irq);
2462+ host->flags &= ~HSMMC_WAKE_IRQ_ENABLED;
2463+ }
2464+
2465+ pinctrl_pm_select_default_state(host->dev);
2466+
2467+ /* irq lost, if pinmux incorrect */
2468+ OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR);
2469+ OMAP_HSMMC_WRITE(host->base, ISE, CIRQ_EN);
2470+ OMAP_HSMMC_WRITE(host->base, IE, CIRQ_EN);
2471+ } else {
2472+ pinctrl_pm_select_default_state(host->dev);
2473+ }
2474+ spin_unlock_irqrestore(&host->irq_lock, flags);
22342475 return 0;
22352476 }
22362477
drivers/mmc/host/s3cmci.c+53−133
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 */
1313
1414 #include <linux/module.h>
15+#include <linux/dmaengine.h>
1516 #include <linux/dma-mapping.h>
1617 #include <linux/clk.h>
1718 #include <linux/mmc/host.h>
@@ -27,6 +28,7 @@ · 9 unmodified lines
2728 #include <mach/dma.h>
2829 #include <mach/gpio-samsung.h>
2930
31+#include <linux/platform_data/dma-s3c24xx.h>
3032 #include <linux/platform_data/mmc-s3cmci.h>
3133
3234 #include "s3cmci.h"
@@ -140,10 +142,6 @@ static const int dbgmap_debug = dbg_err | dbg_debug; · 107 unmodified lines
140142 dev_dbg(&host->pdev->dev, args); \
141143 } while (0)
142144
143−static struct s3c2410_dma_client s3cmci_dma_client = {
144− .name = "s3c-mci",
145−};
146−
147145 static void finalize_request(struct s3cmci_host *host);
148146 static void s3cmci_send_request(struct mmc_host *mmc);
149147 static void s3cmci_reset(struct s3cmci_host *host);
@@ -256,25 +254,8 @@ static inline bool s3cmci_host_usedma(struct s3cmci_host *host) · 106 unmodified lines
256254 {
257255 #ifdef CONFIG_MMC_S3C_PIO
258256 return false;
259−#elif defined(CONFIG_MMC_S3C_DMA)
257+#else /* CONFIG_MMC_S3C_DMA */
260258 return true;
261−#else
262− return host->dodma;
263−#endif
264−}
265−
266−/**
267− * s3cmci_host_canpio - return true if host has pio code available
268− *
269− * Return true if the driver has been compiled with the PIO support code
270− * available.
271− */
272−static inline bool s3cmci_host_canpio(void)
273−{
274−#ifdef CONFIG_MMC_S3C_PIO
275− return true;
276−#else
277− return false;
278259 #endif
279260 }
280261
@@ -841,60 +822,24 @@ static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) · 560 unmodified lines
841822 return IRQ_HANDLED;
842823 }
843824
844−static void s3cmci_dma_done_callback(struct s3c2410_dma_chan *dma_ch,
845− void *buf_id, int size,
846− enum s3c2410_dma_buffresult result)
825+static void s3cmci_dma_done_callback(void *arg)
847826 {
848− struct s3cmci_host *host = buf_id;
827+ struct s3cmci_host *host = arg;
849828 unsigned long iflags;
850− u32 mci_csta, mci_dsta, mci_fsta, mci_dcnt;
851−
852− mci_csta = readl(host->base + S3C2410_SDICMDSTAT);
853− mci_dsta = readl(host->base + S3C2410_SDIDSTA);
854− mci_fsta = readl(host->base + S3C2410_SDIFSTA);
855− mci_dcnt = readl(host->base + S3C2410_SDIDCNT);
856829
857830 BUG_ON(!host->mrq);
858831 BUG_ON(!host->mrq->data);
859− BUG_ON(!host->dmatogo);
860832
861833 spin_lock_irqsave(&host->complete_lock, iflags);
862834
863− if (result != S3C2410_RES_OK) {
864− dbg(host, dbg_fail, "DMA FAILED: csta=0x%08x dsta=0x%08x "
865− "fsta=0x%08x dcnt:0x%08x result:0x%08x toGo:%u\n",
866− mci_csta, mci_dsta, mci_fsta,
867− mci_dcnt, result, host->dmatogo);
868−
869− goto fail_request;
870− }
871−
872− host->dmatogo--;
873− if (host->dmatogo) {
874− dbg(host, dbg_dma, "DMA DONE Size:%i DSTA:[%08x] "
875− "DCNT:[%08x] toGo:%u\n",
876− size, mci_dsta, mci_dcnt, host->dmatogo);
877−
878− goto out;
879− }
880−
881− dbg(host, dbg_dma, "DMA FINISHED Size:%i DSTA:%08x DCNT:%08x\n",
882− size, mci_dsta, mci_dcnt);
835+ dbg(host, dbg_dma, "DMA FINISHED\n");
883836
884837 host->dma_complete = 1;
885838 host->complete_what = COMPLETION_FINALIZE;
886839
887−out:
888840 tasklet_schedule(&host->pio_tasklet);
889841 spin_unlock_irqrestore(&host->complete_lock, iflags);
890− return;
891842
892−fail_request:
893− host->mrq->data->error = -EINVAL;
894− host->complete_what = COMPLETION_FINALIZE;
895− clear_imask(host);
896−
897− goto out;
898843 }
899844
900845 static void finalize_request(struct s3cmci_host *host)
@@ -966,7 +911,7 @@ static void finalize_request(struct s3cmci_host *host) · 65 unmodified lines
966911 * DMA channel and the fifo to clear out any garbage. */
967912 if (mrq->data->error != 0) {
968913 if (s3cmci_host_usedma(host))
969− s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH);
914+ dmaengine_terminate_all(host->dma);
970915
971916 if (host->is2440) {
972917 /* Clear failure register and reset fifo. */
@@ -992,29 +937,6 @@ request_done: · 19 unmodified lines
992937 mmc_request_done(host->mmc, mrq);
993938 }
994939
995−static void s3cmci_dma_setup(struct s3cmci_host *host,
996− enum dma_data_direction source)
997−{
998− static enum dma_data_direction last_source = -1;
999− static int setup_ok;
1000−
1001− if (last_source == source)
1002− return;
1003−
1004− last_source = source;
1005−
1006− s3c2410_dma_devconfig(host->dma, source,
1007− host->mem->start + host->sdidata);
1008−
1009− if (!setup_ok) {
1010− s3c2410_dma_config(host->dma, 4);
1011− s3c2410_dma_set_buffdone_fn(host->dma,
1012− s3cmci_dma_done_callback);
1013− s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART);
1014− setup_ok = 1;
1015− }
1016−}
1017−
1018940 static void s3cmci_send_command(struct s3cmci_host *host,
1019941 struct mmc_command *cmd)
1020942 {
@@ -1162,43 +1084,45 @@ static int s3cmci_prepare_pio(struct s3cmci_host *host, struct mmc_data *data) · 141 unmodified lines
11621084
11631085 static int s3cmci_prepare_dma(struct s3cmci_host *host, struct mmc_data *data)
11641086 {
1165− int dma_len, i;
11661087 int rw = data->flags & MMC_DATA_WRITE;
1088+ struct dma_async_tx_descriptor *desc;
1089+ struct dma_slave_config conf = {
1090+ .src_addr = host->mem->start + host->sdidata,
1091+ .dst_addr = host->mem->start + host->sdidata,
1092+ .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
1093+ .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
1094+ };
11671095
11681096 BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR);
11691097
1170− s3cmci_dma_setup(host, rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1171− s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH);
1172−
1173− dma_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
1174− rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1175−
1176− if (dma_len == 0)
1177− return -ENOMEM;
1178−
1179− host->dma_complete = 0;
1180− host->dmatogo = dma_len;
1181−
1182− for (i = 0; i < dma_len; i++) {
1183− int res;
1184−
1185− dbg(host, dbg_dma, "enqueue %i: %08x@%u\n", i,
1186− sg_dma_address(&data->sg[i]),
1187− sg_dma_len(&data->sg[i]));
1098+ /* Restore prescaler value */
1099+ writel(host->prescaler, host->base + S3C2410_SDIPRE);
11881100
1189− res = s3c2410_dma_enqueue(host->dma, host,
1190− sg_dma_address(&data->sg[i]),
1191− sg_dma_len(&data->sg[i]));
1101+ if (!rw)
1102+ conf.direction = DMA_DEV_TO_MEM;
1103+ else
1104+ conf.direction = DMA_MEM_TO_DEV;
11921105
1193− if (res) {
1194− s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH);
1195− return -EBUSY;
1196− }
1197− }
1106+ dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
1107+ rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
11981108
1199− s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_START);
1109+ dmaengine_slave_config(host->dma, &conf);
1110+ desc = dmaengine_prep_slave_sg(host->dma, data->sg, data->sg_len,
1111+ conf.direction,
1112+ DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
1113+ if (!desc)
1114+ goto unmap_exit;
1115+ desc->callback = s3cmci_dma_done_callback;
1116+ desc->callback_param = host;
1117+ dmaengine_submit(desc);
1118+ dma_async_issue_pending(host->dma);
12001119
12011120 return 0;
1121+
1122+unmap_exit:
1123+ dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
1124+ rw ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1125+ return -ENOMEM;
12021126 }
12031127
12041128 static void s3cmci_send_request(struct mmc_host *mmc)
@@ -1676,10 +1600,6 @@ static int s3cmci_probe(struct platform_device *pdev) · 471 unmodified lines
16761600 host->complete_what = COMPLETION_NONE;
16771601 host->pio_active = XFER_NONE;
16781602
1679−#ifdef CONFIG_MMC_S3C_PIODMA
1680− host->dodma = host->pdata->use_dma;
1681−#endif
1682−
16831603 host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
16841604 if (!host->mem) {
16851605 dev_err(&pdev->dev,
@@ -1765,17 +1685,17 @@ static int s3cmci_probe(struct platform_device *pdev) · 79 unmodified lines
17651685 /* depending on the dma state, get a dma channel to use. */
17661686
17671687 if (s3cmci_host_usedma(host)) {
1768− host->dma = s3c2410_dma_request(DMACH_SDI, &s3cmci_dma_client,
1769− host);
1770− if (host->dma < 0) {
1688+ dma_cap_mask_t mask;
1689+
1690+ dma_cap_zero(mask);
1691+ dma_cap_set(DMA_SLAVE, mask);
1692+
1693+ host->dma = dma_request_slave_channel_compat(mask,
1694+ s3c24xx_dma_filter, (void *)DMACH_SDI, &pdev->dev, "rx-tx");
1695+ if (!host->dma) {
17711696 dev_err(&pdev->dev, "cannot get DMA channel.\n");
1772− if (!s3cmci_host_canpio()) {
1773− ret = -EBUSY;
1774− goto probe_free_gpio_wp;
1775− } else {
1776− dev_warn(&pdev->dev, "falling back to PIO.\n");
1777− host->dodma = 0;
1778− }
1697+ ret = -EBUSY;
1698+ goto probe_free_gpio_wp;
17791699 }
17801700 }
17811701
@@ -1787,7 +1707,7 @@ static int s3cmci_probe(struct platform_device *pdev) · 5 unmodified lines
17871707 goto probe_free_dma;
17881708 }
17891709
1790− ret = clk_enable(host->clk);
1710+ ret = clk_prepare_enable(host->clk);
17911711 if (ret) {
17921712 dev_err(&pdev->dev, "failed to enable clock source.\n");
17931713 goto clk_free;
@@ -1816,7 +1736,7 @@ static int s3cmci_probe(struct platform_device *pdev) · 22 unmodified lines
18161736 mmc->max_segs = 128;
18171737
18181738 dbg(host, dbg_debug,
1819− "probe: mode:%s mapped mci_base:%p irq:%u irq_cd:%u dma:%u.\n",
1739+ "probe: mode:%s mapped mci_base:%p irq:%u irq_cd:%u dma:%p.\n",
18201740 (host->is2440?"2440":""),
18211741 host->base, host->irq, host->irq_cd, host->dma);
18221742
@@ -1845,14 +1765,14 @@ static int s3cmci_probe(struct platform_device *pdev) · 22 unmodified lines
18451765 s3cmci_cpufreq_deregister(host);
18461766
18471767 free_dmabuf:
1848− clk_disable(host->clk);
1768+ clk_disable_unprepare(host->clk);
18491769
18501770 clk_free:
18511771 clk_put(host->clk);
18521772
18531773 probe_free_dma:
18541774 if (s3cmci_host_usedma(host))
1855− s3c2410_dma_free(host->dma, &s3cmci_dma_client);
1775+ dma_release_channel(host->dma);
18561776
18571777 probe_free_gpio_wp:
18581778 if (!host->pdata->no_wprotect)
@@ -1897,7 +1817,7 @@ static void s3cmci_shutdown(struct platform_device *pdev) · 38 unmodified lines
18971817 s3cmci_debugfs_remove(host);
18981818 s3cmci_cpufreq_deregister(host);
18991819 mmc_remove_host(mmc);
1900− clk_disable(host->clk);
1820+ clk_disable_unprepare(host->clk);
19011821 }
19021822
19031823 static int s3cmci_remove(struct platform_device *pdev)
@@ -1914,7 +1834,7 @@ static int s3cmci_remove(struct platform_device *pdev) · 10 unmodified lines
19141834 tasklet_disable(&host->pio_tasklet);
19151835
19161836 if (s3cmci_host_usedma(host))
1917− s3c2410_dma_free(host->dma, &s3cmci_dma_client);
1837+ dma_release_channel(host->dma);
19181838
19191839 free_irq(host->irq, host);
19201840
drivers/mmc/host/s3cmci.h+1−3
@@ -26,7 +26,7 @@ struct s3cmci_host { · 25 unmodified lines
2626 void __iomem *base;
2727 int irq;
2828 int irq_cd;
29− int dma;
29+ struct dma_chan *dma;
3030
3131 unsigned long clk_rate;
3232 unsigned long clk_div;
@@ -36,8 +36,6 @@ struct s3cmci_host { · 3 unmodified lines
3636 int is2440;
3737 unsigned sdiimsk;
3838 unsigned sdidata;
39− int dodma;
40− int dmatogo;
4139
4240 bool irq_disabled;
4341 bool irq_enabled;
drivers/mmc/host/sdhci-acpi.c+3−1
@@ -124,9 +124,11 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { · 123 unmodified lines
124124
125125 static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
126126 .chip = &sdhci_acpi_chip_int,
127− .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_HW_RESET,
127+ .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
128+ MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR,
128129 .caps2 = MMC_CAP2_HC_ERASE_SZ,
129130 .flags = SDHCI_ACPI_RUNTIME_PM,
131+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
130132 };
131133
132134 static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
drivers/mmc/host/sdhci-msm.c+0−1
@@ -16,7 +16,6 @@ · 15 unmodified lines
1616
1717 #include <linux/module.h>
1818 #include <linux/of_device.h>
19−#include <linux/regulator/consumer.h>
2019 #include <linux/delay.h>
2120 #include <linux/mmc/mmc.h>
2221 #include <linux/slab.h>
drivers/mmc/host/sdhci-pci.c+20−18
@@ -103,6 +103,10 @@ static const struct sdhci_pci_fixes sdhci_cafe = { · 102 unmodified lines
103103 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
104104 };
105105
106+static const struct sdhci_pci_fixes sdhci_intel_qrk = {
107+ .quirks = SDHCI_QUIRK_NO_HISPD_BIT,
108+};
109+
106110 static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
107111 {
108112 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
@@ -264,7 +268,7 @@ static void sdhci_pci_int_hw_reset(struct sdhci_host *host) · 155 unmodified lines
264268 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
265269 {
266270 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
267− MMC_CAP_HW_RESET;
271+ MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR;
268272 slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
269273 slot->hw_reset = sdhci_pci_int_hw_reset;
270274 return 0;
@@ -279,6 +283,7 @@ static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot) · 8 unmodified lines
279283 static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = {
280284 .allow_runtime_pm = true,
281285 .probe_slot = byt_emmc_probe_slot,
286+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
282287 };
283288
284289 static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = {
@@ -751,6 +756,14 @@ static const struct pci_device_id pci_ids[] = { · 466 unmodified lines
751756 .driver_data = (kernel_ulong_t)&sdhci_rtsx,
752757 },
753758
759+ {
760+ .vendor = PCI_VENDOR_ID_INTEL,
761+ .device = PCI_DEVICE_ID_INTEL_QRK_SD,
762+ .subvendor = PCI_ANY_ID,
763+ .subdevice = PCI_ANY_ID,
764+ .driver_data = (kernel_ulong_t)&sdhci_intel_qrk,
765+ },
766+
754767 {
755768 .vendor = PCI_VENDOR_ID_INTEL,
756769 .device = PCI_DEVICE_ID_INTEL_MRST_SD0,
@@ -1130,18 +1143,13 @@ static int sdhci_pci_suspend(struct device *dev) · 373 unmodified lines
11301143 goto err_pci_suspend;
11311144 }
11321145
1133− pci_save_state(pdev);
11341146 if (pm_flags & MMC_PM_KEEP_POWER) {
1135− if (pm_flags & MMC_PM_WAKE_SDIO_IRQ) {
1136− pci_pme_active(pdev, true);
1137− pci_enable_wake(pdev, PCI_D3hot, 1);
1138− }
1139− pci_set_power_state(pdev, PCI_D3hot);
1140− } else {
1141− pci_enable_wake(pdev, PCI_D3hot, 0);
1142− pci_disable_device(pdev);
1143− pci_set_power_state(pdev, PCI_D3hot);
1144− }
1147+ if (pm_flags & MMC_PM_WAKE_SDIO_IRQ)
1148+ device_init_wakeup(dev, true);
1149+ else
1150+ device_init_wakeup(dev, false);
1151+ } else
1152+ device_init_wakeup(dev, false);
11451153
11461154 return 0;
11471155
@@ -1162,12 +1170,6 @@ static int sdhci_pci_resume(struct device *dev) · 14 unmodified lines
11621170 if (!chip)
11631171 return 0;
11641172
1165− pci_set_power_state(pdev, PCI_D0);
1166− pci_restore_state(pdev);
1167− ret = pci_enable_device(pdev);
1168− if (ret)
1169− return ret;
1170−
11711173 if (chip->fixes && chip->fixes->resume) {
11721174 ret = chip->fixes->resume(chip);
11731175 if (ret)
drivers/mmc/host/sdhci-pci.h+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #define PCI_DEVICE_ID_INTEL_CLV_SDIO2 0x08fb
1818 #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5
1919 #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6
20+#define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7
2021
2122 /*
2223 * PCI registers
drivers/mmc/host/sdhci-pxav3.c+3−10
@@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) · 287 unmodified lines
288288 int ret;
289289 struct clk *clk;
290290
291− pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL);
291+ pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
292292 if (!pxa)
293293 return -ENOMEM;
294294
295295 host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
296− if (IS_ERR(host)) {
297− kfree(pxa);
296+ if (IS_ERR(host))
298297 return PTR_ERR(host);
299− }
300298
301299 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
302300 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
@@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) · 5 unmodified lines
308306 pltfm_host = sdhci_priv(host);
309307 pltfm_host->priv = pxa;
310308
311− clk = clk_get(dev, NULL);
309+ clk = devm_clk_get(dev, NULL);
312310 if (IS_ERR(clk)) {
313311 dev_err(dev, "failed to get io clock\n");
314312 ret = PTR_ERR(clk);
@@ -389,11 +387,9 @@ err_add_host: · 74 unmodified lines
389387 pm_runtime_put_sync(&pdev->dev);
390388 pm_runtime_disable(&pdev->dev);
391389 clk_disable_unprepare(clk);
392− clk_put(clk);
393390 err_clk_get:
394391 err_mbus_win:
395392 sdhci_pltfm_free(pdev);
396− kfree(pxa);
397393 return ret;
398394 }
399395
@@ -401,17 +397,14 @@ static int sdhci_pxav3_remove(struct platform_device *pdev) · 1 unmodified line
401397 {
402398 struct sdhci_host *host = platform_get_drvdata(pdev);
403399 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
404− struct sdhci_pxa *pxa = pltfm_host->priv;
405400
406401 pm_runtime_get_sync(&pdev->dev);
407402 sdhci_remove_host(host, 1);
408403 pm_runtime_disable(&pdev->dev);
409404
410405 clk_disable_unprepare(pltfm_host->clk);
411− clk_put(pltfm_host->clk);
412406
413407 sdhci_pltfm_free(pdev);
414− kfree(pxa);
415408
416409 return 0;
417410 }
drivers/mmc/host/sdhci-st.c+176−0
@@ -0,0 +1,176 @@
1+/*
2+ * Support for SDHCI on STMicroelectronics SoCs
3+ *
4+ * Copyright (C) 2014 STMicroelectronics Ltd
5+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
6+ * Contributors: Peter Griffin <peter.griffin@linaro.org>
7+ *
8+ * Based on sdhci-cns3xxx.c
9+ *
10+ * This program is free software; you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License version 2 as
12+ * published by the Free Software Foundation.
13+ *
14+ * This program is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ */
20+
21+#include <linux/io.h>
22+#include <linux/of.h>
23+#include <linux/module.h>
24+#include <linux/err.h>
25+#include <linux/mmc/host.h>
26+
27+#include "sdhci-pltfm.h"
28+
29+static u32 sdhci_st_readl(struct sdhci_host *host, int reg)
30+{
31+ u32 ret;
32+
33+ switch (reg) {
34+ case SDHCI_CAPABILITIES:
35+ ret = readl_relaxed(host->ioaddr + reg);
36+ /* Support 3.3V and 1.8V */
37+ ret &= ~SDHCI_CAN_VDD_300;
38+ break;
39+ default:
40+ ret = readl_relaxed(host->ioaddr + reg);
41+ }
42+ return ret;
43+}
44+
45+static const struct sdhci_ops sdhci_st_ops = {
46+ .get_max_clock = sdhci_pltfm_clk_get_max_clock,
47+ .set_clock = sdhci_set_clock,
48+ .set_bus_width = sdhci_set_bus_width,
49+ .read_l = sdhci_st_readl,
50+ .reset = sdhci_reset,
51+};
52+
53+static const struct sdhci_pltfm_data sdhci_st_pdata = {
54+ .ops = &sdhci_st_ops,
55+ .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
56+ SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
57+};
58+
59+
60+static int sdhci_st_probe(struct platform_device *pdev)
61+{
62+ struct sdhci_host *host;
63+ struct sdhci_pltfm_host *pltfm_host;
64+ struct clk *clk;
65+ int ret = 0;
66+ u16 host_version;
67+
68+ clk = devm_clk_get(&pdev->dev, "mmc");
69+ if (IS_ERR(clk)) {
70+ dev_err(&pdev->dev, "Peripheral clk not found\n");
71+ return PTR_ERR(clk);
72+ }
73+
74+ host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
75+ if (IS_ERR(host)) {
76+ dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
77+ return PTR_ERR(host);
78+ }
79+
80+ ret = mmc_of_parse(host->mmc);
81+
82+ if (ret) {
83+ dev_err(&pdev->dev, "Failed mmc_of_parse\n");
84+ return ret;
85+ }
86+
87+ clk_prepare_enable(clk);
88+
89+ pltfm_host = sdhci_priv(host);
90+ pltfm_host->clk = clk;
91+
92+ ret = sdhci_add_host(host);
93+ if (ret) {
94+ dev_err(&pdev->dev, "Failed sdhci_add_host\n");
95+ goto err_out;
96+ }
97+
98+ platform_set_drvdata(pdev, host);
99+
100+ host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
101+
102+ dev_info(&pdev->dev, "SDHCI ST Initialised: Host Version: 0x%x Vendor Version 0x%x\n",
103+ ((host_version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT),
104+ ((host_version & SDHCI_VENDOR_VER_MASK) >>
105+ SDHCI_VENDOR_VER_SHIFT));
106+
107+ return 0;
108+
109+err_out:
110+ clk_disable_unprepare(clk);
111+ sdhci_pltfm_free(pdev);
112+
113+ return ret;
114+}
115+
116+static int sdhci_st_remove(struct platform_device *pdev)
117+{
118+ struct sdhci_host *host = platform_get_drvdata(pdev);
119+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
120+
121+ clk_disable_unprepare(pltfm_host->clk);
122+
123+ return sdhci_pltfm_unregister(pdev);
124+}
125+
126+#ifdef CONFIG_PM_SLEEP
127+static int sdhci_st_suspend(struct device *dev)
128+{
129+ struct sdhci_host *host = dev_get_drvdata(dev);
130+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
131+ int ret = sdhci_suspend_host(host);
132+
133+ if (ret)
134+ goto out;
135+
136+ clk_disable_unprepare(pltfm_host->clk);
137+out:
138+ return ret;
139+}
140+
141+static int sdhci_st_resume(struct device *dev)
142+{
143+ struct sdhci_host *host = dev_get_drvdata(dev);
144+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
145+
146+ clk_prepare_enable(pltfm_host->clk);
147+
148+ return sdhci_resume_host(host);
149+}
150+#endif
151+
152+static SIMPLE_DEV_PM_OPS(sdhci_st_pmops, sdhci_st_suspend, sdhci_st_resume);
153+
154+static const struct of_device_id st_sdhci_match[] = {
155+ { .compatible = "st,sdhci" },
156+ {},
157+};
158+
159+MODULE_DEVICE_TABLE(of, st_sdhci_match);
160+
161+static struct platform_driver sdhci_st_driver = {
162+ .probe = sdhci_st_probe,
163+ .remove = sdhci_st_remove,
164+ .driver = {
165+ .name = "sdhci-st",
166+ .pm = &sdhci_st_pmops,
167+ .of_match_table = of_match_ptr(st_sdhci_match),
168+ },
169+};
170+
171+module_platform_driver(sdhci_st_driver);
172+
173+MODULE_DESCRIPTION("SDHCI driver for STMicroelectronics SoCs");
174+MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
175+MODULE_LICENSE("GPL v2");
176+MODULE_ALIAS("platform:st-sdhci");
drivers/mmc/host/sdhci-tegra.c+0−2
@@ -26,8 +26,6 @@ · 25 unmodified lines
2626 #include <linux/mmc/host.h>
2727 #include <linux/mmc/slot-gpio.h>
2828
29−#include <asm/gpio.h>
30−
3129 #include "sdhci-pltfm.h"
3230
3331 /* Tegra SDHOST controller vendor register definitions */
drivers/mmc/host/sdhci.c+58−86
@@ -1223,8 +1223,16 @@ EXPORT_SYMBOL_GPL(sdhci_set_clock); · 1222 unmodified lines
12231223 static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
12241224 unsigned short vdd)
12251225 {
1226+ struct mmc_host *mmc = host->mmc;
12261227 u8 pwr = 0;
12271228
1229+ if (!IS_ERR(mmc->supply.vmmc)) {
1230+ spin_unlock_irq(&host->lock);
1231+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
1232+ spin_lock_irq(&host->lock);
1233+ return;
1234+ }
1235+
12281236 if (mode != MMC_POWER_OFF) {
12291237 switch (1 << vdd) {
12301238 case MMC_VDD_165_195:
@@ -1283,12 +1291,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, · 52 unmodified lines
12831291 if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
12841292 mdelay(10);
12851293 }
1286−
1287− if (host->vmmc) {
1288− spin_unlock_irq(&host->lock);
1289− mmc_regulator_set_ocr(host->mmc, host->vmmc, vdd);
1290− spin_lock_irq(&host->lock);
1291− }
12921294 }
12931295
12941296 /*****************************************************************************\
@@ -1440,13 +1442,15 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) · 145 unmodified lines
14401442 {
14411443 unsigned long flags;
14421444 u8 ctrl;
1445+ struct mmc_host *mmc = host->mmc;
14431446
14441447 spin_lock_irqsave(&host->lock, flags);
14451448
14461449 if (host->flags & SDHCI_DEVICE_DEAD) {
14471450 spin_unlock_irqrestore(&host->lock, flags);
1448− if (host->vmmc && ios->power_mode == MMC_POWER_OFF)
1449− mmc_regulator_set_ocr(host->mmc, host->vmmc, 0);
1451+ if (!IS_ERR(mmc->supply.vmmc) &&
1452+ ios->power_mode == MMC_POWER_OFF)
1453+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
14501454 return;
14511455 }
14521456
@@ -1530,7 +1534,6 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) · 77 unmodified lines
15301534 host->ops->set_clock(host, host->clock);
15311535 }
15321536
1533−
15341537 /* Reset SD Clock Enable */
15351538 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
15361539 clk &= ~SDHCI_CLOCK_CARD_EN;
@@ -1707,6 +1710,7 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) · 170 unmodified lines
17071710 static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
17081711 struct mmc_ios *ios)
17091712 {
1713+ struct mmc_host *mmc = host->mmc;
17101714 u16 ctrl;
17111715 int ret;
17121716
@@ -1725,11 +1729,12 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, · 12 unmodified lines
17251729 ctrl &= ~SDHCI_CTRL_VDD_180;
17261730 sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
17271731
1728− if (host->vqmmc) {
1729− ret = regulator_set_voltage(host->vqmmc, 2700000, 3600000);
1732+ if (!IS_ERR(mmc->supply.vqmmc)) {
1733+ ret = regulator_set_voltage(mmc->supply.vqmmc, 2700000,
1734+ 3600000);
17301735 if (ret) {
17311736 pr_warning("%s: Switching to 3.3V signalling voltage "
1732− " failed\n", mmc_hostname(host->mmc));
1737+ " failed\n", mmc_hostname(mmc));
17331738 return -EIO;
17341739 }
17351740 }
@@ -1742,16 +1747,16 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, · 6 unmodified lines
17421747 return 0;
17431748
17441749 pr_warning("%s: 3.3V regulator output did not became stable\n",
1745− mmc_hostname(host->mmc));
1750+ mmc_hostname(mmc));
17461751
17471752 return -EAGAIN;
17481753 case MMC_SIGNAL_VOLTAGE_180:
1749− if (host->vqmmc) {
1750− ret = regulator_set_voltage(host->vqmmc,
1754+ if (!IS_ERR(mmc->supply.vqmmc)) {
1755+ ret = regulator_set_voltage(mmc->supply.vqmmc,
17511756 1700000, 1950000);
17521757 if (ret) {
17531758 pr_warning("%s: Switching to 1.8V signalling voltage "
1754− " failed\n", mmc_hostname(host->mmc));
1759+ " failed\n", mmc_hostname(mmc));
17551760 return -EIO;
17561761 }
17571762 }
@@ -1763,24 +1768,22 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, · 5 unmodified lines
17631768 ctrl |= SDHCI_CTRL_VDD_180;
17641769 sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
17651770
1766− /* Wait for 5ms */
1767− usleep_range(5000, 5500);
1768−
17691771 /* 1.8V regulator output should be stable within 5 ms */
17701772 ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
17711773 if (ctrl & SDHCI_CTRL_VDD_180)
17721774 return 0;
17731775
17741776 pr_warning("%s: 1.8V regulator output did not became stable\n",
1775− mmc_hostname(host->mmc));
1777+ mmc_hostname(mmc));
17761778
17771779 return -EAGAIN;
17781780 case MMC_SIGNAL_VOLTAGE_120:
1779− if (host->vqmmc) {
1780− ret = regulator_set_voltage(host->vqmmc, 1100000, 1300000);
1781+ if (!IS_ERR(mmc->supply.vqmmc)) {
1782+ ret = regulator_set_voltage(mmc->supply.vqmmc, 1100000,
1783+ 1300000);
17811784 if (ret) {
17821785 pr_warning("%s: Switching to 1.2V signalling voltage "
1783− " failed\n", mmc_hostname(host->mmc));
1786+ " failed\n", mmc_hostname(mmc));
17841787 return -EIO;
17851788 }
17861789 }
@@ -2643,7 +2646,6 @@ static void sdhci_runtime_pm_bus_off(struct sdhci_host *host) · 856 unmodified lines
26432646 int sdhci_runtime_suspend_host(struct sdhci_host *host)
26442647 {
26452648 unsigned long flags;
2646− int ret = 0;
26472649
26482650 /* Disable tuning since we are suspending */
26492651 if (host->flags & SDHCI_USING_RETUNING_TIMER) {
@@ -2663,14 +2665,14 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host) · 13 unmodified lines
26632665 host->runtime_suspended = true;
26642666 spin_unlock_irqrestore(&host->lock, flags);
26652667
2666− return ret;
2668+ return 0;
26672669 }
26682670 EXPORT_SYMBOL_GPL(sdhci_runtime_suspend_host);
26692671
26702672 int sdhci_runtime_resume_host(struct sdhci_host *host)
26712673 {
26722674 unsigned long flags;
2673− int ret = 0, host_flags = host->flags;
2675+ int host_flags = host->flags;
26742676
26752677 if (host_flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
26762678 if (host->ops->enable_dma)
@@ -2709,7 +2711,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host) · 32 unmodified lines
27092711
27102712 spin_unlock_irqrestore(&host->lock, flags);
27112713
2712− return ret;
2714+ return 0;
27132715 }
27142716 EXPORT_SYMBOL_GPL(sdhci_runtime_resume_host);
27152717
@@ -2820,12 +2822,12 @@ int sdhci_add_host(struct sdhci_host *host) · 104 unmodified lines
28202822 * (128) and potentially one alignment transfer for
28212823 * each of those entries.
28222824 */
2823− host->adma_desc = dma_alloc_coherent(mmc_dev(host->mmc),
2825+ host->adma_desc = dma_alloc_coherent(mmc_dev(mmc),
28242826 ADMA_SIZE, &host->adma_addr,
28252827 GFP_KERNEL);
28262828 host->align_buffer = kmalloc(128 * 4, GFP_KERNEL);
28272829 if (!host->adma_desc || !host->align_buffer) {
2828− dma_free_coherent(mmc_dev(host->mmc), ADMA_SIZE,
2830+ dma_free_coherent(mmc_dev(mmc), ADMA_SIZE,
28292831 host->adma_desc, host->adma_addr);
28302832 kfree(host->align_buffer);
28312833 pr_warning("%s: Unable to allocate ADMA "
@@ -2838,7 +2840,7 @@ int sdhci_add_host(struct sdhci_host *host) · 6 unmodified lines
28382840 pr_warning("%s: unable to allocate aligned ADMA descriptor\n",
28392841 mmc_hostname(mmc));
28402842 host->flags &= ~SDHCI_USE_ADMA;
2841− dma_free_coherent(mmc_dev(host->mmc), ADMA_SIZE,
2843+ dma_free_coherent(mmc_dev(mmc), ADMA_SIZE,
28422844 host->adma_desc, host->adma_addr);
28432845 kfree(host->align_buffer);
28442846 host->adma_desc = NULL;
@@ -2853,7 +2855,7 @@ int sdhci_add_host(struct sdhci_host *host) · 8 unmodified lines
28532855 */
28542856 if (!(host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA))) {
28552857 host->dma_mask = DMA_BIT_MASK(64);
2856− mmc_dev(host->mmc)->dma_mask = &host->dma_mask;
2858+ mmc_dev(mmc)->dma_mask = &host->dma_mask;
28572859 }
28582860
28592861 if (host->version >= SDHCI_SPEC_300)
@@ -2959,28 +2961,25 @@ int sdhci_add_host(struct sdhci_host *host) · 99 unmodified lines
29592961 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
29602962
29612963 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
2962− !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
2964+ !(mmc->caps & MMC_CAP_NONREMOVABLE))
29632965 mmc->caps |= MMC_CAP_NEEDS_POLL;
29642966
2967+ /* If there are external regulators, get them */
2968+ if (mmc_regulator_get_supply(mmc) == -EPROBE_DEFER)
2969+ return -EPROBE_DEFER;
2970+
29652971 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
2966− host->vqmmc = regulator_get_optional(mmc_dev(mmc), "vqmmc");
2967− if (IS_ERR_OR_NULL(host->vqmmc)) {
2968− if (PTR_ERR(host->vqmmc) < 0) {
2969− pr_info("%s: no vqmmc regulator found\n",
2970− mmc_hostname(mmc));
2971− host->vqmmc = NULL;
2972− }
2973− } else {
2974− ret = regulator_enable(host->vqmmc);
2975− if (!regulator_is_supported_voltage(host->vqmmc, 1700000,
2976− 1950000))
2972+ if (!IS_ERR(mmc->supply.vqmmc)) {
2973+ ret = regulator_enable(mmc->supply.vqmmc);
2974+ if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 1700000,
2975+ 1950000))
29772976 caps[1] &= ~(SDHCI_SUPPORT_SDR104 |
29782977 SDHCI_SUPPORT_SDR50 |
29792978 SDHCI_SUPPORT_DDR50);
29802979 if (ret) {
29812980 pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
29822981 mmc_hostname(mmc), ret);
2983− host->vqmmc = NULL;
2982+ mmc->supply.vqmmc = NULL;
29842983 }
29852984 }
29862985
@@ -3041,34 +3040,6 @@ int sdhci_add_host(struct sdhci_host *host) · 54 unmodified lines
30413040
30423041 ocr_avail = 0;
30433042
3044− host->vmmc = regulator_get_optional(mmc_dev(mmc), "vmmc");
3045− if (IS_ERR_OR_NULL(host->vmmc)) {
3046− if (PTR_ERR(host->vmmc) < 0) {
3047− pr_info("%s: no vmmc regulator found\n",
3048− mmc_hostname(mmc));
3049− host->vmmc = NULL;
3050− }
3051− }
3052−
3053−#ifdef CONFIG_REGULATOR
3054− /*
3055− * Voltage range check makes sense only if regulator reports
3056− * any voltage value.
3057− */
3058− if (host->vmmc && regulator_get_voltage(host->vmmc) > 0) {
3059− ret = regulator_is_supported_voltage(host->vmmc, 2700000,
3060− 3600000);
3061− if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))
3062− caps[0] &= ~SDHCI_CAN_VDD_330;
3063− if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300)))
3064− caps[0] &= ~SDHCI_CAN_VDD_300;
3065− ret = regulator_is_supported_voltage(host->vmmc, 1700000,
3066− 1950000);
3067− if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180)))
3068− caps[0] &= ~SDHCI_CAN_VDD_180;
3069− }
3070−#endif /* CONFIG_REGULATOR */
3071−
30723043 /*
30733044 * According to SD Host Controller spec v3.00, if the Host System
30743045 * can afford more than 150mA, Host Driver should set XPC to 1. Also
@@ -3077,8 +3048,8 @@ int sdhci_add_host(struct sdhci_host *host) · 2 unmodified lines
30773048 * value.
30783049 */
30793050 max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT);
3080− if (!max_current_caps && host->vmmc) {
3081− u32 curr = regulator_get_current_limit(host->vmmc);
3051+ if (!max_current_caps && !IS_ERR(mmc->supply.vmmc)) {
3052+ u32 curr = regulator_get_current_limit(mmc->supply.vmmc);
30823053 if (curr > 0) {
30833054
30843055 /* convert to SDHCI_MAX_CURRENT format */
@@ -3118,8 +3089,12 @@ int sdhci_add_host(struct sdhci_host *host) · 33 unmodified lines
31183089 SDHCI_MAX_CURRENT_MULTIPLIER;
31193090 }
31203091
3092+ /* If OCR set by external regulators, use it instead */
3093+ if (mmc->ocr_avail)
3094+ ocr_avail = mmc->ocr_avail;
3095+
31213096 if (host->ocr_mask)
3122− ocr_avail = host->ocr_mask;
3097+ ocr_avail &= host->ocr_mask;
31233098
31243099 mmc->ocr_avail = ocr_avail;
31253100 mmc->ocr_avail_sdio = ocr_avail;
@@ -3273,6 +3248,7 @@ EXPORT_SYMBOL_GPL(sdhci_add_host); · 147 unmodified lines
32733248
32743249 void sdhci_remove_host(struct sdhci_host *host, int dead)
32753250 {
3251+ struct mmc_host *mmc = host->mmc;
32763252 unsigned long flags;
32773253
32783254 if (dead) {
@@ -3282,7 +3258,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) · 3 unmodified lines
32823258
32833259 if (host->mrq) {
32843260 pr_err("%s: Controller removed during "
3285− " transfer!\n", mmc_hostname(host->mmc));
3261+ " transfer!\n", mmc_hostname(mmc));
32863262
32873263 host->mrq->cmd->error = -ENOMEDIUM;
32883264 tasklet_schedule(&host->finish_tasklet);
@@ -3293,7 +3269,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) · 4 unmodified lines
32933269
32943270 sdhci_disable_card_detection(host);
32953271
3296− mmc_remove_host(host->mmc);
3272+ mmc_remove_host(mmc);
32973273
32983274 #ifdef SDHCI_USE_LEDS_CLASS
32993275 led_classdev_unregister(&host->led);
@@ -3310,18 +3286,14 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) · 10 unmodified lines
33103286
33113287 tasklet_kill(&host->finish_tasklet);
33123288
3313− if (host->vmmc) {
3314− regulator_disable(host->vmmc);
3315− regulator_put(host->vmmc);
3316− }
3289+ if (!IS_ERR(mmc->supply.vmmc))
3290+ regulator_disable(mmc->supply.vmmc);
33173291
3318− if (host->vqmmc) {
3319− regulator_disable(host->vqmmc);
3320− regulator_put(host->vqmmc);
3321− }
3292+ if (!IS_ERR(mmc->supply.vqmmc))
3293+ regulator_disable(mmc->supply.vqmmc);
33223294
33233295 if (host->adma_desc)
3324− dma_free_coherent(mmc_dev(host->mmc), ADMA_SIZE,
3296+ dma_free_coherent(mmc_dev(mmc), ADMA_SIZE,
33253297 host->adma_desc, host->adma_addr);
33263298 kfree(host->align_buffer);
33273299
drivers/mmc/host/sh_mmcif.c+38−58
@@ -386,7 +386,7 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · 385 unmodified lines
386386 struct sh_mmcif_plat_data *pdata,
387387 enum dma_transfer_direction direction)
388388 {
389− struct dma_slave_config cfg;
389+ struct dma_slave_config cfg = { 0, };
390390 struct dma_chan *chan;
391391 unsigned int slave_id;
392392 struct resource *res;
@@ -417,8 +417,15 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · 24 unmodified lines
417417 /* In the OF case the driver will get the slave ID from the DT */
418418 cfg.slave_id = slave_id;
419419 cfg.direction = direction;
420− cfg.dst_addr = res->start + MMCIF_CE_DATA;
421− cfg.src_addr = 0;
420+
421+ if (direction == DMA_DEV_TO_MEM) {
422+ cfg.src_addr = res->start + MMCIF_CE_DATA;
423+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
424+ } else {
425+ cfg.dst_addr = res->start + MMCIF_CE_DATA;
426+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
427+ }
428+
422429 ret = dmaengine_slave_config(chan, &cfg);
423430 if (ret < 0) {
424431 dma_release_channel(chan);
@@ -1378,26 +1385,19 @@ static int sh_mmcif_probe(struct platform_device *pdev) · 953 unmodified lines
13781385 dev_err(&pdev->dev, "Get irq error\n");
13791386 return -ENXIO;
13801387 }
1388+
13811389 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1382− if (!res) {
1383− dev_err(&pdev->dev, "platform_get_resource error.\n");
1384− return -ENXIO;
1385− }
1386− reg = ioremap(res->start, resource_size(res));
1387− if (!reg) {
1388− dev_err(&pdev->dev, "ioremap error.\n");
1389− return -ENOMEM;
1390− }
1390+ reg = devm_ioremap_resource(&pdev->dev, res);
1391+ if (IS_ERR(reg))
1392+ return PTR_ERR(reg);
13911393
13921394 mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), &pdev->dev);
1393− if (!mmc) {
1394− ret = -ENOMEM;
1395− goto ealloch;
1396− }
1395+ if (!mmc)
1396+ return -ENOMEM;
13971397
13981398 ret = mmc_of_parse(mmc);
13991399 if (ret < 0)
1400− goto eofparse;
1400+ goto err_host;
14011401
14021402 host = mmc_priv(mmc);
14031403 host->mmc = mmc;
@@ -1427,19 +1427,19 @@ static int sh_mmcif_probe(struct platform_device *pdev) · 23 unmodified lines
14271427 pm_runtime_enable(&pdev->dev);
14281428 host->power = false;
14291429
1430− host->hclk = clk_get(&pdev->dev, NULL);
1430+ host->hclk = devm_clk_get(&pdev->dev, NULL);
14311431 if (IS_ERR(host->hclk)) {
14321432 ret = PTR_ERR(host->hclk);
14331433 dev_err(&pdev->dev, "cannot get clock: %d\n", ret);
1434− goto eclkget;
1434+ goto err_pm;
14351435 }
14361436 ret = sh_mmcif_clk_update(host);
14371437 if (ret < 0)
1438− goto eclkupdate;
1438+ goto err_pm;
14391439
14401440 ret = pm_runtime_resume(&pdev->dev);
14411441 if (ret < 0)
1442− goto eresume;
1442+ goto err_clk;
14431443
14441444 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
14451445
@@ -1447,65 +1447,55 @@ static int sh_mmcif_probe(struct platform_device *pdev) · 1 unmodified line
14471447 sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
14481448
14491449 name = irq[1] < 0 ? dev_name(&pdev->dev) : "sh_mmc:error";
1450− ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, name, host);
1450+ ret = devm_request_threaded_irq(&pdev->dev, irq[0], sh_mmcif_intr,
1451+ sh_mmcif_irqt, 0, name, host);
14511452 if (ret) {
14521453 dev_err(&pdev->dev, "request_irq error (%s)\n", name);
1453− goto ereqirq0;
1454+ goto err_clk;
14541455 }
14551456 if (irq[1] >= 0) {
1456− ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt,
1457− 0, "sh_mmc:int", host);
1457+ ret = devm_request_threaded_irq(&pdev->dev, irq[1],
1458+ sh_mmcif_intr, sh_mmcif_irqt,
1459+ 0, "sh_mmc:int", host);
14581460 if (ret) {
14591461 dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
1460− goto ereqirq1;
1462+ goto err_clk;
14611463 }
14621464 }
14631465
14641466 if (pd && pd->use_cd_gpio) {
14651467 ret = mmc_gpio_request_cd(mmc, pd->cd_gpio, 0);
14661468 if (ret < 0)
1467− goto erqcd;
1469+ goto err_clk;
14681470 }
14691471
14701472 mutex_init(&host->thread_lock);
14711473
1472− clk_disable_unprepare(host->hclk);
14731474 ret = mmc_add_host(mmc);
14741475 if (ret < 0)
1475− goto emmcaddh;
1476+ goto err_clk;
14761477
14771478 dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
14781479
1479− dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION);
1480− dev_dbg(&pdev->dev, "chip ver H'%04x\n",
1481− sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
1480+ dev_info(&pdev->dev, "Chip version 0x%04x, clock rate %luMHz\n",
1481+ sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0xffff,
1482+ clk_get_rate(host->hclk) / 1000000UL);
1483+
1484+ clk_disable_unprepare(host->hclk);
14821485 return ret;
14831486
1484−emmcaddh:
1485−erqcd:
1486− if (irq[1] >= 0)
1487− free_irq(irq[1], host);
1488−ereqirq1:
1489− free_irq(irq[0], host);
1490−ereqirq0:
1491− pm_runtime_suspend(&pdev->dev);
1492−eresume:
1487+err_clk:
14931488 clk_disable_unprepare(host->hclk);
1494−eclkupdate:
1495− clk_put(host->hclk);
1496−eclkget:
1489+err_pm:
14971490 pm_runtime_disable(&pdev->dev);
1498−eofparse:
1491+err_host:
14991492 mmc_free_host(mmc);
1500−ealloch:
1501− iounmap(reg);
15021493 return ret;
15031494 }
15041495
15051496 static int sh_mmcif_remove(struct platform_device *pdev)
15061497 {
15071498 struct sh_mmcif_host *host = platform_get_drvdata(pdev);
1508− int irq[2];
15091499
15101500 host->dying = true;
15111501 clk_prepare_enable(host->hclk);
@@ -1523,16 +1513,6 @@ static int sh_mmcif_remove(struct platform_device *pdev) · 11 unmodified lines
15231513 */
15241514 cancel_delayed_work_sync(&host->timeout_work);
15251515
1526− if (host->addr)
1527− iounmap(host->addr);
1528−
1529− irq[0] = platform_get_irq(pdev, 0);
1530− irq[1] = platform_get_irq(pdev, 1);
1531−
1532− free_irq(irq[0], host);
1533− if (irq[1] >= 0)
1534− free_irq(irq[1], host);
1535−
15361516 clk_disable_unprepare(host->hclk);
15371517 mmc_free_host(host->mmc);
15381518 pm_runtime_put_sync(&pdev->dev);
drivers/mmc/host/tmio_mmc_dma.c+2−0
@@ -294,6 +294,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat · 293 unmodified lines
294294 cfg.slave_id = pdata->dma->slave_id_tx;
295295 cfg.direction = DMA_MEM_TO_DEV;
296296 cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift);
297+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
297298 cfg.src_addr = 0;
298299 ret = dmaengine_slave_config(host->chan_tx, &cfg);
299300 if (ret < 0)
@@ -312,6 +313,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat · 12 unmodified lines
312313 cfg.slave_id = pdata->dma->slave_id_rx;
313314 cfg.direction = DMA_DEV_TO_MEM;
314315 cfg.src_addr = cfg.dst_addr;
316+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
315317 cfg.dst_addr = 0;
316318 ret = dmaengine_slave_config(host->chan_rx, &cfg);
317319 if (ret < 0)
drivers/mmc/host/wmt-sdmmc.c+16−17
@@ -72,7 +72,6 @@ · 71 unmodified lines
7272 #define BM_SPI_CS 0x20
7373 #define BM_SD_POWER 0x40
7474 #define BM_SOFT_RESET 0x80
75−#define BM_ONEBIT_MASK 0xFD
7675
7776 /* SDMMC_BLKLEN bit fields */
7877 #define BLKL_CRCERR_ABORT 0x0800
@@ -120,6 +119,8 @@ · 41 unmodified lines
120119 #define STS2_DATARSP_BUSY 0x20
121120 #define STS2_DIS_FORCECLK 0x80
122121
122+/* SDMMC_EXTCTRL bit fields */
123+#define EXT_EIGHTBIT 0x04
123124
124125 /* MMC/SD DMA Controller Registers */
125126 #define SDDMA_GCR 0x100
@@ -672,7 +673,7 @@ static void wmt_mci_request(struct mmc_host *mmc, struct mmc_request *req) · 546 unmodified lines
672673 static void wmt_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
673674 {
674675 struct wmt_mci_priv *priv;
675− u32 reg_tmp;
676+ u32 busmode, extctrl;
676677
677678 priv = mmc_priv(mmc);
678679
@@ -687,28 +688,26 @@ static void wmt_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 8 unmodified lines
687688 if (ios->clock != 0)
688689 clk_set_rate(priv->clk_sdmmc, ios->clock);
689690
691+ busmode = readb(priv->sdmmc_base + SDMMC_BUSMODE);
692+ extctrl = readb(priv->sdmmc_base + SDMMC_EXTCTRL);
693+
694+ busmode &= ~(BM_EIGHTBIT_MODE | BM_FOURBIT_MODE);
695+ extctrl &= ~EXT_EIGHTBIT;
696+
690697 switch (ios->bus_width) {
691698 case MMC_BUS_WIDTH_8:
692− reg_tmp = readb(priv->sdmmc_base + SDMMC_EXTCTRL);
693− writeb(reg_tmp | 0x04, priv->sdmmc_base + SDMMC_EXTCTRL);
699+ busmode |= BM_EIGHTBIT_MODE;
700+ extctrl |= EXT_EIGHTBIT;
694701 break;
695702 case MMC_BUS_WIDTH_4:
696− reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE);
697− writeb(reg_tmp | BM_FOURBIT_MODE, priv->sdmmc_base +
698− SDMMC_BUSMODE);
699−
700− reg_tmp = readb(priv->sdmmc_base + SDMMC_EXTCTRL);
701− writeb(reg_tmp & 0xFB, priv->sdmmc_base + SDMMC_EXTCTRL);
703+ busmode |= BM_FOURBIT_MODE;
702704 break;
703705 case MMC_BUS_WIDTH_1:
704− reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE);
705− writeb(reg_tmp & BM_ONEBIT_MASK, priv->sdmmc_base +
706− SDMMC_BUSMODE);
707−
708− reg_tmp = readb(priv->sdmmc_base + SDMMC_EXTCTRL);
709− writeb(reg_tmp & 0xFB, priv->sdmmc_base + SDMMC_EXTCTRL);
710706 break;
711707 }
708+
709+ writeb(busmode, priv->sdmmc_base + SDMMC_BUSMODE);
710+ writeb(extctrl, priv->sdmmc_base + SDMMC_EXTCTRL);
712711 }
713712
714713 static int wmt_mci_get_ro(struct mmc_host *mmc)
@@ -830,7 +829,7 @@ static int wmt_mci_probe(struct platform_device *pdev) · 115 unmodified lines
830829 goto fail3;
831830 }
832831
833− ret = request_irq(dma_irq, wmt_mci_dma_isr, 32, "sdmmc", priv);
832+ ret = request_irq(dma_irq, wmt_mci_dma_isr, 0, "sdmmc", priv);
834833 if (ret) {
835834 dev_err(&pdev->dev, "Register DMA IRQ fail\n");
836835 goto fail4;
include/linux/mmc/dw_mmc.h+2−0
@@ -213,6 +213,8 @@ struct dw_mci_dma_ops { · 212 unmodified lines
213213 #define DW_MCI_QUIRK_HIGHSPEED BIT(2)
214214 /* Unreliable card detection */
215215 #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
216+/* No write protect */
217+#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
216218
217219 /* Slot level quirks */
218220 /* This slot has no write protect */
include/linux/mmc/sdhci.h+0−3
@@ -104,9 +104,6 @@ struct sdhci_host { · 103 unmodified lines
104104
105105 const struct sdhci_ops *ops; /* Low level hw interface */
106106
107− struct regulator *vmmc; /* Power regulator (vmmc) */
108− struct regulator *vqmmc; /* Signaling regulator (vccq) */
109−
110107 /* Internal data */
111108 struct mmc_host *mmc; /* MMC structure */
112109 u64 dma_mask; /* custom DMA mask */
include/linux/platform_data/mmc-omap.h+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 */
2929 #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
3030 #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31+#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
3132
3233 struct mmc_card;
3334