Skip to content

Commit cec18ad

Browse files
author
Ulf Hansson
committed
mmc: core: Prepare mmc_send_cxd_data() to be re-used for additional cmds
The function mmc_send_cxd_data() sends a data read command of ADTC type and prepares to receive an R1 response. To make it even more re-usable, let's extend it with another in-parameter for the command argument. While at it, let's also rename the function to mmc_send_adtc_data() as it better describes its purpose. Note that, this change doesn't add any new users of the function. Instead that is done from subsequent changes. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Avri Altman <avri.altman@wdc.com> Link: https://lore.kernel.org/r/20210504161222.101536-7-ulf.hansson@linaro.org
1 parent 6fa7965 commit cec18ad

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎drivers/mmc/core/mmc_ops.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,8 @@ mmc_send_cxd_native(struct mmc_host *host, u32 arg, u32 *cxd, int opcode)
252252
* NOTE: void *buf, caller for the buf is required to use DMA-capable
253253
* buffer or on-stack buffer (with some overhead in callee).
254254
*/
255-
static int
256-
mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
257-
u32 opcode, void *buf, unsigned len)
255+
int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode,
256+
u32 args, void *buf, unsigned len)
258257
{
259258
struct mmc_request mrq = {};
260259
struct mmc_command cmd = {};
@@ -265,7 +264,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
265264
mrq.data = &data;
266265

267266
cmd.opcode = opcode;
268-
cmd.arg = 0;
267+
cmd.arg = args;
269268

270269
/* NOTE HACK: the MMC_RSP_SPI_R1 is always correct here, but we
271270
* rely on callers to never use this with "native" calls for reading
@@ -311,7 +310,7 @@ static int mmc_spi_send_cxd(struct mmc_host *host, u32 *cxd, u32 opcode)
311310
if (!cxd_tmp)
312311
return -ENOMEM;
313312

314-
ret = mmc_send_cxd_data(NULL, host, opcode, cxd_tmp, 16);
313+
ret = mmc_send_adtc_data(NULL, host, opcode, 0, cxd_tmp, 16);
315314
if (ret)
316315
goto err;
317316

@@ -359,7 +358,7 @@ int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd)
359358
if (!ext_csd)
360359
return -ENOMEM;
361360

362-
err = mmc_send_cxd_data(card, card->host, MMC_SEND_EXT_CSD, ext_csd,
361+
err = mmc_send_adtc_data(card, card->host, MMC_SEND_EXT_CSD, 0, ext_csd,
363362
512);
364363
if (err)
365364
kfree(ext_csd);

‎drivers/mmc/core/mmc_ops.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ int mmc_set_dsr(struct mmc_host *host);
2626
int mmc_go_idle(struct mmc_host *host);
2727
int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
2828
int mmc_set_relative_addr(struct mmc_card *card);
29+
int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode,
30+
u32 args, void *buf, unsigned len);
2931
int mmc_send_csd(struct mmc_card *card, u32 *csd);
3032
int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries);
3133
int mmc_send_status(struct mmc_card *card, u32 *status);

0 commit comments

Comments
 (0)