[PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection

Jagan Teki jagan at amarulasolutions.com
Sat Mar 12 10:23:18 CET 2022


On Wed, Feb 23, 2022 at 6:37 PM Johan Jonker <jbx6244 at gmail.com> wrote:
>
> From: Paweł Jarosz <paweljarosz3691 at gmail.com>
>
> dw_mmc supports two transfer modes in u-boot: IDMA and FIFO.
> This patch adds auto detection of transfer mode and
> eliminates the need to set this in host config struct.
> Allow handling for a u-boot,spl-fifo-mode host property in the
> logic to not put the MMC controllers into FIFO mode for all time.

Does it mean fifo-mode property is not useful in SPI and U-Boot
proper? If yes better drop that change as part of this patch.
>
> Signed-off-by: Paweł Jarosz <paweljarosz3691 at gmail.com>
> Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
> ---
>
> Changed V2:
>   use bitfield_extract
>   remove use_dma variable
>   include fifo_mode from host in logic
> ---
>  drivers/mmc/dw_mmc.c | 6 ++++++
>  include/dwmmc.h      | 5 +++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index a949dad5..7e2cd5ed 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -536,6 +536,12 @@ static int dwmci_init(struct mmc *mmc)
>                 return -EIO;
>         }
>
> +       if (!host->fifo_mode &&
> +           SDMMC_GET_TRANS_MODE(dwmci_readl(host, DWMCI_HCON)) == DMA_INTERFACE_IDMA)
> +               host->fifo_mode = 0;
> +       else
> +               host->fifo_mode = 1;

fifo_mode is bool so use true/false.

Jagan.


More information about the U-Boot mailing list