From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756327AbbCCK5M (ORCPT ); Tue, 3 Mar 2015 05:57:12 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:59206 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbbCCK5I (ORCPT ); Tue, 3 Mar 2015 05:57:08 -0500 Message-ID: <54F59362.40605@st.com> Date: Tue, 3 Mar 2015 11:56:34 +0100 From: Maxime Coquelin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Griffin , , , , , , CC: , , , Subject: Re: [PATCH v2 5/8] mmc: sdhci-st: Add sdhci_st_set_uhs_signaling function. References: <1424956227-18258-1-git-send-email-peter.griffin@linaro.org> <1424956227-18258-6-git-send-email-peter.griffin@linaro.org> In-Reply-To: <1424956227-18258-6-git-send-email-peter.griffin@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.23.80] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-03_03:2015-03-03,2015-03-03,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/2015 02:10 PM, Peter Griffin wrote: > To allow UHS modes to work properly we need to provide the st specific > set_uhs_signaling callback function. This function differs from the > generic sdhci_set_uhs_signaling callback in that we need to configure > the correct delay depending on the UHS mode, and also set the V18_EN > bit. > > Signed-off-by: Peter Griffin > Signed-off-by: Giuseppe Cavallaro > --- > drivers/mmc/host/sdhci-st.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c > index 11cf4e2..d53bc82 100644 > --- a/drivers/mmc/host/sdhci-st.c > +++ b/drivers/mmc/host/sdhci-st.c > @@ -260,6 +260,55 @@ static int sdhci_st_set_dll_for_clock(struct sdhci_host *host) > return ret; > } > > +static void sdhci_st_set_uhs_signaling(struct sdhci_host *host, > + unsigned int uhs) > +{ > + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > + struct st_mmc_platform_data *pdata = pltfm_host->priv; > + u16 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); > + int ret = 0; > + > + /* Select Bus Speed Mode for host */ > + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; > + switch (uhs) { > + /* > + * Set V18_EN -- UHS modes do not work without this. > + * does not change signaling voltage > + */ > + > + case MMC_TIMING_UHS_SDR12: > + st_mmcss_set_static_delay(pdata->top_ioaddr); > + ctrl_2 |= SDHCI_CTRL_UHS_SDR12 | SDHCI_CTRL_VDD_180; > + break; > + case MMC_TIMING_UHS_SDR25: > + st_mmcss_set_static_delay(pdata->top_ioaddr); > + ctrl_2 |= SDHCI_CTRL_UHS_SDR25 | SDHCI_CTRL_VDD_180; > + break; > + case MMC_TIMING_UHS_SDR50: > + st_mmcss_set_static_delay(pdata->top_ioaddr); > + ctrl_2 |= SDHCI_CTRL_UHS_SDR50 | SDHCI_CTRL_VDD_180; > + ret = sdhci_st_set_dll_for_clock(host); > + break; > + case MMC_TIMING_UHS_SDR104: > + case MMC_TIMING_MMC_HS200: > + st_mmcss_set_static_delay(pdata->top_ioaddr); > + ctrl_2 |= SDHCI_CTRL_UHS_SDR104 | SDHCI_CTRL_VDD_180; > + ret = sdhci_st_set_dll_for_clock(host); > + break; > + case MMC_TIMING_UHS_DDR50: > + case MMC_TIMING_MMC_DDR52: > + st_mmcss_set_static_delay(pdata->top_ioaddr); > + ctrl_2 |= SDHCI_CTRL_UHS_DDR50 | SDHCI_CTRL_VDD_180; > + break; > + } > + > + if (ret) > + dev_warn(mmc_dev(host->mmc), "Error setting dll for clock\n"); Maybe you could print the uhs value to know which mode it was trying to set? > + > + dev_dbg(mmc_dev(host->mmc), "uhs %d, ctrl_2 %04X\n", uhs, ctrl_2); > + > + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); > +} > > static u32 sdhci_st_readl(struct sdhci_host *host, int reg) > { > @@ -283,6 +332,7 @@ static const struct sdhci_ops sdhci_st_ops = { > .set_bus_width = sdhci_set_bus_width, > .read_l = sdhci_st_readl, > .reset = sdhci_reset, > + .set_uhs_signaling = sdhci_st_set_uhs_signaling, > }; > > static const struct sdhci_pltfm_data sdhci_st_pdata = { Other than that, you can add my: Acked-by: Maxime Coquelin Thanks, Maxime