From: Adrian Hunter <adrian.hunter@intel.com>
To: Avri Altman <avri.altman@wdc.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc@vger.kernel.org
Cc: Ricky WU <ricky_wu@realtek.com>
Subject: Re: [PATCH v4 2/9] mmc: sd: Add Extension memory addressing
Date: Mon, 26 Aug 2024 09:43:13 +0300 [thread overview]
Message-ID: <2518dcfc-452c-4464-a989-b6e4e02772e5@intel.com> (raw)
In-Reply-To: <20240825074141.3171549-3-avri.altman@wdc.com>
On 25/08/24 10:41, Avri Altman wrote:
> SDUC memory addressing spans beyond 2TB and up to 128TB. Therefore, 38
> bits are required to access the entire memory space of all sectors.
> Those extra 6 bits are to be carried by CMD22 prior of sending
> read/write/erase commands: CMD17, CMD18, CMD24, CMD25, CMD32, and CMD33.
>
> CMD22 will carry the higher order 6 bits, and must precedes any of the
> above commands even if it targets sector < 2TB.
>
> No error related to address or length is indicated in CMD22 but rather
> in the read/write command itself.
>
> Tested-by: Ricky WU <ricky_wu@realtek.com>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
> drivers/mmc/core/sd_ops.c | 16 ++++++++++++++++
> drivers/mmc/core/sd_ops.h | 1 +
> include/linux/mmc/sd.h | 3 +++
> 3 files changed, 20 insertions(+)
>
> diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
> index 8b9b34286ef3..780c5dd7266f 100644
> --- a/drivers/mmc/core/sd_ops.c
> +++ b/drivers/mmc/core/sd_ops.c
> @@ -16,6 +16,7 @@
> #include <linux/mmc/sd.h>
>
> #include "core.h"
> +#include "card.h"
> #include "sd_ops.h"
> #include "mmc_ops.h"
>
> @@ -188,6 +189,21 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
> return 0;
> }
>
> +int mmc_send_ext_addr(struct mmc_host *host, sector_t addr)
> +{
> + struct mmc_command cmd = {
> + .opcode = SD_ADDR_EXT,
> + .arg = (u32)((addr >> 32) & 0x3F),
If addr were outside the acceptable range, then the command
should fail, which is what we want, so better to leave out
the mask i.e.
.arg = (u32)(addr >> 32),
> + .flags = MMC_RSP_R1 | MMC_CMD_AC,
> + };
> +
> + if (!mmc_card_ult_capacity(host->card))
> + return 0;
> +
> + return mmc_wait_for_cmd(host, &cmd, 0);
> +}
> +EXPORT_SYMBOL_GPL(mmc_send_ext_addr);
> +
> static int __mmc_send_if_cond(struct mmc_host *host, u32 ocr, u8 pcie_bits,
> u32 *resp)
> {
> diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h
> index 7667fc223b74..462efd43acfa 100644
> --- a/drivers/mmc/core/sd_ops.h
> +++ b/drivers/mmc/core/sd_ops.h
> @@ -21,6 +21,7 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
> int mmc_app_send_scr(struct mmc_card *card);
> int mmc_app_sd_status(struct mmc_card *card, void *ssr);
> int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
> +int mmc_send_ext_addr(struct mmc_host *host, sector_t addr);
>
> #endif
>
> diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
> index 865cc0ca8543..af5fc70e09a2 100644
> --- a/include/linux/mmc/sd.h
> +++ b/include/linux/mmc/sd.h
> @@ -15,6 +15,9 @@
> #define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
> #define SD_SWITCH_VOLTAGE 11 /* ac R1 */
>
> +/* Class 2 */
> +#define SD_ADDR_EXT 22 /* ac [5:0] R1 */
> +
> /* class 10 */
> #define SD_SWITCH 6 /* adtc [31:0] See below R1 */
>
next prev parent reply other threads:[~2024-08-26 6:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-25 7:41 [PATCH v4 0/9] Add SDUC Support Avri Altman
2024-08-25 7:41 ` [PATCH v4 1/9] mmc: sd: SDUC Support Recognition Avri Altman
2024-08-25 7:41 ` [PATCH v4 2/9] mmc: sd: Add Extension memory addressing Avri Altman
2024-08-26 6:43 ` Adrian Hunter [this message]
2024-08-26 7:05 ` Avri Altman
2024-08-25 7:41 ` [PATCH v4 3/9] mmc: core: Add open-ended Ext " Avri Altman
2024-08-25 7:41 ` [PATCH v4 4/9] mmc: core: Add close-ended " Avri Altman
2024-08-26 5:32 ` Avri Altman
2024-08-26 6:51 ` Adrian Hunter
2024-08-26 7:11 ` Avri Altman
2024-08-25 7:41 ` [PATCH v4 5/9] mmc: host: Always use manual-cmd23 in SDUC Avri Altman
2024-08-25 7:41 ` [PATCH v4 6/9] mmc: host: Add close-ended Ext memory addressing Avri Altman
2024-08-25 13:33 ` Avri Altman
2024-08-26 19:31 ` kernel test robot
2024-08-26 22:28 ` kernel test robot
2024-08-25 7:41 ` [PATCH v4 7/9] mmc: core: Allow mmc erase to carry large addresses Avri Altman
2024-08-25 7:41 ` [PATCH v4 8/9] mmc: core: Add Ext memory addressing for erase Avri Altman
2024-08-25 7:41 ` [PATCH v4 9/9] mmc: core: Adjust ACMD22 to SDUC Avri Altman
2024-08-26 6:34 ` Adrian Hunter
2024-08-26 7:26 ` Avri Altman
2024-08-26 7:34 ` Adrian Hunter
2024-08-26 7:39 ` Avri Altman
2024-08-26 6:46 ` [PATCH v4 0/9] Add SDUC Support Adrian Hunter
2024-08-26 6:58 ` Avri Altman
2024-08-27 7:45 ` Avri Altman
2024-08-27 7:57 ` Adrian Hunter
2024-08-27 8:45 ` Avri Altman
2024-08-27 10:58 ` Avri Altman
2024-08-27 11:30 ` Adrian Hunter
2024-08-28 14:41 ` Ulf Hansson
2024-08-29 7:10 ` Avri Altman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2518dcfc-452c-4464-a989-b6e4e02772e5@intel.com \
--to=adrian.hunter@intel.com \
--cc=avri.altman@wdc.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ricky_wu@realtek.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox