]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/mmc.h
mmc: Enable signal voltage to be selected from mmc core
[people/ms/u-boot.git] / include / mmc.h
index 9fe6a87e882795cb323517698fa2a0db3d72cef8..e5249637c85143ac79392a5a0d74f1c72465fe92 100644 (file)
 #define EXT_CSD_BUS_WIDTH_8    2       /* Card is in 8 bit mode */
 #define EXT_CSD_DDR_BUS_WIDTH_4        5       /* Card is in 4 bit DDR mode */
 #define EXT_CSD_DDR_BUS_WIDTH_8        6       /* Card is in 8 bit DDR mode */
+#define EXT_CSD_DDR_FLAG       BIT(2)  /* Flag for DDR mode */
 
+#define EXT_CSD_TIMING_LEGACY  0       /* no high speed */
+#define EXT_CSD_TIMING_HS      1       /* HS */
 #define EXT_CSD_BOOT_ACK_ENABLE                        (1 << 6)
 #define EXT_CSD_BOOT_PARTITION_ENABLE          (1 << 3)
 #define EXT_CSD_PARTITION_ACCESS_ENABLE                (1 << 0)
 #define ENHNCD_SUPPORT         (0x2)
 #define PART_ENH_ATTRIB                (0x1f)
 
+enum mmc_voltage {
+       MMC_SIGNAL_VOLTAGE_000 = 0,
+       MMC_SIGNAL_VOLTAGE_120,
+       MMC_SIGNAL_VOLTAGE_180,
+       MMC_SIGNAL_VOLTAGE_330
+};
+
 /* Maximum block size for MMC */
 #define MMC_MAX_BLOCK_LEN      512
 
@@ -429,6 +439,14 @@ enum bus_mode {
 const char *mmc_mode_name(enum bus_mode mode);
 void mmc_dump_capabilities(const char *text, uint caps);
 
+static inline bool mmc_is_mode_ddr(enum bus_mode mode)
+{
+       if ((mode == MMC_DDR_52) || (mode == UHS_DDR50))
+               return true;
+       else
+               return false;
+}
+
 /*
  * With CONFIG_DM_MMC enabled, struct mmc can be accessed from the MMC device
  * with mmc_get_mmc_dev().
@@ -446,6 +464,7 @@ struct mmc {
        int high_capacity;
        uint bus_width;
        uint clock;
+       enum mmc_voltage signal_voltage;
        uint card_caps;
        uint ocr;
        uint dsr;
@@ -538,7 +557,7 @@ int mmc_unbind(struct udevice *dev);
 int mmc_initialize(bd_t *bis);
 int mmc_init(struct mmc *mmc);
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
-void mmc_set_clock(struct mmc *mmc, uint clock);
+int mmc_set_clock(struct mmc *mmc, uint clock);
 struct mmc *find_mmc_device(int dev_num);
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);