projects/linux·commit 46b51ea2

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc

46b51ea2 · Linus Torvalds <[email protected]> · 2011-10-28 14:16:11 -07:00

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (83 commits)
  mmc: fix compile error when CONFIG_BLOCK is not enabled
  mmc: core: Cleanup eMMC4.5 conditionals
  mmc: omap_hsmmc: if multiblock reads are broken, disable them
  mmc: core: add workaround for controllers with broken multiblock reads
  mmc: core: Prevent too long response times for suspend
  mmc: recognise SDIO cards with SDIO_CCCR_REV 3.00
  mmc: sd: Handle SD3.0 cards not supporting UHS-I bus speed mode
  mmc: core: support HPI send command
  mmc: core: Add cache control for eMMC4.5 device
  mmc: core: Modify the timeout value for writing power class
  mmc: core: new discard feature support at eMMC v4.5
  mmc: core: mmc sanitize feature support for v4.5
  mmc: dw_mmc: modify DATA register offset
  mmc: sdhci-pci: add flag for devices that can support runtime PM
  mmc: omap_hsmmc: ensure pbias configuration is always done
  mmc: core: Add Power Off Notify Feature eMMC 4.5
  mmc: sdhci-s3c: fix potential NULL dereference
  mmc: replace printk with appropriate display macro
  mmc: core: Add default timeout value for CMD6
  mmc: sdhci-pci: add runtime pm support
  ...
Commit
46b51ea2099fa2082342e52b8284aa828429b80b
Parents
1fdb24e9 · a6029e1f

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

Changes

81 files changed · +3093 −1009

