All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ziji Hu <huziji@marvell.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Jimmy Xu <zmxu@marvell.com>, Jisheng Zhang <jszhang@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>, Ryan Gao <ygao@marvell.com>,
	Doug Jones <dougj@marvell.com>, Victor Gu <xigu@marvell.com>,
	"Wei(SOCP) Liu" <liuw@marvell.com>,
	Wilson Ding <dingwei@marvell.com>,
	Yehuda Yitschak <yehuday@marvell.com>,
	Marcin Wojtas <mw@semihalf.com>, Hanna Hawa <hannah@marvell.com>,
	Kostya Porotchkin <kostap@marvell.com>
Subject: Re: [PATCH v5 07/12] mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC.
Date: Sat, 28 Jan 2017 01:10:54 +0800	[thread overview]
Message-ID: <1f174462-7644-1d02-9216-01c1fa3b402b@marvell.com> (raw)
In-Reply-To: <CAPDyKFpx23wio-QmDrx277+YO2Jt2S0ZrokZ2E4K+oVURSR1Hg@mail.gmail.com>

Hi Ulf,

On 2017/1/26 19:29, Ulf Hansson wrote:
> [...]
> 
>> +
>> +static inline bool temp_stage_hs200_to_hs400(struct sdhci_host *host,
>> +                                            struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Tmep stages from HS200 to HS400
>> +        * from HS200 to HS in 200MHz
>> +        * from 200MHz to 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS) &&
>> +            (priv->clock > host->clock)))
>> +               return true;
>> +
>> +       return false;
>> +}
>> +
>> +static inline bool temp_stage_hs400_to_h200(struct sdhci_host *host,
>> +                                           struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Temp stages from HS400 t0 HS200:
>> +        * from 200MHz to 52MHz in HS400
>> +        * from HS400 to HS DDR in 52MHz
>> +        * from HS DDR to HS in 52MHz
>> +        * from HS to HS200 in 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS400) &&
>> +            ((host->clock == MMC_HIGH_52_MAX_DTR) ||
>> +             (host->timing == MMC_TIMING_MMC_DDR52))) ||
>> +           ((priv->timing == MMC_TIMING_MMC_DDR52) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->clock == MMC_HIGH_52_MAX_DTR)))
>> +               return true;
>> +
>> +       return false;
>> +}
> 
> Both the above functions seems to be really fragile to use. If
> anything changes in the core layer related to these sequences, you may
> end up getting a wrong validated expression.
> 
> Perhaps an option would be to add one or two new mmc host ops, which
> could be called during the related hs200/400 sequences that could make
> this less fragile for you? What do you think?
> 

    Yes, they both look fragile to use.
    In my own opinion, hs200->hs400 sequence might be safe since it has been
    defined and fixed by eMMC spec. I personally think it is unlikely to be
    adjusted again. Please correct me if I am wrong.
    However, as you said, hs400->hs200 sequence will have issue if it is
    changed in core layer, since such a sequence is not from eMMC spec.

    But, in my opinion, adding additional mmc host ops might not be helpful.
    The above two functions are part of Xenon PHY adjustment. Those two
    functions help save some PHY setting steps in hs200->hs400/hs400->hs200
    sequence. But other PHY settings are still necessary,
    which should be executed each time when mmc core layer set ios.
    Neither of them can be extracted out and put into another mmc host ops.

    Instead, it will helps us improve the above two if we can add a flag to
    indicate that eMMC is in a temporary status in hs200->hs400 or hs400->hs200
    sequence.

>> +
>> +/*
>> + * If eMMC PHY Slow Mode is required in lower speed mode in SDR mode
>> + * (SDLCK < 55MHz), enable Slow Mode to bypass eMMC PHY.
>> + * SDIO slower SDR mode also requires Slow Mode.
>> + *
>> + * If Slow Mode is enabled, return true.
>> + * Otherwise, return false.
>> + */
>> +static bool emmc_phy_slow_mode(struct sdhci_host *host,
>> +                              unsigned char timing)
>> +{
>> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +       struct sdhci_xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
>> +       struct emmc_phy_params *params = priv->phy_params;
>> +       struct xenon_emmc_phy_regs *phy_regs = priv->emmc_phy_regs;
>> +       u32 reg;
>> +
>> +       /* Skip temp stages from HS200 to HS400 */
>> +       if (temp_stage_hs200_to_hs400(host, priv))
>> +               return false;
>> +
>> +       /* Skip temp stages from HS400 t0 HS200 */
>> +       if (temp_stage_hs400_to_h200(host, priv))
>> +               return false;
>> +
>> +       reg = sdhci_readl(host, phy_regs->timing_adj);
>> +       /* Enable Slow Mode for SDIO in slower SDR mode */
>> +       if ((priv->init_card_type == MMC_TYPE_SDIO) &&
> 
> Ah, noticed that there is some specific things going on here for SDIO
> here as well. So perhaps you do need to implement the ->init_card()
> ops anyway. Which I suggested not to, for patch6. :-)
> 
> Although, there is one problem with using ->init_card(). That is
> particularly for removable cards, as mmc_rescan() doesn't invoke
> ->init_card() when it removes a card, which means, you may use old and
> thus wrong information about what kind of card in the next card
> detection attempt. So perhaps ->init_card() needs to be called from
> the core before it even figured out what kind of card it is trying to
> detect, as to allow the callbacks to reset some data.
> 
> Or perhaps you can think of another clever way!?
>

    It is a good question.

    Our Xenon requires to set SDIO Mode and PHY Slow Mode for SDIO card.
    Both of them are configed in function emmc_phy_set(). In emmc_phy_set(),
    we will skip setting those two configs if current timing is
    MMC_TIMING_LEGACY.
    It seems that card structure can be updated before switching into
    higher speed mode from MMC_TIMING_LEGACY. Thus I personally believe we
    can get updated card type in ->init_card().

    Hope my above answer can satisfy you. If there is any issue, please kindly
    let me know.
    I will also ask my teammates to do more tests, to make sure no corner case.

    Thank you.

Best regards,
Hu Ziji

> 
>> +           ((timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_LEGACY))) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       /* Check if Slow Mode is required in lower speed mode in SDR mode */
>> +       if (((timing == MMC_TIMING_UHS_SDR50) ||
>> +            (timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_MMC_HS) ||
>> +            (timing == MMC_TIMING_LEGACY)) && params->slow_mode) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       reg &= ~XENON_TIMING_ADJUST_SLOW_MODE;
>> +       sdhci_writel(host, reg, phy_regs->timing_adj);
>> +       return false;
>> +}
>> +
> 
> [...]
> 
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: Ziji Hu <huziji@marvell.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Jimmy Xu <zmxu@marvell.com>, Andrew Lunn <andrew@lunn.ch>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Mike Turquette <mturquette@baylibre.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Nadav Haklai <nadavh@marvell.com>, Victor Gu <xigu@marvell.com>,
	Doug Jones <dougj@marvell.com>,
	linux-clk <linux-clk@vger.kernel.org>,
	Jisheng Zhang <jszhang@marvell.com>,
	Yehuda Yitschak <yehuday@marvell.com>,
	Marcin Wojtas <mw@semihalf.com>,
	Kostya Porotchkin <kostap@marvell.com>,
	Hanna Hawa <hannah@marvell.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Jason Cooper <jason@lakedaemon.net>,
	Rob Herring <robh+dt@kernel.org>, Ryan Gao <ygao@marvell.com>,
	"Wei(SOCP) Liu" <liuw@marvell.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Thomas
Subject: Re: [PATCH v5 07/12] mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC.
Date: Sat, 28 Jan 2017 01:10:54 +0800	[thread overview]
Message-ID: <1f174462-7644-1d02-9216-01c1fa3b402b@marvell.com> (raw)
In-Reply-To: <CAPDyKFpx23wio-QmDrx277+YO2Jt2S0ZrokZ2E4K+oVURSR1Hg@mail.gmail.com>

Hi Ulf,

On 2017/1/26 19:29, Ulf Hansson wrote:
> [...]
> 
>> +
>> +static inline bool temp_stage_hs200_to_hs400(struct sdhci_host *host,
>> +                                            struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Tmep stages from HS200 to HS400
>> +        * from HS200 to HS in 200MHz
>> +        * from 200MHz to 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS) &&
>> +            (priv->clock > host->clock)))
>> +               return true;
>> +
>> +       return false;
>> +}
>> +
>> +static inline bool temp_stage_hs400_to_h200(struct sdhci_host *host,
>> +                                           struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Temp stages from HS400 t0 HS200:
>> +        * from 200MHz to 52MHz in HS400
>> +        * from HS400 to HS DDR in 52MHz
>> +        * from HS DDR to HS in 52MHz
>> +        * from HS to HS200 in 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS400) &&
>> +            ((host->clock == MMC_HIGH_52_MAX_DTR) ||
>> +             (host->timing == MMC_TIMING_MMC_DDR52))) ||
>> +           ((priv->timing == MMC_TIMING_MMC_DDR52) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->clock == MMC_HIGH_52_MAX_DTR)))
>> +               return true;
>> +
>> +       return false;
>> +}
> 
> Both the above functions seems to be really fragile to use. If
> anything changes in the core layer related to these sequences, you may
> end up getting a wrong validated expression.
> 
> Perhaps an option would be to add one or two new mmc host ops, which
> could be called during the related hs200/400 sequences that could make
> this less fragile for you? What do you think?
> 

    Yes, they both look fragile to use.
    In my own opinion, hs200->hs400 sequence might be safe since it has been
    defined and fixed by eMMC spec. I personally think it is unlikely to be
    adjusted again. Please correct me if I am wrong.
    However, as you said, hs400->hs200 sequence will have issue if it is
    changed in core layer, since such a sequence is not from eMMC spec.

    But, in my opinion, adding additional mmc host ops might not be helpful.
    The above two functions are part of Xenon PHY adjustment. Those two
    functions help save some PHY setting steps in hs200->hs400/hs400->hs200
    sequence. But other PHY settings are still necessary,
    which should be executed each time when mmc core layer set ios.
    Neither of them can be extracted out and put into another mmc host ops.

    Instead, it will helps us improve the above two if we can add a flag to
    indicate that eMMC is in a temporary status in hs200->hs400 or hs400->hs200
    sequence.

>> +
>> +/*
>> + * If eMMC PHY Slow Mode is required in lower speed mode in SDR mode
>> + * (SDLCK < 55MHz), enable Slow Mode to bypass eMMC PHY.
>> + * SDIO slower SDR mode also requires Slow Mode.
>> + *
>> + * If Slow Mode is enabled, return true.
>> + * Otherwise, return false.
>> + */
>> +static bool emmc_phy_slow_mode(struct sdhci_host *host,
>> +                              unsigned char timing)
>> +{
>> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +       struct sdhci_xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
>> +       struct emmc_phy_params *params = priv->phy_params;
>> +       struct xenon_emmc_phy_regs *phy_regs = priv->emmc_phy_regs;
>> +       u32 reg;
>> +
>> +       /* Skip temp stages from HS200 to HS400 */
>> +       if (temp_stage_hs200_to_hs400(host, priv))
>> +               return false;
>> +
>> +       /* Skip temp stages from HS400 t0 HS200 */
>> +       if (temp_stage_hs400_to_h200(host, priv))
>> +               return false;
>> +
>> +       reg = sdhci_readl(host, phy_regs->timing_adj);
>> +       /* Enable Slow Mode for SDIO in slower SDR mode */
>> +       if ((priv->init_card_type == MMC_TYPE_SDIO) &&
> 
> Ah, noticed that there is some specific things going on here for SDIO
> here as well. So perhaps you do need to implement the ->init_card()
> ops anyway. Which I suggested not to, for patch6. :-)
> 
> Although, there is one problem with using ->init_card(). That is
> particularly for removable cards, as mmc_rescan() doesn't invoke
> ->init_card() when it removes a card, which means, you may use old and
> thus wrong information about what kind of card in the next card
> detection attempt. So perhaps ->init_card() needs to be called from
> the core before it even figured out what kind of card it is trying to
> detect, as to allow the callbacks to reset some data.
> 
> Or perhaps you can think of another clever way!?
>

    It is a good question.

    Our Xenon requires to set SDIO Mode and PHY Slow Mode for SDIO card.
    Both of them are configed in function emmc_phy_set(). In emmc_phy_set(),
    we will skip setting those two configs if current timing is
    MMC_TIMING_LEGACY.
    It seems that card structure can be updated before switching into
    higher speed mode from MMC_TIMING_LEGACY. Thus I personally believe we
    can get updated card type in ->init_card().

    Hope my above answer can satisfy you. If there is any issue, please kindly
    let me know.
    I will also ask my teammates to do more tests, to make sure no corner case.

    Thank you.

Best regards,
Hu Ziji

> 
>> +           ((timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_LEGACY))) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       /* Check if Slow Mode is required in lower speed mode in SDR mode */
>> +       if (((timing == MMC_TIMING_UHS_SDR50) ||
>> +            (timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_MMC_HS) ||
>> +            (timing == MMC_TIMING_LEGACY)) && params->slow_mode) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       reg &= ~XENON_TIMING_ADJUST_SLOW_MODE;
>> +       sdhci_writel(host, reg, phy_regs->timing_adj);
>> +       return false;
>> +}
>> +
> 
> [...]
> 
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: huziji@marvell.com (Ziji Hu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 07/12] mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC.
Date: Sat, 28 Jan 2017 01:10:54 +0800	[thread overview]
Message-ID: <1f174462-7644-1d02-9216-01c1fa3b402b@marvell.com> (raw)
In-Reply-To: <CAPDyKFpx23wio-QmDrx277+YO2Jt2S0ZrokZ2E4K+oVURSR1Hg@mail.gmail.com>

Hi Ulf,

On 2017/1/26 19:29, Ulf Hansson wrote:
> [...]
> 
>> +
>> +static inline bool temp_stage_hs200_to_hs400(struct sdhci_host *host,
>> +                                            struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Tmep stages from HS200 to HS400
>> +        * from HS200 to HS in 200MHz
>> +        * from 200MHz to 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS) &&
>> +            (priv->clock > host->clock)))
>> +               return true;
>> +
>> +       return false;
>> +}
>> +
>> +static inline bool temp_stage_hs400_to_h200(struct sdhci_host *host,
>> +                                           struct sdhci_xenon_priv *priv)
>> +{
>> +       /*
>> +        * Temp stages from HS400 t0 HS200:
>> +        * from 200MHz to 52MHz in HS400
>> +        * from HS400 to HS DDR in 52MHz
>> +        * from HS DDR to HS in 52MHz
>> +        * from HS to HS200 in 52MHz
>> +        */
>> +       if (((priv->timing == MMC_TIMING_MMC_HS400) &&
>> +            ((host->clock == MMC_HIGH_52_MAX_DTR) ||
>> +             (host->timing == MMC_TIMING_MMC_DDR52))) ||
>> +           ((priv->timing == MMC_TIMING_MMC_DDR52) &&
>> +            (host->timing == MMC_TIMING_MMC_HS)) ||
>> +           ((host->timing == MMC_TIMING_MMC_HS200) &&
>> +            (host->clock == MMC_HIGH_52_MAX_DTR)))
>> +               return true;
>> +
>> +       return false;
>> +}
> 
> Both the above functions seems to be really fragile to use. If
> anything changes in the core layer related to these sequences, you may
> end up getting a wrong validated expression.
> 
> Perhaps an option would be to add one or two new mmc host ops, which
> could be called during the related hs200/400 sequences that could make
> this less fragile for you? What do you think?
> 

    Yes, they both look fragile to use.
    In my own opinion, hs200->hs400 sequence might be safe since it has been
    defined and fixed by eMMC spec. I personally think it is unlikely to be
    adjusted again. Please correct me if I am wrong.
    However, as you said, hs400->hs200 sequence will have issue if it is
    changed in core layer, since such a sequence is not from eMMC spec.

    But, in my opinion, adding additional mmc host ops might not be helpful.
    The above two functions are part of Xenon PHY adjustment. Those two
    functions help save some PHY setting steps in hs200->hs400/hs400->hs200
    sequence. But other PHY settings are still necessary,
    which should be executed each time when mmc core layer set ios.
    Neither of them can be extracted out and put into another mmc host ops.

    Instead, it will helps us improve the above two if we can add a flag to
    indicate that eMMC is in a temporary status in hs200->hs400 or hs400->hs200
    sequence.

