[04/12,SRU,B,C,D,OEM-B] mmc: rtsx_usb: Use MMC_CAP2_NO_SDIO

Message ID 20190111083019.32135-5-acelan.kao@canonical.com
State New
Headers show
Series
  • To reduce the Realtek USB cardreader power consumption
Related show

Commit Message

AceLan Kao Jan. 11, 2019, 8:30 a.m.
From: Ulf Hansson <ulf.hansson@linaro.org>

BugLink: https://bugs.launchpad.net/bugs/1811337

Instead of having to return -EINVAL when requested to send SDIO specific
commands, let's set MMC_CAP2_NO_SDIO as it completely prevents them.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: MichaƂ Pecio <michal.pecio@gmail.com>
(cherry picked from commit 4b7d45451dff133b6453cb9571ea5349be1ce14f)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

Patch

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index bb0ec00ef357..96ddb3d3f80f 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -26,7 +26,6 @@ 
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
-#include <linux/mmc/sdio.h>
 #include <linux/mmc/card.h>
 #include <linux/scatterlist.h>
 #include <linux/pm_runtime.h>
@@ -839,17 +838,6 @@  static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		goto finish_detect_card;
 	}
 
-	/*
-	 * Reject SDIO CMDs to speed up card identification
-	 * since unsupported
-	 */
-	if (cmd->opcode == SD_IO_SEND_OP_COND ||
-	    cmd->opcode == SD_IO_RW_DIRECT ||
-	    cmd->opcode == SD_IO_RW_EXTENDED) {
-		cmd->error = -EINVAL;
-		goto finish;
-	}
-
 	mutex_lock(&ucr->dev_mutex);
 
 	mutex_lock(&host->host_mutex);
@@ -1337,7 +1325,8 @@  static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host)
 		MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 |
 		MMC_CAP_NEEDS_POLL;
-	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
+	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
+		MMC_CAP2_NO_SDIO;
 
 	mmc->max_current_330 = 400;
 	mmc->max_current_180 = 800;