Merge "mmc: msm_sdcc: Add debugfs attribute to enforce PIO mode"
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 0b1fa32..32e19f9 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -873,6 +873,10 @@
bool ret = true;
u32 xfer_size = data->blksz * data->blocks;
+ if (host->enforce_pio_mode) {
+ ret = false;
+ goto out;
+ }
if (is_sps_mode(host)) {
/*
* BAM Mode: Fall back on PIO if size is less
@@ -891,7 +895,7 @@
/* PIO Mode */
ret = false;
}
-
+ out:
return ret;
}
@@ -6642,6 +6646,31 @@
msmsdcc_dbg_idle_tout_set,
"%llu\n");
+static int msmsdcc_dbg_pio_mode_get(void *data, u64 *val)
+{
+ struct msmsdcc_host *host = data;
+
+ *val = (u64) host->enforce_pio_mode;
+ return 0;
+}
+
+static int msmsdcc_dbg_pio_mode_set(void *data, u64 val)
+{
+ struct msmsdcc_host *host = data;
+ unsigned long flags;
+
+ spin_lock_irqsave(&host->lock, flags);
+ host->enforce_pio_mode = !!val;
+ spin_unlock_irqrestore(&host->lock, flags);
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(msmsdcc_dbg_pio_mode_ops,
+ msmsdcc_dbg_pio_mode_get,
+ msmsdcc_dbg_pio_mode_set,
+ "%llu\n");
+
static void msmsdcc_dbg_createhost(struct msmsdcc_host *host)
{
int err = 0;
@@ -6669,6 +6698,17 @@
pr_err("%s: Failed to create idle_tout debugfs entry with err=%d\n",
mmc_hostname(host->mmc), err);
}
+
+ host->debugfs_pio_mode = debugfs_create_file("pio_mode",
+ S_IRUSR | S_IWUSR, host->debugfs_host_dir, host,
+ &msmsdcc_dbg_pio_mode_ops);
+
+ if (IS_ERR(host->debugfs_pio_mode)) {
+ err = PTR_ERR(host->debugfs_pio_mode);
+ host->debugfs_pio_mode = NULL;
+ pr_err("%s: Failed to create pio_mode debugfs entry with err=%d\n",
+ mmc_hostname(host->mmc), err);
+ }
}
static int __init msmsdcc_dbg_init(void)
diff --git a/drivers/mmc/host/msm_sdcc.h b/drivers/mmc/host/msm_sdcc.h
index 37b9423..620750a 100644
--- a/drivers/mmc/host/msm_sdcc.h
+++ b/drivers/mmc/host/msm_sdcc.h
@@ -424,6 +424,8 @@
struct device_attribute auto_cmd21_attr;
struct dentry *debugfs_host_dir;
struct dentry *debugfs_idle_tout;
+ bool enforce_pio_mode;
+ struct dentry *debugfs_pio_mode;
};
#define MSMSDCC_VERSION_STEP_MASK 0x0000FFFF