mmc: add set_timing entry for timing selection
Some controller should do some configuration according to the selected timing. Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
parent
227f658e55
commit
81db2d363c
|
|
@ -318,6 +318,12 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
|
|||
return blkcnt;
|
||||
}
|
||||
|
||||
static void mmc_set_timing(struct mmc *mmc, uint timing)
|
||||
{
|
||||
mmc->timing = timing;
|
||||
mmc_set_ios(mmc);
|
||||
}
|
||||
|
||||
static int mmc_go_idle(struct mmc *mmc)
|
||||
{
|
||||
struct mmc_cmd cmd;
|
||||
|
|
@ -1741,6 +1747,7 @@ int mmc_start_init(struct mmc *mmc)
|
|||
mmc->ddr_mode = 0;
|
||||
mmc_set_bus_width(mmc, 1);
|
||||
mmc_set_clock(mmc, 1);
|
||||
mmc_set_timing(mmc, MMC_TIMING_LEGACY);
|
||||
|
||||
/* Reset the Card */
|
||||
err = mmc_go_idle(mmc);
|
||||
|
|
|
|||
|
|
@ -438,6 +438,21 @@ struct mmc {
|
|||
uint has_init;
|
||||
int high_capacity;
|
||||
uint bus_width;
|
||||
uint timing;
|
||||
|
||||
#define MMC_TIMING_LEGACY 0
|
||||
#define MMC_TIMING_MMC_HS 1
|
||||
#define MMC_TIMING_SD_HS 2
|
||||
#define MMC_TIMING_UHS_SDR12 3
|
||||
#define MMC_TIMING_UHS_SDR25 4
|
||||
#define MMC_TIMING_UHS_SDR50 5
|
||||
#define MMC_TIMING_UHS_SDR104 6
|
||||
#define MMC_TIMING_UHS_DDR50 7
|
||||
#define MMC_TIMING_MMC_DDR52 8
|
||||
#define MMC_TIMING_MMC_HS200 9
|
||||
#define MMC_TIMING_MMC_HS400 10
|
||||
#define MMC_TIMING_MMC_HS400ES 11
|
||||
|
||||
uint clock;
|
||||
uint card_caps;
|
||||
uint ocr;
|
||||
|
|
@ -497,6 +512,40 @@ enum mmc_hwpart_conf_mode {
|
|||
MMC_HWPART_CONF_COMPLETE,
|
||||
};
|
||||
|
||||
static inline bool mmc_card_hs(struct mmc *mmc)
|
||||
{
|
||||
return (mmc->timing == MMC_TIMING_MMC_HS) ||
|
||||
(mmc->timing == MMC_TIMING_SD_HS);
|
||||
}
|
||||
|
||||
static inline bool mmc_card_ddr(struct mmc *mmc)
|
||||
{
|
||||
return (mmc->timing == MMC_TIMING_UHS_DDR50) ||
|
||||
(mmc->timing == MMC_TIMING_MMC_DDR52) ||
|
||||
(mmc->timing == MMC_TIMING_MMC_HS400) ||
|
||||
(mmc->timing == MMC_TIMING_MMC_HS400ES);
|
||||
}
|
||||
|
||||
static inline bool mmc_card_hs200(struct mmc *mmc)
|
||||
{
|
||||
return mmc->timing == MMC_TIMING_MMC_HS200;
|
||||
}
|
||||
|
||||
static inline bool mmc_card_ddr52(struct mmc *mmc)
|
||||
{
|
||||
return mmc->timing == MMC_TIMING_MMC_DDR52;
|
||||
}
|
||||
|
||||
static inline bool mmc_card_hs400(struct mmc *mmc)
|
||||
{
|
||||
return mmc->timing == MMC_TIMING_MMC_HS400;
|
||||
}
|
||||
|
||||
static inline bool mmc_card_hs400es(struct mmc *mmc)
|
||||
{
|
||||
return mmc->timing == MMC_TIMING_MMC_HS400ES;
|
||||
}
|
||||
|
||||
struct mmc *mmc_create(const struct mmc_config *cfg, void *priv);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue