diff mbox series

[v7,04/10] mmc: core: Add open-ended Ext memory addressing

Message ID 20240908102018.3711527-5-avri.altman@wdc.com (mailing list archive)
State New
Headers show
Series Add SDUC Support | expand

Commit Message

Avri Altman Sept. 8, 2024, 10:20 a.m. UTC
For open-ended read/write - just send CMD22 before issuing the command.

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
 drivers/mmc/core/block.c | 5 +++++
 drivers/mmc/core/core.c  | 3 +++
 include/linux/mmc/core.h | 5 +++++
 3 files changed, 13 insertions(+)

Comments

Ulf Hansson Oct. 3, 2024, 3:47 p.m. UTC | #1
On Sun, 8 Sept 2024 at 12:22, Avri Altman <avri.altman@wdc.com> wrote:
>
> For open-ended read/write - just send CMD22 before issuing the command.
>
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
>  drivers/mmc/core/block.c | 5 +++++
>  drivers/mmc/core/core.c  | 3 +++
>  include/linux/mmc/core.h | 5 +++++
>  3 files changed, 13 insertions(+)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 05a7745c2a68..ba2ed413be5c 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -1759,6 +1759,11 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>                 brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
>                 brq->mrq.sbc = &brq->sbc;
>         }
> +
> +       if (mmc_card_ult_capacity(card)) {
> +               brq->cmd.ext_addr = blk_rq_pos(req) >> 32;
> +               brq->cmd.has_ext_addr = true;
> +       }
>  }
>
>  #define MMC_MAX_RETRIES                5
> 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..c86df8443a88 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -96,6 +96,11 @@ struct mmc_command {
>         unsigned int            busy_timeout;   /* busy detect timeout in ms */
>         struct mmc_data         *data;          /* data segment associated with cmd */
>         struct mmc_request      *mrq;           /* associated request */
> +
> +       /* for SDUC */
> +       bool has_ext_addr;
> +       u8 ext_addr;
> +       u16 reserved;

I don't see this being used, at least in this patch. Perhaps move it
to the patch that starts using it?

>  };
>
>  struct mmc_data {
> --
> 2.25.1
>

Kind regards
Uffe
Avri Altman Oct. 3, 2024, 4:44 p.m. UTC | #2
> On Sun, 8 Sept 2024 at 12:22, Avri Altman <avri.altman@wdc.com> wrote:
> >
> > For open-ended read/write - just send CMD22 before issuing the
> command.
> >
> > Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> > Signed-off-by: Avri Altman <avri.altman@wdc.com>
> > ---
> >  drivers/mmc/core/block.c | 5 +++++
> >  drivers/mmc/core/core.c  | 3 +++
> >  include/linux/mmc/core.h | 5 +++++
> >  3 files changed, 13 insertions(+)
> >
> > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index
> > 05a7745c2a68..ba2ed413be5c 100644
> > --- a/drivers/mmc/core/block.c
> > +++ b/drivers/mmc/core/block.c
> > @@ -1759,6 +1759,11 @@ static void mmc_blk_rw_rq_prep(struct
> mmc_queue_req *mqrq,
> >                 brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
> >                 brq->mrq.sbc = &brq->sbc;
> >         }
> > +
> > +       if (mmc_card_ult_capacity(card)) {
> > +               brq->cmd.ext_addr = blk_rq_pos(req) >> 32;
> > +               brq->cmd.has_ext_addr = true;
> > +       }
> >  }
> >
> >  #define MMC_MAX_RETRIES                5
> > 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..c86df8443a88 100644
> > --- a/include/linux/mmc/core.h
> > +++ b/include/linux/mmc/core.h
> > @@ -96,6 +96,11 @@ struct mmc_command {
> >         unsigned int            busy_timeout;   /* busy detect timeout in ms */
> >         struct mmc_data         *data;          /* data segment associated with
> cmd */
> >         struct mmc_request      *mrq;           /* associated request */
> > +
> > +       /* for SDUC */
> > +       bool has_ext_addr;
> > +       u8 ext_addr;
> > +       u16 reserved;
> 
> I don't see this being used, at least in this patch. Perhaps move it to the patch
> that starts using it?
In mmc_blk_rw_rq_prep().

Thanks,
Avri

> 
> >  };
> >
> >  struct mmc_data {
> > --
> > 2.25.1
> >
> 
> Kind regards
> Uffe
Ulf Hansson Oct. 4, 2024, 9:38 a.m. UTC | #3
On Thu, 3 Oct 2024 at 18:44, Avri Altman <Avri.Altman@wdc.com> wrote:
>
> > On Sun, 8 Sept 2024 at 12:22, Avri Altman <avri.altman@wdc.com> wrote:
> > >
> > > For open-ended read/write - just send CMD22 before issuing the
> > command.
> > >
> > > Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> > > Signed-off-by: Avri Altman <avri.altman@wdc.com>
> > > ---
> > >  drivers/mmc/core/block.c | 5 +++++
> > >  drivers/mmc/core/core.c  | 3 +++
> > >  include/linux/mmc/core.h | 5 +++++
> > >  3 files changed, 13 insertions(+)
> > >
> > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index
> > > 05a7745c2a68..ba2ed413be5c 100644
> > > --- a/drivers/mmc/core/block.c
> > > +++ b/drivers/mmc/core/block.c
> > > @@ -1759,6 +1759,11 @@ static void mmc_blk_rw_rq_prep(struct
> > mmc_queue_req *mqrq,
> > >                 brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
> > >                 brq->mrq.sbc = &brq->sbc;
> > >         }
> > > +
> > > +       if (mmc_card_ult_capacity(card)) {
> > > +               brq->cmd.ext_addr = blk_rq_pos(req) >> 32;
> > > +               brq->cmd.has_ext_addr = true;
> > > +       }
> > >  }
> > >
> > >  #define MMC_MAX_RETRIES                5
> > > 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..c86df8443a88 100644
> > > --- a/include/linux/mmc/core.h
> > > +++ b/include/linux/mmc/core.h
> > > @@ -96,6 +96,11 @@ struct mmc_command {
> > >         unsigned int            busy_timeout;   /* busy detect timeout in ms */
> > >         struct mmc_data         *data;          /* data segment associated with
> > cmd */
> > >         struct mmc_request      *mrq;           /* associated request */
> > > +
> > > +       /* for SDUC */
> > > +       bool has_ext_addr;
> > > +       u8 ext_addr;
> > > +       u16 reserved;
> >
> > I don't see this being used, at least in this patch. Perhaps move it to the patch
> > that starts using it?
> In mmc_blk_rw_rq_prep().

I was only pointing at the "u16 reserved", the other new variables are fine.

Looking at the complete series, it seems like the "u16 reserved" is
unused and can be removed.

[...]

Kind regards
Uffe
Avri Altman Oct. 4, 2024, 12:44 p.m. UTC | #4
> > > > +       /* for SDUC */
> > > > +       bool has_ext_addr;
> > > > +       u8 ext_addr;
> > > > +       u16 reserved;
> > >
> > > I don't see this being used, at least in this patch. Perhaps move it
> > > to the patch that starts using it?
> > In mmc_blk_rw_rq_prep().
> 
> I was only pointing at the "u16 reserved", the other new variables are fine.
> 
> Looking at the complete series, it seems like the "u16 reserved" is unused
> and can be removed.
OK.

Thanks,
Avri

> 
> [...]
> 
> Kind regards
> Uffe
diff mbox series

Patch

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 05a7745c2a68..ba2ed413be5c 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1759,6 +1759,11 @@  static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
 		brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
 		brq->mrq.sbc = &brq->sbc;
 	}
+
+	if (mmc_card_ult_capacity(card)) {
+		brq->cmd.ext_addr = blk_rq_pos(req) >> 32;
+		brq->cmd.has_ext_addr = true;
+	}
 }
 
 #define MMC_MAX_RETRIES		5
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..c86df8443a88 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -96,6 +96,11 @@  struct mmc_command {
 	unsigned int		busy_timeout;	/* busy detect timeout in ms */
 	struct mmc_data		*data;		/* data segment associated with cmd */
 	struct mmc_request	*mrq;		/* associated request */
+
+	/* for SDUC */
+	bool has_ext_addr;
+	u8 ext_addr;
+	u16 reserved;
 };
 
 struct mmc_data {