[PATCH 2/2] mmc: dw_mmc: prevent to set the wrong value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there is no vqmmc, real voltage should not change.
Then it needs to maintain the previous status for UHS_REG register.
It means that it doesn't need to set any bit.

Signed-off-by: Jaehoon Chung <jh80.chung@xxxxxxxxxxx>
---
 drivers/mmc/host/dw_mmc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 28602cc..6bd8018 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1418,7 +1418,19 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
 					 ret, uhs & v18 ? "1.8" : "3.3");
 			return -EAGAIN;
 		}
+	} else {
+		/*
+		 * If there isn't vqmmc, it should fail to switch voltage.
+		 * Then it needs to maintain the previous status.
+		 * If ios->signal_voltage is 3.3v, it means that previous
+		 * voltages was 1.8v.
+		 */
+		if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
+			uhs |= v18;
+		else
+			uhs &= ~v18;
 	}
+
 	mci_writel(host, UHS_REG, uhs);
 
 	return 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux