All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/7] mmc: sunxi: Add DM_MMC support for A80
Date: Thu, 17 Jan 2019 22:39:49 +0530	[thread overview]
Message-ID: <20190117170951.23623-6-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190117170951.23623-1-jagan@amarulasolutions.com>

Unlike other Allwinner SoC's, A80 comes with different ahb
gate clock offset values and also has mmc common controller.
So support them via driver data.

Cc: Rask Ingemann Lambertsen <rask@formelder.dk>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/mmc/sunxi_mmc.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 5b9ac5f82c..7fab88c47f 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -22,6 +22,7 @@
 #ifdef CONFIG_DM_MMC
 struct sunxi_mmc_variant {
 	bool has_reset;
+	bool has_mmc_common;
 	u16 gate_offset;
 	u16 mclk_offset;
 	u16 reset_offset;
@@ -653,6 +654,19 @@ static int sunxi_mmc_probe(struct udevice *dev)
 			     priv->variant->reset_start_bit));
 	}
 
+	if (priv->variant->has_mmc_common) {
+		u32 *mmc_config_clk, *mmc_common_base;
+
+		ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
+					  0, &args);
+		if (ret)
+			return ret;
+		mmc_config_clk = (u32 *)ofnode_get_addr(args.node);
+
+		mmc_common_base = (void *)mmc_config_clk + (priv->mmc_no * 4);
+		setbits_le32(mmc_common_base, BIT(18) | BIT(16));
+	}
+
 	ret = mmc_set_mod_clk(priv, 24000000);
 	if (ret)
 		return ret;
@@ -697,6 +711,12 @@ static const struct sunxi_mmc_variant sun7i_a20_variant = {
 	.reset_start_bit = 8,
 };
 
+static const struct sunxi_mmc_variant sun9i_a80_variant = {
+	.has_mmc_common = true,
+	.gate_offset = 0x580,
+	.mclk_offset = 0x410,
+};
+
 static const struct sunxi_mmc_variant sun50i_h6_variant = {
 	.has_reset = true,
 	.gate_offset = 0x84c,
@@ -722,6 +742,10 @@ static const struct udevice_id sunxi_mmc_ids[] = {
 	  .compatible = "allwinner,sun8i-a83t-emmc",
 	  .data = (ulong)&sun7i_a20_variant,
 	},
+	{
+	  .compatible = "allwinner,sun9i-a80-mmc",
+	  .data = (ulong)&sun9i_a80_variant,
+	},
 	{
 	  .compatible = "allwinner,sun50i-a64-mmc",
 	  .data = (ulong)&sun7i_a20_variant,
-- 
2.18.0.321.gffc6fa0e3

  parent reply	other threads:[~2019-01-17 17:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 17:09 [U-Boot] [PATCH v2 0/7] mmc: sunxi: Enable DM_MMC Jagan Teki
2019-01-17 17:09 ` [U-Boot] [PATCH v2 1/7] mmc: sunxi: Configure reset support for DM_MMC Jagan Teki
2019-01-17 17:09 ` [U-Boot] [PATCH v2 2/7] mmc: sunxi: Add A83T emmc compatible Jagan Teki
2019-01-17 17:09 ` [U-Boot] [PATCH v2 3/7] mmc: sunxi: Add mmc, emmc H5/A64 compatible Jagan Teki
2019-01-17 17:09 ` [U-Boot] [PATCH v2 4/7] mmc: sunxi: Add DM_MMC support for H6 Jagan Teki
2019-01-17 17:09 ` Jagan Teki [this message]
2019-01-17 17:09 ` [U-Boot] [PATCH v2 6/7] arm: sunxi: Enable DM_MMC Jagan Teki
2019-01-17 17:09 ` [U-Boot] [PATCH v2 7/7] arm: dts: sunxi: Enumerate MMC2 as MMC1 Jagan Teki
2019-01-18 11:53 ` [U-Boot] [PATCH v2 0/7] mmc: sunxi: Enable DM_MMC Andre Przywara
2019-01-18 12:17   ` Tom Rini
2019-01-18 12:30     ` Andre Przywara
2019-01-18 16:41       ` Jagan Teki
2019-01-18 17:48         ` Andre Przywara
2019-01-19  5:50           ` Jagan Teki
2019-01-19 10:17             ` André Przywara

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=20190117170951.23623-6-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.