public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: kever.yang@rock-chips.com
Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, peng.fan@nxp.com,
	jh80.chung@samsung.com, u-boot@lists.denx.de
Subject: [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
Date: Fri,  7 Jan 2022 19:34:06 +0100	[thread overview]
Message-ID: <20220107183406.1804-2-jbx6244@gmail.com> (raw)
In-Reply-To: <20220107183406.1804-1-jbx6244@gmail.com>

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.

This type needs a permanent enabled fifo.
The other Rockchip SoCs not always have the property
"fifo-mode" in the TPL/SPL DT nodes, so dtplat structures
can't be used to switch it on.
Add a data structure linked to the compatible string
to enable.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
 drivers/mmc/rockchip_dw_mmc.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index be065ec0..5fdfcef2 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -19,6 +19,11 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 
+enum rockchip_dwmmc_type {
+	RK2928_MSHC,
+	RK3288_MSHC,
+};
+
 struct rockchip_mmc_plat {
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct dtd_rockchip_rk3288_dw_mshc dtplat;
@@ -111,6 +116,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat;
+	enum rockchip_dwmmc_type type = dev_get_driver_data(dev);
 
 	host->name = dev->name;
 	host->ioaddr = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
@@ -119,7 +125,10 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 	host->priv = dev;
 	host->dev_index = 0;
 	priv->fifo_depth = dtplat->fifo_depth;
-	priv->fifo_mode = 0;
+	if (type == RK2928_MSHC)
+		priv->fifo_mode = 1;
+	else
+		priv->fifo_mode = 0;
 	priv->minmax[0] = 400000;  /*  400 kHz */
 	priv->minmax[1] = dtplat->max_frequency;
 
@@ -163,8 +172,8 @@ static int rockchip_dwmmc_bind(struct udevice *dev)
 }
 
 static const struct udevice_id rockchip_dwmmc_ids[] = {
-	{ .compatible = "rockchip,rk2928-dw-mshc" },
-	{ .compatible = "rockchip,rk3288-dw-mshc" },
+	{ .compatible = "rockchip,rk2928-dw-mshc", .data = RK2928_MSHC },
+	{ .compatible = "rockchip,rk3288-dw-mshc", .data = RK3288_MSHC },
 	{ }
 };
 
@@ -180,5 +189,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


  reply	other threads:[~2022-01-07 18:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 18:34 [PATCH v1 1/2] rockchip: mmc: rockchip_dw_mmc: fix ciu clock index Johan Jonker
2022-01-07 18:34 ` Johan Jonker [this message]
2022-03-12  9:02   ` [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support Jagan Teki
2022-03-12  9:14     ` Johan Jonker

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=20220107183406.1804-2-jbx6244@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=peng.fan@nxp.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --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