FileStatusAddDelContent
Documentation/devicetree/bindings/mmc/nvidia-sdhci.txtadded+27−0View file
Documentation/fault-injection/fault-injection.txtmodified+7−1View file
arch/arm/mach-at91/at91sam9260_devices.cmodified+1−1View file
arch/arm/mach-msm/devices-msm7x00.cmodified+0−24View file
arch/arm/mach-msm/devices-qsd8x50.cmodified+0−24View file
arch/arm/mach-msm/include/mach/mmc.hmodified+1−8View file
arch/arm/mach-shmobile/board-ag5evm.cmodified+6−0View file
arch/arm/mach-shmobile/board-mackerel.cmodified+6−0View file
arch/arm/plat-omap/include/plat/mmc.hmodified+18−1View file
drivers/mmc/card/block.cmodified+212−98View file
drivers/mmc/card/mmc_test.cmodified+48−17View file
drivers/mmc/card/queue.cmodified+4−4View file
drivers/mmc/card/sdio_uart.cmodified+5−5View file
drivers/mmc/core/bus.cmodified+3−3View file
drivers/mmc/core/core.cmodified+387−39View file
drivers/mmc/core/core.hmodified+1−0View file
drivers/mmc/core/debugfs.cmodified+28−0View file
drivers/mmc/core/host.cmodified+11−0View file
drivers/mmc/core/mmc.cmodified+264−23View file
drivers/mmc/core/mmc_ops.cmodified+35−4View file
drivers/mmc/core/mmc_ops.hmodified+1−0View file
drivers/mmc/core/quirks.cmodified+11−0View file
drivers/mmc/core/sd.cmodified+24−25View file
drivers/mmc/core/sd_ops.cmodified+4−4View file
drivers/mmc/core/sdio.cmodified+5−6View file
drivers/mmc/core/sdio_bus.cmodified+1−1View file
drivers/mmc/core/sdio_cis.cmodified+2−2View file
drivers/mmc/core/sdio_irq.cmodified+3−3View file
drivers/mmc/core/sdio_ops.cmodified+6−3View file
drivers/mmc/host/Kconfigmodified+8−8View file
drivers/mmc/host/at91_mci.cmodified+5−1View file
drivers/mmc/host/atmel-mci-regs.hmodified+117−103View file
drivers/mmc/host/atmel-mci.cmodified+558−265View file
drivers/mmc/host/au1xmmc.cmodified+5−5View file
drivers/mmc/host/dw_mmc.cmodified+78−26View file
drivers/mmc/host/dw_mmc.hmodified+13−2View file
drivers/mmc/host/imxmmc.cmodified+1−1View file
drivers/mmc/host/mmc_spi.cmodified+1−0View file
drivers/mmc/host/mmci.cmodified+2−2View file
drivers/mmc/host/msm_sdcc.cmodified+58−28View file
drivers/mmc/host/msm_sdcc.hmodified+5−1View file
drivers/mmc/host/mvsdio.cmodified+7−7View file
drivers/mmc/host/mxcmmc.cmodified+1−1View file
drivers/mmc/host/mxs-mmc.cmodified+1−0View file
drivers/mmc/host/omap_hsmmc.cmodified+17−15View file
drivers/mmc/host/pxamci.cmodified+1−1View file
drivers/mmc/host/s3cmci.cmodified+2−2View file
drivers/mmc/host/sdhci-esdhc-imx.cmodified+73−7View file
drivers/mmc/host/sdhci-of-esdhc.cmodified+15−4View file
drivers/mmc/host/sdhci-of-hlwd.cmodified+1−0View file
drivers/mmc/host/sdhci-pci.cmodified+266−2View file
drivers/mmc/host/sdhci-pltfm.cmodified+1−0View file
drivers/mmc/host/sdhci-pxav2.cmodified+3−2View file
drivers/mmc/host/sdhci-pxav3.cmodified+1−0View file
drivers/mmc/host/sdhci-s3c.cmodified+21−13View file
drivers/mmc/host/sdhci-spear.cmodified+1−2View file
drivers/mmc/host/sdhci-tegra.cmodified+44−11View file
drivers/mmc/host/sdhci.cmodified+271−87View file
drivers/mmc/host/sdhci.hmodified+6−1View file
drivers/mmc/host/sdricoh_cs.cmodified+1−0View file
drivers/mmc/host/sh_mmcif.cmodified+17−4View file
drivers/mmc/host/sh_mobile_sdhi.cmodified+74−25View file
drivers/mmc/host/tifm_sd.cmodified+9−10View file
drivers/mmc/host/tmio_mmc.cmodified+2−2View file
drivers/mmc/host/tmio_mmc.hmodified+7−0View file
drivers/mmc/host/tmio_mmc_pio.cmodified+94−57View file
drivers/mmc/host/via-sdmmc.cmodified+2−1View file
drivers/mmc/host/wbsd.cmodified+11−11View file
include/linux/atmel-mci.hmodified+2−2View file
include/linux/atmel_pdc.hmodified+2−0View file
include/linux/mmc/card.hmodified+57−1View file
include/linux/mmc/core.hmodified+9−0View file
include/linux/mmc/dw_mmc.hmodified+4−0View file
include/linux/mmc/host.hmodified+29−0View file
include/linux/mmc/mmc.hmodified+37−1View file
include/linux/mmc/sdhci.hmodified+8−0View file
include/linux/mmc/sdio.hmodified+2−0View file
include/linux/mmc/sh_mmcif.hmodified+3−1View file
include/linux/mmc/sh_mobile_sdhi.hmodified+4−0View file
lib/Kconfig.debugmodified+11−0View file
lib/fault-inject.cmodified+4−1View file

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

Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt

View file
diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
new file mode 100644
index 0000000..7e51154
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
@@ -0,0 +1,27 @@
+* NVIDIA Tegra Secure Digital Host Controller
+
+This controller on Tegra family SoCs provides an interface for MMC, SD,
+and SDIO types of memory cards.
+
+Required properties:
+- compatible : Should be "nvidia,<chip>-sdhci"
+- reg : Should contain SD/MMC registers location and length
+- interrupts : Should contain SD/MMC interrupt
+
+Optional properties:
+- cd-gpios : Specify GPIOs for card detection
+- wp-gpios : Specify GPIOs for write protection
+- power-gpios : Specify GPIOs for power control
+- support-8bit : Boolean, indicates if 8-bit mode should be used.
+
+Example:
+
+sdhci@c8000200 {
+ compatible = "nvidia,tegra20-sdhci";
+ reg = <0xc8000200 0x200>;
+ interrupts = <47>;
+ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
+ power-gpios = <&gpio 155 0>; /* gpio PT3 */
+ support-8bit;
+};

Documentation/fault-injection/fault-injection.txt

View file
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index 82a5d25..ba4be8b 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -21,6 +21,11 @@ o fail_make_request
/sys/block/<device>/make-it-fail or
/sys/block/<device>/<partition>/make-it-fail. (generic_make_request())
+o fail_mmc_request
+
+ injects MMC data errors on devices permitted by setting
+ debugfs entries under /sys/kernel/debug/mmc0/fail_mmc_request
+
Configure fault-injection capabilities behavior
-----------------------------------------------
@@ -115,7 +120,8 @@ use the boot option:
failslab=
fail_page_alloc=
- fail_make_request=<interval>,<probability>,<space>,<times>
+ fail_make_request=
+ mmc_core.fail_request=<interval>,<probability>,<space>,<times>
How to add new fault injection capability
-----------------------------------------

arch/arm/mach-at91/at91sam9260_devices.c

View file
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index a53b3de..3c2b580 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -319,7 +319,7 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
if (!data)
return;
- for (i = 0; i < ATMEL_MCI_MAX_NR_SLOTS; i++) {
+ for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
if (data->slot[i].bus_width) {
/* input/irq */
if (data->slot[i].detect_pin) {

arch/arm/mach-msm/devices-msm7x00.c

View file
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index c4f5e26..993780f 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -176,12 +176,6 @@ static struct resource resources_sdc1[] = {
.name = "cmd_irq",
},
{
- .start = INT_SDC1_1,
- .end = INT_SDC1_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
- {
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
},
@@ -204,12 +198,6 @@ static struct resource resources_sdc2[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC2_1,
- .end = INT_SDC2_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
@@ -233,12 +221,6 @@ static struct resource resources_sdc3[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC3_1,
- .end = INT_SDC3_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
@@ -262,12 +244,6 @@ static struct resource resources_sdc4[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC4_1,
- .end = INT_SDC4_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"

arch/arm/mach-msm/devices-qsd8x50.c

View file
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 12d8deb..131633b 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -140,12 +140,6 @@ static struct resource resources_sdc1[] = {
.name = "cmd_irq",
},
{
- .start = INT_SDC1_1,
- .end = INT_SDC1_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
- {
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
},
@@ -168,12 +162,6 @@ static struct resource resources_sdc2[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC2_1,
- .end = INT_SDC2_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
@@ -197,12 +185,6 @@ static struct resource resources_sdc3[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC3_1,
- .end = INT_SDC3_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"
@@ -226,12 +208,6 @@ static struct resource resources_sdc4[] = {
.flags = IORESOURCE_IRQ,
.name = "cmd_irq",
},
- {
- .start = INT_SDC4_1,
- .end = INT_SDC4_1,
- .flags = IORESOURCE_IRQ,
- .name = "pio_irq",
- },
{
.flags = IORESOURCE_IRQ | IORESOURCE_DISABLED,
.name = "status_irq"

arch/arm/mach-msm/include/mach/mmc.h

View file
diff --git a/arch/arm/mach-msm/include/mach/mmc.h b/arch/arm/mach-msm/include/mach/mmc.h
index 5631b51..ffcd9e3 100644
--- a/arch/arm/mach-msm/include/mach/mmc.h
+++ b/arch/arm/mach-msm/include/mach/mmc.h
@@ -8,13 +8,6 @@
#include <linux/mmc/card.h>
#include <linux/mmc/sdio_func.h>
-struct embedded_sdio_data {
- struct sdio_cis cis;
- struct sdio_cccr cccr;
- struct sdio_embedded_func *funcs;
- int num_funcs;
-};
-
struct msm_mmc_gpio {
unsigned no;
const char *name;
@@ -29,9 +22,9 @@ struct msm_mmc_platform_data {
unsigned int ocr_mask; /* available voltages */
u32 (*translate_vdd)(struct device *, unsigned int);
unsigned int (*status)(struct device *);
- struct embedded_sdio_data *embedded_sdio;
int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
struct msm_mmc_gpio_data *gpio_data;
+ void (*init_card)(struct mmc_card *card);
};
#endif

arch/arm/mach-shmobile/board-ag5evm.c

View file
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 5fde49d..475342b 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -355,14 +355,17 @@ static struct resource sdhi0_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
+ .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
.start = gic_spi(83),
.flags = IORESOURCE_IRQ,
},
[2] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDCARD,
.start = gic_spi(84),
.flags = IORESOURCE_IRQ,
},
[3] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDIO,
.start = gic_spi(85),
.flags = IORESOURCE_IRQ,
},
@@ -398,14 +401,17 @@ static struct resource sdhi1_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
+ .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
.start = gic_spi(87),
.flags = IORESOURCE_IRQ,
},
[2] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDCARD,
.start = gic_spi(88),
.flags = IORESOURCE_IRQ,
},
[3] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDIO,
.start = gic_spi(89),
.flags = IORESOURCE_IRQ,
},

arch/arm/mach-shmobile/board-mackerel.c

View file
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 7d073c1..4de92dc 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -1072,14 +1072,17 @@ static struct resource sdhi1_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
+ .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
.start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */
.flags = IORESOURCE_IRQ,
},
[2] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDCARD,
.start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */
.flags = IORESOURCE_IRQ,
},
[3] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDIO,
.start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */
.flags = IORESOURCE_IRQ,
},
@@ -1123,14 +1126,17 @@ static struct resource sdhi2_resources[] = {
.flags = IORESOURCE_MEM,
},
[1] = {
+ .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
.start = evt2irq(0x1200), /* SDHI2_SDHI2I0 */
.flags = IORESOURCE_IRQ,
},
[2] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDCARD,
.start = evt2irq(0x1220), /* SDHI2_SDHI2I1 */
.flags = IORESOURCE_IRQ,
},
[3] = {
+ .name = SH_MOBILE_SDHI_IRQ_SDIO,
.start = evt2irq(0x1240), /* SDHI2_SDHI2I2 */
.flags = IORESOURCE_IRQ,
},

arch/arm/plat-omap/include/plat/mmc.h

View file
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index c7b8741..94cf70a 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -31,7 +31,24 @@
#define OMAP_MMC_MAX_SLOTS 2
-#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1)
+/*
+ * struct omap_mmc_dev_attr.flags possibilities
+ *
+ * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
+ * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
+ * should be set if this is the case. See for example Section 22.5.3
+ * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
+ * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
+ *
+ * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
+ * don't work correctly on some MMC controller instances on some
+ * OMAP3 SoCs; this flag should be set if this is the case. See
+ * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
+ * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
+ * Revision F (October 2010) (SPRZ278F).
+ */
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
+#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
struct omap_mmc_dev_attr {
u8 flags;

drivers/mmc/card/block.c

View file
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 4c1a648..a1cb21f 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -94,6 +94,11 @@ struct mmc_blk_data {
unsigned int read_only;
unsigned int part_type;
unsigned int name_idx;
+ unsigned int reset_done;
+#define MMC_BLK_READ BIT(0)
+#define MMC_BLK_WRITE BIT(1)
+#define MMC_BLK_DISCARD BIT(2)
+#define MMC_BLK_SECDISCARD BIT(3)
/*
* Only set in main mmc_blk_data associated
@@ -109,11 +114,11 @@ static DEFINE_MUTEX(open_lock);
enum mmc_blk_status {
MMC_BLK_SUCCESS = 0,
MMC_BLK_PARTIAL,
- MMC_BLK_RETRY,
- MMC_BLK_RETRY_SINGLE,
- MMC_BLK_DATA_ERR,
MMC_BLK_CMD_ERR,
+ MMC_BLK_RETRY,
MMC_BLK_ABORT,
+ MMC_BLK_DATA_ERR,
+ MMC_BLK_ECC_ERR,
};
module_param(perdev_minors, int, 0444);
@@ -291,7 +296,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
struct mmc_card *card;
struct mmc_command cmd = {0};
struct mmc_data data = {0};
- struct mmc_request mrq = {0};
+ struct mmc_request mrq = {NULL};
struct scatterlist sg;
int err;
@@ -442,19 +447,24 @@ static inline int mmc_blk_part_switch(struct mmc_card *card,
{
int ret;
struct mmc_blk_data *main_md = mmc_get_drvdata(card);
+
if (main_md->part_curr == md->part_type)
return 0;
if (mmc_card_mmc(card)) {
- card->ext_csd.part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
- card->ext_csd.part_config |= md->part_type;
+ u8 part_config = card->ext_csd.part_config;
+
+ part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
+ part_config |= md->part_type;
ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_PART_CONFIG, card->ext_csd.part_config,
+ EXT_CSD_PART_CONFIG, part_config,
card->ext_csd.part_time);
if (ret)
return ret;
-}
+
+ card->ext_csd.part_config = part_config;
+ }
main_md->part_curr = md->part_type;
return 0;
@@ -466,7 +476,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
u32 result;
__be32 *blocks;
- struct mmc_request mrq = {0};
+ struct mmc_request mrq = {NULL};
struct mmc_command cmd = {0};
struct mmc_data data = {0};
unsigned int timeout_us;
@@ -616,7 +626,7 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error,
* Otherwise we don't understand what happened, so abort.
*/
static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
- struct mmc_blk_request *brq)
+ struct mmc_blk_request *brq, int *ecc_err)
{
bool prev_cmd_status_valid = true;
u32 status, stop_status = 0;
@@ -641,6 +651,12 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
if (err)
return ERR_ABORT;
+ /* Flag ECC errors */
+ if ((status & R1_CARD_ECC_FAILED) ||
+ (brq->stop.resp[0] & R1_CARD_ECC_FAILED) ||
+ (brq->cmd.resp[0] & R1_CARD_ECC_FAILED))
+ *ecc_err = 1;
+
/*
* Check the current card state. If it is in some data transfer
* mode, tell it to stop (and hopefully transition back to TRAN.)
@@ -658,6 +674,8 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
*/
if (err)
return ERR_ABORT;
+ if (stop_status & R1_CARD_ECC_FAILED)
+ *ecc_err = 1;
}
/* Check for set block count errors */
@@ -670,6 +688,10 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
return mmc_blk_cmd_error(req, "r/w cmd", brq->cmd.error,
prev_cmd_status_valid, status);
+ /* Data errors */
+ if (!brq->stop.error)
+ return ERR_CONTINUE;
+
/* Now for stop errors. These aren't fatal to the transfer. */
pr_err("%s: error %d sending stop command, original cmd response %#x, card status %#x\n",
req->rq_disk->disk_name, brq->stop.error,
@@ -686,12 +708,45 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
return ERR_CONTINUE;
}
+static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host,
+ int type)
+{
+ int err;
+
+ if (md->reset_done & type)
+ return -EEXIST;
+
+ md->reset_done |= type;
+ err = mmc_hw_reset(host);
+ /* Ensure we switch back to the correct partition */
+ if (err != -EOPNOTSUPP) {
+ struct mmc_blk_data *main_md = mmc_get_drvdata(host->card);
+ int part_err;
+
+ main_md->part_curr = main_md->part_type;
+ part_err = mmc_blk_part_switch(host->card, md);
+ if (part_err) {
+ /*
+ * We have failed to get back into the correct
+ * partition, so we need to abort the whole request.
+ */
+ return -ENODEV;
+ }
+ }
+ return err;
+}
+
+static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type)
+{
+ md->reset_done &= ~type;
+}
+
static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
{
struct mmc_blk_data *md = mq->data;
struct mmc_card *card = md->queue.card;
unsigned int from, nr, arg;
- int err = 0;
+ int err = 0, type = MMC_BLK_DISCARD;
if (!mmc_can_erase(card)) {
err = -EOPNOTSUPP;
@@ -701,11 +756,13 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
from = blk_rq_pos(req);
nr = blk_rq_sectors(req);
- if (mmc_can_trim(card))
+ if (mmc_can_discard(card))
+ arg = MMC_DISCARD_ARG;
+ else if (mmc_can_trim(card))
arg = MMC_TRIM_ARG;
else
arg = MMC_ERASE_ARG;
-
+retry:
if (card->quirks & MMC_QUIRK_INAND_CMD38) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
INAND_CMD38_ARG_EXT_CSD,
@@ -718,6 +775,10 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
}
err = mmc_erase(card, from, nr, arg);
out:
+ if (err == -EIO && !mmc_blk_reset(md, card->host, type))
+ goto retry;
+ if (!err)
+ mmc_blk_reset_success(md, type);
spin_lock_irq(&md->lock);
__blk_end_request(req, err, blk_rq_bytes(req));
spin_unlock_irq(&md->lock);
@@ -731,13 +792,20 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
struct mmc_blk_data *md = mq->data;
struct mmc_card *card = md->queue.card;
unsigned int from, nr, arg;
- int err = 0;
+ int err = 0, type = MMC_BLK_SECDISCARD;
- if (!mmc_can_secure_erase_trim(card)) {
+ if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
err = -EOPNOTSUPP;
goto out;
}
+ /* The sanitize operation is supported at v4.5 only */
+ if (mmc_can_sanitize(card)) {
+ err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_SANITIZE_START, 1, 0);
+ goto out;
+ }
+
from = blk_rq_pos(req);
nr = blk_rq_sectors(req);
@@ -745,7 +813,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
arg = MMC_SECURE_TRIM1_ARG;
else
arg = MMC_SECURE_ERASE_ARG;
-
+retry:
if (card->quirks & MMC_QUIRK_INAND_CMD38) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
INAND_CMD38_ARG_EXT_CSD,
@@ -769,6 +837,10 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
}
out:
+ if (err == -EIO && !mmc_blk_reset(md, card->host, type))
+ goto retry;
+ if (!err)
+ mmc_blk_reset_success(md, type);
spin_lock_irq(&md->lock);
__blk_end_request(req, err, blk_rq_bytes(req));
spin_unlock_irq(&md->lock);
@@ -779,16 +851,18 @@ out:
static int mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req)
{
struct mmc_blk_data *md = mq->data;
+ struct mmc_card *card = md->queue.card;
+ int ret = 0;
+
+ ret = mmc_flush_cache(card);
+ if (ret)
+ ret = -EIO;
- /*
- * No-op, only service this because we need REQ_FUA for reliable
- * writes.
- */
spin_lock_irq(&md->lock);
- __blk_end_request_all(req, 0);
+ __blk_end_request_all(req, ret);
spin_unlock_irq(&md->lock);
- return 1;
+ return ret ? 0 : 1;
}
/*
@@ -825,11 +899,11 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
static int mmc_blk_err_check(struct mmc_card *card,
struct mmc_async_req *areq)
{
- enum mmc_blk_status ret = MMC_BLK_SUCCESS;
struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req,
mmc_active);
struct mmc_blk_request *brq = &mq_mrq->brq;
struct request *req = mq_mrq->req;
+ int ecc_err = 0;
/*
* sbc.error indicates a problem with the set block count
@@ -841,8 +915,9 @@ static int mmc_blk_err_check(struct mmc_card *card,
* stop.error indicates a problem with the stop command. Data

This diff is incomplete. Download the complete patch.

drivers/mmc/card/mmc_test.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/card/queue.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/card/sdio_uart.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/bus.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/core.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/debugfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/host.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc_ops.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc_ops.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/quirks.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sd_ops.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sdio.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sdio_bus.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sdio_cis.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sdio_irq.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sdio_ops.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/at91_mci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/atmel-mci-regs.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/atmel-mci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/au1xmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/dw_mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/dw_mmc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/imxmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mmc_spi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mmci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/msm_sdcc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/msm_sdcc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mvsdio.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mxcmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/mxs-mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/omap_hsmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/pxamci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/s3cmci.c

View file

This diff is incomplete. Download the complete patch.

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

View file

This diff is incomplete. Download the complete patch.

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

View file

This diff is incomplete. Download the complete patch.

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

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pltfm.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pxav2.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-pxav3.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-s3c.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-spear.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci-tegra.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdhci.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sdricoh_cs.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sh_mmcif.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/sh_mobile_sdhi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tifm_sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tmio_mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tmio_mmc.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/tmio_mmc_pio.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/via-sdmmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/host/wbsd.c

View file

This diff is incomplete. Download the complete patch.

include/linux/atmel-mci.h

View file

This diff is incomplete. Download the complete patch.

include/linux/atmel_pdc.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/card.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/core.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/dw_mmc.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/host.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/mmc.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/sdhci.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/sdio.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/sh_mmcif.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmc/sh_mobile_sdhi.h

View file

This diff is incomplete. Download the complete patch.

lib/Kconfig.debug

View file

This diff is incomplete. Download the complete patch.

lib/fault-inject.c

View file

This diff is incomplete. Download the complete patch.