mbox series

[0/6] Add UHS mode support for TI's AM65x, J721e, J7200 boards

Message ID 20200923105206.7988-1-faiz_abbas@ti.com
Headers show
Series Add UHS mode support for TI's AM65x, J721e, J7200 boards | expand

Message

Faiz Abbas Sept. 23, 2020, 10:52 a.m. UTC
The following are driver and documentation patches to enable UHS modes for
TI's AM65x, J721e, and J7200 boards. Device tree and defconfig patches
will be sent in a separate series.

With the complete set, the following maximum modes will be supported:

am654x-evm,idk		- SDR104, HS200
j721e-common-proc-board	- DDR50, HS200
j7200-common-proc-board	- DDR50, HS200

These patches mainly add support for the software tuning algorithm[1]
needed for higher speed modes

[1] [1] https://www.ti.com/lit/pdf/spract9

Faiz Abbas (6):
  dt-bindings: mmc: sdhci-am654: Convert sdhci-am654 controller
    documentation to json schema
  dt-bindings: mmc: sdhci-am654: Add documentation for input tap delay
  mmc: sdhci_am654: Fix hard coded otap delay array size
  mmc: sdhci_am654: Add support for input tap delay
  mmc: sdhci_am654: Add support for software tuning
  mmc: sdhci_am654: Enable tuning for SDR50

 .../devicetree/bindings/mmc/sdhci-am654.txt   |  65 ------
 .../devicetree/bindings/mmc/sdhci-am654.yaml  | 218 ++++++++++++++++++
 drivers/mmc/host/sdhci_am654.c                | 179 ++++++++++----
 3 files changed, 358 insertions(+), 104 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mmc/sdhci-am654.txt
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-am654.yaml

Comments

Kishon Vijay Abraham I Sept. 25, 2020, 4:49 a.m. UTC | #1
On 23/09/20 4:22 pm, Faiz Abbas wrote:
> With the new SW tuning App note[1], a custom tuning algorithm is
> required for eMMC HS200, HS400 and SD card UHS modes. The algorithm
> involves running through the 32 possible input tap delay values and
> sending the appropriate tuning command (CMD19/21) for each of them
> to get a fail or pass result for each of the values. Typically, the
> range will have a small contiguous failing window. Considering the
> tuning range as a circular buffer, the algorithm then sets a final
> tuned value directly opposite to the failing window.
> 
> [1] https://www.ti.com/lit/pdf/spract9
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/mmc/host/sdhci_am654.c | 41 ++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 1213b711e60a..5af7638ad606 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -396,7 +396,46 @@ static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
>  	return 0;
>  }
>  
> +#define ITAP_MAX	32
> +static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
> +					       u32 opcode)
> +{
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
> +	int cur_val, prev_val = 1, fail_len = 0, pass_window = 0, pass_len;
> +	u32 itap;
> +
> +	/* Enable ITAPDLY */
> +	regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
> +			   1 << ITAPDLYENA_SHIFT);
> +
> +	for (itap = 0; itap < ITAP_MAX; itap++) {
> +		sdhci_am654_write_itapdly(sdhci_am654, itap);
> +
> +		cur_val = !mmc_send_tuning(host->mmc, opcode, NULL);
> +		if (cur_val && !prev_val)
> +			pass_window = itap;
> +
> +		if (!cur_val)
> +			fail_len++;
> +
> +		prev_val = cur_val;
> +	}
> +	/*
> +	 * Having determined the length of the failing window and start of
> +	 * the passing window calculate the length of the passing window and
> +	 * set the final value halfway through it considering the range as a
> +	 * circular buffer
> +	 */
> +	pass_len = ITAP_MAX - fail_len;
> +	itap = (pass_window + (pass_len >> 1)) % ITAP_MAX;
> +	sdhci_am654_write_itapdly(sdhci_am654, itap);
> +
> +	return 0;
> +}
> +
>  static struct sdhci_ops sdhci_am654_ops = {
> +	.platform_execute_tuning = sdhci_am654_platform_execute_tuning,
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
>  	.set_uhs_signaling = sdhci_set_uhs_signaling,
> @@ -426,6 +465,7 @@ static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
>  };
>  
>  static struct sdhci_ops sdhci_j721e_8bit_ops = {
> +	.platform_execute_tuning = sdhci_am654_platform_execute_tuning,
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
>  	.set_uhs_signaling = sdhci_set_uhs_signaling,
> @@ -449,6 +489,7 @@ static const struct sdhci_am654_driver_data sdhci_j721e_8bit_drvdata = {
>  };
>  
>  static struct sdhci_ops sdhci_j721e_4bit_ops = {
> +	.platform_execute_tuning = sdhci_am654_platform_execute_tuning,
>  	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
>  	.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
>  	.set_uhs_signaling = sdhci_set_uhs_signaling,
>
Ulf Hansson Sept. 28, 2020, 10:34 a.m. UTC | #2
On Wed, 23 Sep 2020 at 12:52, Faiz Abbas <faiz_abbas@ti.com> wrote:
>
> The following are driver and documentation patches to enable UHS modes for
> TI's AM65x, J721e, and J7200 boards. Device tree and defconfig patches
> will be sent in a separate series.
>
> With the complete set, the following maximum modes will be supported:
>
> am654x-evm,idk          - SDR104, HS200
> j721e-common-proc-board - DDR50, HS200
> j7200-common-proc-board - DDR50, HS200
>
> These patches mainly add support for the software tuning algorithm[1]
> needed for higher speed modes
>
> [1] [1] https://www.ti.com/lit/pdf/spract9
>
> Faiz Abbas (6):
>   dt-bindings: mmc: sdhci-am654: Convert sdhci-am654 controller
>     documentation to json schema
>   dt-bindings: mmc: sdhci-am654: Add documentation for input tap delay
>   mmc: sdhci_am654: Fix hard coded otap delay array size
>   mmc: sdhci_am654: Add support for input tap delay
>   mmc: sdhci_am654: Add support for software tuning
>   mmc: sdhci_am654: Enable tuning for SDR50
>
>  .../devicetree/bindings/mmc/sdhci-am654.txt   |  65 ------
>  .../devicetree/bindings/mmc/sdhci-am654.yaml  | 218 ++++++++++++++++++
>  drivers/mmc/host/sdhci_am654.c                | 179 ++++++++++----
>  3 files changed, 358 insertions(+), 104 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/mmc/sdhci-am654.txt
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-am654.yaml
>
> --
> 2.17.1
>

Applied for next, thanks!

Kind regards
Uffe