public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Jaehoon Chung" <jh80.chung@samsung.com>
To: "'Greg Malysa'" <greg.malysa@timesys.com>, <u-boot@lists.denx.de>,
	"'Peng Fan'" <peng.fan@nxp.com>
Cc: "'Nathan Barrett-Morrison'" <nathan.morrison@timesys.com>,
	"'Ian Roberts'" <ian.roberts@timesys.com>,
	"'Jonas	Karlman'" <jonas@kwiboo.se>,
	"'Kever Yang'" <kever.yang@rock-chips.com>,
	"'Marek	Vasut'" <marek.vasut+renesas@mailbox.org>,
	"'Oleksandr Suvorov'" <oleksandr.suvorov@foundries.io>,
	"'Paul Barker'" <paul.barker.ct@bp.renesas.com>,
	"'Peter Geis'" <pgwipeout@gmail.com>,
	"'Sean	Anderson'" <sean.anderson@seco.com>,
	"'Simon Glass'" <sjg@chromium.org>, "'Stefan	Roese'" <sr@denx.de>,
	"'Tom Rini'" <trini@konsulko.com>
Subject: RE: [PATCH] mmc: Support 32-bit only ADMA on 64-bit platforms
Date: Wed, 17 Apr 2024 09:26:06 +0900	[thread overview]
Message-ID: <002f01da905d$d69cf5e0$83d6e1a0$@samsung.com> (raw)
In-Reply-To: <20240326022812.2723-1-greg.malysa@timesys.com>



> -----Original Message-----
> From: Greg Malysa <greg.malysa@timesys.com>
> Sent: Tuesday, March 26, 2024 11:28 AM
> To: u-boot@lists.denx.de; Peng Fan <peng.fan@nxp.com>; Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Greg Malysa <greg.malysa@timesys.com>; Nathan Barrett-Morrison <nathan.morrison@timesys.com>; Ian
> Roberts <ian.roberts@timesys.com>; Jonas Karlman <jonas@kwiboo.se>; Kever Yang <kever.yang@rock-
> chips.com>; Marek Vasut <marek.vasut+renesas@mailbox.org>; Oleksandr Suvorov
> <oleksandr.suvorov@foundries.io>; Paul Barker <paul.barker.ct@bp.renesas.com>; Peter Geis
> <pgwipeout@gmail.com>; Sean Anderson <sean.anderson@seco.com>; Simon Glass <sjg@chromium.org>; Stefan
> Roese <sr@denx.de>; Tom Rini <trini@konsulko.com>
> Subject: [PATCH] mmc: Support 32-bit only ADMA on 64-bit platforms
> 
> Some arm64 platforms may include SDIO host controllers that
> only support 32-bit ADMA. While the Linux kernel detects which
> size is supported and adjusts the descriptor size used dynamically,
> the previous u-boot implementation statically selected between the
> two depending on whether DMA_ADDR_T_64BIT was defined. Because the
> static selection is already in place and effective for most platforms,
> this patch logically separates "64 bit addresses are used for DMA on
> this platform" and "64 bit addresses are used by the SDIO host
> controller for ADMA" in order to support the small number of platforms
> where these statements are not equivalent.
> 
> Using 32 bits is opt-in and existing 64 bit platforms should be
> unaffected by this change.
> 
> Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
> Co-developed-by: Ian Roberts <ian.roberts@timesys.com>
> Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
> Signed-off-by: Greg Malysa <greg.malysa@timesys.com>


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

Best Regards,
Jaehoon Chung

