This adds a function to send a MMC_CMD_SET_BLOCK_COUNT command. This is not yet needed by barebox as we use open end multiblock transfers, but will be needed by upcoming RPMB support. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/mci/mci-core.c | 9 +++++++++ include/mci.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 27a10df9ce..6d8140f7b0 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -311,6 +311,15 @@ static int mci_block_erase(struct mci *card, unsigned int from, return -EIO; } +int mci_set_blockcount(struct mci *mci, unsigned int cmdarg) +{ + struct mci_cmd cmd = {}; + + mci_setup_cmd(&cmd, MMC_CMD_SET_BLOCK_COUNT, cmdarg, MMC_RSP_R1); + + return mci_send_cmd(mci, &cmd, NULL); +} + static int mci_do_block_op(struct mci *mci, const void *src, void *dst, int blocknum, int blocks) { diff --git a/include/mci.h b/include/mci.h index f0db1f9ea0..c6ee6ea50f 100644 --- a/include/mci.h +++ b/include/mci.h @@ -87,12 +87,16 @@ #define MMC_CMD_READ_MULTIPLE_BLOCK 18 #define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ #define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */ +#define MMC_CMD_SET_BLOCK_COUNT 23 #define MMC_CMD_WRITE_SINGLE_BLOCK 24 #define MMC_CMD_WRITE_MULTIPLE_BLOCK 25 #define MMC_CMD_APP_CMD 55 #define MMC_CMD_SPI_READ_OCR 58 #define MMC_CMD_SPI_CRC_ON_OFF 59 +#define MMC_CMD23_ARG_BLOCKS GENMASK(15, 0) +#define MMC_CMD23_ARG_REL_WR BIT(31) + /* class 5 */ #define MMC_ERASE_GROUP_START 35 /* ac [31:0] data addr R1 */ #define MMC_ERASE_GROUP_END 36 /* ac [31:0] data addr R1 */ @@ -724,6 +728,7 @@ int mmc_hs200_tuning(struct mci *mci); int mci_execute_tuning(struct mci *mci); int mci_send_abort_tuning(struct mci *mci, u32 opcode); int mmc_select_timing(struct mci *mci); +int mci_set_blockcount(struct mci *mci, unsigned int cmdarg); static inline bool mmc_card_hs200(struct mci *mci) { -- 2.39.5