mmc: use the right voltage level for MMC DDR and HS200 modes

HS200 only supports 1.2v and 1.8v signal voltages. DDR52 supports 3.3v/1.8v
or 1.2v signal voltages.
Select the lowest voltage available when using those modes.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
diff --git a/include/mmc.h b/include/mmc.h
index a9ebc88..c11f698 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -311,11 +311,15 @@
 
 enum mmc_voltage {
 	MMC_SIGNAL_VOLTAGE_000 = 0,
-	MMC_SIGNAL_VOLTAGE_120,
-	MMC_SIGNAL_VOLTAGE_180,
-	MMC_SIGNAL_VOLTAGE_330
+	MMC_SIGNAL_VOLTAGE_120 = 1,
+	MMC_SIGNAL_VOLTAGE_180 = 2,
+	MMC_SIGNAL_VOLTAGE_330 = 4,
 };
 
+#define MMC_ALL_SIGNAL_VOLTAGE (MMC_SIGNAL_VOLTAGE_120 |\
+				MMC_SIGNAL_VOLTAGE_180 |\
+				MMC_SIGNAL_VOLTAGE_330)
+
 /* Maximum block size for MMC */
 #define MMC_MAX_BLOCK_LEN	512
 
@@ -588,6 +592,8 @@
 #endif
 #endif
 	u8 *ext_csd;
+	u32 cardtype;		/* cardtype read from the MMC */
+	enum mmc_voltage current_voltage;
 	enum bus_mode selected_mode; /* mode currently used */
 	enum bus_mode best_mode; /* best mode is the supported mode with the
 				  * highest bandwidth. It may not always be the
@@ -647,6 +653,14 @@
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
 
 /**
+ * mmc_voltage_to_mv() - Convert a mmc_voltage in mV
+ *
+ * @voltage:	The mmc_voltage to convert
+ * @return the value in mV if OK, -EINVAL on error (invalid mmc_voltage value)
+ */
+int mmc_voltage_to_mv(enum mmc_voltage voltage);
+
+/**
  * mmc_set_clock() - change the bus clock
  * @mmc:	MMC struct
  * @clock:	bus frequency in Hz