> 
> ---
> 
> 
> ---
>  drivers/mmc/Kconfig      | 18 ++++++++++++++++++
>  drivers/mmc/sdhci-adma.c |  2 +-
>  drivers/mmc/sdhci.c      |  9 ++++-----
>  include/sdhci.h          |  4 ++--
>  4 files changed, 25 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index cef05790dd..4538286c64 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -495,6 +495,24 @@ config SPL_MMC_SDHCI_ADMA
>  	  This enables support for the ADMA (Advanced DMA) defined
>  	  in the SD Host Controller Standard Specification Version 3.00 in SPL.
> 
> +config MMC_SDHCI_ADMA_FORCE_32BIT
> +	bool "Force 32 bit mode for ADMA on 64 bit platforms"
> +	help
> +	  This forces SDHCI ADMA to be built for 32 bit descriptors, even
> +	  on a 64 bit platform where they would otherwise be assumed to
> +	  be 64 bits. This is necessary for certain hardware platforms
> +	  that are 64-bit but include only 32-bit support within the selected
> +	  SD host controller IP.
> +
> +config MMC_SDHCI_ADMA_64BIT
> +	bool "Use SHDCI ADMA with 64 bit descriptors"
> +	depends on !MMC_SDHCI_ADMA_FORCE_32BIT
> +	default y if DMA_ADDR_T_64BIT
> +	help
> +	  This selects 64 bit descriptors for SDHCI ADMA. It is enabled by
> +	  default on 64 bit systems, but can be disabled if one of these
> +	  systems includes 32-bit ADMA.
> +
>  config FIXED_SDHCI_ALIGNED_BUFFER
>  	hex "SDRAM address for fixed buffer"
>  	depends on SPL && MVEBU_SPL_BOOT_DEVICE_MMC
> diff --git a/drivers/mmc/sdhci-adma.c b/drivers/mmc/sdhci-adma.c
> index 8213223d3f..474647c3fd 100644
> --- a/drivers/mmc/sdhci-adma.c
> +++ b/drivers/mmc/sdhci-adma.c
> @@ -22,7 +22,7 @@ static void sdhci_adma_desc(struct sdhci_adma_desc *desc,
>  	desc->len = len;
>  	desc->reserved = 0;
>  	desc->addr_lo = lower_32_bits(addr);
> -#ifdef CONFIG_DMA_ADDR_T_64BIT
> +#ifdef CONFIG_MMC_SDHCI_ADMA_64BIT
>  	desc->addr_hi = upper_32_bits(addr);
>  #endif
>  }
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index 0178ed8a11..b27ce57d96 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -900,11 +900,10 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
>  	host->adma_desc_table = sdhci_adma_init();
>  	host->adma_addr = (dma_addr_t)host->adma_desc_table;
> 
> -#ifdef CONFIG_DMA_ADDR_T_64BIT
> -	host->flags |= USE_ADMA64;
> -#else
> -	host->flags |= USE_ADMA;
> -#endif
> +	if (IS_ENABLED(CONFIG_MMC_SDHCI_ADMA_64BIT))
> +		host->flags |= USE_ADMA64;
> +	else
> +		host->flags |= USE_ADMA;
>  #endif
>  	if (host->quirks & SDHCI_QUIRK_REG32_RW)
>  		host->version =
> diff --git a/include/sdhci.h b/include/sdhci.h
> index a1b74e3bd7..07b84d6715 100644
> --- a/include/sdhci.h
> +++ b/include/sdhci.h
> @@ -294,7 +294,7 @@ struct sdhci_ops {
>  };
> 
>  #define ADMA_MAX_LEN	65532
> -#ifdef CONFIG_DMA_ADDR_T_64BIT
> +#ifdef CONFIG_MMC_SDHCI_ADMA_64BIT
>  #define ADMA_DESC_LEN	16
>  #else
>  #define ADMA_DESC_LEN	8
> @@ -319,7 +319,7 @@ struct sdhci_adma_desc {
>  	u8 reserved;
>  	u16 len;
>  	u32 addr_lo;
> -#ifdef CONFIG_DMA_ADDR_T_64BIT
> +#ifdef CONFIG_MMC_SDHCI_ADMA_64BIT
>  	u32 addr_hi;
>  #endif
>  } __packed;
> --
> 2.43.2



      reply	other threads:[~2024-04-17  0:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240326023017epcas1p3db77245c4ac988f6a7a6b658140a074d@epcas1p3.samsung.com>
2024-03-26  2:28 ` [PATCH] mmc: Support 32-bit only ADMA on 64-bit platforms Greg Malysa
2024-04-17  0:26   ` Jaehoon Chung [this message]

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='002f01da905d$d69cf5e0$83d6e1a0$@samsung.com' \
    --to=jh80.chung@samsung.com \
    --cc=greg.malysa@timesys.com \
    --cc=ian.roberts@timesys.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=nathan.morrison@timesys.com \
    --cc=oleksandr.suvorov@foundries.io \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=peng.fan@nxp.com \
    --cc=pgwipeout@gmail.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox