linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mmc: host: add a new cap to force set power control
@ 2016-06-28  9:36 Beata Baranowska
  0 siblings, 0 replies; only message in thread
From: Beata Baranowska @ 2016-06-28  9:36 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson, linux-mmc, linux-kernel
  Cc: sebastianx.jarosz, beatax.baranowska, Chuanxiao Dong

From: Chuanxiao Dong <chuanxiao.dong@intel.com>

Even with a regulator, some host controller still needs to
set the power control register to make sure the inter logical
is working

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
 drivers/mmc/host/sdhci-acpi.c |  5 ++++-
 drivers/mmc/host/sdhci.c      | 10 ++++++----
 include/linux/mmc/host.h      |  6 ++++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 458ffb7637e5..23f436ec5803 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -275,7 +275,8 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
 	.caps    = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
 		   MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
 		   MMC_CAP_WAIT_WHILE_BUSY,
-	.caps2   = MMC_CAP2_HC_ERASE_SZ,
+	.caps2   = MMC_CAP2_HC_ERASE_SZ |
+		   MMC_CAP2_FORCE_SET_PWR_CTRL,
 	.flags   = SDHCI_ACPI_RUNTIME_PM,
 	.quirks  = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
@@ -290,6 +291,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
 	.quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
 	.caps    = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD |
 		   MMC_CAP_WAIT_WHILE_BUSY,
+	.caps2	 = MMC_CAP2_FORCE_SET_PWR_CTRL,
 	.flags   = SDHCI_ACPI_RUNTIME_PM,
 	.pm_caps = MMC_PM_KEEP_POWER,
 	.probe_slot	= sdhci_acpi_sdio_probe_slot,
@@ -302,6 +304,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = {
 	.quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
 		   SDHCI_QUIRK2_STOP_WITH_TC,
 	.caps    = MMC_CAP_WAIT_WHILE_BUSY,
+	.caps2	 = MMC_CAP2_FORCE_SET_PWR_CTRL,
 	.probe_slot	= sdhci_acpi_sd_probe_slot,
 };
 
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 0e3d7c056cb1..9b50648d320f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1268,10 +1268,12 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
 	mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
 	spin_lock_irq(&host->lock);
 
-	if (mode != MMC_POWER_OFF)
-		sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
-	else
-		sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
+	if (!(mmc->caps2 & MMC_CAP2_FORCE_SET_PWR_CTRL)) {
+		if (mode != MMC_POWER_OFF)
+			sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
+		else
+			sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
+	}
 }
 
 void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 45cde8cd39f2..0eee78d17722 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -303,6 +303,12 @@ struct mmc_host {
 #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18)	/* No physical write protect pin, assume that card is always read-write */
 #define MMC_CAP2_NO_SDIO	(1 << 19)	/* Do not send SDIO commands during initialization */
 
+/*
+ * For the host which needs to config its power control
+ * register even it has regulators
+ */
+#define MMC_CAP2_FORCE_SET_PWR_CTRL	(1 << 20)
+
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
 	/* host specific block data */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-28  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28  9:36 [RFC PATCH] mmc: host: add a new cap to force set power control Beata Baranowska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).