Convert CONFIG_SYS_INTERLAKEN et al to Kconfig
[platform/kernel/u-boot.git] / include / mmc.h
index 6f943e7..027e8bc 100644 (file)
@@ -308,6 +308,10 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 
 #define EXT_CSD_HS_CTRL_REL    (1 << 0)        /* host controlled WR_REL_SET */
 
+#define EXT_CSD_BOOT_WP_B_SEC_WP_SEL   (0x80)  /* enable partition selector */
+#define EXT_CSD_BOOT_WP_B_PWR_WP_SEC_SEL (0x02)        /* partition selector to protect */
+#define EXT_CSD_BOOT_WP_B_PWR_WP_EN    (0x01)  /* power-on write-protect */
+
 #define EXT_CSD_WR_DATA_REL_USR                (1 << 0)        /* user data area WR_REL */
 #define EXT_CSD_WR_DATA_REL_GP(x)      (1 << ((x)+1))  /* GP part (x+1) WR_REL */
 
@@ -390,7 +394,7 @@ struct mmc_uclass_priv {
  * will be available.
  *
  * @dev:       Device
- * @return associated mmc struct pointer if available, else NULL
+ * Return: associated mmc struct pointer if available, else NULL
  */
 struct mmc *mmc_get_mmc_dev(const struct udevice *dev);
 
@@ -561,6 +565,7 @@ struct mmc_ops {
        int (*getwp)(struct mmc *mmc);
        int (*host_power_cycle)(struct mmc *mmc);
        int (*get_b_max)(struct mmc *mmc, void *dst, lbaint_t blkcnt);
+       int (*wait_dat0)(struct mmc *mmc, int state, int timeout_us);
 };
 
 static inline int mmc_hs400_prepare_ddr(struct mmc *mmc)
@@ -726,6 +731,8 @@ struct mmc {
                                  */
        u32 quirks;
        u8 hs400_tuning;
+
+       enum bus_mode user_speed_mode; /* input speed mode from user */
 };
 
 #if CONFIG_IS_ENABLED(DM_MMC)
@@ -760,13 +767,13 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv);
 /**
  * mmc_bind() - Set up a new MMC device ready for probing
  *
- * A child block device is bound with the IF_TYPE_MMC interface type. This
+ * A child block device is bound with the UCLASS_MMC interface type. This
  * allows the device to be used with CONFIG_BLK
  *
  * @dev:       MMC device to set up
  * @mmc:       MMC struct
  * @cfg:       MMC configuration
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int mmc_bind(struct udevice *dev, struct mmc *mmc,
             const struct mmc_config *cfg);
@@ -776,7 +783,7 @@ void mmc_destroy(struct mmc *mmc);
  * mmc_unbind() - Unbind a MMC device's child block device
  *
  * @dev:       MMC device
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int mmc_unbind(struct udevice *dev);
 int mmc_initialize(struct bd_info *bis);
@@ -784,19 +791,14 @@ int mmc_init_device(int num);
 int mmc_init(struct mmc *mmc);
 int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error);
 int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data);
-
-#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
-    CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
-    CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
 int mmc_deinit(struct mmc *mmc);
-#endif
 
 /**
  * mmc_of_parse() - Parse the device tree to get the capabilities of the host
  *
  * @dev:       MMC device
  * @cfg:       MMC configuration
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg);
 
@@ -806,7 +808,7 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg);
  *
  * @dev:       MMC device
  * @cfg:       MMC configuration
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int mmc_pwrseq_get_power(struct udevice *dev, struct mmc_config *cfg);
 #endif
@@ -817,7 +819,7 @@ 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)
+ * Return: the value in mV if OK, -EINVAL on error (invalid mmc_voltage value)
  */
 int mmc_voltage_to_mv(enum mmc_voltage voltage);
 
@@ -826,7 +828,7 @@ int mmc_voltage_to_mv(enum mmc_voltage voltage);
  * @mmc:       MMC struct
  * @clock:     bus frequency in Hz
  * @disable:   flag indicating if the clock must on or off
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int mmc_set_clock(struct mmc *mmc, uint clock, bool disable);
 
@@ -840,7 +842,7 @@ void print_mmc_devices(char separator);
 /**
  * get_mmc_num() - get the total MMC device number
  *
- * @return 0 if there is no MMC device, else the number of devices
+ * Return: 0 if there is no MMC device, else the number of devices
  */
 int get_mmc_num(void);
 int mmc_switch_part(struct mmc *mmc, unsigned int part_num);
@@ -900,9 +902,10 @@ int mmc_set_bkops_enable(struct mmc *mmc);
  * the presence of SD/eMMC when no card detect logic is available.
  *
  * @param mmc  Pointer to a MMC device struct
- * @return 0 on success, <0 on error.
+ * @param quiet        Be quiet, do not print error messages when card is not detected.
+ * Return: 0 on success, <0 on error.
  */
-int mmc_get_op_cond(struct mmc *mmc);
+int mmc_get_op_cond(struct mmc *mmc, bool quiet);
 
 /**
  * Start device initialization and return immediately; it does not block on
@@ -911,7 +914,7 @@ int mmc_get_op_cond(struct mmc *mmc);
  * initializatin.
  *
  * @param mmc  Pointer to a MMC device struct
- * @return 0 on success, <0 on error.
+ * Return: 0 on success, <0 on error.
  */
 int mmc_start_init(struct mmc *mmc);
 
@@ -958,11 +961,21 @@ int mmc_get_env_dev(void);
  * mmc_get_blk_desc() - Get the block descriptor for an MMC device
  *
  * @mmc:       MMC device
- * @return block device if found, else NULL
+ * Return: block descriptor if found, else NULL
  */
 struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);
 
 /**
+ * mmc_get_blk() - Get the block device for an MMC device
+ *
+ * @dev:       MMC device
+ * @blkp:      Returns pointer to probed block device on sucesss
+ *
+ * Return: 0 on success, -ve on error
+ */
+int mmc_get_blk(struct udevice *dev, struct udevice **blkp);
+
+/**
  * mmc_send_ext_csd() - read the extended CSD register
  *
  * @mmc:       MMC device
@@ -982,6 +995,18 @@ int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd);
  */
 int mmc_boot_wp(struct mmc *mmc);
 
+/**
+ * mmc_boot_wp_single_partition() - set write protection to a boot partition.
+ *
+ * This function sets a single boot partition to protect and leave the
+ * other partition writable.
+ *
+ * @param mmc the mmc device.
+ * @param partition 0 - first boot partition, 1 - second boot partition.
+ * @return 0 for success
+ */
+int mmc_boot_wp_single_partition(struct mmc *mmc, int partition);
+
 static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
 {
        return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;