]> git.sur5r.net Git - u-boot/blobdiff - include/mmc.h
dm: Drop the block_dev_desc_t typedef
[u-boot] / include / mmc.h
index 644e3fa1e1353b1e54f1378b96731a4050e85d1c..cdb56e7ac14eaaeef3d952876756beb6359ad0bb 100644 (file)
@@ -55,8 +55,7 @@
 #define MMC_MODE_4BIT          (1 << 2)
 #define MMC_MODE_8BIT          (1 << 3)
 #define MMC_MODE_SPI           (1 << 4)
-#define MMC_MODE_HC            (1 << 5)
-#define MMC_MODE_DDR_52MHz     (1 << 6)
+#define MMC_MODE_DDR_52MHz     (1 << 5)
 
 #define SD_DATA_4BIT   0x00040000
 
@@ -70,8 +69,7 @@
 #define UNUSABLE_ERR           -17 /* Unusable Card */
 #define COMM_ERR               -18 /* Communications Error */
 #define TIMEOUT                        -19
-#define IN_PROGRESS            -20 /* operation is in progress */
-#define SWITCH_ERR             -21 /* Card reports failure to switch mode */
+#define SWITCH_ERR             -20 /* Card reports failure to switch mode */
 
 #define MMC_CMD_GO_IDLE_STATE          0
 #define MMC_CMD_SEND_OP_COND           1
 #define OCR_VOLTAGE_MASK       0x007FFF80
 #define OCR_ACCESS_MODE                0x60000000
 
-#define SECURE_ERASE           0x80000000
+#define MMC_ERASE_ARG          0x00000000
+#define MMC_SECURE_ERASE_ARG   0x80000000
+#define MMC_TRIM_ARG           0x00000001
+#define MMC_DISCARD_ARG                0x00000003
+#define MMC_SECURE_TRIM1_ARG   0x80000001
+#define MMC_SECURE_TRIM2_ARG   0x80008000
 
 #define MMC_STATUS_MASK                (~0x0206BF7F)
 #define MMC_STATUS_SWITCH_ERROR        (1 << 7)
 #define MMC_NUM_BOOT_PARTITION 2
 #define MMC_PART_RPMB           3       /* RPMB partition number */
 
+/* Driver model support */
+
+/**
+ * struct mmc_uclass_priv - Holds information about a device used by the uclass
+ */
+struct mmc_uclass_priv {
+       struct mmc *mmc;
+};
+
+/**
+ * mmc_get_mmc_dev() - get the MMC struct pointer for a device
+ *
+ * Provided that the device is already probed and ready for use, this value
+ * will be available.
+ *
+ * @dev:       Device
+ * @return associated mmc struct pointer if available, else NULL
+ */
+struct mmc *mmc_get_mmc_dev(struct udevice *dev);
+
+/* End of driver model support */
+
 struct mmc_cid {
        unsigned long psn;
        unsigned short oid;
@@ -339,7 +364,6 @@ struct mmc {
        u8 part_attr;
        u8 wr_rel_set;
        char part_config;
-       char part_num;
        uint tran_speed;
        uint read_bl_len;
        uint write_bl_len;
@@ -352,7 +376,7 @@ struct mmc {
        u64 capacity_gp[4];
        u64 enh_user_start;
        u64 enh_user_size;
-       block_dev_desc_t block_dev;
+       struct blk_desc block_dev;
        char op_cond_pending;   /* 1 if we are waiting on an op_cond command */
        char init_in_progress;  /* 1 if we have done mmc_start_init() */
        char preinit;           /* start init as early as possible */
@@ -455,6 +479,7 @@ void board_mmc_power_init(void);
 int board_mmc_init(bd_t *bis);
 int cpu_mmc_init(bd_t *bis);
 int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr);
+int mmc_get_env_dev(void);
 
 struct pci_device_id;
 
@@ -464,11 +489,9 @@ struct pci_device_id;
  * This finds all the matching PCI IDs and sets them up as MMC devices.
  *
  * @name:              Name to use for devices
- * @mmc_supported:     PCI IDs to search for
- * @num_ids:           Number of elements in @mmc_supported
+ * @mmc_supported:     PCI IDs to search for, terminated by {0, 0}
  */
-int pci_mmc_init(const char *name, struct pci_device_id *mmc_supported,
-                int num_ids);
+int pci_mmc_init(const char *name, struct pci_device_id *mmc_supported);
 
 /* Set block count limit because of 16 bit register limit on some hardware*/
 #ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT