* CM23: Reliable Write Request / Forced Programming Bits
@ 2021-09-22 17:47 Kegl Rohit
2021-09-23 17:28 ` Kegl Rohit
0 siblings, 1 reply; 2+ messages in thread
From: Kegl Rohit @ 2021-09-22 17:47 UTC (permalink / raw)
To: linux-mmc
Hello!
I have a question about the transfer of CM23 (SET_BLOCK_COUNT),
before starting a multiple block write CMD25.
I want to set some of this CMD23 bits:
BIT(31) stands for Reliable Write Request
BIT(24) stands for Forced Programming
I could only see usage of the Reliable Write Request for some rpmb ioctl:
https://github.com/torvalds/linux/blob/master/include/uapi/linux/mmc/ioctl.h#L13
https://github.com/torvalds/linux/blob/master/drivers/mmc/core/block.c#L550
sbc.arg = data.blocks | (idata->ic.write_flag & BIT(31));
But there are also BITS MMC_DATA_REL_WR, MMC_DATA_FORCED_PRG
https://github.com/torvalds/linux/blob/master/include/linux/mmc/core.h#L128
Used here:
https://github.com/torvalds/linux/blob/master/drivers/mmc/core/block.c#L1301
Which confuses me.
I am using the mmc_test code as example to execute a mmc block write.
https://github.com/torvalds/linux/blob/master/drivers/mmc/core/mmc_test.c#L190
So i set the BIT(24):
mrq->sbc->arg = blocks | BIT(24);
But then i realized that the sdhci mmc host uses SDHCI_AUTO_CMD23 and
mmc_test_prepare_sbc simply returns doing nothing.
What would be the correct way to set the BIT(24) with CMD23 in the
mmc_test example with a host which does SDHCI_AUTO_CMD23?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: CM23: Reliable Write Request / Forced Programming Bits
2021-09-22 17:47 CM23: Reliable Write Request / Forced Programming Bits Kegl Rohit
@ 2021-09-23 17:28 ` Kegl Rohit
0 siblings, 0 replies; 2+ messages in thread
From: Kegl Rohit @ 2021-09-23 17:28 UTC (permalink / raw)
To: linux-mmc
I looked over the main use in the mmc block queue:
This hardcoded (1 << 31), (1 << 29) ...
if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) &&
(do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) ||
do_data_tag)) {
brq->sbc.opcode = MMC_SET_BLOCK_COUNT;
brq->sbc.arg = brq->data.blocks |
(do_rel_wr ? (1 << 31) : 0) |
(do_data_tag ? (1 << 29) : 0);
brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
brq->mrq.sbc = &brq->sbc;
}
https://github.com/torvalds/linux/blob/master/drivers/mmc/core/block.c#L1629
I think this clears things up.
=> I need to adapt my mmc_test sample code and simply set the request member:
struct mmc_command sbc = {};
mrq->sbc = &sbc;
before calling mmc_test_prepare_sbc. Then the sbc opcode will be initialized.
And if the MMC host and card supports CMD23 the host driver will
execute the previously set mrq->sbc and disable auto CMD23 for this
request.
Am I right?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-23 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 17:47 CM23: Reliable Write Request / Forced Programming Bits Kegl Rohit
2021-09-23 17:28 ` Kegl Rohit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).