All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 09/20] mmc: am654_sdhci: Fix HISPD bit configuration in some lower speed modes
Date: Tue, 26 Jan 2021 07:43:01 +0900	[thread overview]
Message-ID: <570e154a-f131-2fa4-21e6-1f3fe10c128b@samsung.com> (raw)
In-Reply-To: <20210121124052.3454-10-a-govindraju@ti.com>

On 1/21/21 9:40 PM, Aswath Govindraju wrote:
> From: Faiz Abbas <faiz_abbas@ti.com>
> 
> According to the AM654x Data Manual[1], the setup timing in lower speed
> modes can only be met if the controller uses a falling edge data launch.
> 
> To ensure this, the HIGH_SPEED_ENA (HOST_CONTROL[2]) bit should be
> cleared in default speed, SD high speed, MMC high speed, SDR12 and SDR25
> speed modes.
> 
> Use the sdhci writeb callback to implement this condition.
> 
> [1] http://www.ti.com/lit/gpn/am6546 Section 5.10.5.16.1
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/Kconfig       |  1 +
>  drivers/mmc/am654_sdhci.c | 25 +++++++++++++++++++++++--
>  2 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 14d79139864a..f8ea92172e44 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -526,6 +526,7 @@ config MMC_SDHCI_AM654
>  	depends on MMC_SDHCI
>  	depends on DM_MMC && OF_CONTROL && BLK
>  	depends on REGMAP
> +	select MMC_SDHCI_IO_ACCESSORS
>  	help
>  	  Support for Secure Digital Host Controller Interface (SDHCI)
>  	  controllers present on TI's AM654 SOCs.
> diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
> index 9549420c6582..5dea3eb1be4e 100644
> --- a/drivers/mmc/am654_sdhci.c
> +++ b/drivers/mmc/am654_sdhci.c
> @@ -369,6 +369,26 @@ static int am654_sdhci_deferred_probe(struct sdhci_host *host)
>  	return sdhci_probe(dev);
>  }
>  
> +static void am654_sdhci_write_b(struct sdhci_host *host, u8 val, int reg)
> +{
> +	if (reg == SDHCI_HOST_CONTROL) {
> +		switch (host->mmc->selected_mode) {
> +		/*
> +		 * According to the data manual, HISPD bit
> +		 * should not be set in these speed modes.
> +		 */
> +		case SD_HS:
> +		case MMC_HS:
> +		case UHS_SDR12:
> +		case UHS_SDR25:
> +			val &= ~SDHCI_CTRL_HISPD;
> +		default:
> +			break;
> +		}
> +	}
> +
> +	writeb(val, host->ioaddr + reg);
> +}
>  #ifdef MMC_SUPPORTS_TUNING
>  #define ITAP_MAX	32
>  static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
> @@ -414,6 +434,7 @@ const struct sdhci_ops am654_sdhci_ops = {
>  	.deferred_probe		= am654_sdhci_deferred_probe,
>  	.set_ios_post		= &am654_sdhci_set_ios_post,
>  	.set_control_reg	= &am654_sdhci_set_control_reg,
> +	.write_b		= am654_sdhci_write_b,
>  };
>  
>  const struct am654_driver_data am654_drv_data = {
> @@ -455,6 +476,7 @@ const struct sdhci_ops j721e_4bit_sdhci_ops = {
>  #endif
>  	.deferred_probe		= am654_sdhci_deferred_probe,
>  	.set_ios_post		= &j721e_4bit_sdhci_set_ios_post,
> +	.write_b		= am654_sdhci_write_b,
>  };
>  
>  const struct am654_driver_data j721e_4bit_drv_data = {
> @@ -532,6 +554,7 @@ static int am654_sdhci_probe(struct udevice *dev)
>  	host->max_clk = clock;
>  	host->mmc = &plat->mmc;
>  	host->mmc->dev = dev;
> +	host->ops = drv_data->ops;
>  	ret = sdhci_setup_cfg(cfg, host, cfg->f_max,
>  			      AM654_SDHCI_MIN_FREQ);
>  	if (ret)
> @@ -541,8 +564,6 @@ static int am654_sdhci_probe(struct udevice *dev)
>  	if (ret)
>  		return ret;
>  
> -	host->ops = drv_data->ops;
> -
>  	/* Update ops based on SoC revision */
>  	soc = soc_device_match(am654_sdhci_soc_attr);
>  	if (soc && soc->data) {
> 

  reply	other threads:[~2021-01-25 22:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 12:40 [PATCH v3 00/20] Add support for MMC higher speed modes for TI's am65x, j721e and j7200 platforms Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 01/20] mmc: sdhci: Add helper functions for UHS modes Aswath Govindraju
2021-01-24  2:03   ` Simon Glass
2021-01-25 10:23     ` Aswath Govindraju
2021-01-25 22:18   ` Jaehoon Chung
2021-01-28  9:20     ` Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 02/20] mmc: am654_sdhci: Unconditionally switch off DLL in the beginning of ios_post() Aswath Govindraju
2021-01-25 22:19   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 03/20] mmc: am654_sdhci: Convert flag fields to BIT macro Aswath Govindraju
2021-01-25 22:19   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 04/20] mmc: am654_sdhci: Add flag for PHY calibration Aswath Govindraju
2021-01-25 22:19   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 05/20] mmc: am654_sdhci: Add support for AM65x SR2.0 Aswath Govindraju
2021-01-25 22:19   ` Jaehoon Chung
2021-01-28  9:15     ` Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 06/20] mmc: am654_sdhci: Add support for input tap delay Aswath Govindraju
2021-01-25 22:21   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 07/20] mmc: am654_sdhci: Add support for writing to clkbuf_sel Aswath Govindraju
2021-01-25 22:22   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 08/20] mmc: am654_sdhci: Add support for software tuning Aswath Govindraju
2021-01-25 22:41   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 09/20] mmc: am654_sdhci: Fix HISPD bit configuration in some lower speed modes Aswath Govindraju
2021-01-25 22:43   ` Jaehoon Chung [this message]
2021-01-21 12:40 ` [PATCH v3 10/20] mmc: am654_sdhci: Use sdhci_set_control_reg() Aswath Govindraju
2021-01-25 22:43   ` Jaehoon Chung
2021-01-21 12:40 ` [PATCH v3 11/20] arm: dts: k3-am65: Fix mmc nodes Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 12/20] arm: dts: k3-j721e-main: Update otap-delay values Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 13/20] arm: dts: k3-j721e-common-proc-board: Add support for UHS modes for SD card Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 14/20] arm: dts: k3-j7200-main: Add support for gpio0 Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 15/20] arm: dts: k3-j7200-common-proc-board: Enable support for UHS modes Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 16/20] configs: j721e_evm: Add " Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 17/20] configs: j7200_evm: " Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 18/20] arm: dts: k3-am65-main: Add itapdly and clkbuf-sel values Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 19/20] arm: dts: k3-am654-base-board: Limit Sd card to High speed modes Aswath Govindraju
2021-01-21 12:40 ` [PATCH v3 20/20] configs: am65x_evm: Add configs for UHS modes Aswath Govindraju

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=570e154a-f131-2fa4-21e6-1f3fe10c128b@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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.