>> +
>> +/*
>> + * If eMMC PHY Slow Mode is required in lower speed mode in SDR mode
>> + * (SDLCK < 55MHz), enable Slow Mode to bypass eMMC PHY.
>> + * SDIO slower SDR mode also requires Slow Mode.
>> + *
>> + * If Slow Mode is enabled, return true.
>> + * Otherwise, return false.
>> + */
>> +static bool emmc_phy_slow_mode(struct sdhci_host *host,
>> +                              unsigned char timing)
>> +{
>> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +       struct sdhci_xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
>> +       struct emmc_phy_params *params = priv->phy_params;
>> +       struct xenon_emmc_phy_regs *phy_regs = priv->emmc_phy_regs;
>> +       u32 reg;
>> +
>> +       /* Skip temp stages from HS200 to HS400 */
>> +       if (temp_stage_hs200_to_hs400(host, priv))
>> +               return false;
>> +
>> +       /* Skip temp stages from HS400 t0 HS200 */
>> +       if (temp_stage_hs400_to_h200(host, priv))
>> +               return false;
>> +
>> +       reg = sdhci_readl(host, phy_regs->timing_adj);
>> +       /* Enable Slow Mode for SDIO in slower SDR mode */
>> +       if ((priv->init_card_type == MMC_TYPE_SDIO) &&
> 
> Ah, noticed that there is some specific things going on here for SDIO
> here as well. So perhaps you do need to implement the ->init_card()
> ops anyway. Which I suggested not to, for patch6. :-)
> 
> Although, there is one problem with using ->init_card(). That is
> particularly for removable cards, as mmc_rescan() doesn't invoke
> ->init_card() when it removes a card, which means, you may use old and
> thus wrong information about what kind of card in the next card
> detection attempt. So perhaps ->init_card() needs to be called from
> the core before it even figured out what kind of card it is trying to
> detect, as to allow the callbacks to reset some data.
> 
> Or perhaps you can think of another clever way!?
>

    It is a good question.

    Our Xenon requires to set SDIO Mode and PHY Slow Mode for SDIO card.
    Both of them are configed in function emmc_phy_set(). In emmc_phy_set(),
    we will skip setting those two configs if current timing is
    MMC_TIMING_LEGACY.
    It seems that card structure can be updated before switching into
    higher speed mode from MMC_TIMING_LEGACY. Thus I personally believe we
    can get updated card type in ->init_card().

    Hope my above answer can satisfy you. If there is any issue, please kindly
    let me know.
    I will also ask my teammates to do more tests, to make sure no corner case.

    Thank you.

Best regards,
Hu Ziji

> 
>> +           ((timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_LEGACY))) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       /* Check if Slow Mode is required in lower speed mode in SDR mode */
>> +       if (((timing == MMC_TIMING_UHS_SDR50) ||
>> +            (timing == MMC_TIMING_UHS_SDR25) ||
>> +            (timing == MMC_TIMING_UHS_SDR12) ||
>> +            (timing == MMC_TIMING_SD_HS) ||
>> +            (timing == MMC_TIMING_MMC_HS) ||
>> +            (timing == MMC_TIMING_LEGACY)) && params->slow_mode) {
>> +               reg |= XENON_TIMING_ADJUST_SLOW_MODE;
>> +               sdhci_writel(host, reg, phy_regs->timing_adj);
>> +               return true;
>> +       }
>> +
>> +       reg &= ~XENON_TIMING_ADJUST_SLOW_MODE;
>> +       sdhci_writel(host, reg, phy_regs->timing_adj);
>> +       return false;
>> +}
>> +
> 
> [...]
> 
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-01-27 17:35 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 17:19 [PATCH v5 00/12] mmc: Add support to Marvell Xenon SD Host Controller Gregory CLEMENT
2017-01-11 17:19 ` Gregory CLEMENT
2017-01-11 17:19 ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 01/12] clk: apn806: Add eMMC clock to system controller driver Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-21  0:16   ` Stephen Boyd
2017-01-21  0:16     ` Stephen Boyd
2017-01-21  0:16     ` Stephen Boyd
2017-01-11 17:19 ` [PATCH v5 02/12] mmc: sdhci: Export sdhci_set_ios() from sdhci.c Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 03/12] mmc: sdhci: Export sdhci_start_signal_voltage_switch() in sdhci.c Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 04/12] mmc: sdhci: Export sdhci_enable_sdio_irq() from sdhci.c Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 05/12] dt: bindings: Add bindings for Marvell Xenon SD Host Controller Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-13 20:16   ` Rob Herring
2017-01-13 20:16     ` Rob Herring
2017-01-13 20:16     ` Rob Herring
2017-01-26 10:49   ` Ulf Hansson
2017-01-26 10:49     ` Ulf Hansson
2017-01-26 10:49     ` Ulf Hansson
2017-01-26 10:49     ` Ulf Hansson
2017-01-27 10:04     ` Gregory CLEMENT
2017-01-27 10:04       ` Gregory CLEMENT
2017-01-27 10:04       ` Gregory CLEMENT
2017-01-27 10:04       ` Gregory CLEMENT
2017-01-27 15:36       ` Ulf Hansson
2017-01-27 15:36         ` Ulf Hansson
2017-01-27 15:36         ` Ulf Hansson
2017-01-27 15:36         ` Ulf Hansson
2017-01-27 17:25         ` Gregory CLEMENT
2017-01-27 17:25           ` Gregory CLEMENT
2017-01-27 17:25           ` Gregory CLEMENT
2017-01-27 17:25           ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 06/12] mmc: sdhci-xenon: Add Marvell Xenon SDHC core functionality Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-26 10:50   ` Ulf Hansson
2017-01-26 10:50     ` Ulf Hansson
2017-01-26 10:50     ` Ulf Hansson
2017-01-26 10:50     ` Ulf Hansson
2017-01-26 12:39     ` Adrian Hunter
2017-01-26 12:39       ` Adrian Hunter
2017-01-26 12:39       ` Adrian Hunter
2017-01-26 12:39       ` Adrian Hunter
2017-01-27 15:12       ` Ulf Hansson
2017-01-27 15:12         ` Ulf Hansson
2017-01-27 15:12         ` Ulf Hansson
2017-01-27 15:12         ` Ulf Hansson
2017-01-28  8:16         ` Adrian Hunter
2017-01-28  8:16           ` Adrian Hunter
2017-01-28  8:16           ` Adrian Hunter
2017-01-28  8:16           ` Adrian Hunter
2017-01-30  9:10           ` Ulf Hansson
2017-01-30  9:10             ` Ulf Hansson
2017-01-30  9:10             ` Ulf Hansson
2017-01-30  9:10             ` Ulf Hansson
2017-01-30  9:40             ` Adrian Hunter
2017-01-30  9:40               ` Adrian Hunter
2017-01-30  9:40               ` Adrian Hunter
2017-01-30  9:40               ` Adrian Hunter
2017-01-30 10:15               ` Ulf Hansson
2017-01-30 10:15                 ` Ulf Hansson
2017-01-30 10:15                 ` Ulf Hansson
2017-01-30 10:15                 ` Ulf Hansson
2017-01-27 16:39     ` Ziji Hu
2017-01-27 16:39       ` Ziji Hu
2017-01-27 16:39       ` Ziji Hu
2017-01-27 16:39       ` Ziji Hu
2017-01-30  8:41       ` Ulf Hansson
2017-01-30  8:41         ` Ulf Hansson
2017-01-30  8:41         ` Ulf Hansson
2017-01-30  8:41         ` Ulf Hansson
2017-01-30 15:12         ` Ziji Hu
2017-01-30 15:12           ` Ziji Hu
2017-01-30 15:12           ` Ziji Hu
2017-01-30 15:12           ` Ziji Hu
2017-01-11 17:19 ` [PATCH v5 07/12] mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-26 11:29   ` Ulf Hansson
2017-01-26 11:29     ` Ulf Hansson
2017-01-26 11:29     ` Ulf Hansson
2017-01-26 11:29     ` Ulf Hansson
2017-01-27 17:10     ` Ziji Hu [this message]
2017-01-27 17:10       ` Ziji Hu
2017-01-27 17:10       ` Ziji Hu
2017-01-27 17:10       ` Ziji Hu
2017-01-11 17:19 ` [PATCH v5 08/12] mmc: sdhci-xenon: Add SoC PHY PAD voltage control Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 09/12] MAINTAINERS: add entry for Marvell Xenon MMC Host Controller drivers Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 10/12] arm64: dts: marvell: add eMMC support for Armada 37xx Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 11/12] arm64: dts: marvell: add sdhci support for Armada 7K/8K Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19 ` [PATCH v5 12/12] arm64: configs: enable SDHCI driver for Xenon Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT
2017-01-11 17:19   ` Gregory CLEMENT

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=1f174462-7644-1d02-9216-01c1fa3b402b@marvell.com \
    --to=huziji@marvell.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dingwei@marvell.com \
    --cc=dougj@marvell.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=hannah@marvell.com \
    --cc=jason@lakedaemon.net \
    --cc=jszhang@marvell.com \
    --cc=kostap@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=liuw@marvell.com \
    --cc=mturquette@baylibre.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xigu@marvell.com \
    --cc=yehuday@marvell.com \
    --cc=ygao@marvell.com \
    --cc=zmxu@marvell.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.