summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-04-22 08:58:41 -0400
committerTom Rini <trini@konsulko.com>2020-04-22 08:58:41 -0400
commit2b63959e30f23ef3088dbed6626341c6d8371a66 (patch)
tree1ea89ae7672fbb34886d05c0f6eabfea4d0e00d3 /include
parent2f2031e647564be8121c05507fbec8e6c5bc0e63 (diff)
parent2448c34f9fc26d3c459e6e7b28c6357656bfa287 (diff)
Merge tag 'mmc-2020-4-22' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
- iproc_sdhci memory leak fix and enable R1B resp quirk - more mmc cmds and several mmc updates from Heinirich - Use bounce buffer for tmio sdhci - Alignment check for tmio sdhci
Diffstat (limited to 'include')
-rw-r--r--include/bouncebuf.h15
-rw-r--r--include/configs/rcar-gen3-common.h2
-rw-r--r--include/mmc.h39
-rw-r--r--include/spl.h32
4 files changed, 85 insertions, 3 deletions
diff --git a/include/bouncebuf.h b/include/bouncebuf.h
index fd9b0f3b289..7427bd12e27 100644
--- a/include/bouncebuf.h
+++ b/include/bouncebuf.h
@@ -62,6 +62,21 @@ struct bounce_buffer {
*/
int bounce_buffer_start(struct bounce_buffer *state, void *data,
size_t len, unsigned int flags);
+
+/**
+ * bounce_buffer_start() -- Start the bounce buffer session with external align check function
+ * state: stores state passed between bounce_buffer_{start,stop}
+ * data: pointer to buffer to be aligned
+ * len: length of the buffer
+ * flags: flags describing the transaction, see above.
+ * alignment: alignment of the newly allocated bounce buffer
+ * addr_is_aligned: function for checking the alignment instead of the default one
+ */
+int bounce_buffer_start_extalign(struct bounce_buffer *state, void *data,
+ size_t len, unsigned int flags,
+ size_t alignment,
+ int (*addr_is_aligned)(struct bounce_buffer *state));
+
/**
* bounce_buffer_stop() -- Finish the bounce buffer session
* state: stores state passed between bounce_buffer_{start,stop}
diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h
index 6528f1fa622..8f400ba05a0 100644
--- a/include/configs/rcar-gen3-common.h
+++ b/include/configs/rcar-gen3-common.h
@@ -47,7 +47,7 @@
#define CONFIG_SYS_MONITOR_BASE 0x00000000
#define CONFIG_SYS_MONITOR_LEN (1 * 1024 * 1024)
-#define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024)
+#define CONFIG_SYS_MALLOC_LEN (64 * 1024 * 1024)
#define CONFIG_SYS_BOOTM_LEN (64 << 20)
/* The HF/QSPI layout permits up to 1 MiB large bootloader blob */
diff --git a/include/mmc.h b/include/mmc.h
index e83c22423bf..5e9d15cb41a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -223,6 +223,9 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
#define EXT_CSD_WR_REL_PARAM 166 /* R */
#define EXT_CSD_WR_REL_SET 167 /* R/W */
#define EXT_CSD_RPMB_MULT 168 /* RO */
+#define EXT_CSD_USER_WP 171 /* R/W & R/W/C_P & R/W/E_P */
+#define EXT_CSD_BOOT_WP 173 /* R/W & R/W/C_P */
+#define EXT_CSD_BOOT_WP_STATUS 174 /* R */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
#define EXT_CSD_BOOT_BUS_WIDTH 177
#define EXT_CSD_PART_CONF 179 /* R/W */
@@ -488,6 +491,19 @@ struct dm_mmc_ops {
* @return 0 if not present, 1 if present, -ve on error
*/
int (*host_power_cycle)(struct udevice *dev);
+
+ /**
+ * get_b_max - get maximum length of single transfer
+ * Called before reading blocks from the card,
+ * useful for system which have e.g. DMA limits
+ * on various memory ranges.
+ *
+ * @dev: Device to check
+ * @dst: Destination buffer in memory
+ * @blkcnt: Total number of blocks in this transfer
+ * @return maximum number of blocks for this transfer
+ */
+ int (*get_b_max)(struct udevice *dev, void *dst, lbaint_t blkcnt);
};
#define mmc_get_ops(dev) ((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -501,6 +517,7 @@ int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout_us);
int dm_mmc_host_power_cycle(struct udevice *dev);
int dm_mmc_deferred_probe(struct udevice *dev);
+int dm_mmc_get_b_max(struct udevice *dev, void *dst, lbaint_t blkcnt);
/* Transition functions for compatibility */
int mmc_set_ios(struct mmc *mmc);
@@ -511,6 +528,7 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us);
int mmc_set_enhanced_strobe(struct mmc *mmc);
int mmc_host_power_cycle(struct mmc *mmc);
int mmc_deferred_probe(struct mmc *mmc);
+int mmc_get_b_max(struct mmc *mmc, void *dst, lbaint_t blkcnt);
#else
struct mmc_ops {
@@ -521,6 +539,7 @@ struct mmc_ops {
int (*getcd)(struct mmc *mmc);
int (*getwp)(struct mmc *mmc);
int (*host_power_cycle)(struct mmc *mmc);
+ int (*get_b_max)(struct mmc *mmc, void *dst, lbaint_t blkcnt);
};
#endif
@@ -893,6 +912,26 @@ int mmc_get_env_dev(void);
*/
struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);
+/**
+ * mmc_send_ext_csd() - read the extended CSD register
+ *
+ * @mmc: MMC device
+ * @ext_csd a cache aligned buffer of length MMC_MAX_BLOCK_LEN allocated by
+ * the caller, e.g. using
+ * ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN)
+ * Return: 0 for success
+ */
+int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd);
+
+/**
+ * mmc_boot_wp() - power on write protect boot partitions
+ *
+ * The boot partitions are write protected until the next power cycle.
+ *
+ * Return: 0 for success
+ */
+int mmc_boot_wp(struct mmc *mmc);
+
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;
diff --git a/include/spl.h b/include/spl.h
index 5d8d14dbf5c..8b15cd4914c 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -238,8 +238,36 @@ int spl_load_imx_container(struct spl_image_info *spl_image,
/* SPL common functions */
void preloader_console_init(void);
u32 spl_boot_device(void);
-u32 spl_boot_mode(const u32 boot_device);
-int spl_boot_partition(const u32 boot_device);
+
+/**
+ * spl_mmc_boot_mode() - Lookup function for the mode of an MMC boot source.
+ * @boot_device: ID of the device which the MMC driver wants to read
+ * from. Common values are e.g. BOOT_DEVICE_MMC1,
+ * BOOT_DEVICE_MMC2, BOOT_DEVICE_MMC2_2.
+ *
+ * This function should return one of MMCSD_MODE_FS, MMCSD_MODE_EMMCBOOT, or
+ * MMCSD_MODE_RAW for each MMC boot source which is defined for the target. The
+ * boot_device parameter tells which device the MMC driver is interested in.
+ *
+ * If not overridden, it is weakly defined in common/spl/spl_mmc.c.
+ *
+ * Note: It is important to use the boot_device parameter instead of e.g.
+ * spl_boot_device() as U-Boot is not always loaded from the same device as SPL.
+ */
+u32 spl_mmc_boot_mode(const u32 boot_device);
+
+/**
+ * spl_mmc_boot_partition() - MMC partition to load U-Boot from.
+ * @boot_device: ID of the device which the MMC driver wants to load
+ * U-Boot from.
+ *
+ * This function should return the partition number which the SPL
+ * should load U-Boot from (on the given boot_device) when
+ * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is set.
+ *
+ * If not overridden, it is weakly defined in common/spl/spl_mmc.c.
+ */
+int spl_mmc_boot_partition(const u32 boot_device);
void spl_set_bd(void);
/**