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>
This commit is contained in:
Jean-Jacques Hiblot
2017-09-21 16:30:11 +02:00
committed by Jaehoon Chung
parent 83dc42271f
commit bc1e3272ff
2 changed files with 84 additions and 4 deletions

View File

@@ -311,11 +311,15 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
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 @@ struct mmc {
#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
@@ -646,6 +652,14 @@ int mmc_initialize(bd_t *bis);
int mmc_init(struct mmc *mmc);
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