[V12,12/23] mmc: sdhci-uhs2: skip signal_voltage_switch()

Message ID 20230915094351.11120-13-victorshihgli@gmail.com
State New
Headers
Series Add support UHS-II for GL9755 |

Commit Message

Victor Shih Sept. 15, 2023, 9:43 a.m. UTC
  From: Victor Shih <victor.shih@genesyslogic.com.tw>

For UHS2, the signal voltage is supplied by vdd2 which is already 1.8v,
so no voltage switch required.

Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---

Updates in V5:
 - Use sdhci_uhs2_mode() to simplify code in
   sdhci_uhs2_start_signal_voltage_switch().

---

 drivers/mmc/host/sdhci-uhs2.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
  

Comments

Ulf Hansson Oct. 3, 2023, 9:58 a.m. UTC | #1
On Fri, 15 Sept 2023 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote:
>
> From: Victor Shih <victor.shih@genesyslogic.com.tw>
>
> For UHS2, the signal voltage is supplied by vdd2 which is already 1.8v,
> so no voltage switch required.

Can you please elaborate on this? I don't get anything of the above, sorry.

>
> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>
> Updates in V5:
>  - Use sdhci_uhs2_mode() to simplify code in
>    sdhci_uhs2_start_signal_voltage_switch().
>
> ---
>
>  drivers/mmc/host/sdhci-uhs2.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index fc37a34629c2..92fb69b7e209 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -142,6 +142,27 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
>         }
>  }
>
> +/*****************************************************************************\
> + *                                                                           *
> + * MMC callbacks                                                             *
> + *                                                                           *
> +\*****************************************************************************/
> +
> +static int sdhci_uhs2_start_signal_voltage_switch(struct mmc_host *mmc,
> +                                                 struct mmc_ios *ios)
> +{
> +       struct sdhci_host *host = mmc_priv(mmc);
> +
> +       /*
> +        * For UHS2, the signal voltage is supplied by vdd2 which is
> +        * already 1.8v so no voltage switch required.
> +        */
> +       if (sdhci_uhs2_mode(host))
> +               return 0;

This is just wrong. If we are initializing a uhs2 card, we certainly
should call ->start_signal_voltage_switch() callback at all. This is
for UHS-I cards, right?

> +
> +       return sdhci_start_signal_voltage_switch(mmc, ios);
> +}
> +
>  /*****************************************************************************\
>   *                                                                           *
>   * Driver init/exit                                                          *
> @@ -150,6 +171,9 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
>
>  static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
>  {
> +       host->mmc_host_ops.start_signal_voltage_switch =
> +               sdhci_uhs2_start_signal_voltage_switch;
> +
>         return 0;
>  }
>

Kind regards
Uffe
  
Victor Shih Oct. 6, 2023, 10:30 a.m. UTC | #2
On Tue, Oct 3, 2023 at 5:58 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Fri, 15 Sept 2023 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote:
> >
> > From: Victor Shih <victor.shih@genesyslogic.com.tw>
> >
> > For UHS2, the signal voltage is supplied by vdd2 which is already 1.8v,
> > so no voltage switch required.
>
> Can you please elaborate on this? I don't get anything of the above, sorry.
>
> >
> > Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
> > Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> > ---
> >
> > Updates in V5:
> >  - Use sdhci_uhs2_mode() to simplify code in
> >    sdhci_uhs2_start_signal_voltage_switch().
> >
> > ---
> >
> >  drivers/mmc/host/sdhci-uhs2.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> > index fc37a34629c2..92fb69b7e209 100644
> > --- a/drivers/mmc/host/sdhci-uhs2.c
> > +++ b/drivers/mmc/host/sdhci-uhs2.c
> > @@ -142,6 +142,27 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
> >         }
> >  }
> >
> > +/*****************************************************************************\
> > + *                                                                           *
> > + * MMC callbacks                                                             *
> > + *                                                                           *
> > +\*****************************************************************************/
> > +
> > +static int sdhci_uhs2_start_signal_voltage_switch(struct mmc_host *mmc,
> > +                                                 struct mmc_ios *ios)
> > +{
> > +       struct sdhci_host *host = mmc_priv(mmc);
> > +
> > +       /*
> > +        * For UHS2, the signal voltage is supplied by vdd2 which is
> > +        * already 1.8v so no voltage switch required.
> > +        */
> > +       if (sdhci_uhs2_mode(host))
> > +               return 0;
>
> This is just wrong. If we are initializing a uhs2 card, we certainly
> should call ->start_signal_voltage_switch() callback at all. This is
> for UHS-I cards, right?
>

Hi, Ulf

UHS-II does not need single_voltage.
I will modify the commit message in the next version.
sdhci_uhs2_start_signal_voltage_switch() is under
mmc_host_ops.start_signal_voltage_switch host ops,
therefore, we need to keep the UHS-I path here.

Thanks, Victor Shih

> > +
> > +       return sdhci_start_signal_voltage_switch(mmc, ios);
> > +}
> > +
> >  /*****************************************************************************\
> >   *                                                                           *
> >   * Driver init/exit                                                          *
> > @@ -150,6 +171,9 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
> >
> >  static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> >  {
> > +       host->mmc_host_ops.start_signal_voltage_switch =
> > +               sdhci_uhs2_start_signal_voltage_switch;
> > +
> >         return 0;
> >  }
> >
>
> Kind regards
> Uffe
  
Adrian Hunter Oct. 6, 2023, 10:50 a.m. UTC | #3
On 6/10/23 13:30, Victor Shih wrote:
> On Tue, Oct 3, 2023 at 5:58 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>>
>> On Fri, 15 Sept 2023 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote:
>>>
>>> From: Victor Shih <victor.shih@genesyslogic.com.tw>
>>>
>>> For UHS2, the signal voltage is supplied by vdd2 which is already 1.8v,
>>> so no voltage switch required.
>>
>> Can you please elaborate on this? I don't get anything of the above, sorry.
>>
>>>
>>> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
>>> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>>> ---
>>>
>>> Updates in V5:
>>>  - Use sdhci_uhs2_mode() to simplify code in
>>>    sdhci_uhs2_start_signal_voltage_switch().
>>>
>>> ---
>>>
>>>  drivers/mmc/host/sdhci-uhs2.c | 24 ++++++++++++++++++++++++
>>>  1 file changed, 24 insertions(+)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
>>> index fc37a34629c2..92fb69b7e209 100644
>>> --- a/drivers/mmc/host/sdhci-uhs2.c
>>> +++ b/drivers/mmc/host/sdhci-uhs2.c
>>> @@ -142,6 +142,27 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
>>>         }
>>>  }
>>>
>>> +/*****************************************************************************\
>>> + *                                                                           *
>>> + * MMC callbacks                                                             *
>>> + *                                                                           *
>>> +\*****************************************************************************/
>>> +
>>> +static int sdhci_uhs2_start_signal_voltage_switch(struct mmc_host *mmc,
>>> +                                                 struct mmc_ios *ios)
>>> +{
>>> +       struct sdhci_host *host = mmc_priv(mmc);
>>> +
>>> +       /*
>>> +        * For UHS2, the signal voltage is supplied by vdd2 which is
>>> +        * already 1.8v so no voltage switch required.
>>> +        */
>>> +       if (sdhci_uhs2_mode(host))
>>> +               return 0;
>>
>> This is just wrong. If we are initializing a uhs2 card, we certainly
>> should call ->start_signal_voltage_switch() callback at all. This is
>> for UHS-I cards, right?
>>
> 
> Hi, Ulf
> 
> UHS-II does not need single_voltage.
> I will modify the commit message in the next version.
> sdhci_uhs2_start_signal_voltage_switch() is under
> mmc_host_ops.start_signal_voltage_switch host ops,
> therefore, we need to keep the UHS-I path here.

You should be able to leave out the patch entirely
because ->start_signal_voltage_switch() is not called
for UHS2 mode

> 
> Thanks, Victor Shih
> 
>>> +
>>> +       return sdhci_start_signal_voltage_switch(mmc, ios);
>>> +}
>>> +
>>>  /*****************************************************************************\
>>>   *                                                                           *
>>>   * Driver init/exit                                                          *
>>> @@ -150,6 +171,9 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
>>>
>>>  static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
>>>  {
>>> +       host->mmc_host_ops.start_signal_voltage_switch =
>>> +               sdhci_uhs2_start_signal_voltage_switch;
>>> +
>>>         return 0;
>>>  }
>>>
>>
>> Kind regards
>> Uffe
  
Victor Shih Nov. 17, 2023, 10:49 a.m. UTC | #4
On Fri, Oct 6, 2023 at 6:51 PM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 6/10/23 13:30, Victor Shih wrote:
> > On Tue, Oct 3, 2023 at 5:58 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >>
> >> On Fri, 15 Sept 2023 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote:
> >>>
> >>> From: Victor Shih <victor.shih@genesyslogic.com.tw>
> >>>
> >>> For UHS2, the signal voltage is supplied by vdd2 which is already 1.8v,
> >>> so no voltage switch required.
> >>
> >> Can you please elaborate on this? I don't get anything of the above, sorry.
> >>
> >>>
> >>> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> >>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >>> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
> >>> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> >>> ---
> >>>
> >>> Updates in V5:
> >>>  - Use sdhci_uhs2_mode() to simplify code in
> >>>    sdhci_uhs2_start_signal_voltage_switch().
> >>>
> >>> ---
> >>>
> >>>  drivers/mmc/host/sdhci-uhs2.c | 24 ++++++++++++++++++++++++
> >>>  1 file changed, 24 insertions(+)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> >>> index fc37a34629c2..92fb69b7e209 100644
> >>> --- a/drivers/mmc/host/sdhci-uhs2.c
> >>> +++ b/drivers/mmc/host/sdhci-uhs2.c
> >>> @@ -142,6 +142,27 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
> >>>         }
> >>>  }
> >>>
> >>> +/*****************************************************************************\
> >>> + *                                                                           *
> >>> + * MMC callbacks                                                             *
> >>> + *                                                                           *
> >>> +\*****************************************************************************/
> >>> +
> >>> +static int sdhci_uhs2_start_signal_voltage_switch(struct mmc_host *mmc,
> >>> +                                                 struct mmc_ios *ios)
> >>> +{
> >>> +       struct sdhci_host *host = mmc_priv(mmc);
> >>> +
> >>> +       /*
> >>> +        * For UHS2, the signal voltage is supplied by vdd2 which is
> >>> +        * already 1.8v so no voltage switch required.
> >>> +        */
> >>> +       if (sdhci_uhs2_mode(host))
> >>> +               return 0;
> >>
> >> This is just wrong. If we are initializing a uhs2 card, we certainly
> >> should call ->start_signal_voltage_switch() callback at all. This is
> >> for UHS-I cards, right?
> >>
> >
> > Hi, Ulf
> >
> > UHS-II does not need single_voltage.
> > I will modify the commit message in the next version.
> > sdhci_uhs2_start_signal_voltage_switch() is under
> > mmc_host_ops.start_signal_voltage_switch host ops,
> > therefore, we need to keep the UHS-I path here.
>
> You should be able to leave out the patch entirely
> because ->start_signal_voltage_switch() is not called
> for UHS2 mode
>

Hi, Ulf and Adrian

I will drop this patch in version 13.

Thanks, Victor Shih

> >
> > Thanks, Victor Shih
> >
> >>> +
> >>> +       return sdhci_start_signal_voltage_switch(mmc, ios);
> >>> +}
> >>> +
> >>>  /*****************************************************************************\
> >>>   *                                                                           *
> >>>   * Driver init/exit                                                          *
> >>> @@ -150,6 +171,9 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
> >>>
> >>>  static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
> >>>  {
> >>> +       host->mmc_host_ops.start_signal_voltage_switch =
> >>> +               sdhci_uhs2_start_signal_voltage_switch;
> >>> +
> >>>         return 0;
> >>>  }
> >>>
> >>
> >> Kind regards
> >> Uffe
>
  

Patch

diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
index fc37a34629c2..92fb69b7e209 100644
--- a/drivers/mmc/host/sdhci-uhs2.c
+++ b/drivers/mmc/host/sdhci-uhs2.c
@@ -142,6 +142,27 @@  static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
 	}
 }
 
+/*****************************************************************************\
+ *                                                                           *
+ * MMC callbacks                                                             *
+ *                                                                           *
+\*****************************************************************************/
+
+static int sdhci_uhs2_start_signal_voltage_switch(struct mmc_host *mmc,
+						  struct mmc_ios *ios)
+{
+	struct sdhci_host *host = mmc_priv(mmc);
+
+	/*
+	 * For UHS2, the signal voltage is supplied by vdd2 which is
+	 * already 1.8v so no voltage switch required.
+	 */
+	if (sdhci_uhs2_mode(host))
+		return 0;
+
+	return sdhci_start_signal_voltage_switch(mmc, ios);
+}
+
 /*****************************************************************************\
  *                                                                           *
  * Driver init/exit                                                          *
@@ -150,6 +171,9 @@  static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
 
 static int sdhci_uhs2_host_ops_init(struct sdhci_host *host)
 {
+	host->mmc_host_ops.start_signal_voltage_switch =
+		sdhci_uhs2_start_signal_voltage_switch;
+
 	return 0;
 }