diff mbox series

[v6,6/9] mmc: core: Add Ext memory addressing for erase

Message ID 20240904145256.3670679-7-avri.altman@wdc.com
State New
Headers show
Series Add SDUC Support | expand

Commit Message

Avri Altman Sept. 4, 2024, 2:52 p.m. UTC
CMD22 shall precede CMD32 and CMD33 to configure 38-bit erase start
address and 38 bit erase stop address.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
 drivers/mmc/core/core.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Adrian Hunter Sept. 6, 2024, 10:06 a.m. UTC | #1
On 4/09/24 17:52, Avri Altman wrote:
> CMD22 shall precede CMD32 and CMD33 to configure 38-bit erase start
> address and 38 bit erase stop address.
> 
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
>  drivers/mmc/core/core.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 06f63fbaadfb..8d9f2c44d2a2 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1645,8 +1645,14 @@ static int mmc_do_erase(struct mmc_card *card, sector_t from,
>  		cmd.opcode = SD_ERASE_WR_BLK_START;
>  	else
>  		cmd.opcode = MMC_ERASE_GROUP_START;
> -	cmd.arg = from;
> +	cmd.arg = from & 0xFFFFFFFF;

Not needed

>  	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
> +
> +	if (mmc_card_ult_capacity(card)) {
> +		cmd.ext_addr = (from >> 32) & 0x3F;

'0x3F' not needed


> +		cmd.has_ext_addr = 1;

'true' if use bool

> +	}
> +
>  	err = mmc_wait_for_cmd(card->host, &cmd, 0);
>  	if (err) {
>  		pr_err("mmc_erase: group start error %d, "
> @@ -1660,8 +1666,14 @@ static int mmc_do_erase(struct mmc_card *card, sector_t from,
>  		cmd.opcode = SD_ERASE_WR_BLK_END;
>  	else
>  		cmd.opcode = MMC_ERASE_GROUP_END;
> -	cmd.arg = to;
> +	cmd.arg = to & 0xFFFFFFFF;

Not needed

>  	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
> +
> +	if (mmc_card_ult_capacity(card)) {
> +		cmd.ext_addr = (to >> 32) & 0x3F;

'0x3F' not needed

> +		cmd.has_ext_addr = 1;

'true' if use bool

> +	}
> +
>  	err = mmc_wait_for_cmd(card->host, &cmd, 0);
>  	if (err) {
>  		pr_err("mmc_erase: group end error %d, status %#x\n",
Avri Altman Sept. 6, 2024, 10:14 a.m. UTC | #2
> On 4/09/24 17:52, Avri Altman wrote:
> > CMD22 shall precede CMD32 and CMD33 to configure 38-bit erase start
> > address and 38 bit erase stop address.
> >
> > Signed-off-by: Avri Altman <avri.altman@wdc.com>
> > ---
> >  drivers/mmc/core/core.c | 16 ++++++++++++++--
> >  1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index
> > 06f63fbaadfb..8d9f2c44d2a2 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -1645,8 +1645,14 @@ static int mmc_do_erase(struct mmc_card *card,
> sector_t from,
> >               cmd.opcode = SD_ERASE_WR_BLK_START;
> >       else
> >               cmd.opcode = MMC_ERASE_GROUP_START;
> > -     cmd.arg = from;
> > +     cmd.arg = from & 0xFFFFFFFF;
> 
> Not needed
Done.

> 
> >       cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
> > +
> > +     if (mmc_card_ult_capacity(card)) {
> > +             cmd.ext_addr = (from >> 32) & 0x3F;
> 
> '0x3F' not needed
Done.

> 
> 
> > +             cmd.has_ext_addr = 1;
> 
> 'true' if use bool
Done.

> 
> > +     }
> > +
> >       err = mmc_wait_for_cmd(card->host, &cmd, 0);
> >       if (err) {
> >               pr_err("mmc_erase: group start error %d, "
> > @@ -1660,8 +1666,14 @@ static int mmc_do_erase(struct mmc_card *card,
> sector_t from,
> >               cmd.opcode = SD_ERASE_WR_BLK_END;
> >       else
> >               cmd.opcode = MMC_ERASE_GROUP_END;
> > -     cmd.arg = to;
> > +     cmd.arg = to & 0xFFFFFFFF;
> 
> Not needed
Done.

> 
> >       cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
> > +
> > +     if (mmc_card_ult_capacity(card)) {
> > +             cmd.ext_addr = (to >> 32) & 0x3F;
> 
> '0x3F' not needed
Done.

> 
> > +             cmd.has_ext_addr = 1;
> 
> 'true' if use bool
Done.

Thanks,
Avri
> 
> > +     }
> > +
> >       err = mmc_wait_for_cmd(card->host, &cmd, 0);
> >       if (err) {
> >               pr_err("mmc_erase: group end error %d, status %#x\n",
diff mbox series

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 06f63fbaadfb..8d9f2c44d2a2 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1645,8 +1645,14 @@  static int mmc_do_erase(struct mmc_card *card, sector_t from,
 		cmd.opcode = SD_ERASE_WR_BLK_START;
 	else
 		cmd.opcode = MMC_ERASE_GROUP_START;
-	cmd.arg = from;
+	cmd.arg = from & 0xFFFFFFFF;
 	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
+
+	if (mmc_card_ult_capacity(card)) {
+		cmd.ext_addr = (from >> 32) & 0x3F;
+		cmd.has_ext_addr = 1;
+	}
+
 	err = mmc_wait_for_cmd(card->host, &cmd, 0);
 	if (err) {
 		pr_err("mmc_erase: group start error %d, "
@@ -1660,8 +1666,14 @@  static int mmc_do_erase(struct mmc_card *card, sector_t from,
 		cmd.opcode = SD_ERASE_WR_BLK_END;
 	else
 		cmd.opcode = MMC_ERASE_GROUP_END;
-	cmd.arg = to;
+	cmd.arg = to & 0xFFFFFFFF;
 	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
+
+	if (mmc_card_ult_capacity(card)) {
+		cmd.ext_addr = (to >> 32) & 0x3F;
+		cmd.has_ext_addr = 1;
+	}
+
 	err = mmc_wait_for_cmd(card->host, &cmd, 0);
 	if (err) {
 		pr_err("mmc_erase: group end error %d, status %#x\n",