public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: 赵仪峰 <yifeng.zhao@rock-chips.com>
To: "Alper Nebi Yasak" <alpernebiyasak@gmail.com>,
	 u-boot <u-boot@lists.denx.de>
Cc: "Peng Fan" <peng.fan@nxp.com>,
	"Ashok Reddy Soma" <ashok.reddy.soma@xilinx.com>,
	"Samuel Dionne-Riel" <samuel@dionne-riel.com>,
	"Aswath Govindraju" <a-govindraju@ti.com>,
	"Philipp Tomsich" <philipp.tomsich@vrull.eu>,
	"Jagan Teki" <jagan@amarulasolutions.com>,
	"Stephen Carlson" <stcarlso@linux.microsoft.com>,
	"Akash Gajjar" <akash@openedev.com>,
	"Michal Simek" <michal.simek@xilinx.com>,
	杨凯 <kever.yang@rock-chips.com>, "Faiz Abbas" <faiz_abbas@ti.com>,
	sjg <sjg@chromium.org>, Peter Robinson <pbrobinson@gmail.com>,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Jack Mitchell" <ml@embed.me.uk>,
	"Alper Nebi Yasak" <alpernebiyasak@gmail.com>
Subject: Re: [PATCH v2 4/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568
Date: Wed, 12 Jan 2022 10:03:53 +0800	[thread overview]
Message-ID: <2022011210025303440329@rock-chips.com> (raw)
In-Reply-To: 20220111133931.7866-5-alpernebiyasak@gmail.com

Hi Alper,

The Synopsys DWC MSHC for RK3568 and RK3588 need config
DWCMSHC_EMMC_CONTROL.bit0 = 1 (CARD_IS_EMMC)
to enable Data Strobe pin for HS400 and HS400ES.

reference code:
#define DWCMSHC_EMMC_CONTROL 0x52c
#define DWCMSHC_CARD_IS_EMMC BIT(0)

/* set CARD_IS_EMMC bit to enable Data Strobe for HS400 and HS400ES */
ctrl = sdhci_readw(host, DWCMSHC_EMMC_CONTROL);
ctrl |= DWCMSHC_CARD_IS_EMMC;
sdhci_writew(host, ctrl, DWCMSHC_EMMC_CONTROL);

>
On RK3568, a register bit must be set to enable Enhanced Strobe.
However, it appears that the address of this register may differ from
vendor to vendor and should be read from the underlying MMC IP.
Let the Rockchip SDHCI driver read this address and set the relevant bit
when Enhanced Strobe configuration is requested.
 
This is mostly ported from Linux's Synopsys DWC MSHC driver which
happens to be the underlying IP. (drivers/mmc/host/sdhci-of-dwcmshc.c in
Linux tree).
 
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
Didn't add Reviewed-by tag due to changes. Only build-tested as I don't
have a RK3568 board.
 
Changes in v2:
- Rename rk3568_set_enhanced_strobe -> rk3568_sdhci_set_enhanced_strobe
- Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
 
drivers/mmc/rockchip_sdhci.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
 
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
index f920c5141142..3030d746f890 100644
--- a/drivers/mmc/rockchip_sdhci.c
+++ b/drivers/mmc/rockchip_sdhci.c
@@ -45,6 +45,13 @@
#define ARASAN_VENDOR_REGISTER 0x78
#define ARASAN_VENDOR_ENHANCED_STROBE BIT(0)
+/* DWC IP vendor area 1 pointer */
+#define DWCMSHC_P_VENDOR_AREA1 0xe8
+#define DWCMSHC_AREA1_MASK GENMASK(11, 0)
+/* Offset inside the vendor area 1 */
+#define DWCMSHC_EMMC_CONTROL 0x2c
+#define DWCMSHC_ENHANCED_STROBE BIT(8)
+
/* Rockchip specific Registers */
#define DWCMSHC_EMMC_DLL_CTRL 0x800
#define DWCMSHC_EMMC_DLL_CTRL_RESET BIT(1)
@@ -311,6 +318,25 @@ static int rk3568_emmc_get_phy(struct udevice *dev)
return 0;
}
+static int rk3568_sdhci_set_enhanced_strobe(struct sdhci_host *host)
+{
+ struct mmc *mmc = host->mmc;
+ u32 vendor;
+ int reg;
+
+ reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK)
+       + DWCMSHC_EMMC_CONTROL;
+
+ vendor = sdhci_readl(host, reg);
+ if (mmc->selected_mode == MMC_HS_400_ES)
+ vendor |= DWCMSHC_ENHANCED_STROBE;
+ else
+ vendor &= ~DWCMSHC_ENHANCED_STROBE;
+ sdhci_writel(host, vendor, reg);
+
+ return 0;
+}
+
static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
{
struct mmc *mmc = host->mmc;
@@ -519,6 +545,7 @@ static const struct sdhci_data rk3568_data = {
.get_phy = rk3568_emmc_get_phy,
.emmc_phy_init = rk3568_emmc_phy_init,
.set_ios_post = rk3568_sdhci_set_ios_post,
+ .set_enhanced_strobe = rk3568_sdhci_set_enhanced_strobe,
};
static const struct udevice_id sdhci_ids[] = {
-- 
2.34.1
 
 
 
 

  reply	other threads:[~2022-01-12  2:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 13:39 [PATCH v2 0/4] rockchip: sdhci: Fix reinit and add HS400 Enhanced Strobe support Alper Nebi Yasak
2022-01-11 13:39 ` [PATCH v2 1/4] mmc: sdhci: Add " Alper Nebi Yasak
2022-01-21 15:20   ` Simon Glass
2022-01-11 13:39 ` [PATCH v2 2/4] rockchip: sdhci: Fix RK3399 eMMC PHY power cycling Alper Nebi Yasak
2022-01-21 15:20   ` Simon Glass
2022-01-28 22:37     ` Alper Nebi Yasak
2022-01-11 13:39 ` [PATCH v2 3/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399 Alper Nebi Yasak
2022-01-11 13:39 ` [PATCH v2 4/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568 Alper Nebi Yasak
2022-01-12  2:03   ` 赵仪峰 [this message]
2022-01-13 19:29     ` Alper Nebi Yasak

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=2022011210025303440329@rock-chips.com \
    --to=yifeng.zhao@rock-chips.com \
    --cc=a-govindraju@ti.com \
    --cc=akash@openedev.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=faiz_abbas@ti.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jh80.chung@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=michal.simek@xilinx.com \
    --cc=ml@embed.me.uk \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=samuel@dionne-riel.com \
    --cc=sjg@chromium.org \
    --cc=stcarlso@linux.microsoft.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