u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
@ 2022-02-23 13:07 Johan Jonker
  2022-02-23 13:07 ` [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection Johan Jonker
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Jonker @ 2022-02-23 13:07 UTC (permalink / raw)
  To: kever.yang
  Cc: sjg, philipp.tomsich, peng.fan, jh80.chung, paweljarosz3691, u-boot

The Rockchip SoCs rk3066/rk3188 have mmc DT nodes
with as compatible string "rockchip,rk2928-dw-mshc".
Add support to the existing driver with help of
a DM_DRIVER_ALIAS.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V2:
  remove fifo_mode changes
---
 drivers/mmc/rockchip_dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index 7f8dea1e..586b7de7 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -180,5 +180,6 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = {
 	.plat_auto	= sizeof(struct rockchip_mmc_plat),
 };
 
+DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk2928_dw_mshc)
 DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc)
 DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection
  2022-02-23 13:07 [PATCH v2 1/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support Johan Jonker
@ 2022-02-23 13:07 ` Johan Jonker
  2022-03-12  9:23   ` Jagan Teki
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Jonker @ 2022-02-23 13:07 UTC (permalink / raw)
  To: kever.yang
  Cc: sjg, philipp.tomsich, peng.fan, jh80.chung, paweljarosz3691, u-boot

From: Paweł Jarosz <paweljarosz3691@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.

Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
Signed-off-by: Johan Jonker <jbx6244@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;
+
 	/* Enumerate at 400KHz */
 	dwmci_setup_bus(host, mmc->cfg->f_min);
 
diff --git a/include/dwmmc.h b/include/dwmmc.h
index 5fc8ed83..d8d9ebe7 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -9,6 +9,7 @@
 
 #include <asm/cache.h>
 #include <asm/io.h>
+#include <bitfield.h>
 #include <mmc.h>
 #include <linux/bitops.h>
 
@@ -119,6 +120,10 @@
 #define RX_WMARK_SHIFT		16
 #define RX_WMARK_MASK		(0xfff << RX_WMARK_SHIFT)
 
+/* HCON Register */
+#define DMA_INTERFACE_IDMA		(0x0)
+#define SDMMC_GET_TRANS_MODE(x)		bitfield_extract(x, 16, 2)
+
 #define DWMCI_IDMAC_OWN		(1 << 31)
 #define DWMCI_IDMAC_CH		(1 << 4)
 #define DWMCI_IDMAC_FS		(1 << 3)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection
  2022-02-23 13:07 ` [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection Johan Jonker
@ 2022-03-12  9:23   ` Jagan Teki
  2022-03-12  9:44     ` Johan Jonker
  0 siblings, 1 reply; 4+ messages in thread
From: Jagan Teki @ 2022-03-12  9:23 UTC (permalink / raw)
  To: Johan Jonker
  Cc: kever.yang, sjg, philipp.tomsich, peng.fan, jh80.chung,
	paweljarosz3691, u-boot

On Wed, Feb 23, 2022 at 6:37 PM Johan Jonker <jbx6244@gmail.com> wrote:
>
> From: Paweł Jarosz <paweljarosz3691@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@gmail.com>
> Signed-off-by: Johan Jonker <jbx6244@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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection
  2022-03-12  9:23   ` Jagan Teki
@ 2022-03-12  9:44     ` Johan Jonker
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Jonker @ 2022-03-12  9:44 UTC (permalink / raw)
  To: Jagan Teki
  Cc: kever.yang, sjg, philipp.tomsich, peng.fan, jh80.chung,
	paweljarosz3691, u-boot



On 3/12/22 10:23, Jagan Teki wrote:
> On Wed, Feb 23, 2022 at 6:37 PM Johan Jonker <jbx6244@gmail.com> wrote:
>>
>> From: Paweł Jarosz <paweljarosz3691@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.

This is about setting the fifo-mode for rk3066/rk3188 without DT as
these early models don't seem to have IDMA.

Handling of the fifo_mode variable is still needed for the Rockchip
exception that needs to be included in the logic.

rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/commit/c8dd0e42d709c9734f313c547d0707e27ca0de51

We could remove normal fifo-mode parsing, but as this is a generic file
for multiple SoC families I'm a little bit reluctant to change that for
other drivers then Rockchip.

Otherwise patch V1 does the job without changing dw_mmc.c

Please advise what direction we should go or what changes should be made.

Kind regards,

Johan Jonker


>>
>> Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
>> Signed-off-by: Johan Jonker <jbx6244@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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-12  9:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 13:07 [PATCH v2 1/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support Johan Jonker
2022-02-23 13:07 ` [PATCH v2 2/2] mmc: dw_mmc: support transfer mode auto detection Johan Jonker
2022-03-12  9:23   ` Jagan Teki
2022-03-12  9:44     ` Johan Jonker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).