Linux MultiMedia Card development
 help / color / mirror / Atom feed
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" <linux-mmc@vger.kernel.org>
Cc: Ricky WU <ricky_wu@realtek.com>, Shawn Lin <shawn.lin@rock-chips.com>
Subject: Re: [PATCH v6 3/9] mmc: core: Add open-ended Ext memory addressing
Date: Fri, 6 Sep 2024 11:33:08 +0300	[thread overview]
Message-ID: <4a4dc281-34b7-473b-892b-7227530f6d56@intel.com> (raw)
In-Reply-To: <DM6PR04MB6575CF2F7CBDEB87949965D7FC9E2@DM6PR04MB6575.namprd04.prod.outlook.com>

On 6/09/24 11:20, Avri Altman wrote:
>>
>> On 4/09/24 17:52, Avri Altman wrote:
>>> For open-ended read/write - just send CMD22 before issuing the command.
>>> While at it, make sure that the rw command arg is properly casting the
>>> lower 32 bits, as it can be larger now.
>>>
>>> Signed-off-by: Avri Altman <avri.altman@wdc.com>
>>> ---
>>>  drivers/mmc/core/block.c | 6 +++++-
>>>  drivers/mmc/core/core.c  | 3 +++
>>>  include/linux/mmc/core.h | 5 +++++
>>>  3 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index
>>> cc7318089cf2..54469261bc25 100644
>>> --- a/drivers/mmc/core/block.c
>>> +++ b/drivers/mmc/core/block.c
>>> @@ -226,6 +226,7 @@ static void mmc_blk_rw_rq_prep(struct
>>> mmc_queue_req *mqrq,  static void mmc_blk_hsq_req_done(struct
>>> mmc_request *mrq);  static int mmc_spi_err_check(struct mmc_card
>>> *card);  static int mmc_blk_busy_cb(void *cb_data, bool *busy);
>>> +static int mmc_blk_wait_for_idle(struct mmc_queue *mq, struct
>>> +mmc_host *host);
>>
>> Not using mmc_blk_wait_for_idle() anymore.
> Done.
> 
>>
>>>
>>>  static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)  { @@
>>> -1710,7 +1711,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req
>>> *mqrq,
>>>
>>>       brq->mrq.cmd = &brq->cmd;
>>>
>>> -     brq->cmd.arg = blk_rq_pos(req);
>>> +     brq->cmd.arg = blk_rq_pos(req) & 0xFFFFFFFF;
>>
>> arg is 32 bits so not needed
> Done.
> 
>>
>>>       if (!mmc_card_blockaddr(card))
>>>               brq->cmd.arg <<= 9;
>>>       brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
>> @@
>>> -1758,6 +1759,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req
>> *mqrq,
>>>                       (do_data_tag ? (1 << 29) : 0);
>>>               brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
>>>               brq->mrq.sbc = &brq->sbc;
>>> +     } else if (mmc_card_ult_capacity(card)) {
>>
>> The 'else' isn't actually needed, is it?  Might as well keep sbc and ext_addr
>> separate in this patch.
> Sorry - I don't follow what you mean.
> Doesn't the else implies open-ended?

Disallowing SDUC with close-ended seems like a separate
issue.  The 'else' is not actually required, is it?

> 
>>
>>> +             brq->cmd.ext_addr = (blk_rq_pos(req) >> 32) & 0x3F;
>>
>> '& 0x3f' should not be needed. i.e. we either validate blk_rq_pos(req) (no point)
>> or we assume it is valid.
> Done.
> 
>>
>>> +             brq->cmd.has_ext_addr = 1;
>>
>> If you switch to bool, that could use 'true' instead of '1'
> Done.
> 
> Thanks,
> Avri
> 
>>
>>>       }
>>>  }
>>>
>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index
>>> d6c819dd68ed..a0b2999684b3 100644
>>> --- a/drivers/mmc/core/core.c
>>> +++ b/drivers/mmc/core/core.c
>>> @@ -336,6 +336,9 @@ int mmc_start_request(struct mmc_host *host,
>>> struct mmc_request *mrq)  {
>>>       int err;
>>>
>>> +     if (mrq->cmd && mrq->cmd->has_ext_addr)
>>> +             mmc_send_ext_addr(host, mrq->cmd->ext_addr);
>>> +
>>>       init_completion(&mrq->cmd_completion);
>>>
>>>       mmc_retune_hold(host);
>>> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index
>>> f0ac2e469b32..41c21c216584 100644
>>> --- a/include/linux/mmc/core.h
>>> +++ b/include/linux/mmc/core.h
>>> @@ -76,6 +76,11 @@ struct mmc_command {
>>>   */
>>>  #define mmc_cmd_type(cmd)    ((cmd)->flags & MMC_CMD_MASK)
>>>
>>> +     /* for SDUC */
>>> +     u8 has_ext_addr;
>>> +     u8 ext_addr;
>>> +     u16 reserved;
>>> +
>>>       unsigned int            retries;        /* max number of retries */
>>>       int                     error;          /* command error */
>>>
> 


  reply	other threads:[~2024-09-06  8:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 14:52 [PATCH v6 0/9] Add SDUC Support Avri Altman
2024-09-04 14:52 ` [PATCH v6 1/9] mmc: sd: SDUC Support Recognition Avri Altman
2024-09-06  6:39   ` Adrian Hunter
2024-09-06  8:10     ` Avri Altman
2024-09-04 14:52 ` [PATCH v6 2/9] mmc: sd: Add Extension memory addressing Avri Altman
2024-09-04 14:52 ` [PATCH v6 3/9] mmc: core: Add open-ended Ext " Avri Altman
2024-09-04 22:13   ` Christian Loehle
2024-09-05  6:12     ` Avri Altman
2024-09-05  7:25       ` Adrian Hunter
2024-09-05  8:27       ` Christian Loehle
2024-09-05  9:47         ` Avri Altman
2024-09-06  8:02   ` Adrian Hunter
2024-09-06  8:20     ` Avri Altman
2024-09-06  8:33       ` Adrian Hunter [this message]
2024-09-06 10:11         ` Avri Altman
2024-09-04 14:52 ` [PATCH v6 4/9] mmc: core: Don't use close-ended rw for SDUC Avri Altman
2024-09-04 14:52 ` [PATCH v6 5/9] mmc: core: Allow mmc erase to carry large addresses Avri Altman
2024-09-04 14:52 ` [PATCH v6 6/9] mmc: core: Add Ext memory addressing for erase Avri Altman
2024-09-06 10:06   ` Adrian Hunter
2024-09-06 10:14     ` Avri Altman
2024-09-04 14:52 ` [PATCH v6 7/9] mmc: core: Adjust ACMD22 to SDUC Avri Altman
2024-09-06 10:57   ` Adrian Hunter
2024-09-06 11:07     ` Avri Altman
2024-09-04 14:52 ` [PATCH v6 8/9] mmc: core: Disable SDUC for mmc_test Avri Altman
2024-09-06 10:10   ` Adrian Hunter
2024-09-06 10:15     ` Avri Altman
2024-09-04 14:52 ` [PATCH v6 9/9] mmc: core: Enable SDUC Avri Altman
2024-09-06 11:10 ` [PATCH v6 0/9] Add SDUC Support Adrian Hunter

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=4a4dc281-34b7-473b-892b-7227530f6d56@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=Avri.Altman@wdc.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ricky_wu@realtek.com \
    --cc=shawn.lin@rock-chips.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