From: Anand Moon <linux.amoon@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCHv6 2/5] mmc: meson-gx: Use proper compatible string as per the dts
Date: Sun, 9 Feb 2020 11:05:54 +0000 [thread overview]
Message-ID: <20200209110557.1996-3-linux.amoon@gmail.com> (raw)
In-Reply-To: <20200209110557.1996-1-linux.amoon@gmail.com>
Use proper compatible string as per the dts so that mmc driver
could be tuned properly. SoC family S905, S905X have common clk
tuning parameters setting, while AGX and G12 have common clk tuning
parameters setting for mmc driver.
Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
No changes.
---
arch/arm/include/asm/arch-meson/sd_emmc.h | 7 ++++
drivers/mmc/meson_gx_mmc.c | 46 +++++++++++++++++------
2 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h b/arch/arm/include/asm/arch-meson/sd_emmc.h
index f4299485dc..83142d5d3f 100644
--- a/arch/arm/include/asm/arch-meson/sd_emmc.h
+++ b/arch/arm/include/asm/arch-meson/sd_emmc.h
@@ -13,6 +13,12 @@
#define SDIO_PORT_B 1
#define SDIO_PORT_C 2
+enum mmc_compatible {
+ MMC_COMPATIBLE_GXBB,
+ MMC_COMPATIBLE_GX,
+ MMC_COMPATIBLE_AXG,
+};
+
#define SD_EMMC_CLKSRC_24M 24000000 /* 24 MHz */
#define SD_EMMC_CLKSRC_DIV2 1000000000 /* 1 GHz */
@@ -87,6 +93,7 @@
struct meson_mmc_platdata {
struct mmc_config cfg;
struct mmc mmc;
+ int compat;
void *regbase;
void *w_buf;
};
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
index b013c7c5fb..1aefe360c4 100644
--- a/drivers/mmc/meson_gx_mmc.c
+++ b/drivers/mmc/meson_gx_mmc.c
@@ -37,7 +37,8 @@ static inline void meson_write(struct mmc *mmc, uint32_t val, int offset)
writel(val, get_regbase(mmc) + offset);
}
-static void meson_mmc_config_clock(struct mmc *mmc)
+static void meson_mmc_config_clock(struct mmc *mmc,
+ struct meson_mmc_platdata *pdata)
{
uint32_t meson_mmc_clk = 0;
unsigned int clk, clk_src, clk_div;
@@ -66,14 +67,20 @@ static void meson_mmc_config_clock(struct mmc *mmc)
/* RX clock phase 0:180 */
meson_mmc_clk |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
-#ifdef CONFIG_MESON_GX
- /* clk always on */
- meson_mmc_clk |= CLK_V2_ALWAYS_ON;
-#endif
-#if (defined(CONFIG_MESON_AXG) || defined(CONFIG_MESON_G12A))
- /* clk always on */
- meson_mmc_clk |= CLK_V3_ALWAYS_ON;
-#endif
+ switch (pdata->compat) {
+ case MMC_COMPATIBLE_GXBB:
+ case MMC_COMPATIBLE_GX:
+ /* clk always on */
+ meson_mmc_clk |= CLK_V2_ALWAYS_ON;
+ break;
+ case MMC_COMPATIBLE_AXG:
+ /* clk always on */
+ meson_mmc_clk |= CLK_V3_ALWAYS_ON;
+ break;
+ default:
+ debug("no compatible supported");
+ break;
+ }
/* clock settings */
meson_mmc_clk |= clk_src;
@@ -85,9 +92,11 @@ static void meson_mmc_config_clock(struct mmc *mmc)
static int meson_dm_mmc_set_ios(struct udevice *dev)
{
struct mmc *mmc = mmc_get_mmc_dev(dev);
+ struct meson_mmc_platdata *pdata =
+ (struct meson_mmc_platdata *)dev_get_driver_data(dev);
uint32_t meson_mmc_cfg;
- meson_mmc_config_clock(mmc);
+ meson_mmc_config_clock(mmc, pdata);
meson_mmc_cfg = meson_read(mmc, MESON_SD_EMMC_CFG);
@@ -324,9 +333,22 @@ int meson_mmc_bind(struct udevice *dev)
return mmc_bind(dev, &pdata->mmc, &pdata->cfg);
}
+static const struct meson_mmc_platdata gxbb_data = {
+ .compat = MMC_COMPATIBLE_GXBB,
+};
+
+static const struct meson_mmc_platdata gx_data = {
+ .compat = MMC_COMPATIBLE_GX,
+};
+
+static const struct meson_mmc_platdata axg_data = {
+ .compat = MMC_COMPATIBLE_AXG,
+};
+
static const struct udevice_id meson_mmc_match[] = {
- { .compatible = "amlogic,meson-gx-mmc" },
- { .compatible = "amlogic,meson-axg-mmc" },
+ { .compatible = "amlogic,meson-gxbb-mmc", .data = (ulong)&gxbb_data },
+ { .compatible = "amlogic,meson-gx-mmc", .data = (ulong)&gx_data },
+ { .compatible = "amlogic,meson-axg-mmc", .data = (ulong)&axg_data },
{ /* sentinel */ }
};
--
2.25.0
next prev parent reply other threads:[~2020-02-09 11:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-09 11:05 [PATCHv6 0/5] Odroid n2 using eMMC would fail to boot up Anand Moon
2020-02-09 11:05 ` [PATCHv6 1/5] mmc: meson-gx: Fix clk phase tuning for MMC Anand Moon
2020-02-09 13:08 ` Neil Armstrong
2020-02-09 17:22 ` Anand Moon
2020-02-10 9:03 ` Neil Armstrong
2020-02-13 11:58 ` Anand Moon
2020-02-13 15:39 ` Neil Armstrong
2020-02-13 16:41 ` Anand Moon
2020-02-10 9:35 ` Jerome Brunet
2020-02-13 12:04 ` Anand Moon
2020-02-09 11:05 ` Anand Moon [this message]
2020-02-09 13:01 ` [PATCHv6 2/5] mmc: meson-gx: Use proper compatible string as per the dts Neil Armstrong
2020-02-09 17:23 ` Anand Moon
2020-02-10 8:26 ` Neil Armstrong
2020-02-09 11:05 ` [PATCHv6 3/5] arm: dts: gx: Move common nodes to the -u-boot.dtsi Anand Moon
2020-02-09 12:58 ` Neil Armstrong
2020-02-09 17:25 ` Anand Moon
2020-02-10 8:24 ` Neil Armstrong
2020-02-09 11:05 ` [PATCHv6 4/5] arm: dts: g12: " Anand Moon
2020-02-09 12:58 ` Neil Armstrong
2020-02-09 17:25 ` Anand Moon
2020-02-09 11:05 ` [PATCHv6 5/5] arm: dts: s400: " Anand Moon
2020-02-09 12:58 ` Neil Armstrong
2020-02-09 17:24 ` Anand Moon
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=20200209110557.1996-3-linux.amoon@gmail.com \
--to=linux.amoon@gmail.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