From: Jaehoon Chung Subject: Re: [PATCH] mmc: sdhci: Fix HISPD bit handling Date: Wed, 27 May 2020 15:20:10 +0900 Message-ID: <39f02255-e362-9eeb-051b-dd11176d9fea@samsung.com> References: <20200524172513.199962-1-jagan@amarulasolutions.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200524172513.199962-1-jagan@amarulasolutions.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" To: Jagan Teki , u-boot@lists.denx.de Cc: sunil@amarulasolutions.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Kever Yang , Peng Fan List-Id: linux-rockchip.vger.kernel.org On 5/25/20 2:25 AM, Jagan Teki wrote: > SDHCI HISPD bits need to be configured based on desired mmc > timings mode and some HISPD quirks. > > So, handle the HISPD bit based on the mmc computed selected > mode(timing parameter) rather than fixed mmc card clock > frequency. > > Linux handle the HISPD similar like this in below commit, > > commit <501639bf2173> ("mmc: sdhci: fix SDHCI_QUIRK_NO_HISPD_BIT handling") > > This eventually fixed the mmc write issue observed in > rk3399 sdhci controller. > > Bug log for refernece, > => gpt write mmc 0 $partitions > Writing GPT: mmc write failed > ** Can't write to device 0 ** > ** Can't write to device 0 ** > error! > > Cc: Kever Yang > Cc: Peng Fan > Signed-off-by: Jagan Teki Reviewed-by: Jaehoon Chung > --- > drivers/mmc/sdhci.c | 23 +++++++++++++++-------- > 1 file changed, 15 insertions(+), 8 deletions(-) > > diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c > index 92cc8434af..280b8c88eb 100644 > --- a/drivers/mmc/sdhci.c > +++ b/drivers/mmc/sdhci.c > @@ -594,14 +594,21 @@ static int sdhci_set_ios(struct mmc *mmc) > ctrl &= ~SDHCI_CTRL_4BITBUS; > } > > - if (mmc->clock > 26000000) > - ctrl |= SDHCI_CTRL_HISPD; > - else > - ctrl &= ~SDHCI_CTRL_HISPD; > - > - if ((host->quirks & SDHCI_QUIRK_NO_HISPD_BIT) || > - (host->quirks & SDHCI_QUIRK_BROKEN_HISPD_MODE)) > - ctrl &= ~SDHCI_CTRL_HISPD; > + if (!(host->quirks & SDHCI_QUIRK_NO_HISPD_BIT) || > + !(host->quirks & SDHCI_QUIRK_BROKEN_HISPD_MODE)) { > + if (mmc->selected_mode == MMC_HS || > + mmc->selected_mode == SD_HS || > + mmc->selected_mode == MMC_DDR_52 || > + mmc->selected_mode == MMC_HS_200 || > + mmc->selected_mode == MMC_HS_400 || > + mmc->selected_mode == UHS_SDR25 || > + mmc->selected_mode == UHS_SDR50 || > + mmc->selected_mode == UHS_SDR104 || > + mmc->selected_mode == UHS_DDR50) > + ctrl |= SDHCI_CTRL_HISPD; > + else > + ctrl &= ~SDHCI_CTRL_HISPD; > + } > > sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); > >