Re: [PATCH v4 1/2] mmc: mmc: add prepare_ddr_to_hs400 callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25 October 2018 at 04:59, Yinbo Zhu <yinbo.zhu@xxxxxxx> wrote:
> Some SD controllers need specific settings for HS400 mode
> before the speed mode is been switching from DDR mode to
> HS400 mode. This patch is to add prepare_ddr_to_hs400 callback
> for this.
>
> Signed-off-by: Yinbo Zhu <yinbo.zhu@xxxxxxx>
> ---
> Change in v4:
>                 post this as part of patch series
>
>  drivers/mmc/core/mmc.c   |    3 +++
>  include/linux/mmc/host.h |    1 +
>  2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index bc1bd2c..749c5f2 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1182,6 +1182,9 @@ static int mmc_select_hs400(struct mmc_card *card)
>                 goto out_err;
>
>         /* Switch card to DDR */
> +       if (host->ops->prepare_ddr_to_hs400)
> +               host->ops->prepare_ddr_to_hs400(host);

The code is starting to become a bit messy with all the hs400 related
callbacks, however I guess there is no other option - so I am fine
with adding this.

Although, please rename the callback to "hs400_prepare_ddr" to make
its purpose more clear and aligned with other "hs400" callbacks.

> +
>         err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>                          EXT_CSD_BUS_WIDTH,
>                          EXT_CSD_DDR_BUS_WIDTH_8,
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 2a5fe75..a44544e 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -146,6 +146,7 @@ struct mmc_host_ops {
>
>         /* Prepare HS400 target operating frequency depending host driver */
>         int     (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
> +       int     (*prepare_ddr_to_hs400)(struct mmc_host *host);

Please add a comment above the new callback, something along the lines of:

"Prepare switch to DDR during the HS400 init sequence."

>
>         /* Prepare for switching from HS400 to HS200 */
>         void    (*hs400_downgrade)(struct mmc_host *host);
> --
> 1.7.1
>

Kind regards
Uffe



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux